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

Commit f2367b70 authored by David Collins's avatar David Collins Committed by Fenglin Wu
Browse files

regulator: rpmh-regulator: update ARC voltage level masking logic



Change the logic applied for ARC regulator resources that define
hardware voltage level 0 as "off" in order to avoid sending an
incorrect regulator disable request when regulator_set_voltage()
is called before regulator_enable().

Change-Id: If3fe9e088d6ee875261381f00a0eaa32960e3199
Signed-off-by: default avatarDavid Collins <collinsd@codeaurora.org>
parent 15849a7b
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -393,10 +393,15 @@ static void rpmh_regulator_handle_arc_enable(struct rpmh_aggr_vreg *aggr_vreg,
	 * Mask the voltage level if "off" level is supported and the regulator
	 * has not been enabled.
	 */
	if (aggr_vreg->level[0] == RPMH_REGULATOR_LEVEL_OFF &&
	    (!(req->valid & BIT(RPMH_REGULATOR_REG_ARC_PSEUDO_ENABLE)) ||
	     !req->reg[RPMH_REGULATOR_REG_ARC_PSEUDO_ENABLE]))
	if (aggr_vreg->level[0] == RPMH_REGULATOR_LEVEL_OFF) {
		if (req->valid & BIT(RPMH_REGULATOR_REG_ARC_PSEUDO_ENABLE)) {
			if (!req->reg[RPMH_REGULATOR_REG_ARC_PSEUDO_ENABLE])
				req->reg[RPMH_REGULATOR_REG_ARC_LEVEL] = 0;
		} else {
			/* Invalidate voltage level if enable is invalid. */
			req->valid &= ~BIT(RPMH_REGULATOR_REG_ARC_LEVEL);
		}
	}

	/*
	 * Mark the pseudo enable bit as invalid so that it is not accidentally