[PATCH 03/16] regulator: rk8xx: fix SWITCH enable on RK809

Quentin Schulz foss+uboot at 0leil.net
Wed Feb 21 18:07:32 CET 2024


From: William Wu <william.wu at rock-chips.com>

On RK809 in PMIC_POWER_ENX registers, in order to set or clear a bit N,
the bit at offset N + 4 needs to be set otherwise nothing is done.

This fixes the inability to modify the SWITCH state on RK809.

Cc: Quentin Schulz <foss+uboot at 0leil.net>
Signed-off-by: William Wu <william.wu at rock-chips.com>
[reworded commit log]
Signed-off-by: Quentin Schulz <quentin.schulz at theobroma-systems.com>
---
 drivers/power/regulator/rk8xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/regulator/rk8xx.c b/drivers/power/regulator/rk8xx.c
index 97d73ac95e0..e905df3a800 100644
--- a/drivers/power/regulator/rk8xx.c
+++ b/drivers/power/regulator/rk8xx.c
@@ -901,7 +901,7 @@ static int switch_set_enable(struct udevice *dev, bool enable)
 	case RK809_ID:
 		mask = (1 << (sw + 2)) | (1 << (sw + 6));
 		ret = pmic_clrsetbits(dev->parent, RK817_POWER_EN(3), mask,
-				      enable ? mask : 0);
+				      enable ? mask : (1 << (sw + 6)));
 		break;
 	case RK818_ID:
 		mask = 1 << 6;

-- 
2.43.2



More information about the U-Boot mailing list