diff options
| author | Subbaraman Narayanamurthy <subbaram@codeaurora.org> | 2017-10-24 17:35:58 -0700 |
|---|---|---|
| committer | Subbaraman Narayanamurthy <subbaram@codeaurora.org> | 2017-10-24 17:35:58 -0700 |
| commit | ce1d2a82669394ab60c4430ca1268560ecdcc251 (patch) | |
| tree | 57ebbe9bbd53d4dab1a7bca36467beeaadfb7f35 | |
| parent | 9551e129dd2625ea2ab4fa5620820849b069ce2f (diff) | |
regulator: qpnp-labibb: Fix LAB PS_CTL configuration for pmi8998
PMI8998 LAB pulse skip configuration is different from PMI8996
and earlier PMICs. Fix it by using the right configuration API
to configure LAB PS_CTL along with supporting PM660A properly.
Since the existing LAB PS configuration threshold for pmi8998 is
incorrect in device tree, update it along with this change.
Change-Id: I2686733867ec3e2909d0c071a5881d3d824c713e
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
| -rw-r--r-- | Documentation/devicetree/bindings/regulator/qpnp-labibb-regulator.txt | 6 | ||||
| -rw-r--r-- | arch/arm/boot/dts/qcom/msm-pmi8998.dtsi | 2 | ||||
| -rw-r--r-- | drivers/regulator/qpnp-labibb-regulator.c | 24 |
3 files changed, 23 insertions, 9 deletions
diff --git a/Documentation/devicetree/bindings/regulator/qpnp-labibb-regulator.txt b/Documentation/devicetree/bindings/regulator/qpnp-labibb-regulator.txt index 1ac52d120daa..a5e607de69d8 100644 --- a/Documentation/devicetree/bindings/regulator/qpnp-labibb-regulator.txt +++ b/Documentation/devicetree/bindings/regulator/qpnp-labibb-regulator.txt @@ -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 and "lab-sc_err" diff --git a/arch/arm/boot/dts/qcom/msm-pmi8998.dtsi b/arch/arm/boot/dts/qcom/msm-pmi8998.dtsi index 147b537eba33..4c049c8007cc 100644 --- a/arch/arm/boot/dts/qcom/msm-pmi8998.dtsi +++ b/arch/arm/boot/dts/qcom/msm-pmi8998.dtsi @@ -599,7 +599,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>; diff --git a/drivers/regulator/qpnp-labibb-regulator.c b/drivers/regulator/qpnp-labibb-regulator.c index 72c697bdcd29..0314e28a5966 100644 --- a/drivers/regulator/qpnp-labibb-regulator.c +++ b/drivers/regulator/qpnp-labibb-regulator.c @@ -1238,6 +1238,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, @@ -1249,6 +1250,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, @@ -1358,8 +1360,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) @@ -1371,13 +1374,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); @@ -1385,12 +1388,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, }; @@ -4000,7 +4009,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; |
