aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2018-04-12 06:02:00 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2018-05-02 07:06:59 -0400
commit1b799c5cf031c2b615f4b21150eafde3ff227788 (patch)
treea05bbb287f63deaffabd8e9265c2352d8fd01e42
parent19fffc8450d4378580a8f019b195c4617083176f (diff)
ACPI / battery: Ignore AC state in handle_discharging on systems where it is broken
On some devices the "AC" interface ACPI AML code uses the exact same broken logic which is causing the battery code to wrongly report discharging to determine the "AC" state. Specifically the ACPI AML code is checking the charging status bits of the charger-IC rather then the vbus present or power-good status bits. This makes our workaround for devices which wrongly report discharging when plugged into AC while the charge is above the start charging threshold not work on these devices. This commit adds a battery_ac_is_broken flag and when that is set it skips the power_supply_is_system_supplied() check in the workaround fixing this. This flag gets set by a DMI quirk selected by systems where we know the AC AML code is broken in this way *and* the rate_now value can be trusted. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/acpi/battery.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index bd36cb5c3fe1..c63b6a14ad95 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -74,6 +74,7 @@ static async_cookie_t async_cookie;
74static bool battery_driver_registered; 74static bool battery_driver_registered;
75static int battery_bix_broken_package; 75static int battery_bix_broken_package;
76static int battery_notification_delay_ms; 76static int battery_notification_delay_ms;
77static int battery_ac_is_broken;
77static unsigned int cache_time = 1000; 78static unsigned int cache_time = 1000;
78module_param(cache_time, uint, 0644); 79module_param(cache_time, uint, 0644);
79MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); 80MODULE_PARM_DESC(cache_time, "cache time in milliseconds");
@@ -222,7 +223,8 @@ static int acpi_battery_handle_discharging(struct acpi_battery *battery)
222 * was above the device's start charging threshold atm the AC adapter 223 * was above the device's start charging threshold atm the AC adapter
223 * was plugged in and the device thus did not start a new charge cycle. 224 * was plugged in and the device thus did not start a new charge cycle.
224 */ 225 */
225 if (power_supply_is_system_supplied() && battery->rate_now == 0) 226 if ((battery_ac_is_broken || power_supply_is_system_supplied()) &&
227 battery->rate_now == 0)
226 return POWER_SUPPLY_STATUS_NOT_CHARGING; 228 return POWER_SUPPLY_STATUS_NOT_CHARGING;
227 229
228 return POWER_SUPPLY_STATUS_DISCHARGING; 230 return POWER_SUPPLY_STATUS_DISCHARGING;
@@ -1345,6 +1347,13 @@ battery_notification_delay_quirk(const struct dmi_system_id *d)
1345 return 0; 1347 return 0;
1346} 1348}
1347 1349
1350static int __init
1351battery_ac_is_broken_quirk(const struct dmi_system_id *d)
1352{
1353 battery_ac_is_broken = 1;
1354 return 0;
1355}
1356
1348static const struct dmi_system_id bat_dmi_table[] __initconst = { 1357static const struct dmi_system_id bat_dmi_table[] __initconst = {
1349 { 1358 {
1350 /* NEC LZ750/LS */ 1359 /* NEC LZ750/LS */
@@ -1362,6 +1371,17 @@ static const struct dmi_system_id bat_dmi_table[] __initconst = {
1362 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire V5-573G"), 1371 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire V5-573G"),
1363 }, 1372 },
1364 }, 1373 },
1374 {
1375 /* Point of View mobii wintab p800w */
1376 .callback = battery_ac_is_broken_quirk,
1377 .matches = {
1378 DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
1379 DMI_MATCH(DMI_BOARD_NAME, "Aptio CRB"),
1380 DMI_MATCH(DMI_BIOS_VERSION, "3BAIR1013"),
1381 /* Above matches are too generic, add bios-date match */
1382 DMI_MATCH(DMI_BIOS_DATE, "08/22/2014"),
1383 },
1384 },
1365 {}, 1385 {},
1366}; 1386};
1367 1387