diff options
| -rw-r--r-- | drivers/acpi/battery.c | 24 |
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"); | |||
| 70 | MODULE_LICENSE("GPL"); | 71 | MODULE_LICENSE("GPL"); |
| 71 | 72 | ||
| 72 | static int battery_bix_broken_package; | 73 | static int battery_bix_broken_package; |
| 74 | static int battery_notification_delay_ms; | ||
| 73 | static unsigned int cache_time = 1000; | 75 | static unsigned int cache_time = 1000; |
| 74 | module_param(cache_time, uint, 0644); | 76 | module_param(cache_time, uint, 0644); |
| 75 | MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); | 77 | MODULE_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 | ||
| 1125 | static int battery_notification_delay_quirk(const struct dmi_system_id *d) | ||
| 1126 | { | ||
| 1127 | battery_notification_delay_ms = 1000; | ||
| 1128 | return 0; | ||
| 1129 | } | ||
| 1130 | |||
| 1115 | static struct dmi_system_id bat_dmi_table[] = { | 1131 | static 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 | ||
