Hi,
On 9/20/20 8:04 PM, Andy Shevchenko wrote:
+Cc: PDx86 mailing list and co-maintainers
So unrelated to the original issue, but I assume that this
battery_care_limit is a threshold above which the
laptop will not start charging, i.e. if it is set to 80
as Alessandro is trying to do and the laptop is plugged
into the charger after being discharged to 90% then it will
NOT charge.
Assuming I have got this right, then now a days we have
a standard power_supply class sysfs attribute for this,
charge_start_threshold .
Or maybe I got it wrong and the battery_care_limit means
never charge above that value? Then the new standard
power_supply class sysfs attribute would be
charge_stop_threshold.
These attributes should be added to the existing
/sys/class/power_supply/BAT? entry which is registered
for the battery by the drivers/apci/battery.c driver.
Now normally it is not possible to add sysfs attributes
to a power-supply added by another driver, but recently
some work has been done to make this possible, for
pretty much the same reasons as why we want this in
the lg-laptop driver now.
Specifically the thinkpad_acpi driver uses this new
mechanism to register both a charge_start_threshold and
a charge_stop_threshold with the /sys/class/power_supply/BAT0
entry for the Thinkpad's battery.
There are some discussions/plans in the GNOME project to
add support for selecting battery charge profiles from the
GUI. But this will only work if the foo-laptop driver for the
laptop implements the new standard charge_start_threshold and
charge_stop_threshold sysfs attributes under
/sys/class/power_supply/BAT?
So if someone with access to a LG-gram laptop could make the
driver register these standard attributes that would be great.
See thinkpad_acpi for an example how to do this.
Regards,
Hans
On Sat, Sep 19, 2020 at 2:44 PM Alessandro Zarrilli
<alessandro@xxxxxxxxxxxx> wrote:
Note: I'm adding Andy in CC because I see he was the committer of the driver I'm going to talk about.
Hi Matan,
I see you are the maintainer of the Linux kernel LG Gram laptop driver (linux/drivers/platform/x86/lg-laptop.c).
I've just bought the LG Gram 2020 version (product code 17Z990). I'm running Kernel 5.4.0, but unfortunately it seems your driver is not working correctly on this laptop model.
Take for example "battery care limit", the feature I'm interested the most:
# cat /sys/devices/platform/lg-laptop/battery_care_limit
0
# echo 80 > /sys/devices/platform/lg-laptop/battery_care_limit
# cat /sys/devices/platform/lg-laptop/battery_care_limit
0
# echo 100 > /sys/devices/platform/lg-laptop/battery_care_limit
# cat /sys/devices/platform/lg-laptop/battery_care_limit
0
Is there any chance you could fix this? Can I help in any way? I'm not skilled in C programming (just used it a long time ago), but I'm an old time developer and Linux system administrator: if you give me some hints, maybe I could sort it out myself.
Thanks and regards
Alessandro