Linux Power Management development
 help / color / mirror / Atom feed
From: Mike Looijmans <mike.looijmans@topic.nl>
To: Ladislav Michl <ladis@linux-mips.org>
Cc: linux-pm@vger.kernel.org, Sebastian Reichel <sre@kernel.org>
Subject: Re: LTC3651 and other GPIO chargers
Date: Tue, 27 Jun 2017 08:59:17 +0200	[thread overview]
Message-ID: <81719e77-05a6-f5a8-e62d-e12f0a0c8d55@topic.nl> (raw)
In-Reply-To: <20170627063836.bp32zzxtf5ulu7dw@lenoch>

On 27-06-17 08:38, Ladislav Michl wrote:
> On Tue, Jun 27, 2017 at 07:39:21AM +0200, Mike Looijmans wrote:
>> On 26-06-17 18:21, Ladislav Michl wrote:
>>> Hi there!
>>>
>>> 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.
>>
>> It's an interesting idea, and while writing the ltc3651 driver, I was
>> thinking along those lines already. However, there are only two gpio charger
>> drivers now, so I didn't see the need yet.
>>
>> The table is an interesting approach. Something else to consider: Some gpio
>> chargers allow control as well, e.g. pulling the "charging" ping low
>> externally forces the charging to stop.
> 
> Yes, the aforementioned LM3658 chip is one of such chargers. We already
> have charger-manager and gpio-regulator, but this doesn't seem to solve
> this situation as it provides "software charger ic". So for now I'm
> just misusing led class to enable charger - something which indeed needs
> to be solved properly.

Yeah, LED is great for (mis)using for all kinds of generic GPIO switches. Been 
there, done that (controlling model trains through relais for example...)

The problem goes a bit deeper. There's a bit of support for everything, and 
laptops and tablets seem to have it worked out reasonably, but for embedded 
devices, we somehow always end up with some very bare drivers for the charger, 
fuel gauge, charge detector, monitors, controllers and whatnot, and we always 
need a dedicated user-mode application to stitch it all together, for example 
to reset the battery gauge to full when the charger reports that charge has 
completed, or changing the max charger current from 0.5 to 1.5A when a 
dedicated charger has been detected on the USB wires. would be nice if that 
application could get that information from the drivers so we could make a 
generic power manager...


>> Something that might help is to create a "GPIO charger" sub-menu in Kconfig,
>> to make hunting for these drivers a bit easier.
> 
> I hope number of these driver will stop rising after we have one to rule
> them all :-)

True.



Kind regards,

Mike Looijmans
System Expert

TOPIC Products
Materiaalweg 4, NL-5681 RJ Best
Postbus 440, NL-5680 AK Best
Telefoon: +31 (0) 499 33 69 79
E-mail: mike.looijmans@topicproducts.com
Website: www.topicproducts.com

Please consider the environment before printing this e-mail

  reply	other threads:[~2017-06-27  7:18 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 [this message]
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

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=81719e77-05a6-f5a8-e62d-e12f0a0c8d55@topic.nl \
    --to=mike.looijmans@topic.nl \
    --cc=ladis@linux-mips.org \
    --cc=linux-pm@vger.kernel.org \
    --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