git: 7ea71c136c20 - main - axp81x: Do not change the voltage of a regulator in range
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 10 Nov 2026 13:42:59 UTC
The branch main has been updated by manu:
URL: https://cgit.FreeBSD.org/src/commit/?id=7ea71c136c209e1aea05afb08f59c8917cff8325
commit 7ea71c136c209e1aea05afb08f59c8917cff8325
Author: Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2026-11-10 08:02:41 +0000
Commit: Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2026-11-10 13:42:45 +0000
axp81x: Do not change the voltage of a regulator in range
axp8xx_regnode_init() set every regulator described in the FDT to its
minimum voltage, even if the firmware had already set a voltage in the
range. For a regulator that is in use, like the one of the CPU, this can
make the system crash. Only set the voltage when the current one is out
of the range.
Tested on: A64, H6
---
sys/arm/allwinner/axp81x.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/sys/arm/allwinner/axp81x.c b/sys/arm/allwinner/axp81x.c
index eb1852895bf3..ed70d5477e0e 100644
--- a/sys/arm/allwinner/axp81x.c
+++ b/sys/arm/allwinner/axp81x.c
@@ -710,6 +710,7 @@ struct axp8xx_softc {
#define AXP_UNLOCK(sc) mtx_unlock(&(sc)->mtx)
static int axp8xx_regnode_set_voltage(struct regnode *regnode, int min_uvolt,
int max_uvolt, int *udelay);
+static int axp8xx_regnode_get_voltage(struct regnode *regnode, int *uvolt);
static int
axp8xx_read(device_t dev, uint8_t reg, uint8_t *data, uint8_t size)
@@ -756,13 +757,21 @@ static int
axp8xx_regnode_init(struct regnode *regnode)
{
struct regnode_std_param *param;
- int rv, udelay;
+ int rv, udelay, uvolt;
udelay = 0;
param = regnode_get_stdparam(regnode);
if (param->min_uvolt == 0)
return (0);
+ /*
+ * Do not touch a regulator that is already in the range, the firmware
+ * set it, and some of them are in use, like the one of the CPU.
+ */
+ if (axp8xx_regnode_get_voltage(regnode, &uvolt) == 0 &&
+ uvolt >= param->min_uvolt && uvolt <= param->max_uvolt)
+ return (0);
+
/*
* Set the regulator at the correct voltage
* Do not enable it, this is will be done either by a