The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Felipe Balbi <me@felipebalbi.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Felipe Balbi <me@felipebalbi.com>,
	Liam Girdwood <lrg@slimlogic.co.uk>,
	Mike Rapoport <mike@compulab.co.il>,
	linux-kernel@vger.kernel.org
Subject: Re: Smart Battery System Design (was: Re: Question about userspace-consumer)
Date: Wed, 12 Aug 2009 22:07:03 +0300	[thread overview]
Message-ID: <20090812190659.GA21001@gandalf> (raw)
In-Reply-To: <20090812100517.GA11227@sirena.org.uk>

Hi,

On Wed, Aug 12, 2009 at 11:05:17AM +0100, Mark Brown wrote:
> You actually get notification on any change the supply chooses to notify
> the core on IIRC.

true, but that's only (at least on the chips I've seen) for the presence
of the charger. I haven't seen a chip that notify you based on a
threshold of e.g. voltage change or temperature change. Which would be a
really nice feature: you could give a "best" temperature value and a
threshold of +-10% and if that changes over that limit, device
interrupts processor, or something like that.

> I'd be inclined to put at least some of the basic charge cycle into the
> kernel but it doesn't concern me too much so long as the user/kernel
> interface doesn't expose us to the risk of damaging the battery through
> inattention.

sounds reasonable.

> It's probably more interesting to think of prioritising between multiple
> batteries here - most systems I've seen have power path management which
> handles all the incoming power sources and uses them to maintain an
> unregulated power domain which is then used as the root supply for the
> rest of the system, including the battery chargers.  This takes the
> supply selection well out of the domain of charging.

sounds really good. Haven't a system like that so far :-(

> This is the really tricky bit since you need some idea of the load from
> the rest of the system if the charger really is able to draw current.
> Normally there's a combination of checking various gates to see if it's
> possible to start charging with the current parameters and then things
> like monitoring the supply voltage to the charger to make sure it's not
> drooping and taking corrective action if it does.
> 
> My feeling is that in addition to what you're saying the in-kernel side
> of things should also describe how the system is wired together since
> that's the sort of task the kernel is doing anyway, it's something
> that is fixed in the hardware and it's potentially dangerous to get
> wrong.

agree with you here.

> Assuming the charger also has things like voltage and current control
> exposed.  I think I'd expect to see some sort of charger class which
> abstracts out the functionality of the charger so that the same user
> applications can also be used to set policy for more autonomous
> chargers.  Those chargers may require contortions to fit them into the
> regulator API depending on the control they provide to the system.  More
> simple chargers may well fit cleanly into the regulator API (they're
> regulators after all) but that'd be just one example of this class.
> 
> Quite how much I'd expect such a soft charger to be able to do for
> itself I'm less sure about but I'd be inclined to at least look at doing
> the stuff that can be done with only information from the battery in
> kernel to make things more consistent for user space.

makes sense.

> Yes, exactly - there's a real danger of catastrophic system failure if
> that happens.

sure there is.

I believe we're reaching some conclusions here. I'll think over your
thoughts and try to get more time to read the specs over the weekend (so
much work during the week, sigh). Then let's see what could be done so
we have a good design for a charger api in kernel.

-- 
balbi

  reply	other threads:[~2009-08-12 19:07 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-10 20:05 Question about userspace-consumer Felipe Balbi
2009-08-10 21:58 ` Mark Brown
2009-08-11  5:44   ` Felipe Balbi
2009-08-11  9:40     ` Mark Brown
2009-08-11 10:30       ` Liam Girdwood
2009-08-11 20:49         ` Smart Battery System Design (was: Re: Question about userspace-consumer) Felipe Balbi
2009-08-11 20:59           ` Felipe Balbi
2009-08-11 22:36           ` Mark Brown
2009-08-12  6:47             ` Felipe Balbi
2009-08-12 10:05               ` Mark Brown
2009-08-12 19:07                 ` Felipe Balbi [this message]
2009-08-12 22:53                   ` Mark Brown
2009-08-14 16:32             ` Pavel Machek
2009-08-15 16:43               ` Mark Brown
2009-08-15 22:34                 ` Pavel Machek
2009-08-16  9:18                   ` Mark Brown
2009-08-22  9:28                     ` Pavel Machek
2009-08-22 10:16                       ` Mark Brown
2009-08-21 14:01                         ` Pavel Machek
2009-08-22 14:16                           ` Mark Brown
2009-08-22 19:35                             ` Pavel Machek
2009-08-23  9:08                               ` Mark Brown
2009-08-11 12:09     ` Question about userspace-consumer Mike Rapoport
2009-08-11 12:56       ` Mark Brown
2009-08-11 20:40         ` Felipe Balbi
2009-08-14 16:31     ` Pavel Machek

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=20090812190659.GA21001@gandalf \
    --to=me@felipebalbi.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@slimlogic.co.uk \
    --cc=mike@compulab.co.il \
    /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