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 /drivers/regulator | |
| parent | fa18a83d0aa0ba21573f6dc7b36e12674d65a8ad (diff) | |
| parent | aac48797c8ca51bd6675fde3e7b4171d91d96358 (diff) | |
Merge "regulator: qpnp-labibb: make IBB discharge resistor configuration optional"
Diffstat (limited to 'drivers/regulator')
| -rw-r--r-- | drivers/regulator/qpnp-labibb-regulator.c | 50 |
1 files changed, 20 insertions, 30 deletions
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)) { |
