summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSubbaraman Narayanamurthy <subbaram@codeaurora.org>2017-01-25 14:28:47 -0800
committerSubbaraman Narayanamurthy <subbaram@codeaurora.org>2017-01-26 19:06:29 -0800
commitaac48797c8ca51bd6675fde3e7b4171d91d96358 (patch)
tree5c5c3b753c1b5b8b6d3d23acfe8da18064ec71e0
parent3824526de4f201d9d85bdd41ad2343a0e3d2ef37 (diff)
regulator: qpnp-labibb: make IBB discharge resistor configuration optional
IBB discharge resistor configuration needs to be decided on the mode (LCD/AMOLED) along with the capacitor used on the hardware platform. On hardware platforms that uses pmi8998, this would be configured in the bootloader and HLOS should not be modifying it based on the mode. Hence, remove the property in msm-pmi8998.dtsi. Change the device tree property to optional so that the driver can probe even when the property is not specified. Also, remove the code that force discharge resistor configuration to 300KOhms for AMOLED mode as it can be done either in the bootloader or through device tree. CRs-Fixed: 1115531 Change-Id: I0da5db166bb99a732978c287e97566f649686f42 Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
-rw-r--r--Documentation/devicetree/bindings/regulator/qpnp-labibb-regulator.txt3
-rw-r--r--arch/arm/boot/dts/qcom/msm-pmi8998.dtsi1
-rw-r--r--drivers/regulator/qpnp-labibb-regulator.c47
3 files changed, 20 insertions, 31 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 7586570ef75d..264e402b6a25 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,