battery: Add the ThinkPad "Not Charging" quirk
Subsystems (3)
PATCH v6 2/3 battery: Add the ThinkPad "Not Charging" quirk
The EC/ACPI firmware on Lenovo ThinkPads used to report a status of "Unknown" when the battery is between the charge start and charge stop thresholds. On Windows, it reports "Not Charging" so the quirk has been added to also report correctly.
Now the "status" attribute returns "Not Charging" when the battery on ThinkPads is not physicaly charging.
--- drivers/acpi/battery.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
drivers/acpi/battery.c +23 -0
@@ -71,6 +71,7 @@ static async_cookie_t async_cookie;static bool battery_driver_registered;static int battery_bix_broken_package;static int battery_notification_delay_ms; +static int battery_quirk_thinkpad_notcharging;static unsigned int cache_time =1000 ;module_param (cache_time, uint,0644 );MODULE_PARM_DESC (cache_time,"cache time in milliseconds" );
@@ -222,6 +223,13 @@ static int acpi_battery_get_property(struct power_supply *psy, val->intval =POWER_SUPPLY_STATUS_CHARGING ; else if (acpi_battery_is_charged(battery)) val->intval = POWER_SUPPLY_STATUS_FULL; +/* +* On the Lenovo ThinkPad ACPI implementation, when +* neither bits 0 or 1 are set, that state is +* considered as "Not Charging". +*/ + else if (battery_quirk_thinkpad_notcharging) + val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING; else val->intval = POWER_SUPPLY_STATUS_UNKNOWN; break;
@@ -1301,6 +1309,13 @@ battery_notification_delay_quirk(const struct dmi_system_id *d)return 0 ; } +static int __init +battery_quirk_not_charging (const struct dmi_system_id *d) +{ + battery_quirk_thinkpad_notcharging =1 ; +return 0 ; +} +static const struct dmi_system_id bat_dmi_table[]__initconst = { { .callback = battery_bix_broken_package_quirk,
@@ -1318,6 +1333,14 @@ static const struct dmi_system_id bat_dmi_table[] __initconst = { DMI_MATCH(DMI_PRODUCT_NAME, "Aspire V5-573G"), }, }, + { + .callback = battery_quirk_not_charging, + .ident = "Lenovo ThinkPad", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad"), + }, + }, {}, };
Signature · 1 line
2.7.4
Rafael J. Wysocki
Quoted 11 lines · Ognjen Galic
The EC/ACPI firmware on Lenovo ThinkPads used to report a status of "Unknown" when the battery is between the charge start and charge stop thresholds. On Windows, it reports "Not Charging" so the quirk has been added to also report correctly.
Now the "status" attribute returns "Not Charging" when the battery on ThinkPads is not physicaly charging.
Tested-by Kevin Locke <kevin(a)kevinlocke.name>Tested-by Christoph Böhmwalder <christoph(a)boehmwalder.at>Signed-off-by Ognjen Galic <smclt30p(a)gmail.com>
It doesn't look like this is related to the [1/3] and [3/3], so why do you make it part of the series?
drivers/acpi/battery.c static async_cookie_t async_cookie; · line 74
Quoted 13 lines
--- drivers/acpi/battery.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)drivers/acpi/battery.c +1
-0@@ -71,6 +71,7 @@ static async_cookie_t async_cookie;static bool battery_driver_registered;static int battery_bix_broken_package;static int battery_notification_delay_ms; +static int battery_quirk_thinkpad_notcharging;
Drop "thinkpad" from this name as somebody may need to use the quirk for a machine from a different vendor in the future.
Quoted 18 lines
drivers/acpi/battery.c +7
-0static unsigned int cache_time =1000 ;module_param (cache_time, uint,0644 );MODULE_PARM_DESC (cache_time,"cache time in milliseconds" );@@ -222,6 +223,13 @@ static int acpi_battery_get_property(struct power_supply *psy, val->intval =POWER_SUPPLY_STATUS_CHARGING ; else if (acpi_battery_is_charged(battery)) val->intval = POWER_SUPPLY_STATUS_FULL; +/* +* On the Lenovo ThinkPad ACPI implementation, when +* neither bits 0 or 1 are set, that state is +* considered as "Not Charging". +*/ + else if (battery_quirk_thinkpad_notcharging) + val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING; else val->intval = POWER_SUPPLY_STATUS_UNKNOWN; break;
drivers/acpi/battery.c battery_notification_delay_quirk(const struct dmi_system_id *d) · line 1313
Quoted 5 lines
drivers/acpi/battery.c +2
-0@@ -1301,6 +1309,13 @@ battery_notification_delay_quirk(const struct dmi_system_id *d)return 0 ; } +static int __init +battery_quirk_not_charging (const struct dmi_system_id *d)
Don't break the above line (it will be over 80 chars long, but that's fine).
drivers/acpi/battery.c static const struct dmi_system_id bat_dmi_table[] __initconst = { · line 1336
Quoted 13 lines
drivers/acpi/battery.c +6
-0+{ + battery_quirk_thinkpad_notcharging =1 ; +return 0 ; +} +static const struct dmi_system_id bat_dmi_table[]__initconst = { { .callback = battery_bix_broken_package_quirk,@@ -1318,6 +1333,14 @@ static const struct dmi_system_id bat_dmi_table[] __initconst = { DMI_MATCH(DMI_PRODUCT_NAME, "Aspire V5-573G"), }, }, + {
Add a comment to describe this quirk (which it is needed in the first place).
drivers/acpi/battery.c static const struct dmi_system_id bat_dmi_table[] __initconst = {
Quoted 11 lines
drivers/acpi/battery.c +7
-1+ .callback = battery_quirk_not_charging, + .ident = "Lenovo ThinkPad", + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad"), + }, + }, {}, }; --
Thanks,
Rafael
Rafael J. Wysocki
Quoted 59 lines · Rafael J. Wysocki
Quoted 11 lines · Ognjen Galic
The EC/ACPI firmware on Lenovo ThinkPads used to report a status of "Unknown" when the battery is between the charge start and charge stop thresholds. On Windows, it reports "Not Charging" so the quirk has been added to also report correctly.
Now the "status" attribute returns "Not Charging" when the battery on ThinkPads is not physicaly charging.
Tested-by Kevin Locke <kevin(a)kevinlocke.name>Tested-by Christoph Böhmwalder <christoph(a)boehmwalder.at>Signed-off-by Ognjen Galic <smclt30p(a)gmail.com>It doesn't look like this is related to the [1/3] and [3/3], so why do you make it part of the series?
drivers/acpi/battery.c static async_cookie_t async_cookie; · line 74
Quoted 13 lines
--- drivers/acpi/battery.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)drivers/acpi/battery.c +1
-0@@ -71,6 +71,7 @@ static async_cookie_t async_cookie;static bool battery_driver_registered;static int battery_bix_broken_package;static int battery_notification_delay_ms; +static int battery_quirk_thinkpad_notcharging;Drop "thinkpad" from this name as somebody may need to use the quirk for a machine from a different vendor in the future.
Quoted 18 lines
drivers/acpi/battery.c +7
-0static unsigned int cache_time =1000 ;module_param (cache_time, uint,0644 );MODULE_PARM_DESC (cache_time,"cache time in milliseconds" );@@ -222,6 +223,13 @@ static int acpi_battery_get_property(struct power_supply *psy, val->intval =POWER_SUPPLY_STATUS_CHARGING ; else if (acpi_battery_is_charged(battery)) val->intval = POWER_SUPPLY_STATUS_FULL; +/* +* On the Lenovo ThinkPad ACPI implementation, when +* neither bits 0 or 1 are set, that state is +* considered as "Not Charging". +*/ + else if (battery_quirk_thinkpad_notcharging) + val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING; else val->intval = POWER_SUPPLY_STATUS_UNKNOWN; break;drivers/acpi/battery.c battery_notification_delay_quirk(const struct dmi_system_id *d) · line 1313
Quoted 5 lines
drivers/acpi/battery.c +2
-0@@ -1301,6 +1309,13 @@ battery_notification_delay_quirk(const struct dmi_system_id *d)return 0 ; } +static int __init +battery_quirk_not_charging (const struct dmi_system_id *d)Don't break the above line (it will be over 80 chars long, but that's fine).
Quoted 15 lines
drivers/acpi/battery.c static const struct dmi_system_id bat_dmi_table[] __initconst = { · line 1336
Quoted 13 lines
drivers/acpi/battery.c +6
-0+{ + battery_quirk_thinkpad_notcharging =1 ; +return 0 ; +} +static const struct dmi_system_id bat_dmi_table[]__initconst = { { .callback = battery_bix_broken_package_quirk,@@ -1318,6 +1333,14 @@ static const struct dmi_system_id bat_dmi_table[] __initconst = { DMI_MATCH(DMI_PRODUCT_NAME, "Aspire V5-573G"), }, }, + {Add a comment to describe this quirk (which it is needed in the first place).
s/whichj/why/
Quoted 12 lines
Quoted 12 lines
drivers/acpi/battery.c +7
-1+ .callback = battery_quirk_not_charging, + .ident = "Lenovo ThinkPad", + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad"), + }, + }, {}, }; --
Quoted 9 lines · Rafael J. Wysocki
Quoted 8 lines · Ognjen Galic
The EC/ACPI firmware on Lenovo ThinkPads used to report a status of "Unknown" when the battery is between the charge start and charge stop thresholds. On Windows, it reports "Not Charging" so the quirk has been added to also report correctly.
Now the "status" attribute returns "Not Charging" when the battery on ThinkPads is not physicaly charging.
Quoted 7 lines
Quoted 3 lines
Tested-by Kevin Locke <[email protected]>Tested-by Christoph Böhmwalder <[email protected]>Signed-off-by Ognjen Galic <[email protected]>It doesn't look like this is related to the [1/3] and [3/3], so why do you make it part of the series?
I made it the same series because it is practically the same feature set. Without this patch and with 1/3 and 3/3 applied, there is a bug where the status attribute would show "Unknown" for a battery that is between the start and stop thresholds while attached to AC.
Quoted 73 lines
drivers/acpi/battery.c static async_cookie_t async_cookie; · line 74
Quoted 13 lines
--- drivers/acpi/battery.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)drivers/acpi/battery.c +1
-0@@ -71,6 +71,7 @@ static async_cookie_t async_cookie;static bool battery_driver_registered;static int battery_bix_broken_package;static int battery_notification_delay_ms; +static int battery_quirk_thinkpad_notcharging;Drop "thinkpad" from this name as somebody may need to use the quirk for a machine from a different vendor in the future.
Quoted 18 lines
drivers/acpi/battery.c +7
-0static unsigned int cache_time =1000 ;module_param (cache_time, uint,0644 );MODULE_PARM_DESC (cache_time,"cache time in milliseconds" );@@ -222,6 +223,13 @@ static int acpi_battery_get_property(struct power_supply *psy, val->intval =POWER_SUPPLY_STATUS_CHARGING ; else if (acpi_battery_is_charged(battery)) val->intval = POWER_SUPPLY_STATUS_FULL; +/* +* On the Lenovo ThinkPad ACPI implementation, when +* neither bits 0 or 1 are set, that state is +* considered as "Not Charging". +*/ + else if (battery_quirk_thinkpad_notcharging) + val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING; else val->intval = POWER_SUPPLY_STATUS_UNKNOWN; break;drivers/acpi/battery.c battery_notification_delay_quirk(const struct dmi_system_id *d) · line 1313
Quoted 5 lines
drivers/acpi/battery.c +2
-0@@ -1301,6 +1309,13 @@ battery_notification_delay_quirk(const struct dmi_system_id *d)return 0 ; } +static int __init +battery_quirk_not_charging (const struct dmi_system_id *d)Don't break the above line (it will be over 80 chars long, but that's fine).
drivers/acpi/battery.c static const struct dmi_system_id bat_dmi_table[] __initconst = { · line 1336
Quoted 13 lines
drivers/acpi/battery.c +6
-0+{ + battery_quirk_thinkpad_notcharging =1 ; +return 0 ; +} +static const struct dmi_system_id bat_dmi_table[]__initconst = { { .callback = battery_bix_broken_package_quirk,@@ -1318,6 +1333,14 @@ static const struct dmi_system_id bat_dmi_table[] __initconst = { DMI_MATCH(DMI_PRODUCT_NAME, "Aspire V5-573G"), }, }, + {Add a comment to describe this quirk (which it is needed in the first place).
drivers/acpi/battery.c static const struct dmi_system_id bat_dmi_table[] __initconst = {
Quoted 11 lines
drivers/acpi/battery.c +7
-1+ .callback = battery_quirk_not_charging, + .ident = "Lenovo ThinkPad", + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad"), + }, + }, {}, }; --Thanks,
Rafael
Rafael J. Wysocki
Quoted 14 lines · Ognjen Galic
Quoted 13 lines · Rafael J. Wysocki
Quoted 11 lines · Ognjen Galic
The EC/ACPI firmware on Lenovo ThinkPads used to report a status of "Unknown" when the battery is between the charge start and charge stop thresholds. On Windows, it reports "Not Charging" so the quirk has been added to also report correctly.
Now the "status" attribute returns "Not Charging" when the battery on ThinkPads is not physicaly charging.
Tested-by Kevin Locke <kevin(a)kevinlocke.name>Tested-by Christoph Böhmwalder <christoph(a)boehmwalder.at>Signed-off-by Ognjen Galic <smclt30p(a)gmail.com>
Quoted 8 lines
Quoted 3 lines
It doesn't look like this is related to the [1/3] and [3/3], so why do you make it part of the series?
I made it the same series because it is practically the same feature set. Without this patch and with 1/3 and 3/3 applied, there is a bug where the status attribute would show "Unknown" for a battery that is between the start and stop thresholds while attached to AC.
OK, fair enough.
I would reorder it as the first patch in the series, then, because the other two are more related to each other.
Thanks,
Rafael
Quoted 25 lines · Rafael J. Wysocki
Quoted 15 lines · Ognjen Galic
Quoted 14 lines · Rafael J. Wysocki
Quoted 11 lines · Ognjen Galic
The EC/ACPI firmware on Lenovo ThinkPads used to report a status of "Unknown" when the battery is between the charge start and charge stop thresholds. On Windows, it reports "Not Charging" so the quirk has been added to also report correctly.
Now the "status" attribute returns "Not Charging" when the battery on ThinkPads is not physicaly charging.
Tested-by Kevin Locke <[email protected]>Tested-by Christoph Böhmwalder <[email protected]>Signed-off-by Ognjen Galic <[email protected]>Quoted 8 lines
Quoted 3 lines
It doesn't look like this is related to the [1/3] and [3/3], so why do you make it part of the series?
I made it the same series because it is practically the same feature set. Without this patch and with 1/3 and 3/3 applied, there is a bug where the status attribute would show "Unknown" for a battery that is between the start and stop thresholds while attached to AC.
Quoted 8 lines
OK, fair enough.
I would reorder it as the first patch in the series, then, because the other two are more related to each other.
Thanks,
Rafael
Do I really need now to re-order and re-send the whole patchset for it to get merged?
Thanks.
Andy Shevchenko
Quoted 7 lines · Ognjen Galić
Quoted 2 lines · Rafael J. Wysocki
I would reorder it as the first patch in the series, then, because the other two are more related to each other.
Do I really need now to re-order and re-send the whole patchset for it to get merged?
Through which tree it's supposed to go?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 6 lines · Andy Shevchenko
Quoted 4 lines · Ognjen Galić
Quoted 2 lines · Rafael J. Wysocki
I would reorder it as the first patch in the series, then, because the other two are more related to each other.
Quoted 9 lines
Quoted 2 lines
Do I really need now to re-order and re-send the whole patchset for it to get merged?
Through which tree it's supposed to go?
--
With Best Regards,
Andy Shevchenko
I'm afraid I don't understand the question. If you mean by Linux tree, it was written while 4.15-rc2 was active.
Thanks,
Gala
Rafael J. Wysocki
Quoted 10 lines · Andy Shevchenko
Quoted 7 lines · Ognjen Galić
Quoted 2 lines · Rafael J. Wysocki
I would reorder it as the first patch in the series, then, because the other two are more related to each other.
Do I really need now to re-order and re-send the whole patchset for it to get merged?
Through which tree it's supposed to go?
Wait, wait. I haven't commented patches [1,3/3] yet, so no ACKs assumed, please.
Thanks,
Rafael
Andy Shevchenko
Quoted 8 lines · Rafael J. Wysocki
Quoted 6 lines · Andy Shevchenko
Quoted 4 lines · Ognjen Galić
Quoted 2 lines · Rafael J. Wysocki
I would reorder it as the first patch in the series, then, because the other two are more related to each other.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Do I really need now to re-order and re-send the whole patchset for it to get merged?
Through which tree it's supposed to go?
Wait, wait. I haven't commented patches [1,3/3] yet, so no ACKs assumed, please.
I would prefer if you can take it through linux-pm.
Whenever you are okay with the series let me know I would review PDx86 bits.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Rafael J. Wysocki
Quoted 12 lines · Andy Shevchenko
Quoted 11 lines · Rafael J. Wysocki
Quoted 9 lines · Andy Shevchenko
Quoted 7 lines · Ognjen Galić
Quoted 2 lines · Rafael J. Wysocki
I would reorder it as the first patch in the series, then, because the other two are more related to each other.
Do I really need now to re-order and re-send the whole patchset for it to get merged?
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Through which tree it's supposed to go?
Wait, wait. I haven't commented patches [1,3/3] yet, so no ACKs assumed, please.
I would prefer if you can take it through linux-pm.
No problem.
Quoted 1 line
Whenever you are okay with the series let me know I would review PDx86 bits.
OK
Thanks,
Rafael
Rafael J. Wysocki
Quoted 31 lines · Ognjen Galić
Quoted 30 lines · Rafael J. Wysocki
Quoted 15 lines · Ognjen Galic
Quoted 14 lines · Rafael J. Wysocki
Quoted 11 lines · Ognjen Galic
The EC/ACPI firmware on Lenovo ThinkPads used to report a status of "Unknown" when the battery is between the charge start and charge stop thresholds. On Windows, it reports "Not Charging" so the quirk has been added to also report correctly.
Now the "status" attribute returns "Not Charging" when the battery on ThinkPads is not physicaly charging.
Tested-by Kevin Locke <kevin(a)kevinlocke.name>Tested-by Christoph Böhmwalder <christoph(a)boehmwalder.at>Signed-off-by Ognjen Galic <smclt30p(a)gmail.com>Quoted 8 lines
Quoted 3 lines
It doesn't look like this is related to the [1/3] and [3/3], so why do you make it part of the series?
I made it the same series because it is practically the same feature set. Without this patch and with 1/3 and 3/3 applied, there is a bug where the status attribute would show "Unknown" for a battery that is between the start and stop thresholds while attached to AC.
OK, fair enough.
I would reorder it as the first patch in the series, then, because the other two are more related to each other.
Quoted 6 lines
Quoted 3 lines
Thanks,
RafaelDo I really need now to re-order and re-send the whole patchset for it to get merged?
I'm not sure I will take anything of it at this time.
Thanks,
Rafael