summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXi Chen <xixi.chen@mediatek.com>2018-11-22 10:13:38 +0800
committerPrashanth Swaminathan <prashanthsw@google.com>2019-01-09 18:50:38 -0800
commit360c90352a50e857ae18113cb1804844411f145e (patch)
tree656633838d2eb6e8362da2c0e79f239fd0cc5943
parent129f6ee0715c49bbee4228653ca9508e312c2b98 (diff)
downloadmt8516-v4.4-360c90352a50e857ae18113cb1804844411f145e.tar.gz
[ALPS04195528] leds: sgm37603a: update min/max brightness value
[Detail] 1 min brightness: 1 --> i2c value: 0x4; 2 max brightness: 255 --> i2c value: 0xba4; 3 zero brightness:0 --> i2c value: 0x0. Change-Id: I6840a85fb74ec63b169364603f4d3ae902212187 CR-Id: ALPS04195528 Signed-off-by: Xi Chen <xixi.chen@mediatek.com>
-rw-r--r--drivers/leds/leds-sgm37603a.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/leds/leds-sgm37603a.c b/drivers/leds/leds-sgm37603a.c
index 5a5980546f3f..cb3ac522064e 100644
--- a/drivers/leds/leds-sgm37603a.c
+++ b/drivers/leds/leds-sgm37603a.c
@@ -220,11 +220,14 @@ static void _sgm37603a_led_set_brightness(
if (lp->brightness_limit)
val = brightness * lp->brightness_limit /
lp->max_brightness;
- val *= 14;
- if (val > 3533) /* 0xdcd */
- val = 3533;
- else if (val < 0x9)
- val = 0x9;
+
+ if (val == 1) { /* min brightness: 1 */
+ val = 0x4;
+ } else if (val > 1) {
+ val *= 12; /* 2980 / 255 + 1 */
+ if (val > 2980) /* 0xba4 */
+ val = 2980;
+ }
sgm37603a_write_byte(lp, lp->cfg->reg_devicectrl, 0x00);
sgm37603a_write_byte(lp, lp->cfg->reg_brightness1, val & 0xF);