leds: qti-flash: Enable the torch mode after enabling the led module
Currently, we are enabling the torch mode before enabling led module. This causes large USB current spike after the torch event. To avoid such undesired behaviour enable the torch mode after enabling the led module. Change-Id: I1d867b07d05c3d745220c33a941680aa7d70f1f5 Signed-off-by: Kavya Nunna <knunna@codeaurora.org>
This commit is contained in:
parent
c6d2596d53
commit
a16e0056dc
@ -364,6 +364,18 @@ static int qti_flash_led_strobe(struct qti_flash_led *led,
|
|||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
for (i = 0; i < led->num_fnodes; i++) {
|
||||||
|
if ((mask & BIT(led->fnode[i].id)) &&
|
||||||
|
led->fnode[i].configured &&
|
||||||
|
led->fnode[i].type == FLASH_LED_TYPE_TORCH &&
|
||||||
|
led->subtype == 0x6) {
|
||||||
|
rc = qti_flash_led_masked_write(led,
|
||||||
|
FORCE_TORCH_MODE,
|
||||||
|
FORCE_TORCH, FORCE_TORCH);
|
||||||
|
if (rc < 0)
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
}
|
||||||
rc = qti_flash_led_masked_write(led, FLASH_EN_LED_CTRL,
|
rc = qti_flash_led_masked_write(led, FLASH_EN_LED_CTRL,
|
||||||
mask, value);
|
mask, value);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
@ -379,6 +391,17 @@ static int qti_flash_led_strobe(struct qti_flash_led *led,
|
|||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
for (i = 0; i < led->num_fnodes; i++) {
|
||||||
|
if ((mask & BIT(led->fnode[i].id)) &&
|
||||||
|
led->fnode[i].configured &&
|
||||||
|
led->fnode[i].type == FLASH_LED_TYPE_TORCH &&
|
||||||
|
led->subtype == 0x6) {
|
||||||
|
rc = qti_flash_led_masked_write(led,
|
||||||
|
FORCE_TORCH_MODE, FORCE_TORCH, 0);
|
||||||
|
if (rc < 0)
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
}
|
||||||
rc = qti_flash_led_module_control(led, enable);
|
rc = qti_flash_led_module_control(led, enable);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
goto error;
|
goto error;
|
||||||
@ -434,13 +457,6 @@ static int qti_flash_led_enable(struct flash_node_data *fnode)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fnode->type == FLASH_LED_TYPE_TORCH && led->subtype == 0x6) {
|
|
||||||
rc = qti_flash_led_masked_write(led, FORCE_TORCH_MODE,
|
|
||||||
FORCE_TORCH, FORCE_TORCH);
|
|
||||||
if (rc < 0)
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
fnode->configured = true;
|
fnode->configured = true;
|
||||||
|
|
||||||
if ((fnode->strobe_sel == HW_STROBE) &&
|
if ((fnode->strobe_sel == HW_STROBE) &&
|
||||||
@ -476,13 +492,6 @@ static int qti_flash_led_disable(struct flash_node_data *fnode)
|
|||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (fnode->type == FLASH_LED_TYPE_TORCH && led->subtype == 0x6) {
|
|
||||||
rc = qti_flash_led_masked_write(led, FORCE_TORCH_MODE,
|
|
||||||
FORCE_TORCH, 0);
|
|
||||||
if (rc < 0)
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
fnode->configured = false;
|
fnode->configured = false;
|
||||||
fnode->current_ma = 0;
|
fnode->current_ma = 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user