All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Rapoport <mike@compulab.co.il>
To: me@felipebalbi.com
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Liam Girdwood <lrg@slimlogic.co.uk>,
	linux-kernel@vger.kernel.org
Subject: Re: Question about userspace-consumer
Date: Tue, 11 Aug 2009 15:09:08 +0300	[thread overview]
Message-ID: <4A815F64.8000105@compulab.co.il> (raw)
In-Reply-To: <20090811054438.GA7176@gandalf>

Felipe Balbi wrote:
> On Mon, Aug 10, 2009 at 10:58:01PM +0100, Mark Brown wrote:
>> On Mon, Aug 10, 2009 at 11:05:54PM +0300, Felipe Balbi wrote:
>>
>> The existing drivers for this sort of functionality are all regular
>> kernel drivers (in drivers/power and to a lesser extent drivers/hwmon)
>> and it looks like it'd be at least as much work to rearrange the power
>> supply stuff to support userspace drivers.  My initial expectation would
> 
> power supply already does what it needs, no ? It exports battery
> figures (state-of-charge, time-to-charge, temperature, etc etc) via
> sysfs to userland, where our "charging daemon" could read those values
> from.
> 
>> be for a generic driver with some policy exposed to user space and some
>> configuration exposed for architecture code (especially for setting up
>> multi-battery board layouts and things).  That's not a terribly informed
>> opinion, though.

+1

>>> For doing that, probably userspace-consumer would have to be able to
>>> set_voltage/get_voltage, set/get_current_limit and so on. So I was
>>> thinking on changing userspace-consumer to use regulator_get() instead
>>> of regulator_bulk_get() and make each instance of userspace-consumer to
>>> talk to only and only one regulator.

I don't think that a battery charger should identify itself like a regulator
device. It seems to me that charger driver belongs completely to the power
supply subsystem and if there's a need to add policy enforcement functionality,
it should be added to the power supply subsystem.
Moreover, extending userspace-consumer driver for battery charger needs is too
dangerous. You have to ensure that *all* critical conditions are handled
in-kernel, no matter what userspace policy is.

> I think kernel should, as long as possible, only provide functionalities
> for userland to take decisions and actions, no ?
> 
> Handling policy in kernel space I find it a little odd, specially
> because different manufacturers might have different charging algorithms
> they want to implement.

It depends on how do you define policy. If the policy includes e.g. over-charge
and over-temperature than it should be handled in-kernel.

> that said, power supply framework and regulator framework seem to be
> well enough for implementing the basic support for SBS-enabled charging
> scheme.

As far as I understood SBS scheme, the host has very little impact on the
charging process. Most of the charging is handled by Smart Battery and Smart
Battery Charger without any host intervention.


-- 
Sincerely yours,
Mike.


  parent reply	other threads:[~2009-08-11 12:09 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
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     ` Mike Rapoport [this message]
2009-08-11 12:56       ` Question about userspace-consumer 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=4A815F64.8000105@compulab.co.il \
    --to=mike@compulab.co.il \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@slimlogic.co.uk \
    --cc=me@felipebalbi.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.