Skip to contentSkip to conversation

power: rk808: fix ldo register offset

PATCH New Heiko Stuebner 4 participants 4 messages May 6, 2017 – May 24, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 power: rk808: fix ldo register offset

Till now get_ldo_reg did a return &rk808_ldo[num - 1]; to return the ldo register offset but didn't take into account that its calling functions already created the ldo as ldo = dev->driver_data - 1.

This resulted in the setting for ldo8 writing to the register of ldo7 and so on. So fix this and get the correct ldo register data.

---
 drivers/power/regulator/rk8xx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/power/regulator/rk8xx.c +2 -2
index e655c2d91f..c1ece96b66 100644
@@ -92,9 +92,9 @@ static const struct rk8xx_reg_info *get_ldo_reg(struct udevice *pmic,
 	struct rk8xx_priv *priv = dev_get_priv(pmic);
 	switch (priv->variant) {
 	case RK818_ID:
-		return &rk818_ldo[num - 1];
+		return &rk818_ldo[num];
 	default:
-		return &rk808_ldo[num - 1];
+		return &rk808_ldo[num];
 	}
 }
 
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 power: rk808: fix ldo register offset

Hi,

2017-05-07 3:21 GMT+08:00 Heiko Stuebner <[email protected]>:

Quoted 31 lines

Till now get_ldo_reg did a return &rk808_ldo[num - 1]; to return the ldo register offset but didn't take into account that its calling functions already created the ldo as ldo = dev->driver_data - 1.

This resulted in the setting for ldo8 writing to the register of ldo7 and so on. So fix this and get the correct ldo register data.

---
 drivers/power/regulator/rk8xx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/power/regulator/rk8xx.c +2 -3
index e655c2d91f..c1ece96b66 100644
@@ -92,9 +92,9 @@ static const struct rk8xx_reg_info *get_ldo_reg(struct udevice *pmic,
        struct rk8xx_priv *priv = dev_get_priv(pmic);
        switch (priv->variant) {
        case RK818_ID:
-               return &rk818_ldo[num - 1];
+               return &rk818_ldo[num];
        default:
-               return &rk808_ldo[num - 1];
+               return &rk808_ldo[num];
        }
 }
 
--

2.11.0

Quoted 4 lines

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

Sorry for untest patches, Reviewed-by: Jacob Chen <[email protected]>.

#2 lore raw

PATCH 1/1 power: rk808: fix ldo register offset

In reply to Heiko Stuebner
Quoted 4 lines · Heiko Stuebner

Till now get_ldo_reg did a return &rk808_ldo[num - 1]; to return the ldo register offset but didn't take into account that its calling functions already created the ldo as ldo = dev->driver_data - 1.

Quoted 8 lines

This resulted in the setting for ldo8 writing to the register of ldo7 and so on. So fix this and get the correct ldo register data.

---
 drivers/power/regulator/rk8xx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
#3 lore raw

PATCH 1/1 power: rk808: fix ldo register offset

Quoted 4 lines · Heiko Stuebner

Till now get_ldo_reg did a return &rk808_ldo[num - 1]; to return the ldo register offset but didn't take into account that its calling functions already created the ldo as ldo = dev->driver_data - 1.

Quoted 8 lines

This resulted in the setting for ldo8 writing to the register of ldo7 and so on. So fix this and get the correct ldo register data.

---
 drivers/power/regulator/rk8xx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Applied to u-boot-rockchip, thanks!