display: add a simple api to query the display state (on/off)

Co-authored-by: morogoku <morogoku@hotmail.com>
Co-authored-by: THEBOSS <ehabhani59@gmail.com>
This commit is contained in:
THEBOSS 2020-08-24 05:08:46 +03:00 committed by xxmustafacooTR
parent de653647db
commit e61e26e101
No known key found for this signature in database
GPG key ID: 520B6FE385CBF5C9
2 changed files with 28 additions and 0 deletions

View file

@ -14,6 +14,7 @@
#include <linux/mutex.h>
#include <video/mipi_display.h>
#include <linux/platform_device.h>
#include <linux/display_state.h>
#include "../disp_err.h"
#include "../decon.h"
@ -27,6 +28,12 @@ static struct v4l2_subdev *panel_sd;
static DEFINE_MUTEX(cmd_lock);
struct panel_state *panel_state;
bool display_on = true;
bool is_display_on()
{
return display_on;
}
static int dsim_ioctl_panel(struct dsim_device *dsim, u32 cmd, void *arg)
{
int ret;
@ -435,6 +442,8 @@ static int common_lcd_displayon(struct dsim_device *dsim)
return ret;
}
display_on = true;
return 0;
}
@ -448,6 +457,8 @@ static int common_lcd_suspend(struct dsim_device *dsim)
return ret;
}
display_on = false;
return 0;
}

View file

@ -0,0 +1,17 @@
/*
* include/linux/display_state.h
*
* Copyright (c) 2016-2017 Francisco Franco
* franciscofranco.1990@gmail.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef _LINUX_DISPLAY_STATE_H
#define _LINUX_DISPLAY_STATE_H
bool is_display_on(void);
#endif