linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Pavel Machek <pavel@ucw.cz>
Cc: Merlijn Wajer <merlijn@wizzup.org>,
	Sebastian Reichel <sre@kernel.org>,
	linux-pm@vger.kernel.org, linux-omap@vger.kernel.org,
	"Arthur D." <spinal.by@gmail.com>
Subject: Re: [PATCH 1/3] RFC: power: supply: cpcap-battery: Add helper for rough capacity
Date: Thu, 23 Jan 2020 08:02:57 -0800	[thread overview]
Message-ID: <20200123160257.GX5885@atomide.com> (raw)
In-Reply-To: <20200121222547.GA17712@duo.ucw.cz>

* Pavel Machek <pavel@ucw.cz> [200121 22:26]:
> Hi!
> 
> > >> Get a rough battery charge estimate until we've seen a high or low
> > >> battery level. After that we can use the coulomb counter to calculate
> > >> the battery capacity.
> > >>
> > >> Note that I should probably update this to support ocv-capacity-table
> > >> before this makes sense to apply. With ocv-capacity-table we should be
> > >> able to estimate battery state as described in the documentation for
> > >> Documentation/devicetree/bindings/power/supply/battery.txt.
> > > 
> > > Maybe we should let userspace do that?
> > > 
> > > https://github.com/pavelmachek/libbattery
> > 
> > Unless this gets integrated in UPower, My point of view is that
> > userspace probably wants some uniform approach. Kernel interface
> > definitely is one uniform interface that would also get picked up by UPower.
> 
> I see that it is convenient to have it in kernel. I just assumed
> Sebastian would not take that, because it does not _need_ to be in
> kernel...

I think we should find a way where we can keep the existing kernel
interface as all the apps rely on that. If we allow userspace to
optionally set the estimated battery full and battery empty coulomb
counter values we should be all set.

For temperature compensation it seems that the ocv-capacity-table
is the way to go to describe the battery if the battery data is
unsuable or does not exist.

> And maybe it is easier in userspace, since userspace has access to
> persistent storage, so it can store detailed battery calibration
> parameters? (And Gnome/Mate even does something like that, see
> mate-power-statistics).

Agreed, at minimum the userspace should save estimated coulomb
counter full and empty values. After that calculations are trivial
as seen with this series.

> So... not my decision. Don't care too much either way. I have been
> doing this in userspace, but...
> 
> What I'd like to see is some kind of indication that "this attribute
> is not from hardware, kernel computed it for you" so clever userspace
> can ignore it/compute it in more advanced way.

Well we do have that via IIO already. Not sure if that is needed
for power supply.

Regards,

Tony

  reply	other threads:[~2020-01-23 16:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-19 20:11 [PATCH 1/3] RFC: power: supply: cpcap-battery: Add helper for rough capacity Tony Lindgren
2020-01-19 20:11 ` [PATCH 2/3] RFC: power: supply: cpcap-battery: Save high and low states Tony Lindgren
2020-01-19 20:11 ` [PATCH 3/3] RFC: power: supply: cpcap-battery: Implement capacity percentage Tony Lindgren
2020-01-21  9:57 ` [PATCH 1/3] RFC: power: supply: cpcap-battery: Add helper for rough capacity Pavel Machek
2020-01-21 10:42   ` Merlijn Wajer
2020-01-21 22:25     ` Pavel Machek
2020-01-23 16:02       ` Tony Lindgren [this message]
2020-03-10  4:54         ` Arthur D.
2020-03-10 15:39           ` Tony Lindgren
2020-03-10 18:35             ` Arthur D.
2020-03-11 14:23               ` Tony Lindgren

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=20200123160257.GX5885@atomide.com \
    --to=tony@atomide.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=merlijn@wizzup.org \
    --cc=pavel@ucw.cz \
    --cc=spinal.by@gmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).