From: Ladislav Michl <ladis@linux-mips.org>
To: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Cc: linux-pm@vger.kernel.org,
Mike Looijmans <mike.looijmans@topic.nl>,
Rob Herring <robh@kernel.org>
Subject: Re: LTC3651 and other GPIO chargers
Date: Thu, 13 Jul 2017 09:25:09 +0200 [thread overview]
Message-ID: <20170713072509.zlokpbnezgfb3p5z@lenoch> (raw)
In-Reply-To: <20170703135238.6rbjh26l6yd7v7xy@earth>
On Mon, Jul 03, 2017 at 03:52:38PM +0200, Sebastian Reichel wrote:
> Hi,
>
> On Mon, Jun 26, 2017 at 06:21:06PM +0200, Ladislav Michl wrote:
> > A driver for LTC3651 was recently added to -next
> > https://patchwork.kernel.org/patch/9717049/
> > which brings a question whenever we want to add separate driver
> > (or vendor specific bindings) for ever growing list of similar
> > chargers. For example those using the same status output lines
> > are: BQ24232HA, LTC4007, LTM8061, RT9502, LT3651, LT3650, TP4056,
> > MAX1737...
> > Others for example BQ24032A and LM3658 (which I have to support)
> > are using different status encoding, ie. LM3658:
> >
> > stat1 stat2 Condition
> > 0 0 Power-Down, charging is suspended or interrupted
> > 1 0 Pre-qualification mode, CC and CV charging
> > 0 1 Charge is completed
> > 1 1 Bad battery (Safety timer expired), or LDO mode
> >
> > What about extending gpio-charger instead?
> > - allow gpio list fdt subnode
> > - consider each gpio line to represent bit in a word
> > - provide per property subnodes
> > - each subnode holds a mask and mapping to property values
> > This way we should be able to cover most chargers providing status
> > using gpios. Comments welcome and appreciated - those will turn into
> > implementation.
> >
> > Thank you,
> > ladis
>
> I think you mean something like this?
Not exatly, but you are pretty close.
> charger {
> compatible = "vendor,chip", "gpio-charger;
>
> status-gpios = <status-gpio1>, <status-gpio2>;
>
> status-mapping-0 {
> mask = <00>;
> type = "exploded";
> };
>
> status-mapping-1 {
> mask = <01>;
> type = "frozen";
> };
>
> ...
> };
>
> In that case: NAK. I like the general idea, but the DT binding looks
> like a mess. Instead of providing the mapping in DT, it should be
> provided by the driver and selected based on the compatible value.
I won't pretend I'm not disapointed, but you are propably right.
Mapping in DT would bind DT with Linux specific implementation details.
Now testing patched gpio-charger. Patch will be send once I'm happy
with implementation.
Thank you,
ladis
prev parent reply other threads:[~2017-07-13 7:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-26 16:21 LTC3651 and other GPIO chargers Ladislav Michl
2017-06-27 5:39 ` Mike Looijmans
2017-06-27 6:38 ` Ladislav Michl
2017-06-27 6:59 ` Mike Looijmans
2017-07-28 1:04 ` Ladislav Michl
2017-07-28 5:27 ` Mike Looijmans
2017-07-03 13:52 ` Sebastian Reichel
2017-07-13 7:25 ` Ladislav Michl [this message]
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=20170713072509.zlokpbnezgfb3p5z@lenoch \
--to=ladis@linux-mips.org \
--cc=linux-pm@vger.kernel.org \
--cc=mike.looijmans@topic.nl \
--cc=robh@kernel.org \
--cc=sebastian.reichel@collabora.co.uk \
/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