Skip to contentSkip to conversation

sysfs charge thresholds for ThinkPads (and possibly others), preparation for second try

DISCUSSION Julian Andres Klode 2 participants 4 messages Jul 7, 2015 – Jul 9, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi everyone (Thinkpad-ACPI, ACPI, and Power supply maintainers),

some might know that I presented a patch set adding support for charge thresholds to thinkpad_acpi about 1.5 years ago.

Back then, one of the major rejections was that the functionality for setting charge thresholds should be integrated into the power supply stack somehow. I did not know who to contact back then, but know I re-read MAINTAINERS and found all your addresses, so I give it a second try.

One issue with just integrating it in the current battery directories would be that ThinkPads are able to set charge thresholds for batteries that are currently not inserted.

Quoted 6 lines · Back then I

The next step is to integrate this properly with power supply and/or acpi battery. One way would be to add additional power supply properties and then add get/set_property() pointers to the acpi battery which it can fall back to if it does not support a requested property (and we would locate the ACPI battery and set those pointers to new thinkpad_acpi functions).

If you, the ACPI and power supply people, have any preferred way (or any idea at all how) to proceed, that would be useful, so I don't start working on it again, and then somebody does not like it.

Regards,

Julian

CCing [email protected] who keeps pushing me to follow up on this - thanks :)

Signature · 6 lines
Julian Andres Klode  - Debian Developer, Ubuntu Member

See http://wiki.debian.org/JulianAndresKlode and http://jak-linux.org/.

Be friendly, do not top-post, and follow RFC 1855 "Netiquette".
    - If you don't I might ignore you.
#1 lore raw

Hi,

Quoted 4 lines · Julian Andres Klode

Hi everyone (Thinkpad-ACPI, ACPI, and Power supply maintainers),

some might know that I presented a patch set adding support for charge thresholds to thinkpad_acpi about 1.5 years ago.

Can you provide a link to the patch set?

Quoted 9 lines

Back then, one of the major rejections was that the functionality for setting charge thresholds should be integrated into the power supply stack somehow. I did not know who to contact back then, but know I re-read MAINTAINERS and found all your addresses, so I give it a second try.

One issue with just integrating it in the current battery directories would be that ThinkPads are able to set charge thresholds for batteries that are currently not inserted.

So the power supply device should be kept with POWER_SUPPLY_PROP_PRESENT being disabled (and most properties returning -ENODATA). The ACPI SBS driver seems to implement POWER_SUPPLY_PROP_PRESENT, but I didn't test it.

Quoted 8 lines
Quoted 6 lines · Back then I

The next step is to integrate this properly with power supply and/or acpi battery. One way would be to add additional power supply properties and then add get/set_property() pointers to the acpi battery which it can fall back to if it does not support a requested property (and we would locate the ACPI battery and set those pointers to new thinkpad_acpi functions).

Quoted 4 lines

If you, the ACPI and power supply people, have any preferred way (or any idea at all how) to proceed, that would be useful, so I don't start working on it again, and then somebody does not like it.

Adding charging thresholds as power_supply_property sounds fine to me.

-- Sebastian

#2 lore raw
Quoted 9 lines · Sebastian Reichel

Hi,

Quoted 4 lines · Julian Andres Klode

Hi everyone (Thinkpad-ACPI, ACPI, and Power supply maintainers),

some might know that I presented a patch set adding support for charge thresholds to thinkpad_acpi about 1.5 years ago.

Can you provide a link to the patch set?

Sure:
http://thread.gmane.org/gmane.linux.acpi.ibm-acpi.devel/3175

(it was not on the ACPI and Power MLs back then)

Quoted 7 lines
Quoted 7 lines

Back then, one of the major rejections was that the functionality for setting charge thresholds should be integrated into the power supply stack somehow. I did not know who to contact back then, but know I re-read MAINTAINERS and found all your addresses, so I give it a second try.

Quoted 8 lines
Quoted 3 lines

One issue with just integrating it in the current battery directories would be that ThinkPads are able to set charge thresholds for batteries that are currently not inserted.

So the power supply device should be kept with POWER_SUPPLY_PROP_PRESENT being disabled (and most properties returning -ENODATA). The ACPI SBS driver seems to implement POWER_SUPPLY_PROP_PRESENT, but I didn't test it.

Yes, indeed.

Quoted 9 lines
Quoted 9 lines
Quoted 6 lines · Back then I

The next step is to integrate this properly with power supply and/or acpi battery. One way would be to add additional power supply properties and then add get/set_property() pointers to the acpi battery which it can fall back to if it does not support a requested property (and we would locate the ACPI battery and set those pointers to new thinkpad_acpi functions).

Quoted 8 lines
Quoted 4 lines

If you, the ACPI and power supply people, have any preferred way (or any idea at all how) to proceed, that would be useful, so I don't start working on it again, and then somebody does not like it.

Adding charging thresholds as power_supply_property sounds fine to me.

Right, it gets a bit more complicated though: Since the code is platform-specific, it should live in the platform driver, so a way is needed to extend the existing device with new properties from the platform driver.

Signature · 6 lines
Julian Andres Klode  - Debian Developer, Ubuntu Member

See http://wiki.debian.org/JulianAndresKlode and http://jak-linux.org/.

Be friendly, do not top-post, and follow RFC 1855 "Netiquette".
    - If you don't I might ignore you.
#3 lore raw

Hi,

Quoted 9 lines · Julian Andres Klode
Quoted 8 lines · Sebastian Reichel

Hi,

Quoted 4 lines · Julian Andres Klode

Hi everyone (Thinkpad-ACPI, ACPI, and Power supply maintainers),

some might know that I presented a patch set adding support for charge thresholds to thinkpad_acpi about 1.5 years ago.

Quoted 6 lines
Quoted 1 line

Can you provide a link to the patch set?

Sure:
http://thread.gmane.org/gmane.linux.acpi.ibm-acpi.devel/3175

(it was not on the ACPI and Power MLs back then)

Thanks.

Quoted 15 lines

[...]

Quoted 13 lines
Quoted 12 lines
Quoted 6 lines · Back then I

The next step is to integrate this properly with power supply and/or acpi battery. One way would be to add additional power supply properties and then add get/set_property() pointers to the acpi battery which it can fall back to if it does not support a requested property (and we would locate the ACPI battery and set those pointers to new thinkpad_acpi functions).

If you, the ACPI and power supply people, have any preferred way (or any idea at all how) to proceed, that would be useful, so I don't start working on it again, and then somebody does not like it.

Quoted 7 lines
Quoted 2 lines

Adding charging thresholds as power_supply_property sounds fine to me.

Right, it gets a bit more complicated though: Since the code is platform-specific, it should live in the platform driver, so a way is needed to extend the existing device with new properties from the platform driver.

Yes, my answer was only from the power supply subsystem's point of view, since I do not know much about the thinkpad-acpi and SBS driver. It seems the SBS driver has already minimal support for handling platform specifics via the acpi_sbs_dmi_table, though. I suggest to add a Thinkpad entry and modify the SBS driver, so that it calls your additional code.

It would be nice, if the Thinkpad specific code could also be used to add a label to the batteries, so that it's easier to distinguish batteries in case of multiple ones being available.

-- Sebastian