[PATCH v4 2/2] power: supply: mt6360_charger: add MT6360 charger support
Matti Vaittinen
matti.vaittinen at fi.rohmeurope.com
Thu May 27 03:22:33 PDT 2021
On Thu, 2021-05-27 at 17:58 +0800, Gene Chen wrote:
> Matti Vaittinen <matti.vaittinen at fi.rohmeurope.com> 於 2021年5月27日 週四
> 下午12:25寫道:
> >
> > On Wed, 2021-05-26 at 17:40 +0800, Gene Chen wrote:
> > > Matti Vaittinen <matti.vaittinen at fi.rohmeurope.com> 於 2021年3月30日
> > > 週二
> > > 下午7:48寫道:
> > > > On Mon, 2021-01-18 at 20:41 +0800, Gene Chen wrote:
> > > > > From: Gene Chen <gene_chen at richtek.com>
> > > > >
> > > > > Add basic support for the battery charger for MT6360 PMIC
> > > > >
> > > > > Signed-off-by: Gene Chen <gene_chen at richtek.com>
> > > > > ---
> > > > > drivers/power/supply/Kconfig | 10 +
> > > > > drivers/power/supply/Makefile | 1 +
> > > > > drivers/power/supply/mt6360_charger.c | 914
> > > > > ++++++++++++++++++++++++++++++++++
> > > > > 3 files changed, 925 insertions(+)
> > > > > create mode 100644 drivers/power/supply/mt6360_charger.c
> > > > >
> > > >
> > > > Thanks for the contribution :)
> > > >
> > > > Few comments which I am not demanding to be 'fixed' - but which
> > > > might
> > > > be good to be checked. Eg, please consider my comments as
> > > > 'nit's.
> > > >
> > > > ...
> > > >
> > > > > +static unsigned int mt6360_map_reg_sel(u32 data, u32 min,
> > > > > u32
> > > > > max,
> > > > > u32 step)
> > > > > +{
> > > > > + u32 target = 0, max_sel;
> > > > > +
> > > > > + if (data >= min) {
> > > > > + target = (data - min) / step;
> > > > > + max_sel = (max - min) / step;
> > > > > + if (target > max_sel)
> > > > > + target = max_sel;
> > > > > + }
> > > > > + return target;
> > > > > +}
> > > >
> > > > lib/linear_ranges.c might already implement this ...
> > > >
> > >
> > > I found we are neither linear_range_get_selector_high or
> > > linear_range_get_selector_low.
> > > When value lower than min_value, choose min_sel. If higher than
> > > max_value, choose max_sel.
> >
> > Ah, correct.
> >
> > > Should I create linear_range_get_selector() for this?
> >
> > My suggestion would be yes, but I am not insisting on it.
> >
>
> Maybe this is a special choosing mechanism, I will keep it.
> Could I also keep mt6360_map_real_val?
I think adding generic function to linear range code for others to re-
use would be nice. But if you choose to keep the mt6360_map_reg_sel()
then it I agree that you should also keep the mt6360_map_real_val().
Best regards
Matti Vaittinen
More information about the Linux-mediatek
mailing list