[PATCH v1 4/5] power: regulator: tps65941: use function callbacks for conversion ops

Bhargav Raviprakash bhargav.r at ltts.com
Wed Mar 6 14:34:29 CET 2024


On Fri, 23 Feb 2024 15:11:56 +0530, Dhruva Gole wrote:
> On Feb 23, 2024 at 14:42:11 +0530, Bhargav Raviprakash wrote:
> > Use function callbacks for volt2val, val2volt and slewrate lookups.
> > This makes it easier to add support for TPS65224 PMIC regulators.
> > 
> > Signed-off-by: Bhargav Raviprakash <bhargav.r at ltts.com>
> > ---
> >  drivers/power/regulator/tps65941_regulator.c | 61 +++++++++++++++-----
> >  1 file changed, 48 insertions(+), 13 deletions(-)
> 
> Add Tom Rini in To or CC please.
> 

Sure

> > 
> > diff --git a/drivers/power/regulator/tps65941_regulator.c b/drivers/power/regulator/tps65941_regulator.c
> > index cf54e30df5..cdfbc3f4de 100644
> > --- a/drivers/power/regulator/tps65941_regulator.c
> > +++ b/drivers/power/regulator/tps65941_regulator.c
> > @@ -35,6 +35,17 @@
> >  #define TPS65941_LDO_ID_3         3
> >  #define TPS65941_LDO_ID_4         4
> >  
> > +#define TPS65941_BUCK_CONV_OPS_IDX  0
> > +#define TPS65941_LDO_CONV_OPS_IDX   0
> > +
> > +struct tps65941_reg_conv_ops {
> > +	int volt_mask;
> > +	int (*volt2val)(int idx, int uV);
> > +	int (*val2volt)(int idx, int volt);
> > +	int slew_mask;
> > +	int (*lookup_slew)(int id);
> > +};
> > +
> >  static const char tps65941_buck_ctrl[TPS65941_BUCK_NUM] = {0x4, 0x6, 0x8, 0xA,
> >  								0xC};
> >  static const char tps65941_buck_vout[TPS65941_BUCK_NUM] = {0xE, 0x10, 0x12,
> > @@ -79,7 +90,7 @@ static int tps65941_buck_enable(struct udevice *dev, int op, bool *enable)
> >  	return 0;
> >  }
> >  
> > -static int tps65941_buck_volt2val(int uV)
> > +static int tps65941_buck_volt2val(int /*idx*/, int uV)
> 
> IMHO /*idx*/ does NOT look good.
> Check something like __maybe_unused attribute
> 
> [...]
> 
> -- 
> Best regards,
> Dhruva Gole <d-gole at ti.com>

Thanks for the feedback. Will use '__maybe_unused' in next version.

Regards,
Bhargav


More information about the U-Boot mailing list