linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Reichel <sebastian.reichel@collabora.com>
To: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Cc: clang-built-linux@googlegroups.com, linux-kernel@vger.kernel.org,
	linux-pm@vger.kernel.org
Subject: Re: [PATCH v4 2/4] power: supply: core: add input voltage/current measurements
Date: Sun, 3 May 2020 02:09:21 +0200	[thread overview]
Message-ID: <20200503000921.6krrkai7onsba2uz@earth.universe> (raw)
In-Reply-To: <20200502231158.GB25127@qmqm.qmqm.pl>

[-- Attachment #1: Type: text/plain, Size: 2216 bytes --]

Hi,

On Sun, May 03, 2020 at 01:11:58AM +0200, Michał Mirosław wrote:
> On Sun, May 03, 2020 at 12:45:26AM +0200, Michał Mirosław wrote:
> > On Sun, May 03, 2020 at 12:23:49AM +0200, Sebastian Reichel wrote:
> > > On Fri, May 01, 2020 at 05:11:18PM +0200, Michał Mirosław wrote:
> [...]
> > > > --- a/include/linux/power_supply.h
> > > > +++ b/include/linux/power_supply.h
> > > > @@ -127,7 +127,9 @@ enum power_supply_property {
> > > >  	POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT_MAX,
> > > >  	POWER_SUPPLY_PROP_CHARGE_CONTROL_START_THRESHOLD, /* in percents! */
> > > >  	POWER_SUPPLY_PROP_CHARGE_CONTROL_END_THRESHOLD, /* in percents! */
> > > > +	POWER_SUPPLY_PROP_INPUT_CURRENT_NOW,
> > > 
> > > What:           /sys/class/power_supply/<supply_name>/current_avg    
> > > Date:           May 2007
> > > Contact:        linux-pm@vger.kernel.org                          
> > > Description:                  
> > >                 Reports an average IBUS current reading over a fixed period.   
> > >                 Normally devices will provide a fixed interval in which they   
> > >                 average readings to smooth out the reported value.             
> > >                                                                                 
> > >                 Access: Read    
> > >                 Valid values: Represented in microamps
> > > 
> > 
> > There are two entries for /sys/class/power_supply/<supply_name>/current_avg
> > in the file, the other one mentions IBAT instead. "voltage_now" has the
> > same problem.
> [...]
> 
> So the general idea of the sysfs API seems to require separate devices for the
> input (charger) and battery elements.
>
> Since what I'm looking at is an integrated battery controller
> (bq25896) which has three connections: an USB power (VBUS), a
> battery and the system load, but it creates only a single
> power-class device.

power-supply exposes either TYPE_MAINS/TYPE_USB or TYPE_BATTERY.
If a device is combined function, then it should register two
power-supply devices.

> This is complicated by the fact that this is an OTG device and so
> it can sink or source VBUS power.

Ok.

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2020-05-03  0:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-01 15:11 [PATCH v4 0/4] power: supply: core: extend with new properties Michał Mirosław
2020-05-01 15:11 ` [PATCH v4 1/4] power: supply: core: tabularize HWMON temperature labels Michał Mirosław
2020-05-02 22:24   ` Sebastian Reichel
2020-05-01 15:11 ` [PATCH v4 2/4] power: supply: core: add input voltage/current measurements Michał Mirosław
2020-05-02 22:23   ` Sebastian Reichel
2020-05-02 22:45     ` Michał Mirosław
2020-05-02 23:11       ` Michał Mirosław
2020-05-03  0:09         ` Sebastian Reichel [this message]
2020-05-01 15:11 ` [PATCH v4 4/4] power: supply: core: document measurement points Michał Mirosław
2020-05-01 15:11 ` [PATCH v4 3/4] power: supply: core: add output voltage measurements Michał Mirosław

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=20200503000921.6krrkai7onsba2uz@earth.universe \
    --to=sebastian.reichel@collabora.com \
    --cc=clang-built-linux@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mirq-linux@rere.qmqm.pl \
    --subject='Re: [PATCH v4 2/4] power: supply: core: add input voltage/current measurements' \
    /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

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).