From 696ca2f89671104679d74916ae31117ef7d05db5 Mon Sep 17 00:00:00 2001 From: Kiran Gunda Date: Fri, 7 Sep 2018 14:49:44 +0530 Subject: [PATCH 1/3] ARM: dts: msm: Add LCDB BST node for PM6150L and PM8150L The driver requires all the 3 nodes (bst, ldo, ncp) defined for a proper initialization sequence. Without any of them it skips the device tree parsing and variables stay un-initialized causing incorrect configuration. Change-Id: I04064abccee0014d01042e60e7ccbb25ab226e75 Signed-off-by: Kiran Gunda --- arch/arm64/boot/dts/qcom/pm6150l.dtsi | 7 +++++++ arch/arm64/boot/dts/qcom/pm8150l.dtsi | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/pm6150l.dtsi b/arch/arm64/boot/dts/qcom/pm6150l.dtsi index cfb5052030e1..ae731febad45 100644 --- a/arch/arm64/boot/dts/qcom/pm6150l.dtsi +++ b/arch/arm64/boot/dts/qcom/pm6150l.dtsi @@ -166,6 +166,13 @@ regulator-min-microvolt = <4000000>; regulator-max-microvolt = <6000000>; }; + + lcdb_bst_vreg: bst { + label = "bst"; + regulator-name = "lcdb_bst"; + regulator-min-microvolt = <4700000>; + regulator-max-microvolt = <6275000>; + }; }; flash_led: qcom,leds@d300 { diff --git a/arch/arm64/boot/dts/qcom/pm8150l.dtsi b/arch/arm64/boot/dts/qcom/pm8150l.dtsi index c518b990cc59..c05ed990e278 100644 --- a/arch/arm64/boot/dts/qcom/pm8150l.dtsi +++ b/arch/arm64/boot/dts/qcom/pm8150l.dtsi @@ -161,6 +161,13 @@ regulator-min-microvolt = <4000000>; regulator-max-microvolt = <6000000>; }; + + lcdb_bst_vreg: bst { + label = "bst"; + regulator-name = "lcdb_bst"; + regulator-min-microvolt = <4700000>; + regulator-max-microvolt = <6275000>; + }; }; flash_led: qcom,leds@d300 { From 4465854295f4b7bfebe5ee3ee3052990e689e3ca Mon Sep 17 00:00:00 2001 From: Kiran Gunda Date: Fri, 7 Sep 2018 18:06:44 +0530 Subject: [PATCH 2/3] regulator: lcdb: Correct the typo in pull down strength programming There is a typo in programming the BST_PD_CTL value. Due to this NCP_PD_STRENGTH register is programmed instead of the BST_PD_STRENGTH. Fix it. Change-Id: If630056f77194d3fdfa30b7c1ddd61f74da04cff Signed-off-by: Kiran Gunda --- drivers/regulator/qpnp-lcdb-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/qpnp-lcdb-regulator.c b/drivers/regulator/qpnp-lcdb-regulator.c index fe543aecdcd6..7f3d3b05bfd9 100644 --- a/drivers/regulator/qpnp-lcdb-regulator.c +++ b/drivers/regulator/qpnp-lcdb-regulator.c @@ -1823,7 +1823,7 @@ static int qpnp_lcdb_init_bst(struct qpnp_lcdb *lcdb) if (lcdb->bst.pd_strength != -EINVAL) { rc = qpnp_lcdb_masked_write(lcdb, lcdb->base + - LCDB_NCP_PD_CTL_REG, BOOST_PD_STRENGTH_BIT, + LCDB_BST_PD_CTL_REG, BOOST_PD_STRENGTH_BIT, lcdb->bst.pd_strength ? BOOST_PD_STRENGTH_BIT : 0); if (rc < 0) { From 9837ac3885d9438a6d8ec47e9038c63f0dc8f27b Mon Sep 17 00:00:00 2001 From: Kiran Gunda Date: Mon, 10 Sep 2018 12:16:41 +0530 Subject: [PATCH 3/3] regulator: qpnp-lcdb: Correct the get_voltage calculation NCP/LDO output voltage register is of 5 bits [4:0] only. The current calculation uses [7:0] which causes a incorrect value to be reported. Fix it. Change-Id: Idd00f5364e6bac7b086f4ca606c592e57d8bb24a Signed-off-by: Kiran Gunda --- drivers/regulator/qpnp-lcdb-regulator.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/regulator/qpnp-lcdb-regulator.c b/drivers/regulator/qpnp-lcdb-regulator.c index 7f3d3b05bfd9..45c2b7f0e46f 100644 --- a/drivers/regulator/qpnp-lcdb-regulator.c +++ b/drivers/regulator/qpnp-lcdb-regulator.c @@ -1148,6 +1148,7 @@ static int qpnp_lcdb_get_voltage(struct qpnp_lcdb *lcdb, return rc; } + val &= SET_OUTPUT_VOLTAGE_MASK; if (val < VOLTAGE_STEP_50MV_OFFSET) { *voltage_mv = VOLTAGE_MIN_STEP_100_MV + (val * VOLTAGE_STEP_100_MV);