linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Mess in the /sysfs: class/power_supply
@ 2015-01-31 21:39 Pavel Machek
  2015-02-25 21:44 ` Mess in the /sysfs: class/power_supply/bq2415x Sebastian Reichel
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Machek @ 2015-01-31 21:39 UTC (permalink / raw)
  To: kernel list, Greg KH; +Cc: sre, dbaryshkov, dwmw2, linux-pm

Hi!

So we have multiple values in one sysfs file:

root@n900:/sys/class/power_supply# cat bq24150a-0/registers
0x00=0x50
0x01=0xc8
0x02=0x8e
0x03=0x4b
0x04=0x99

(should this go to debugfs somewhere?)

Unobvious and undocumented entries:

root@n900:/sys/class/power_supply# cat bq24150a-0/boost_status
0
pavel@duo:/data/l/linux-n900$ grep -ri boost_status Documentation/
pavel@duo:/data/l/linux-n900$ grep -ri termination_current Documentation/
pavel@duo:/data/l/linux-n900$ grep -ri current_now Documentation/
pavel@duo:/data/l/linux-n900$ grep -ri time_to_empty_avg Documentation/
pavel@duo:/data/l/linux-n900$


And different units in different parts of tree:

(these are mA)

root@n900:/sys/class/power_supply# cat bq24150a-0/current_limit
1800
root@n900:/sys/class/power_supply# cat bq24150a-0/termination_current
100

(and this is in uA)

root@n900:/sys/class/power_supply# cat bq27200-0/current_now
12138

(I believe uA is right, so it is bq24150a that should be fixed....?)

Ok, of course questions are: do we need to do something with it? If
so, what?

Best regards,
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Mess in the /sysfs: class/power_supply/bq2415x
  2015-01-31 21:39 Mess in the /sysfs: class/power_supply Pavel Machek
@ 2015-02-25 21:44 ` Sebastian Reichel
  2015-02-25 22:01   ` Pali Rohár
  0 siblings, 1 reply; 3+ messages in thread
From: Sebastian Reichel @ 2015-02-25 21:44 UTC (permalink / raw)
  To: Pavel Machek
  Cc: kernel list, Greg KH, dbaryshkov, dwmw2, linux-pm,
	Pali Rohár

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

Hi Pavel,

On Sat, Jan 31, 2015 at 10:39:19PM +0100, Pavel Machek wrote:
> So we have multiple values in one sysfs file:
> 
> root@n900:/sys/class/power_supply# cat bq24150a-0/registers
> 0x00=0x50
> 0x01=0xc8
> 0x02=0x8e
> 0x03=0x4b
> 0x04=0x99
> 
> (should this go to debugfs somewhere?)

I guess this should be dropped in favour of debugfs. A standardized
debugfs node will be exported automatically if the driver is
converted to regmap.

> Unobvious and undocumented entries:
> 
> root@n900:/sys/class/power_supply# cat bq24150a-0/boost_status
> 0
> pavel@duo:/data/l/linux-n900$ grep -ri boost_status Documentation/
> pavel@duo:/data/l/linux-n900$ grep -ri termination_current Documentation/
> pavel@duo:/data/l/linux-n900$ grep -ri current_now Documentation/
> pavel@duo:/data/l/linux-n900$ grep -ri time_to_empty_avg Documentation/
> pavel@duo:/data/l/linux-n900$

Anton seems to have missed making Pali to write a Documentation
patch. Pali: Can you do so, please?

> And different units in different parts of tree:
> 
> (these are mA)
> 
> root@n900:/sys/class/power_supply# cat bq24150a-0/current_limit
> 1800
> root@n900:/sys/class/power_supply# cat bq24150a-0/termination_current
> 100
> 
> (and this is in uA)
> 
> root@n900:/sys/class/power_supply# cat bq27200-0/current_now
> 12138
> 
> (I believe uA is right, so it is bq24150a that should be fixed....?)

> Ok, of course questions are: do we need to do something with it? If
> so, what?

For consistency it should be uA, but I guess this would introduce a
regression for Maemo people. Pali?

-- Sebastian

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Mess in the /sysfs: class/power_supply/bq2415x
  2015-02-25 21:44 ` Mess in the /sysfs: class/power_supply/bq2415x Sebastian Reichel
@ 2015-02-25 22:01   ` Pali Rohár
  0 siblings, 0 replies; 3+ messages in thread
From: Pali Rohár @ 2015-02-25 22:01 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Pavel Machek, kernel list, Greg KH, dbaryshkov, dwmw2, linux-pm

[-- Attachment #1: Type: Text/Plain, Size: 2919 bytes --]

On Wednesday 25 February 2015 22:44:42 Sebastian Reichel wrote:
> Hi Pavel,
> 
> On Sat, Jan 31, 2015 at 10:39:19PM +0100, Pavel Machek wrote:
> > So we have multiple values in one sysfs file:
> > 
> > root@n900:/sys/class/power_supply# cat bq24150a-0/registers
> > 0x00=0x50
> > 0x01=0xc8
> > 0x02=0x8e
> > 0x03=0x4b
> > 0x04=0x99
> > 
> > (should this go to debugfs somewhere?)
> 
> I guess this should be dropped in favour of debugfs. A
> standardized debugfs node will be exported automatically if
> the driver is converted to regmap.
> 
> > Unobvious and undocumented entries:
> > 
> > root@n900:/sys/class/power_supply# cat
> > bq24150a-0/boost_status 0
> > pavel@duo:/data/l/linux-n900$ grep -ri boost_status
> > Documentation/ pavel@duo:/data/l/linux-n900$ grep -ri
> > termination_current Documentation/
> > pavel@duo:/data/l/linux-n900$ grep -ri current_now
> > Documentation/ pavel@duo:/data/l/linux-n900$ grep -ri
> > time_to_empty_avg Documentation/
> > pavel@duo:/data/l/linux-n900$
> 
> Anton seems to have missed making Pali to write a
> Documentation patch. Pali: Can you do so, please?
> 

Some of properties are standard power_supply properties and those 
are documented in Documentation/power/power_supply_class.txt

bq2415x specific are documented only in bq2415x_charger.c source 
code. So probably we should move documentation into 
Documentation/power/bq2415x_charer.txt

But I think there are other stuff with higher priority for N900 
as moving comments/documentation...

> > And different units in different parts of tree:
> > 
> > (these are mA)
> > 
> > root@n900:/sys/class/power_supply# cat
> > bq24150a-0/current_limit 1800
> > root@n900:/sys/class/power_supply# cat
> > bq24150a-0/termination_current 100
> > 

Those are non standard power-supply properties and so unit is not 
defined.

> > (and this is in uA)
> > 
> > root@n900:/sys/class/power_supply# cat bq27200-0/current_now
> > 12138
> > 

This is power supply.

> > (I believe uA is right, so it is bq24150a that should be
> > fixed....?)
> > 

Units
~~~~~
Quoting include/linux/power_supply.h:

  All voltages, currents, charges, energies, time and 
temperatures in µV,
  µA, µAh, µWh, seconds and tenths of degree Celsius unless 
otherwise
  stated. It's driver's job to convert its raw values to units in 
which
  this class operates.

> > Ok, of course questions are: do we need to do something with
> > it? If so, what?
> 
> For consistency it should be uA, but I guess this would
> introduce a regression for Maemo people. Pali?
> 
> -- Sebastian

It looks like that in Maemo & CSSU we are using only:

/sys/class/power_supply/bq24150a-0/mode
/sys/class/power_supply/bq24150a-0/stat_pin_enable

But it does not mean that some other people do not use other 
bq2415x sysfs nodes.

-- 
Pali Rohár
pali.rohar@gmail.com

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-02-25 22:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-31 21:39 Mess in the /sysfs: class/power_supply Pavel Machek
2015-02-25 21:44 ` Mess in the /sysfs: class/power_supply/bq2415x Sebastian Reichel
2015-02-25 22:01   ` Pali Rohár

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