Merge tag 'u-boot-rockchip-20240930' of https://source.denx.de/u-boot/custodians/u-boot-rockchip
CI: https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/pipelines/22470
- rk8xx pmic fix
diff --git a/drivers/power/regulator/rk8xx.c b/drivers/power/regulator/rk8xx.c
index 34e6151..375d06e 100644
--- a/drivers/power/regulator/rk8xx.c
+++ b/drivers/power/regulator/rk8xx.c
@@ -381,7 +381,7 @@
val = ((uvolt - info->min_uv) / info->step_uv) + info->min_sel;
debug("%s: volt=%d, buck=%d, reg=0x%x, mask=0x%x, val=0x%x\n",
- __func__, uvolt, buck + 1, info->vsel_reg, mask, val);
+ __func__, uvolt, buck, info->vsel_reg, mask, val);
if (priv->variant == RK816_ID) {
pmic_clrsetbits(pmic, info->vsel_reg, mask, val);
@@ -415,7 +415,7 @@
break;
case RK806_ID:
value = RK806_POWER_EN_CLRSETBITS(buck % 4, enable);
- en_reg = RK806_POWER_EN((buck + 1) / 4);
+ en_reg = RK806_POWER_EN(buck / 4);
ret = pmic_reg_write(pmic, en_reg, value);
break;
case RK808_ID:
@@ -470,7 +470,7 @@
val = ((uvolt - info->min_uv) / info->step_uv) + info->min_sel;
debug("%s: volt=%d, buck=%d, reg=0x%x, mask=0x%x, val=0x%x\n",
- __func__, uvolt, buck + 1, info->vsel_sleep_reg, mask, val);
+ __func__, uvolt, buck, info->vsel_sleep_reg, mask, val);
return pmic_clrsetbits(pmic, info->vsel_sleep_reg, mask, val);
}
@@ -494,7 +494,7 @@
break;
case RK806_ID:
mask = BIT(buck % 4);
- ret = pmic_reg_read(pmic, RK806_POWER_EN((buck + 1) / 4));
+ ret = pmic_reg_read(pmic, RK806_POWER_EN(buck / 4));
break;
case RK808_ID:
case RK818_ID:
@@ -539,12 +539,13 @@
{
u8 reg;
- if (buck + 1 >= 9) {
+ if (buck >= 8) {
+ /* BUCK9 and BUCK10 */
reg = RK806_POWER_SLP_EN1;
- mask = BIT(buck + 1 - 3);
+ mask = BIT(buck - 2);
} else {
reg = RK806_POWER_SLP_EN0;
- mask = BIT(buck + 1);
+ mask = BIT(buck);
}
ret = pmic_clrsetbits(pmic, reg, mask, enable ? mask : 0);
}
@@ -590,12 +591,13 @@
{
u8 reg;
- if (buck + 1 >= 9) {
+ if (buck >= 8) {
+ /* BUCK9 and BUCK10 */
reg = RK806_POWER_SLP_EN1;
- mask = BIT(buck + 1 - 3);
+ mask = BIT(buck - 2);
} else {
reg = RK806_POWER_SLP_EN0;
- mask = BIT(buck + 1);
+ mask = BIT(buck);
}
val = pmic_reg_read(pmic, reg);
}