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

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

Merge "regulator: qpnp-labibb: Fix LAB PS_CTL configuration for pmi8998"

parents fe5570ca 66e37072
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -82,8 +82,10 @@ LAB subnode required properties:
- qcom,qpnp-lab-init-lcd-voltage: 	The default output voltage when LAB regulator
					is configured in lcd mode.
- qcom,qpnp-lab-ps-threshold:		The threshold in mA of Pulse Skip Mode for
					LAB regulator. Supported values are 20, 30,
					40 and 50.
					LAB regulator. Supported values for
					PMI8994/6 are 20, 30, 40 and 50.
					Supported values for PMI8998/PM660A are
					50, 60, 70 and 80.
- interrupts:				Specify the interrupts as per the interrupt
					encoding.
					Currently "lab-vreg-ok" is required for
+1 −1
Original line number Diff line number Diff line
@@ -530,7 +530,7 @@
									<1600>;
				qcom,qpnp-lab-limit-maximum-current = <1600>;
				qcom,qpnp-lab-limit-max-current-enable;
				qcom,qpnp-lab-ps-threshold = <20>;
				qcom,qpnp-lab-ps-threshold = <70>;
				qcom,qpnp-lab-ps-enable;
				qcom,qpnp-lab-nfet-size = <100>;
				qcom,qpnp-lab-pfet-size = <100>;
+18 −6
Original line number Diff line number Diff line
@@ -1226,6 +1226,7 @@ static int qpnp_ibb_output_voltage_at_one_pulse_v2(struct qpnp_labibb *labibb,
	return rc;
}

/* For PMI8998 and earlier PMICs */
static const struct ibb_ver_ops ibb_ops_v1 = {
	.set_default_voltage	= qpnp_ibb_set_default_voltage_v1,
	.set_voltage		= qpnp_ibb_set_voltage_v1,
@@ -1237,6 +1238,7 @@ static const struct ibb_ver_ops ibb_ops_v1 = {
	.voltage_at_one_pulse	= qpnp_ibb_output_voltage_at_one_pulse_v1,
};

/* For PM660A and later PMICs */
static const struct ibb_ver_ops ibb_ops_v2 = {
	.set_default_voltage	= qpnp_ibb_set_default_voltage_v2,
	.set_voltage		= qpnp_ibb_set_voltage_v2,
@@ -1346,8 +1348,9 @@ static int qpnp_lab_ps_ctl_v2(struct qpnp_labibb *labibb,
				u32 thresh, bool enable)
{
	int rc = 0;
	u8 val;
	u8 val, mask;

	mask = LAB_PS_CTL_EN;
	if (enable) {
		for (val = 0; val < ARRAY_SIZE(lab_ps_thresh_table_v2); val++)
			if (lab_ps_thresh_table_v2[val] == thresh)
@@ -1359,13 +1362,13 @@ static int qpnp_lab_ps_ctl_v2(struct qpnp_labibb *labibb,
		}

		val |= LAB_PS_CTL_EN;
		mask |= LAB_PS_THRESH_MASK;
	} else {
		val = 0;
	}

	rc = qpnp_labibb_write(labibb, labibb->lab_base +
			 REG_LAB_PS_CTL, &val, 1);

	rc = qpnp_labibb_masked_write(labibb, labibb->lab_base +
			 REG_LAB_PS_CTL, mask, val);
	if (rc < 0)
		pr_err("write register %x failed rc = %d\n",
				REG_LAB_PS_CTL, rc);
@@ -1373,12 +1376,18 @@ static int qpnp_lab_ps_ctl_v2(struct qpnp_labibb *labibb,
	return rc;
}

/* For PMI8996 and earlier PMICs */
static const struct lab_ver_ops lab_ops_v1 = {
	.set_default_voltage	= qpnp_lab_set_default_voltage_v1,
	.ps_ctl			= qpnp_lab_ps_ctl_v1,
};

static const struct lab_ver_ops lab_ops_v2 = {
static const struct lab_ver_ops pmi8998_lab_ops = {
	.set_default_voltage	= qpnp_lab_set_default_voltage_v1,
	.ps_ctl			= qpnp_lab_ps_ctl_v2,
};

static const struct lab_ver_ops pm660_lab_ops = {
	.set_default_voltage	= qpnp_lab_set_default_voltage_v2,
	.ps_ctl			= qpnp_lab_ps_ctl_v2,
};
@@ -3723,7 +3732,10 @@ static int qpnp_labibb_regulator_probe(struct platform_device *pdev)

	if (labibb->pmic_rev_id->pmic_subtype == PM660L_SUBTYPE) {
		labibb->ibb_ver_ops = &ibb_ops_v2;
		labibb->lab_ver_ops = &lab_ops_v2;
		labibb->lab_ver_ops = &pm660_lab_ops;
	} else if (labibb->pmic_rev_id->pmic_subtype == PMI8998_SUBTYPE) {
		labibb->ibb_ver_ops = &ibb_ops_v1;
		labibb->lab_ver_ops = &pmi8998_lab_ops;
	} else {
		labibb->ibb_ver_ops = &ibb_ops_v1;
		labibb->lab_ver_ops = &lab_ops_v1;