Merge "leds: qpnp-flash-v2: Fix HW_STROBE configuration"
This commit is contained in:
commit
6950f08dc3
1 changed files with 46 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, strobe_ctrl;
|
||||
|
||||
for (i = 0; i < led->num_fnodes; i++) {
|
||||
addr_offset = led->fnode[i].id;
|
||||
|
@ -402,6 +402,51 @@ 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;
|
||||
/*
|
||||
* As per the hardware recommendation, to use LED2/LED3 in HW
|
||||
* strobe mode, LED1 should be set to HW strobe mode as well.
|
||||
*/
|
||||
if (led->fnode[i].strobe_sel == HW_STROBE &&
|
||||
(led->fnode[i].id == LED2 || led->fnode[i].id == LED3)) {
|
||||
mask = FLASH_HW_STROBE_MASK;
|
||||
addr_offset = led->fnode[LED1].id;
|
||||
/*
|
||||
* HW_STROBE: enable, TRIGGER: level,
|
||||
* POLARITY: active high
|
||||
*/
|
||||
strobe_ctrl = BIT(2) | BIT(0);
|
||||
rc = qpnp_flash_led_masked_write(led,
|
||||
FLASH_LED_REG_STROBE_CTRL(
|
||||
led->base + addr_offset),
|
||||
mask, strobe_ctrl);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
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 +640,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