diff options
author | lokilee73 <changjoo.lee@samsung.com> | 2018-06-12 11:02:28 +0900 |
---|---|---|
committer | Hyotaek Shim <hyotaek.shim@samsung.com> | 2018-06-12 17:02:12 +0900 |
commit | b48941a56bc8e7e0b2e5d614d35bc76e7b62b95d (patch) | |
tree | 0ad7e8604e694acd29fbca69ced205ea43afbe56 | |
parent | bd063251da70f4baed17aef0f8be4397afb34879 (diff) | |
download | device-tm1-b48941a56bc8e7e0b2e5d614d35bc76e7b62b95d.tar.gz device-tm1-b48941a56bc8e7e0b2e5d614d35bc76e7b62b95d.tar.bz2 device-tm1-b48941a56bc8e7e0b2e5d614d35bc76e7b62b95d.zip |
Add display_get_state to remove dependency with enlightenment
Change-Id: Icd681534b54ceda927c8563d7622bade37047755
Signed-off-by: lokilee73 <changjoo.lee@samsung.com>
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
-rwxr-xr-x[-rw-r--r--] | hw/display/display.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/hw/display/display.c b/hw/display/display.c index 75858fe..3b13a34 100644..100755 --- a/hw/display/display.c +++ b/hw/display/display.c @@ -30,6 +30,10 @@ #define BACKLIGHT_PATH "/sys/class/backlight/panel" #endif +#ifndef LCD_PATH +#define LCD_PATH "/sys/class/lcd/panel" +#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; |