diff options
author | taeyoung <ty317.kim@samsung.com> | 2016-07-07 10:35:50 +0900 |
---|---|---|
committer | SeokYeon Hwang <syeon.hwang@samsung.com> | 2016-08-04 01:18:45 -0700 |
commit | c0ff251413ec12bd02e1bd90d87d915fcf701e52 (patch) | |
tree | 2f389d483a3082f361f53e1cb381f7a39662a02b | |
parent | 140e97f3e85d19fd219e62d4c918ddcbd6c286f8 (diff) | |
download | device-manager-plugin-emul-c0ff251413ec12bd02e1bd90d87d915fcf701e52.tar.gz device-manager-plugin-emul-c0ff251413ec12bd02e1bd90d87d915fcf701e52.tar.bz2 device-manager-plugin-emul-c0ff251413ec12bd02e1bd90d87d915fcf701e52.zip |
display: return raw brightness value
- The brightness value from driver is returned to device daemon.
device daemon will calculate it for users
Change-Id: I376df8af520676a3dffcd8ec5543a1cac8df46f6
Signed-off-by: taeyoung <ty317.kim@samsung.com>
-rw-r--r-- | hw/display/display.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/hw/display/display.c b/hw/display/display.c index fa9821f..0cd242c 100644 --- a/hw/display/display.c +++ b/hw/display/display.c @@ -30,7 +30,7 @@ #define BACKLIGHT_PATH "/sys/class/backlight/emulator" #endif -static int get_max_brightness(int *val) +static int display_get_max_brightness(int *val) { static int max = -1; int r; @@ -69,21 +69,20 @@ static int display_get_brightness(int *brightness) static int display_set_brightness(int brightness) { - int r, v, max; + int r, max; - if (brightness < 0 || brightness > 100) { - _E("wrong parameter"); - return -EINVAL; - } - - r = get_max_brightness(&max); + r = display_get_max_brightness(&max); if (r < 0) { _E("fail to get max brightness (errno:%d)", r); return r; } - v = brightness/100.f*max; - r = sys_set_int(BACKLIGHT_PATH"/brightness", v); + if (brightness < 0 || brightness > max) { + _E("wrong parameter"); + return -EINVAL; + } + + r = sys_set_int(BACKLIGHT_PATH"/brightness", brightness); if (r < 0) { _E("fail to set brightness (errno:%d)", r); return r; @@ -105,6 +104,7 @@ static int display_open(struct hw_info *info, return -ENOMEM; display_dev->common.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; |