aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/battery.c
diff options
context:
space:
mode:
authorAlexander Mezin <mezin.alexander@gmail.com>2014-06-03 15:01:23 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-06-17 07:57:50 -0400
commitf43691c61d6e547809bff33394ac83cc263960e4 (patch)
tree4ed25bdc02bfb67704f7484e6518a70558e03c25 /drivers/acpi/battery.c
parent3f5dc08f5682bba2b9054ee8995e0d84fc14daad (diff)
ACPI / battery: add quirk for Acer Aspire V5-573G
On Acer Aspire V5-573G battery notifications are sometimes triggered too early. For example, when AC is unplugged and notification is triggered, battery state is still reported as "Full", and changes to "Discharging" only after short delay, without any notification. This patch solves the problem by adding 1 second sleep. Similar quirk is already implemented in AC driver for other laptop. Signed-off-by: Alexander Mezin <mezin.alexander@gmail.com> Acked-by: Lan Tianyu <tianyu.lan@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/battery.c')
-rw-r--r--drivers/acpi/battery.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 9530f4478ae2..1ce197f499f1 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -32,6 +32,7 @@
32#include <linux/jiffies.h> 32#include <linux/jiffies.h>
33#include <linux/async.h> 33#include <linux/async.h>
34#include <linux/dmi.h> 34#include <linux/dmi.h>
35#include <linux/delay.h>
35#include <linux/slab.h> 36#include <linux/slab.h>
36#include <linux/suspend.h> 37#include <linux/suspend.h>
37#include <asm/unaligned.h> 38#include <asm/unaligned.h>
@@ -70,6 +71,7 @@ MODULE_DESCRIPTION("ACPI Battery Driver");
70MODULE_LICENSE("GPL"); 71MODULE_LICENSE("GPL");
71 72
72static int battery_bix_broken_package; 73static int battery_bix_broken_package;
74static int battery_notification_delay_ms;
73static unsigned int cache_time = 1000; 75static unsigned int cache_time = 1000;
74module_param(cache_time, uint, 0644); 76module_param(cache_time, uint, 0644);
75MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); 77MODULE_PARM_DESC(cache_time, "cache time in milliseconds");
@@ -1062,6 +1064,14 @@ static void acpi_battery_notify(struct acpi_device *device, u32 event)
1062 if (!battery) 1064 if (!battery)
1063 return; 1065 return;
1064 old = battery->bat.dev; 1066 old = battery->bat.dev;
1067 /*
1068 * On Acer Aspire V5-573G notifications are sometimes triggered too
1069 * early. For example, when AC is unplugged and notification is
1070 * triggered, battery state is still reported as "Full", and changes to
1071 * "Discharging" only after short delay, without any notification.
1072 */
1073 if (battery_notification_delay_ms > 0)
1074 msleep(battery_notification_delay_ms);
1065 if (event == ACPI_BATTERY_NOTIFY_INFO) 1075 if (event == ACPI_BATTERY_NOTIFY_INFO)
1066 acpi_battery_refresh(battery); 1076 acpi_battery_refresh(battery);
1067 acpi_battery_update(battery, false); 1077 acpi_battery_update(battery, false);
@@ -1112,6 +1122,12 @@ static int battery_bix_broken_package_quirk(const struct dmi_system_id *d)
1112 return 0; 1122 return 0;
1113} 1123}
1114 1124
1125static int battery_notification_delay_quirk(const struct dmi_system_id *d)
1126{
1127 battery_notification_delay_ms = 1000;
1128 return 0;
1129}
1130
1115static struct dmi_system_id bat_dmi_table[] = { 1131static struct dmi_system_id bat_dmi_table[] = {
1116 { 1132 {
1117 .callback = battery_bix_broken_package_quirk, 1133 .callback = battery_bix_broken_package_quirk,
@@ -1121,6 +1137,14 @@ static struct dmi_system_id bat_dmi_table[] = {
1121 DMI_MATCH(DMI_PRODUCT_NAME, "PC-LZ750LS"), 1137 DMI_MATCH(DMI_PRODUCT_NAME, "PC-LZ750LS"),
1122 }, 1138 },
1123 }, 1139 },
1140 {
1141 .callback = battery_notification_delay_quirk,
1142 .ident = "Acer Aspire V5-573G",
1143 .matches = {
1144 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
1145 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire V5-573G"),
1146 },
1147 },
1124 {}, 1148 {},
1125}; 1149};
1126 1150