Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 93a396a8 authored by Kiran Gunda's avatar Kiran Gunda Committed by Subbaraman Narayanamurthy
Browse files

leds: qpnp-flash-v2: Disable the safety timer by default



Safety timer is enabled in the HW by default. Make it disabled
by default and enable based on the client's need.

Change-Id: I7967b91deeed5f87557e59f1dd16ce41a22ae134
Signed-off-by: default avatarKiran Gunda <kgunda@codeaurora.org>
Signed-off-by: default avatarSubbaraman Narayanamurthy <subbaram@codeaurora.org>
parent 18183be5
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -404,6 +404,22 @@ static int qpnp_flash_led_headroom_config(struct qpnp_flash_led *led)
	return rc;
}

static int qpnp_flash_led_safety_tmr_config(struct qpnp_flash_led *led)
{
	int rc = 0, i, addr_offset;

	for (i = 0; i < led->num_fnodes; i++) {
		addr_offset = led->fnode[i].id;
		rc = qpnp_flash_led_write(led,
			FLASH_LED_REG_SAFETY_TMR(led->base + addr_offset),
			FLASH_LED_SAFETY_TMR_DISABLED);
		if (rc < 0)
			return rc;
	}

	return rc;
}

static int qpnp_flash_led_strobe_config(struct qpnp_flash_led *led)
{
	int i, rc, addr_offset;
@@ -542,6 +558,10 @@ static int qpnp_flash_led_init_settings(struct qpnp_flash_led *led)
	if (rc < 0)
		return rc;

	rc = qpnp_flash_led_safety_tmr_config(led);
	if (rc < 0)
		return rc;

	rc = qpnp_flash_led_strobe_config(led);
	if (rc < 0)
		return rc;
@@ -1138,6 +1158,12 @@ static int qpnp_flash_led_switch_disable(struct flash_switch_data *snode)
		if (rc < 0)
			return rc;

		rc = qpnp_flash_led_write(led,
			FLASH_LED_REG_SAFETY_TMR(led->base + addr_offset),
			FLASH_LED_SAFETY_TMR_DISABLED);
		if (rc < 0)
			return rc;

		led->fnode[i].led_on = false;

		if (led->fnode[i].strobe_sel == HW_STROBE) {