lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f650d4944a291197467e594c75103243f9943527.camel@fi.rohmeurope.com>
Date:   Thu, 27 May 2021 13:22:33 +0300
From:   Matti Vaittinen <matti.vaittinen@...rohmeurope.com>
To:     Gene Chen <gene.chen.richtek@...il.com>
Cc:     sre@...nel.org, Matthias Brugger <matthias.bgg@...il.com>,
        Rob Herring <robh+dt@...nel.org>, linux-pm@...r.kernel.org,
        devicetree <devicetree@...r.kernel.org>,
        linux-arm Mailing List <linux-arm-kernel@...ts.infradead.org>,
        "moderated list:ARM/Mediatek SoC support" 
        <linux-mediatek@...ts.infradead.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Gene Chen <gene_chen@...htek.com>, Wilma.Wu@...iatek.com,
        shufan_lee@...htek.com, ChiYuan Huang <cy_huang@...htek.com>,
        benjamin.chao@...iatek.com
Subject: Re: [PATCH v4 2/2] power: supply: mt6360_charger: add MT6360
 charger support


On Thu, 2021-05-27 at 17:58 +0800, Gene Chen wrote:
> Matti Vaittinen <matti.vaittinen@...rohmeurope.com> 於 2021年5月27日 週四
> 下午12:25寫道:
> > 
> > On Wed, 2021-05-26 at 17:40 +0800, Gene Chen wrote:
> > > Matti Vaittinen <matti.vaittinen@...rohmeurope.com> 於 2021年3月30日
> > > 週二
> > > 下午7:48寫道:
> > > > On Mon, 2021-01-18 at 20:41 +0800, Gene Chen wrote:
> > > > > From: Gene Chen <gene_chen@...htek.com>
> > > > > 
> > > > > Add basic support for the battery charger for MT6360 PMIC
> > > > > 
> > > > > Signed-off-by: Gene Chen <gene_chen@...htek.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ