* [PATCHv1] power: supply: document current direction
@ 2020-08-27 14:02 Sebastian Reichel
2020-10-02 16:23 ` Andreas Kemnade
0 siblings, 1 reply; 3+ messages in thread
From: Sebastian Reichel @ 2020-08-27 14:02 UTC (permalink / raw)
To: Andreas Kemnade, Sebastian Reichel
Cc: linux-pm, linux-kernel, kernel, Sebastian Reichel
Currently the sign for CURRENT_NOW and CURRENT_AVG is a bit
of a mess. There are basically 3 different ways battery fuel
gauges report the current:
1. uses negative values for discharging and positive values
for charging
2. uses positive values for discharging and negative values
for discharging (opposit of 1)
3. only uses positive values
As a result userspace currently cannot use the sign at all in
a generic way. Let's solve the issue by documenting a canonical
way for reporting the data and ensure new drivers follow this
way. Then existing drivers can be fixed on a case-by-case basis.
The 'negative value = battery discharging' has been choosen,
since there are only very few drivers doing it the other way
around.
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
Documentation/ABI/testing/sysfs-class-power | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/Documentation/ABI/testing/sysfs-class-power b/Documentation/ABI/testing/sysfs-class-power
index 651599fb18f8..dbccb2fcd7ce 100644
--- a/Documentation/ABI/testing/sysfs-class-power
+++ b/Documentation/ABI/testing/sysfs-class-power
@@ -108,7 +108,8 @@ Description:
which they average readings to smooth out the reported value.
Access: Read
- Valid values: Represented in microamps
+ Valid values: Represented in microamps. Negative values are used
+ for discharging batteries, positive values for charging batteries.
What: /sys/class/power_supply/<supply_name>/current_max
Date: October 2010
@@ -127,7 +128,8 @@ Description:
This value is not averaged/smoothed.
Access: Read
- Valid values: Represented in microamps
+ Valid values: Represented in microamps. Negative values are used
+ for discharging batteries, positive values for charging batteries.
What: /sys/class/power_supply/<supply_name>/charge_control_limit
Date: Oct 2012
--
2.28.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCHv1] power: supply: document current direction
2020-08-27 14:02 [PATCHv1] power: supply: document current direction Sebastian Reichel
@ 2020-10-02 16:23 ` Andreas Kemnade
2020-10-03 10:48 ` Sebastian Reichel
0 siblings, 1 reply; 3+ messages in thread
From: Andreas Kemnade @ 2020-10-02 16:23 UTC (permalink / raw)
To: Sebastian Reichel; +Cc: Sebastian Reichel, linux-pm, linux-kernel, kernel
On Thu, 27 Aug 2020 16:02:48 +0200
Sebastian Reichel <sebastian.reichel@collabora.com> wrote:
> Currently the sign for CURRENT_NOW and CURRENT_AVG is a bit
> of a mess. There are basically 3 different ways battery fuel
> gauges report the current:
>
> 1. uses negative values for discharging and positive values
> for charging
> 2. uses positive values for discharging and negative values
> for discharging (opposit of 1)
> 3. only uses positive values
>
> As a result userspace currently cannot use the sign at all in
> a generic way. Let's solve the issue by documenting a canonical
> way for reporting the data and ensure new drivers follow this
> way. Then existing drivers can be fixed on a case-by-case basis.
>
> The 'negative value = battery discharging' has been choosen,
> since there are only very few drivers doing it the other way
> around.
>
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> ---
would be nice if this comes in, so that is it clearly specified.
Regards,
Andreas
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCHv1] power: supply: document current direction
2020-10-02 16:23 ` Andreas Kemnade
@ 2020-10-03 10:48 ` Sebastian Reichel
0 siblings, 0 replies; 3+ messages in thread
From: Sebastian Reichel @ 2020-10-03 10:48 UTC (permalink / raw)
To: Andreas Kemnade; +Cc: linux-pm, linux-kernel, kernel
[-- Attachment #1: Type: text/plain, Size: 1281 bytes --]
Hi,
On Fri, Oct 02, 2020 at 06:23:03PM +0200, Andreas Kemnade wrote:
> On Thu, 27 Aug 2020 16:02:48 +0200
> Sebastian Reichel <sebastian.reichel@collabora.com> wrote:
>
> > Currently the sign for CURRENT_NOW and CURRENT_AVG is a bit
> > of a mess. There are basically 3 different ways battery fuel
> > gauges report the current:
> >
> > 1. uses negative values for discharging and positive values
> > for charging
> > 2. uses positive values for discharging and negative values
> > for discharging (opposit of 1)
> > 3. only uses positive values
> >
> > As a result userspace currently cannot use the sign at all in
> > a generic way. Let's solve the issue by documenting a canonical
> > way for reporting the data and ensure new drivers follow this
> > way. Then existing drivers can be fixed on a case-by-case basis.
> >
> > The 'negative value = battery discharging' has been choosen,
> > since there are only very few drivers doing it the other way
> > around.
> >
> > Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> > ---
>
> would be nice if this comes in, so that is it clearly specified.
Ack, I'm a bit late picking up patches this merge window due to a
vacation. This has been queued now.
-- Sebastian
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-10-03 10:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-27 14:02 [PATCHv1] power: supply: document current direction Sebastian Reichel
2020-10-02 16:23 ` Andreas Kemnade
2020-10-03 10:48 ` Sebastian Reichel
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).