leds: qpnp-flash-v2: Add support for multi-strobe
Multi-strobe option is used to enable/disable the LEDs back-to-back without disabling the module in the HW_STROBE mode. Hence, enable the multi-strobe option if the LED is configured in HW_STROBE mode. Change-Id: I3e16254c6dcb4c4ae0b295cd7eea4e8ee8e1c2c7 Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
This commit is contained in:
parent
225f40883b
commit
1a91cd330a
1 changed files with 26 additions and 14 deletions
|
@ -391,7 +391,7 @@ led_brightness qpnp_flash_led_brightness_get(struct led_classdev *led_cdev)
|
|||
static int qpnp_flash_led_init_settings(struct qpnp_flash_led *led)
|
||||
{
|
||||
int rc, i, addr_offset;
|
||||
u8 val = 0, mask;
|
||||
u8 val = 0, mask, strobe_mask = 0;
|
||||
|
||||
for (i = 0; i < led->num_fnodes; i++) {
|
||||
addr_offset = led->fnode[i].id;
|
||||
|
@ -402,6 +402,31 @@ static int qpnp_flash_led_init_settings(struct qpnp_flash_led *led)
|
|||
return rc;
|
||||
|
||||
val |= 0x1 << led->fnode[i].id;
|
||||
|
||||
if (led->fnode[i].strobe_sel == HW_STROBE) {
|
||||
if (led->fnode[i].id == LED3)
|
||||
strobe_mask |= LED3_FLASH_ONCE_ONLY_BIT;
|
||||
else
|
||||
strobe_mask |= LED1N2_FLASH_ONCE_ONLY_BIT;
|
||||
}
|
||||
|
||||
if (led->fnode[i].id == LED3 &&
|
||||
led->fnode[i].strobe_sel == LPG_STROBE)
|
||||
strobe_mask |= LED3_FLASH_ONCE_ONLY_BIT;
|
||||
}
|
||||
|
||||
rc = qpnp_flash_led_masked_write(led,
|
||||
FLASH_LED_REG_MULTI_STROBE_CTRL(led->base),
|
||||
strobe_mask, 0);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
if (led->fnode[LED3].strobe_sel == LPG_STROBE) {
|
||||
rc = qpnp_flash_led_masked_write(led,
|
||||
FLASH_LED_REG_LPG_INPUT_CTRL(led->base),
|
||||
LPG_INPUT_SEL_BIT, LPG_INPUT_SEL_BIT);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = qpnp_flash_led_write(led,
|
||||
|
@ -595,19 +620,6 @@ static int qpnp_flash_led_init_settings(struct qpnp_flash_led *led)
|
|||
return rc;
|
||||
}
|
||||
|
||||
if (led->fnode[LED3].strobe_sel == LPG_STROBE) {
|
||||
rc = qpnp_flash_led_masked_write(led,
|
||||
FLASH_LED_REG_MULTI_STROBE_CTRL(led->base),
|
||||
LED3_FLASH_ONCE_ONLY_BIT, 0);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
rc = qpnp_flash_led_masked_write(led,
|
||||
FLASH_LED_REG_LPG_INPUT_CTRL(led->base),
|
||||
LPG_INPUT_SEL_BIT, LPG_INPUT_SEL_BIT);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue