On Thu, May 09, 2024 at 11:10:41AM +0200, Johan Hovold wrote: > On Wed, May 08, 2024 at 10:37:50PM +0000, Stephen Boyd wrote: > > Quoting Johan Hovold (2024-05-06 08:08:29) > > > +struct pm8008_regulator { > > > + struct regmap *regmap; > > > + struct regulator_desc rdesc; > > > + u16 base; > > > + int step_rate; > > > > Is struct regulator_desc::vsel_step usable for this? If not, can it be > > unsigned? > > Not sure, I'll take a look when respinning. No, vsel_step is unrelated to this, which is really a slew rate. I've reworked the driver and dropped this field in favour of regulator_desc::ramp_delay. > > > +}; > > > +static int pm8008_regulator_get_voltage(struct regulator_dev *rdev) > > > +{ > > > + struct pm8008_regulator *pm8008_reg = rdev_get_drvdata(rdev); > > > + __le16 mV; > > > + int uV; > > > + > > > + regmap_bulk_read(pm8008_reg->regmap, > > > + LDO_VSET_LB_REG(pm8008_reg->base), (void *)&mV, 2); > > > > Is struct regulator_desc::vsel_reg usable for this? > > Will look into that. I don't think vsel_reg can be used here as the voltage is set using two registers (LSB and MSB). > > > + > > > + uV = le16_to_cpu(mV) * 1000; > > > + return (uV - pm8008_reg->rdesc.min_uV) / pm8008_reg->rdesc.uV_step; > > > +} Johan