rk808: Add min/max for the switch regulators

The two switch regulator are always 3.0V.
Add a special case in get_voltage that if min=max we directly
return the value without calculating it.

Reviewed by:	mmel
Differential Revision:	https://reviews.freebsd.org/D23004
This commit is contained in:
Emmanuel Vadot 2020-01-08 11:29:22 +00:00
parent 29bfe2102d
commit d194b63134
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=356485

View File

@ -204,6 +204,7 @@ static struct rk805_regdef rk808_regdefs[] = {
.voltage_nstep = 64,
},
{
/* BUCK3 voltage is calculated based on external resistor */
.id = RK805_DCDC3,
.name = "DCDC_REG3",
.enable_reg = RK805_DCDC_EN,
@ -322,12 +323,16 @@ static struct rk805_regdef rk808_regdefs[] = {
.name = "SWITCH_REG1",
.enable_reg = RK805_DCDC_EN,
.enable_mask = 0x20,
.voltage_min = 3000000,
.voltage_max = 3000000,
},
{
.id = RK808_SWITCH2,
.name = "SWITCH_REG2",
.enable_reg = RK805_DCDC_EN,
.enable_mask = 0x40,
.voltage_min = 3000000,
.voltage_max = 3000000,
},
};
@ -450,6 +455,11 @@ rk805_regnode_get_voltage(struct regnode *regnode, int *uvolt)
sc = regnode_get_softc(regnode);
if (sc->def->voltage_min == sc->def->voltage_max) {
*uvolt = sc->def->voltage_min;
return (0);
}
if (!sc->def->voltage_step)
return (ENXIO);