From: Brian Swetland <swetland@google.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>,
Rebecca Schultz Zavin <rebecca@android.com>,
Mike Lockwood <lockwood@android.com>
Cc: Linus Walleij <linus.walleij@stericsson.com>,
cbou@mail.ru, dwmw2@infradead.org,
LKML <linux-kernel@vger.kernel.org>,
linux-embedded@vger.kernel.org
Subject: Re: [POWER] battery calibration parameters from sysfs
Date: Mon, 7 Dec 2009 21:27:20 -0800 [thread overview]
Message-ID: <a55d774e0912072127u33cebd65xbfe341160c314a2e@mail.gmail.com> (raw)
In-Reply-To: <20091207165628.GA24981@rakim.wolfsonmicro.main>
On Mon, Dec 7, 2009 at 8:56 AM, Mark Brown
<broonie@opensource.wolfsonmicro.com> wrote:
>
>> One of the things we're facing is Android, which has
>> its userspace in plain Java JNI at the end of this link:
>> http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=s
>> ervices/jni/com_android_server_BatteryService.cpp;h=8e7cadc6b680fc420d34
>> 1faa094c71922946fdab;hb=HEAD
>
> Something word wrapped that link but I think I found the same code.
>
>> If you browse down to line 275 you can see it parse the sysfs
>> attribute "capacity", then this propagates up to the battery
>> status indicator on *all* Android phones out there. So if
>> you want to run Android unmodified, this is what you need to
>> provide. They are effectively using the power sysfs as
>> their hardware abstraction layer in this case.
>
> Oh dear. Using the power sysfs as the hardware abstraction seems
> perfectly reasonable but assuming that a given battery driver is going
> to have this level of information doesn't match up with an awful lot of
> actual charger hardware. My main concern here is that battery
> performance monitoring has no pressing need to be in kernel and that
> pushing it into the kernel creates a barrier to implementing more
> advanced schemes in userspace, which is especially serious given how
> involved this needs to be in order to be accurate.
We should tidy up the userspace side to have better abstraction for
this. On a number of devices we do obtain all the information
necessary from the kernel driver (or, in some cases battery monitoring
on the baseband side that the kernel driver chats with). On other
devices we don't (Motorola Droid, for example uses a userspace battery
daemon).
>> Note: I'm not claiming that Android is doing it right or that
>> we can't modify this code or so, it's just that this is the way
>> a few million Android devices out there are actually doing it.
>
> I don't think the existing Android devices are much of an issue here,
> it's not as though end users have the ability modify the firmware on
> them (modulo the fairly small number of ADP devices). This is an issue
> for people producing new devices who are already going to be doing some
> development to get the kernel up and running on their hardware.
My preference, from an Android point of view, would be to make sure we
have some reasonable userspace abstraction and provide a default
implementation that will do the right thing with an intelligent
battery driver (our usual design for inhouse work). Then alternative
implementations can be plugged in, should that not be sufficient.
Brian
next prev parent reply other threads:[~2009-12-08 5:27 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-04 10:42 [POWER] battery calibration parameters from sysfs Linus Walleij
2009-12-04 10:49 ` Mark Brown
2009-12-04 14:17 ` Mark Brown
2009-12-05 13:08 ` Linus Walleij
2009-12-05 17:45 ` Mark Brown
2009-12-07 11:48 ` Mark Brown
2009-12-07 14:07 ` Linus Walleij
2009-12-07 16:56 ` Mark Brown
2009-12-08 5:27 ` Brian Swetland [this message]
2009-12-08 10:28 ` Mark Brown
2009-12-13 13:24 ` Pavel Machek
2009-12-14 12:12 ` Mark Brown
2009-12-14 21:22 ` Pavel Machek
2009-12-14 23:43 ` Aras Vaichas
2009-12-15 3:02 ` Bill Gatliff
2009-12-15 22:58 ` Aras Vaichas
2009-12-15 23:32 ` Stanislav Brabec
2009-12-16 9:40 ` Andy Green
[not found] ` <4B28AAFC.5010108-/Zus8d0mwwtBDgjK7y7TUQ@public.gmane.org>
2009-12-18 8:48 ` Pavel Machek
[not found] ` <20091214121247.GB22388-HF5t3jzXg/6ND3a5+9QAFujbO/Zr0HzV@public.gmane.org>
2009-12-16 22:53 ` Pavel Machek
2009-12-13 13:19 ` Pavel Machek
2009-12-14 11:50 ` Mark Brown
2009-12-14 11:58 ` Pavel Machek
2009-12-14 12:14 ` Mark Brown
2009-12-04 11:34 ` Alexander Clouter
2009-12-06 20:52 ` Greg KH
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=a55d774e0912072127u33cebd65xbfe341160c314a2e@mail.gmail.com \
--to=swetland@google.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=cbou@mail.ru \
--cc=dwmw2@infradead.org \
--cc=linus.walleij@stericsson.com \
--cc=linux-embedded@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lockwood@android.com \
--cc=rebecca@android.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 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).