summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlokilee73 <changjoo.lee@samsung.com>2019-07-15 17:55:17 +0900
committerlokilee73 <changjoo.lee@samsung.com>2019-07-15 17:55:32 +0900
commitc710dd5b58bbb4800becf67529bce32fca63f8ed (patch)
tree27f6b16e63cc207c4b2b0cbc6e2a5f80fae81289
parentd9641c3e092681df74054957b1547ba32c7f31f5 (diff)
downloaddevice-emulator-c710dd5b58bbb4800becf67529bce32fca63f8ed.tar.gz
device-emulator-c710dd5b58bbb4800becf67529bce32fca63f8ed.tar.bz2
device-emulator-c710dd5b58bbb4800becf67529bce32fca63f8ed.zip
Add display_get_state to get lcd state
Change-Id: I105931b402d864fff36050640a20fa86076591ab Signed-off-by: lokilee73 <changjoo.lee@samsung.com>
-rw-r--r--hw/display/display.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/hw/display/display.c b/hw/display/display.c
index 71e7260..2398fff 100644
--- a/hw/display/display.c
+++ b/hw/display/display.c
@@ -30,6 +30,10 @@
#define BACKLIGHT_PATH "/sys/class/backlight/emulator"
#endif
+#ifndef LCD_PATH
+#define LCD_PATH "/sys/class/lcd/emulator"
+#endif
+
static int display_get_max_brightness(int *val)
{
static int max = -1;
@@ -91,6 +95,32 @@ static int display_set_brightness(int brightness)
return 0;
}
+static int display_get_state(enum display_state *state)
+{
+ int r, v;
+
+ r = sys_get_int(LCD_PATH"/lcd_power", &v);
+ if (r < 0) {
+ _E("fail to get state (errno:%d)", r);
+ return r;
+ }
+
+ //remap LCD state
+ switch (v) {
+ case 0:
+ *state = DISPLAY_ON;
+ break;
+ case 4:
+ *state = DISPLAY_OFF;
+ break;
+ default:
+ *state = -EINVAL;
+ break;
+ }
+
+ return 0;
+}
+
static int display_open(struct hw_info *info,
const char *id, struct hw_common **common)
{
@@ -107,6 +137,7 @@ static int display_open(struct hw_info *info,
display_dev->get_max_brightness = display_get_max_brightness;
display_dev->get_brightness = display_get_brightness;
display_dev->set_brightness = display_set_brightness;
+ display_dev->get_state = display_get_state;
*common = (struct hw_common *)display_dev;
return 0;