summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortaeyoung <ty317.kim@samsung.com>2016-07-07 10:18:22 +0900
committertaeyoung <ty317.kim@samsung.com>2016-07-07 10:19:07 +0900
commit618a9cd21db354460ed234335f7b93ef95ca114b (patch)
tree6c100c608e00753f106e2debac347f483b9a33b2
parent6a4892a96d489ecb727dc9ca92e6a54cc601b581 (diff)
downloaddevice-tm1-618a9cd21db354460ed234335f7b93ef95ca114b.tar.gz
device-tm1-618a9cd21db354460ed234335f7b93ef95ca114b.tar.bz2
device-tm1-618a9cd21db354460ed234335f7b93ef95ca114b.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: I2b08ae36fdb9c96e07089e74e2a4a6e4bcb4972c Signed-off-by: taeyoung <ty317.kim@samsung.com>
-rw-r--r--hw/display/display.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/hw/display/display.c b/hw/display/display.c
index 020eb33..75858fe 100644
--- a/hw/display/display.c
+++ b/hw/display/display.c
@@ -30,7 +30,7 @@
#define BACKLIGHT_PATH "/sys/class/backlight/panel"
#endif
-static int get_max_brightness(int *val)
+static int display_get_max_brightness(int *val)
{
static int max = -1;
int r;
@@ -69,23 +69,22 @@ 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 : %d", r);
+ _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 : %d", r);
+ _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;