arm: allwinner: axp209: Add regnode_status method
This allow consumers to check if the regulator is enable or not. MFC after: 1 week
This commit is contained in:
parent
b74b94d2a1
commit
ca4387843e
@ -707,6 +707,22 @@ axp2xx_regnode_voltage_to_reg(struct axp2xx_reg_sc *sc, int min_uvolt,
|
||||
return (0);
|
||||
}
|
||||
|
||||
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),
|
||||
|
Loading…
x
Reference in New Issue
Block a user