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

Commit 841eb431 authored by Subbaraman Narayanamurthy's avatar Subbaraman Narayanamurthy
Browse files

regulator: qpnp-lcdb: Fix boost headroom and max voltage configuration



For PM660L, maximum boost voltage is 6250 mV and for PM855L, it
is 6275 mV. Fix this. Also, if the child node for boost regulator
is not specified in the device tree, boost headroom is set to 0.
This is incorrect when there is a request for voltage change in
addition to enable/disable LDO/NCP regulators, boost voltage can
get set without the required headroom as the headroom was set to
0. Fix this by initializing boost headroom to default values even
if the child node for boost is not defined.

While at it, add the default boost headroom values for different
PMICs in device tree bindings documentation.

Change-Id: I79911d88e0fa25d8b520796c8eea61e6e4ab27ae
Signed-off-by: default avatarSubbaraman Narayanamurthy <subbaram@codeaurora.org>
parent f5c48058
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -212,8 +212,9 @@ Properties below are specific to BOOST subnode only.
- qcom,bst-headroom-mv
	Usage:      optional
	Value type:  <u16>
	Definition:  Headroom of the boost (in mV). The minimum headroom is
		     200mV and if not specified defaults to 200mV.
	Definition:  Headroom of the boost (in mV). If not specified, then the
		     default value is 200 mV (PM660L) or 150 mV (for PM855L or
		     PMI632).

=======
Example
+14 −3
Original line number Diff line number Diff line
@@ -991,7 +991,8 @@ static irqreturn_t qpnp_lcdb_sc_irq_handler(int irq, void *data)
}

#define MIN_BST_VOLTAGE_MV			4700
#define MAX_BST_VOLTAGE_MV			6250
#define PM660_MAX_BST_VOLTAGE_MV		6250
#define MAX_BST_VOLTAGE_MV			6275
#define MIN_VOLTAGE_MV				4000
#define MAX_VOLTAGE_MV				6000
#define VOLTAGE_MIN_STEP_100_MV			4000
@@ -1017,8 +1018,14 @@ static int qpnp_lcdb_set_bst_voltage(struct qpnp_lcdb *lcdb,

	if (bst_voltage_mv < MIN_BST_VOLTAGE_MV)
		bst_voltage_mv = MIN_BST_VOLTAGE_MV;
	else if (bst_voltage_mv > MAX_BST_VOLTAGE_MV)

	if (pmic_subtype == PM660L_SUBTYPE) {
		if (bst_voltage_mv > PM660_MAX_BST_VOLTAGE_MV)
			bst_voltage_mv = PM660_MAX_BST_VOLTAGE_MV;
	} else {
		if (bst_voltage_mv > MAX_BST_VOLTAGE_MV)
			bst_voltage_mv = MAX_BST_VOLTAGE_MV;
	}

	if (bst_voltage_mv != bst->voltage_mv) {
		if (pmic_subtype == PM660L_SUBTYPE) {
@@ -1883,6 +1890,8 @@ static int qpnp_lcdb_init_bst(struct qpnp_lcdb *lcdb)
			return rc;
		}
		lcdb->bst.soft_start_us = (val & SOFT_START_MASK) * 200 + 200;
		if (!lcdb->bst.headroom_mv)
			lcdb->bst.headroom_mv = PM660_BST_HEADROOM_DEFAULT_MV;
	} else {
		rc = qpnp_lcdb_read(lcdb, lcdb->base +
				    LCDB_BST_SS_CTL_REG, &val, 1);
@@ -1891,6 +1900,8 @@ static int qpnp_lcdb_init_bst(struct qpnp_lcdb *lcdb)
			return rc;
		}
		lcdb->bst.soft_start_us = soft_start_us[val & SOFT_START_MASK];
		if (!lcdb->bst.headroom_mv)
			lcdb->bst.headroom_mv = BST_HEADROOM_DEFAULT_MV;
	}

	return 0;