diff options
| author | Linux Build Service Account <lnxbuild@localhost> | 2017-01-30 07:04:55 -0800 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-01-30 07:04:55 -0800 |
| commit | 510fc66816808fc4381ef68f0dcf2bf38a15347d (patch) | |
| tree | 9aae27c74160b32a41bd75a97b63d654132065e1 | |
| parent | fa18a83d0aa0ba21573f6dc7b36e12674d65a8ad (diff) | |
| parent | aac48797c8ca51bd6675fde3e7b4171d91d96358 (diff) | |
Merge "regulator: qpnp-labibb: make IBB discharge resistor configuration optional"
| -rw-r--r-- | Documentation/devicetree/bindings/regulator/qpnp-labibb-regulator.txt | 3 | ||||
| -rw-r--r-- | arch/arm/boot/dts/qcom/msm-pmi8998.dtsi | 1 | ||||
| -rw-r--r-- | drivers/regulator/qpnp-labibb-regulator.c | 50 |
3 files changed, 22 insertions, 32 deletions
diff --git a/Documentation/devicetree/bindings/regulator/qpnp-labibb-regulator.txt b/Documentation/devicetree/bindings/regulator/qpnp-labibb-regulator.txt index 3e22f178aa82..d08ca957c954 100644 --- a/Documentation/devicetree/bindings/regulator/qpnp-labibb-regulator.txt +++ b/Documentation/devicetree/bindings/regulator/qpnp-labibb-regulator.txt @@ -203,10 +203,11 @@ IBB subnode required properties: - qcom,qpnp-ibb-init-lcd-voltage: The default output voltage when IBB regulator is configured in lcd mode. +IBB subnode optional properties: + - qcom,qpnp-ibb-discharge-resistor: The discharge resistor in Kilo Ohms which controls the soft start time. Supported values are 300, 64, 32 and 16. -IBB subnode optional properties: - qcom,qpnp-ibb-slew-rate: The time (in us) taken by the regulator to change voltage value in one step. This property is not diff --git a/arch/arm/boot/dts/qcom/msm-pmi8998.dtsi b/arch/arm/boot/dts/qcom/msm-pmi8998.dtsi index b1880c076e1c..be47b6483288 100644 --- a/arch/arm/boot/dts/qcom/msm-pmi8998.dtsi +++ b/arch/arm/boot/dts/qcom/msm-pmi8998.dtsi @@ -534,7 +534,6 @@ qcom,qpnp-ibb-soft-start = <1000>; - qcom,qpnp-ibb-discharge-resistor = <32>; qcom,qpnp-ibb-lab-pwrup-delay = <8000>; qcom,qpnp-ibb-lab-pwrdn-delay = <8000>; qcom,qpnp-ibb-en-discharge; diff --git a/drivers/regulator/qpnp-labibb-regulator.c b/drivers/regulator/qpnp-labibb-regulator.c index 9a8a3b18d03a..40c62c355188 100644 --- a/drivers/regulator/qpnp-labibb-regulator.c +++ b/drivers/regulator/qpnp-labibb-regulator.c @@ -333,7 +333,7 @@ enum ibb_mode { IBB_HW_SW_CONTROL, }; -static const int ibb_discharge_resistor_table[] = { +static const int ibb_dischg_res_table[] = { 300, 64, 32, @@ -946,38 +946,27 @@ static int qpnp_ibb_soft_start_ctl_v1(struct qpnp_labibb *labibb, rc = of_property_read_u32(of_node, "qcom,qpnp-ibb-discharge-resistor", &tmp); + if (!rc) { + for (val = 0; val < ARRAY_SIZE(ibb_dischg_res_table); val++) { + if (ibb_dischg_res_table[val] == tmp) + break; + } - if (rc < 0) { - pr_err("qcom,qpnp-ibb-discharge-resistor is missing, rc = %d\n", - rc); - return rc; - } - - if (labibb->mode == QPNP_LABIBB_AMOLED_MODE) { - /* - * AMOLED mode needs ibb discharge resistor to be - * configured for 300KOhm - */ - if (tmp < ibb_discharge_resistor_table[0]) - tmp = ibb_discharge_resistor_table[0]; - } - - for (val = 0; val < ARRAY_SIZE(ibb_discharge_resistor_table); val++) - if (ibb_discharge_resistor_table[val] == tmp) - break; + if (val == ARRAY_SIZE(ibb_dischg_res_table)) { + pr_err("Invalid value in qcom,qpnp-ibb-discharge-resistor\n"); + return -EINVAL; + } - if (val == ARRAY_SIZE(ibb_discharge_resistor_table)) { - pr_err("Invalid value in qcom,qpnp-ibb-discharge-resistor\n"); - return -EINVAL; + rc = qpnp_labibb_write(labibb, labibb->ibb_base + + REG_IBB_SOFT_START_CTL, &val, 1); + if (rc < 0) { + pr_err("write to register %x failed rc = %d\n", + REG_IBB_SOFT_START_CTL, rc); + return rc; + } } - rc = qpnp_labibb_write(labibb, labibb->ibb_base + - REG_IBB_SOFT_START_CTL, &val, 1); - if (rc < 0) - pr_err("write to register %x failed rc = %d\n", - REG_IBB_SOFT_START_CTL, rc); - - return rc; + return 0; } static int qpnp_ibb_soft_start_ctl_v2(struct qpnp_labibb *labibb, @@ -3408,7 +3397,8 @@ static int register_qpnp_ibb_regulator(struct qpnp_labibb *labibb, * before by the bootloader. */ if (labibb->pmic_rev_id->pmic_subtype == PMI8998_SUBTYPE) - labibb->swire_control = val & IBB_ENABLE_CTL_SWIRE_RDY; + labibb->swire_control = ibb_enable_ctl & + IBB_ENABLE_CTL_SWIRE_RDY; if (ibb_enable_ctl & (IBB_ENABLE_CTL_SWIRE_RDY | IBB_ENABLE_CTL_MODULE_EN)) { |
