diff options
author | Emmanuel Vadot <manu@FreeBSD.org> | 2020-01-10 18:53:14 +0000 |
---|---|---|
committer | Emmanuel Vadot <manu@FreeBSD.org> | 2020-01-10 18:53:14 +0000 |
commit | ca4387843e0a61599446f6aa63102c7717016e7b (patch) | |
tree | 147e6d726ff0cdb0ddac9588c9a69d76e5cfd7b0 /sys/arm | |
parent | b74b94d2a1f89f3104f121f58afe61c61b614dba (diff) | |
download | src-ca4387843e0a61599446f6aa63102c7717016e7b.tar.gz src-ca4387843e0a61599446f6aa63102c7717016e7b.zip |
arm: allwinner: axp209: Add regnode_status method
This allow consumers to check if the regulator is enable or not.
MFC after: 1 week
Notes
Notes:
svn path=/head/; revision=356610
Diffstat (limited to 'sys/arm')
-rw-r--r-- | sys/arm/allwinner/axp209.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sys/arm/allwinner/axp209.c b/sys/arm/allwinner/axp209.c index e36d30746aae..090886e413ba 100644 --- a/sys/arm/allwinner/axp209.c +++ b/sys/arm/allwinner/axp209.c @@ -708,6 +708,22 @@ axp2xx_regnode_voltage_to_reg(struct axp2xx_reg_sc *sc, int min_uvolt, } static int +axp2xx_regnode_status(struct regnode *regnode, int *status) +{ + struct axp2xx_reg_sc *sc; + uint8_t val; + + sc = regnode_get_softc(regnode); + + *status = 0; + axp2xx_read(sc->base_dev, sc->def->enable_reg, &val, 1); + if (val & sc->def->enable_mask) + *status = REGULATOR_STATUS_ENABLED; + + return (0); +} + +static int axp2xx_regnode_set_voltage(struct regnode *regnode, int min_uvolt, int max_uvolt, int *udelay) { @@ -750,6 +766,7 @@ static regnode_method_t axp2xx_regnode_methods[] = { /* Regulator interface */ REGNODEMETHOD(regnode_init, axp2xx_regnode_init), REGNODEMETHOD(regnode_enable, axp2xx_regnode_enable), + REGNODEMETHOD(regnode_status, axp2xx_regnode_status), REGNODEMETHOD(regnode_set_voltage, axp2xx_regnode_set_voltage), REGNODEMETHOD(regnode_get_voltage, axp2xx_regnode_get_voltage), REGNODEMETHOD(regnode_check_voltage, regnode_method_check_voltage), |