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

Commit e639e800 authored by Osvaldo Banuelos's avatar Osvaldo Banuelos Committed by Kyle Yan
Browse files

input: qpnp-power-on: use restart reason bits based upon PON GEN



Support using 7 bits in the SOFT_RB_SPARE PON register if the
PON peripheral is GEN2, otherwise use only 6 bits. This allows
compatibility with bootloader code on targets with older PMICs
where 7 bits for restart reasons are not necessary.

Change-Id: Ibf7fc53d3ff7084b252a44c44e3ce29326659787
CRs-Fixed: 1023239
Signed-off-by: default avatarOsvaldo Banuelos <osvaldob@codeaurora.org>
parent 338cc814
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -347,8 +347,13 @@ int qpnp_pon_set_restart_reason(enum pon_restart_reason reason)
	if (!pon->store_hard_reset_reason)
		return 0;

	if (is_pon_gen2(pon))
		rc = qpnp_pon_masked_write(pon, QPNP_PON_SOFT_RB_SPARE(pon),
					   PON_MASK(7, 1), (reason << 1));
	else
		rc = qpnp_pon_masked_write(pon, QPNP_PON_SOFT_RB_SPARE(pon),
					   PON_MASK(7, 2), (reason << 2));

	if (rc)
		dev_err(&pon->pdev->dev,
				"Unable to write to addr=%x, rc(%d)\n",