power: rk808: fix ldo register offset
authorHeiko Stübner <heiko@sntech.de>
Sat, 6 May 2017 19:21:29 +0000 (21:21 +0200)
committerSimon Glass <sjg@chromium.org>
Wed, 7 Jun 2017 13:29:19 +0000 (07:29 -0600)
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>
Acked-by: Simon Glass <sjg@chromium.org>
drivers/power/regulator/rk8xx.c

index e655c2d91f5e18eb7858b84842c030be2119d1fc..c1ece96b66fa3a22a3b5c89b079bcf2417bb8b7b 100644 (file)
@@ -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];
        }
 }