diff mbox

[U-Boot] power: rk808: fix ldo register offset

Message ID 20170506192129.11248-1-heiko@sntech.de
State Accepted
Commit d1bf69d822724d427b23e289b0c2cf9275c1e99e
Delegated to: Simon Glass
Headers show

Commit Message

Heiko Stuebner May 6, 2017, 7:21 p.m. UTC
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.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 drivers/power/regulator/rk8xx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jacob Chen May 7, 2017, 10:58 a.m. UTC | #1
Hi,

2017-05-07 3:21 GMT+08:00 Heiko Stuebner <heiko@sntech.de>:
> 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.
>
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> ---
>  drivers/power/regulator/rk8xx.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/power/regulator/rk8xx.c b/drivers/power/regulator/rk8xx.c
> index e655c2d91f..c1ece96b66 100644
> --- a/drivers/power/regulator/rk8xx.c
> +++ b/drivers/power/regulator/rk8xx.c
> @@ -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
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot


Sorry for untest patches, Reviewed-by: Jacob Chen <jacob2.chen@rock-chips.com>.
Simon Glass May 14, 2017, 9:32 a.m. UTC | #2
On 6 May 2017 at 13:21, Heiko Stuebner <heiko@sntech.de> wrote:
> 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.
>
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> ---
>  drivers/power/regulator/rk8xx.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>

Acked-by: Simon Glass <sjg@chromium.org>
Simon Glass May 24, 2017, 12:48 a.m. UTC | #3
On 6 May 2017 at 13:21, Heiko Stuebner <heiko@sntech.de> wrote:
> 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.
>
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> ---
>  drivers/power/regulator/rk8xx.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>

Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-rockchip, thanks!
diff mbox

Patch

diff --git a/drivers/power/regulator/rk8xx.c b/drivers/power/regulator/rk8xx.c
index e655c2d91f..c1ece96b66 100644
--- a/drivers/power/regulator/rk8xx.c
+++ b/drivers/power/regulator/rk8xx.c
@@ -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];
 	}
 }