From: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
To: Gene Chen <gene.chen.richtek@gmail.com>
Cc: sre@kernel.org, Matthias Brugger <matthias.bgg@gmail.com>,
Rob Herring <robh+dt@kernel.org>,
linux-pm@vger.kernel.org, devicetree <devicetree@vger.kernel.org>,
linux-arm Mailing List <linux-arm-kernel@lists.infradead.org>,
"moderated list:ARM/Mediatek SoC support"
<linux-mediatek@lists.infradead.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Gene Chen <gene_chen@richtek.com>,
Wilma.Wu@mediatek.com, shufan_lee@richtek.com,
ChiYuan Huang <cy_huang@richtek.com>,
benjamin.chao@mediatek.com
Subject: Re: [PATCH v4 2/2] power: supply: mt6360_charger: add MT6360 charger support
Date: Thu, 27 May 2021 13:22:33 +0300 [thread overview]
Message-ID: <f650d4944a291197467e594c75103243f9943527.camel@fi.rohmeurope.com> (raw)
In-Reply-To: <CAE+NS36skw0XRCnNzHp8KSvdS+YPCAgwBNM-F7Wg=dxuiF5z1w@mail.gmail.com>
On Thu, 2021-05-27 at 17:58 +0800, Gene Chen wrote:
> Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com> 於 2021年5月27日 週四
> 下午12:25寫道:
> >
> > On Wed, 2021-05-26 at 17:40 +0800, Gene Chen wrote:
> > > Matti Vaittinen <matti.vaittinen@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@richtek.com>
> > > > >
> > > > > Add basic support for the battery charger for MT6360 PMIC
> > > > >
> > > > > Signed-off-by: Gene Chen <gene_chen@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
next prev parent reply other threads:[~2021-05-27 10:22 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-18 12:41 [PATCH v4 0/2] power: supply: mt6360_charger: add MT6360 charger support Gene Chen
2021-01-18 12:41 ` [PATCH v4 1/2] dt-bindings: power: Add bindings document for Charger support on MT6360 PMIC Gene Chen
2021-01-18 12:41 ` [PATCH v4 2/2] power: supply: mt6360_charger: add MT6360 charger support Gene Chen
2021-03-02 7:27 ` Gene Chen
2021-03-22 10:58 ` Gene Chen
2021-03-29 17:13 ` Matthias Brugger
2021-03-30 11:48 ` Matti Vaittinen
2021-05-26 9:40 ` Gene Chen
2021-05-27 4:25 ` Matti Vaittinen
2021-05-27 9:58 ` Gene Chen
2021-05-27 10:22 ` Matti Vaittinen [this message]
2021-04-02 11:57 ` Sebastian Reichel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f650d4944a291197467e594c75103243f9943527.camel@fi.rohmeurope.com \
--to=matti.vaittinen@fi.rohmeurope.com \
--cc=Wilma.Wu@mediatek.com \
--cc=benjamin.chao@mediatek.com \
--cc=cy_huang@richtek.com \
--cc=devicetree@vger.kernel.org \
--cc=gene.chen.richtek@gmail.com \
--cc=gene_chen@richtek.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-pm@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=robh+dt@kernel.org \
--cc=shufan_lee@richtek.com \
--cc=sre@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).