leds: qpnp-flash-v2: Do not clear led_on when flash/torch brightness is 0

Currently, led_on flag is cleared whenever the brightness is set
to 0. This is incorrect as the led_on flag should be cleared only
when switch device is disabled. Fix it.

Change-Id: I7d70cb9588b55610dbc8eaf57338490ce82a0917
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
This commit is contained in:
Subbaraman Narayanamurthy 2018-03-06 16:01:26 -08:00
parent b09c520194
commit f33e3b2556

View File

@ -1001,7 +1001,8 @@ static void qpnp_flash_led_node_set(struct flash_node_data *fnode, int value)
fnode->cdev.brightness = prgm_current_ma;
fnode->current_reg_val = get_current_reg_code(prgm_current_ma,
fnode->ires_ua);
fnode->led_on = prgm_current_ma != 0;
if (prgm_current_ma)
fnode->led_on = true;
if (led->pdata->chgr_mitigation_sel == FLASH_SW_CHARGER_MITIGATION) {
qpnp_flash_led_aggregate_max_current(fnode);