diff options
| author | Jonas Karlman <[email protected]> | 2024-09-17 20:59:17 +0000 |
|---|---|---|
| committer | Kever Yang <[email protected]> | 2024-09-27 18:20:49 +0800 |
| commit | 596465138175cd7e4171cad1e68a2ef7c5c002bc (patch) | |
| tree | de81a19e0bb795e018e106308345cc00acb04696 /drivers | |
| parent | 56b47b8b6a09c777e74fe6c52512c832691169aa (diff) | |
regulator: rk8xx: Fix buck get and set enabled state on RK806
Wrong POWER_EN reg is used to get and set enabled state for the RK806
buck 4 and 8 regulators, also wrong POWER_SLP_EN0 bit is used for
suspend state for the RK806 buck 1-8 regulators.
Fix this by not adding one to the zero based buck variable.
Fixes: f172575d92cd ("power: rk8xx: add support for RK806")
Signed-off-by: Jonas Karlman <[email protected]>
Reviewed-by: Kever Yang <[email protected]>
Reviewed-by: Quentin Schulz <[email protected]>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/power/regulator/rk8xx.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/power/regulator/rk8xx.c b/drivers/power/regulator/rk8xx.c index 34e61511d88..b910943c2c4 100644 --- a/drivers/power/regulator/rk8xx.c +++ b/drivers/power/regulator/rk8xx.c @@ -415,7 +415,7 @@ static int _buck_set_enable(struct udevice *pmic, int buck, bool enable) 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: @@ -494,7 +494,7 @@ static int _buck_get_enable(struct udevice *pmic, int buck) 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: @@ -544,7 +544,7 @@ static int _buck_set_suspend_enable(struct udevice *pmic, int buck, bool enable) mask = BIT(buck + 1 - 3); } else { reg = RK806_POWER_SLP_EN0; - mask = BIT(buck + 1); + mask = BIT(buck); } ret = pmic_clrsetbits(pmic, reg, mask, enable ? mask : 0); } @@ -595,7 +595,7 @@ static int _buck_get_suspend_enable(struct udevice *pmic, int buck) mask = BIT(buck + 1 - 3); } else { reg = RK806_POWER_SLP_EN0; - mask = BIT(buck + 1); + mask = BIT(buck); } val = pmic_reg_read(pmic, reg); } |
