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

Commit 35011c87 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "regulator: cpr3-regulator: cap max_uV in LDO regulator set_voltage() calls"

parents f60a16fb e8fc10a6
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -749,7 +749,8 @@ static int cpr3_regulator_set_bhs_mode(struct cpr3_regulator *vreg,
		bhs_volt = vreg->ldo_max_volt;
	}

	rc = regulator_set_voltage(ldo_reg, bhs_volt, vdd_ceiling_volt);
	rc = regulator_set_voltage(ldo_reg, bhs_volt, min(vdd_ceiling_volt,
							  vreg->ldo_max_volt));
	if (rc) {
		cpr3_err(vreg, "regulator_set_voltage(ldo) == %d failed, rc=%d\n",
			 bhs_volt, rc);
@@ -787,7 +788,7 @@ static int cpr3_regulator_config_vreg_ldo(struct cpr3_regulator *vreg,
			     int vdd_volt)
{
	struct regulator *ldo_reg = vreg->ldo_regulator;
	int rc, ldo_volt, bhs_volt;
	int rc, ldo_volt, bhs_volt, max_volt;

	rc = cpr3_regulator_config_ldo_retention(vreg, vdd_floor_volt);
	if (rc)
@@ -800,6 +801,8 @@ static int cpr3_regulator_config_vreg_ldo(struct cpr3_regulator *vreg,
	ldo_volt = vreg->corner[vreg->current_corner].open_loop_volt
		- vreg->ldo_adjust_volt;

	max_volt = min(vdd_ceiling_volt, vreg->ldo_max_volt);

	if (vdd_floor_volt >= ldo_volt + vreg->ldo_headroom_volt) {
		if (vreg->ldo_regulator_bypass == BHS_MODE) {
			if (ldo_volt > vreg->ldo_max_volt) {
@@ -818,8 +821,8 @@ static int cpr3_regulator_config_vreg_ldo(struct cpr3_regulator *vreg,
					   bhs_volt, vreg->ldo_max_volt);
				bhs_volt = vreg->ldo_max_volt;
			}
			rc = regulator_set_voltage(ldo_reg, bhs_volt,
						vdd_ceiling_volt);

			rc = regulator_set_voltage(ldo_reg, bhs_volt, max_volt);
			if (rc) {
				cpr3_err(vreg, "regulator_set_voltage(ldo) == %d failed, rc=%d\n",
					 bhs_volt, rc);
@@ -836,7 +839,7 @@ static int cpr3_regulator_config_vreg_ldo(struct cpr3_regulator *vreg,
		}

		/* Configure final LDO output voltage */
		rc = regulator_set_voltage(ldo_reg, ldo_volt, vdd_ceiling_volt);
		rc = regulator_set_voltage(ldo_reg, ldo_volt, max_volt);
		if (rc) {
			cpr3_err(vreg, "regulator_set_voltage(ldo) == %d failed, rc=%d\n",
				 ldo_volt, rc);