All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] soc: rockchip: io-domain: set 3.3V before regulator disable
@ 2021-08-18  1:09 ` Jianqun Xu
  0 siblings, 0 replies; 10+ messages in thread
From: Jianqun Xu @ 2021-08-18  1:09 UTC (permalink / raw)
  To: lgirdwood, broonie, ulf.hansson, lee.jones, zhangchangzhong, heiko
  Cc: linux-rockchip, linux-kernel, Jianqun Xu

Do a fix to rockchip io-domain, follow this orders:

* system running state
  -> io-domain vsel to 3.3V (actually is done by pre-disable)
    -> regulator_enable
      -> vsel change according to regulator voltage

* system running state
  -> io-domain vsel to 3.3V
    -> regulator_disable

Found on some Rockchip SoCs, the regulator enable or disable without
care about the io-domain maybe caused soc damaged.

Tested on RV1126 EVB.

Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
---
v3:
 - abandon PRE-ENABLE patch
 - delete the EVENT_PRE_ENABLE case
v2: none
v1: first version

 drivers/soc/rockchip/io-domain.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/soc/rockchip/io-domain.c b/drivers/soc/rockchip/io-domain.c
index cf8182fc3642..3c59077fafb1 100644
--- a/drivers/soc/rockchip/io-domain.c
+++ b/drivers/soc/rockchip/io-domain.c
@@ -123,6 +123,12 @@ static int rockchip_iodomain_notify(struct notifier_block *nb,
 	} else if (event & (REGULATOR_EVENT_VOLTAGE_CHANGE |
 			    REGULATOR_EVENT_ABORT_VOLTAGE_CHANGE)) {
 		uV = (unsigned long)data;
+	} else if (event & REGULATOR_EVENT_PRE_ENABLE) {
+		uV = MAX_VOLTAGE_3_3;
+	} else if (event & REGULATOR_EVENT_PRE_DISABLE) {
+		uV = MAX_VOLTAGE_3_3;
+	} else if (event & REGULATOR_EVENT_ENABLE) {
+		uV = regulator_get_voltage(supply->reg);
 	} else {
 		return NOTIFY_OK;
 	}
-- 
2.25.1




^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-08-18 12:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-18  1:09 [PATCH v3] soc: rockchip: io-domain: set 3.3V before regulator disable Jianqun Xu
2021-08-18  1:09 ` Jianqun Xu
2021-08-18  5:11 ` kernel test robot
2021-08-18  5:11   ` kernel test robot
2021-08-18  5:11   ` kernel test robot
2021-08-18  5:56 ` kernel test robot
2021-08-18  5:56   ` kernel test robot
2021-08-18  5:56   ` kernel test robot
2021-08-18 12:27 ` Mark Brown
2021-08-18 12:27   ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.