diff mbox series

sunxi: power: axp809: Fix DCDC4 programming

Message ID 20241007222625.18883-1-andre.przywara@arm.com
State Accepted
Commit d75fa8c80dcfa34733701ae86f8c2b5c2dd72720
Delegated to: Andre Przywara
Headers show
Series sunxi: power: axp809: Fix DCDC4 programming | expand

Commit Message

Andre Przywara Oct. 7, 2024, 10:26 p.m. UTC
When trying to set the DCDC4 regulator, the code was accidentally
setting the voltage register for DCDC5 (VCC-DRAM). The higher voltage
doesn't harm the DRAM chips, but upsets the Linux regulator driver: when
it tried to correct that, it tripped over a separate DT bug.
The DCDC5 DT limits are 1.425 and 1.575V, which cannot bet set with the
rail's resolution of 50mV. The kernel driver gave up, and made in turn
the system hang, as the PMIC powers essential devices.

Fix the copy&paste bug by using the correct PMIC voltage register.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
 drivers/power/axp809.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Chen-Yu Tsai Oct. 25, 2024, 2:42 p.m. UTC | #1
On Tue, Oct 8, 2024 at 6:27 AM Andre Przywara <andre.przywara@arm.com> wrote:
>
> When trying to set the DCDC4 regulator, the code was accidentally
> setting the voltage register for DCDC5 (VCC-DRAM). The higher voltage
> doesn't harm the DRAM chips, but upsets the Linux regulator driver: when
> it tried to correct that, it tripped over a separate DT bug.
> The DCDC5 DT limits are 1.425 and 1.575V, which cannot bet set with the
> rail's resolution of 50mV. The kernel driver gave up, and made in turn
> the system hang, as the PMIC powers essential devices.
>
> Fix the copy&paste bug by using the correct PMIC voltage register.
>
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>

Reviewed-by: Chen-Yu Tsai <wens@csie.org>

> ---
>  drivers/power/axp809.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/power/axp809.c b/drivers/power/axp809.c
> index 9e38e1a7450..ec3eca1ac4b 100644
> --- a/drivers/power/axp809.c
> +++ b/drivers/power/axp809.c
> @@ -93,7 +93,7 @@ int axp_set_dcdc4(unsigned int mvolt)
>                 return pmic_bus_clrbits(AXP809_OUTPUT_CTRL1,
>                                         AXP809_OUTPUT_CTRL1_DCDC4_EN);
>
> -       ret = pmic_bus_write(AXP809_DCDC5_CTRL, cfg);
> +       ret = pmic_bus_write(AXP809_DCDC4_CTRL, cfg);
>         if (ret)
>                 return ret;
>
> --
> 2.46.2
>
Jaehoon Chung Oct. 28, 2024, 12:30 a.m. UTC | #2
> -----Original Message-----
> From: Chen-Yu Tsai <wens@csie.org>
> Sent: Friday, October 25, 2024 11:43 PM
> To: Andre Przywara <andre.przywara@arm.com>
> Cc: Jaehoon Chung <jh80.chung@samsung.com>; Jagan Teki <jagan@amarulasolutions.com>; Tom Rini
> <trini@konsulko.com>; u-boot@lists.denx.de; linux-sunxi@lists.linux.dev
> Subject: Re: [PATCH] sunxi: power: axp809: Fix DCDC4 programming
>
> On Tue, Oct 8, 2024 at 6:27?AM Andre Przywara <andre.przywara@arm.com> wrote:
> >
> > When trying to set the DCDC4 regulator, the code was accidentally
> > setting the voltage register for DCDC5 (VCC-DRAM). The higher voltage
> > doesn't harm the DRAM chips, but upsets the Linux regulator driver: when
> > it tried to correct that, it tripped over a separate DT bug.
> > The DCDC5 DT limits are 1.425 and 1.575V, which cannot bet set with the
> > rail's resolution of 50mV. The kernel driver gave up, and made in turn
> > the system hang, as the PMIC powers essential devices.
> >
> > Fix the copy&paste bug by using the correct PMIC voltage register.
> >
> > Signed-off-by: Andre Przywara <andre.przywara@arm.com>
>
> Reviewed-by: Chen-Yu Tsai <wens@csie.org>

Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>

>
> > ---
> >  drivers/power/axp809.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/power/axp809.c b/drivers/power/axp809.c
> > index 9e38e1a7450..ec3eca1ac4b 100644
> > --- a/drivers/power/axp809.c
> > +++ b/drivers/power/axp809.c
> > @@ -93,7 +93,7 @@ int axp_set_dcdc4(unsigned int mvolt)
> >                 return pmic_bus_clrbits(AXP809_OUTPUT_CTRL1,
> >                                         AXP809_OUTPUT_CTRL1_DCDC4_EN);
> >
> > -       ret = pmic_bus_write(AXP809_DCDC5_CTRL, cfg);
> > +       ret = pmic_bus_write(AXP809_DCDC4_CTRL, cfg);
> >         if (ret)
> >                 return ret;
> >
> > --
> > 2.46.2
> >
diff mbox series

Patch

diff --git a/drivers/power/axp809.c b/drivers/power/axp809.c
index 9e38e1a7450..ec3eca1ac4b 100644
--- a/drivers/power/axp809.c
+++ b/drivers/power/axp809.c
@@ -93,7 +93,7 @@  int axp_set_dcdc4(unsigned int mvolt)
 		return pmic_bus_clrbits(AXP809_OUTPUT_CTRL1,
 					AXP809_OUTPUT_CTRL1_DCDC4_EN);
 
-	ret = pmic_bus_write(AXP809_DCDC5_CTRL, cfg);
+	ret = pmic_bus_write(AXP809_DCDC4_CTRL, cfg);
 	if (ret)
 		return ret;