diff mbox series

[4/4] soc: rockchip: io-domain: do more thing about regulator notify

Message ID 20210816032003.1162779-5-jay.xu@rock-chips.com (mailing list archive)
State New, archived
Headers show
Series regulator pre-enable | expand

Commit Message

Jianqun Xu Aug. 16, 2021, 3:20 a.m. UTC
Do a fix to rockchip io-domain, follow this orders:

* system running state
  -> io-domain vsel to 3.3V
    -> 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.

Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
---
 drivers/soc/rockchip/io-domain.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Ulf Hansson Aug. 16, 2021, 12:39 p.m. UTC | #1
On Mon, 16 Aug 2021 at 05:20, Jianqun Xu <jay.xu@rock-chips.com> wrote:
>
> Do a fix to rockchip io-domain, follow this orders:
>
> * system running state
>   -> io-domain vsel to 3.3V
>     -> 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.

Can you please try to elaborate on the problem a bit more, as I don't
quite get the problem.

What regulator is causing this problem? Who is the consumer of the regulator?

Kind regards
Uffe

>
> Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
> ---
>  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..af5fb11ad9a3 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 = (unsigned long)data;
>         } else {
>                 return NOTIFY_OK;
>         }
> --
> 2.25.1
>
>
>
diff mbox series

Patch

diff --git a/drivers/soc/rockchip/io-domain.c b/drivers/soc/rockchip/io-domain.c
index cf8182fc3642..af5fb11ad9a3 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 = (unsigned long)data;
 	} else {
 		return NOTIFY_OK;
 	}