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>
This commit is contained in:
Subbaraman Narayanamurthy 2017-01-25 14:28:47 -08:00
parent 3824526de4
commit aac48797c8
3 changed files with 21 additions and 32 deletions

View file

@ -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

View file

@ -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;

View file

@ -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 (val == ARRAY_SIZE(ibb_dischg_res_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;
}
}
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_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;
return 0;
}
static int qpnp_ibb_soft_start_ctl_v2(struct qpnp_labibb *labibb,