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

Commit f9e751cf authored by Umang Agrawal's avatar Umang Agrawal Committed by Guru Das Srinagesh
Browse files

power: smb5: Modify WDOG SNARL IRQ enable/disable flow



WDOG SNARL IRQ is required for SW Thermal Regulation WA only. Hence,
remove run time enable/disable logic of WDOG_SNARL_IRQ and add support
to disable WDOG_SNARL_IRQ post its registration in case SW Thermal
Regulation WA is not required.

Change-Id: I3012450e6c7e57298e325ec7e2d89ddddf85c2ce
Signed-off-by: default avatarUmang Agrawal <uagrawal@codeaurora.org>
parent a1f1cfe0
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -2623,11 +2623,16 @@ static int smb5_request_interrupts(struct smb5 *chip)
		chg->usb_icl_change_irq_enabled = true;

	/*
	 * Disable WDOG SNARL IRQ by default to prevent IRQ storm. If required
	 * for any application, enable it through votable.
	 * WDOG_SNARL_IRQ is required for SW Thermal Regulation WA only. In
	 * case the WA is not required, disable the WDOG_SNARL_IRQ to prevent
	 * interrupt storm.
	 */
	if (chg->irq_info[WDOG_SNARL_IRQ].irq)
		vote(chg->wdog_snarl_irq_en_votable, DEFAULT_VOTER, false, 0);

	if (chg->irq_info[WDOG_SNARL_IRQ].irq && !(chg->wa_flags &
						SW_THERM_REGULATION_WA)) {
		disable_irq_wake(chg->irq_info[WDOG_SNARL_IRQ].irq);
		disable_irq_nosync(chg->irq_info[WDOG_SNARL_IRQ].irq);
	}

	return rc;
}
+0 −33
Original line number Diff line number Diff line
@@ -1495,25 +1495,6 @@ static int smblib_usb_irq_enable_vote_callback(struct votable *votable,
	return 0;
}

static int smblib_wdog_snarl_irq_en_vote_callback(struct votable *votable,
				void *data, int enable, const char *client)
{
	struct smb_charger *chg = data;

	if (!chg->irq_info[WDOG_SNARL_IRQ].irq)
		return 0;

	if (enable) {
		enable_irq(chg->irq_info[WDOG_SNARL_IRQ].irq);
		enable_irq_wake(chg->irq_info[WDOG_SNARL_IRQ].irq);
	} else {
		disable_irq_wake(chg->irq_info[WDOG_SNARL_IRQ].irq);
		disable_irq_nosync(chg->irq_info[WDOG_SNARL_IRQ].irq);
	}

	return 0;
}

/*******************
 * VCONN REGULATOR *
 * *****************/
@@ -2389,8 +2370,6 @@ static int smblib_set_sw_thermal_regulation(struct smb_charger *chg,
			return rc;
		}

		vote(chg->wdog_snarl_irq_en_votable, SW_THERM_REGULATION_VOTER,
							true, 0);
		/*
		 * Schedule SW_THERM_REGULATION_WORK directly if USB input
		 * is suspended due to SW thermal regulation WA since WDOG
@@ -2403,8 +2382,6 @@ static int smblib_set_sw_thermal_regulation(struct smb_charger *chg,
			schedule_delayed_work(&chg->thermal_regulation_work, 0);
		}
	} else {
		vote(chg->wdog_snarl_irq_en_votable, SW_THERM_REGULATION_VOTER,
							false, 0);
		cancel_delayed_work_sync(&chg->thermal_regulation_work);
		vote(chg->awake_votable, SW_THERM_REGULATION_VOTER, false, 0);
	}
@@ -5905,16 +5882,6 @@ static int smblib_create_votables(struct smb_charger *chg)
		return rc;
	}

	chg->wdog_snarl_irq_en_votable = create_votable("SNARL_WDOG_IRQ_ENABLE",
					VOTE_SET_ANY,
					smblib_wdog_snarl_irq_en_vote_callback,
					chg);
	if (IS_ERR(chg->wdog_snarl_irq_en_votable)) {
		rc = PTR_ERR(chg->wdog_snarl_irq_en_votable);
		chg->wdog_snarl_irq_en_votable = NULL;
		return rc;
	}

	return rc;
}

+0 −1
Original line number Diff line number Diff line
@@ -365,7 +365,6 @@ struct smb_charger {
	struct votable		*pl_enable_votable_indirect;
	struct votable		*usb_irq_enable_votable;
	struct votable		*cp_disable_votable;
	struct votable		*wdog_snarl_irq_en_votable;
	struct votable		*smb_override_votable;

	/* work */