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:
Kavya Nunna 2020-08-20 17:33:35 +05:30
parent c6d2596d53
commit a16e0056dc

View File

@ -364,6 +364,18 @@ static int qti_flash_led_strobe(struct qti_flash_led *led,
if (rc < 0)
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,
mask, value);
if (rc < 0)
@ -379,6 +391,17 @@ static int qti_flash_led_strobe(struct qti_flash_led *led,
if (rc < 0)
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);
if (rc < 0)
goto error;
@ -434,13 +457,6 @@ static int qti_flash_led_enable(struct flash_node_data *fnode)
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;
if ((fnode->strobe_sel == HW_STROBE) &&
@ -476,13 +492,6 @@ static int qti_flash_led_disable(struct flash_node_data *fnode)
if (rc < 0)
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->current_ma = 0;