Commit a90b4038 authored by Lan Tianyu's avatar Lan Tianyu Committed by Rafael J. Wysocki

ACPI / Battery: Add a _BIX quirk for NEC LZ750/LS

The AML method _BIX of NEC LZ750/LS returns a broken package which
skips the first member "Revision" (ACPI 5.0, Table 10-234).

Add a quirk for this machine to skip member "Revision" during parsing
the package returned by _BIX.

Reference: https://bugzilla.kernel.org/show_bug.cgi?id=67351Reported-and-tested-by: default avatarFrancisco Castro <fcr@adinet.com.uy>
Cc: 3.8+ <stable@vger.kernel.org> " 3.8+
Signed-off-by: default avatarLan Tianyu <tianyu.lan@intel.com>
Reviewed-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent d6e0a2dd
...@@ -62,6 +62,7 @@ MODULE_AUTHOR("Alexey Starikovskiy <astarikovskiy@suse.de>"); ...@@ -62,6 +62,7 @@ MODULE_AUTHOR("Alexey Starikovskiy <astarikovskiy@suse.de>");
MODULE_DESCRIPTION("ACPI Battery Driver"); MODULE_DESCRIPTION("ACPI Battery Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
static int battery_bix_broken_package;
static unsigned int cache_time = 1000; static unsigned int cache_time = 1000;
module_param(cache_time, uint, 0644); module_param(cache_time, uint, 0644);
MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); MODULE_PARM_DESC(cache_time, "cache time in milliseconds");
...@@ -416,7 +417,12 @@ static int acpi_battery_get_info(struct acpi_battery *battery) ...@@ -416,7 +417,12 @@ static int acpi_battery_get_info(struct acpi_battery *battery)
ACPI_EXCEPTION((AE_INFO, status, "Evaluating %s", name)); ACPI_EXCEPTION((AE_INFO, status, "Evaluating %s", name));
return -ENODEV; return -ENODEV;
} }
if (test_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags))
if (battery_bix_broken_package)
result = extract_package(battery, buffer.pointer,
extended_info_offsets + 1,
ARRAY_SIZE(extended_info_offsets) - 1);
else if (test_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags))
result = extract_package(battery, buffer.pointer, result = extract_package(battery, buffer.pointer,
extended_info_offsets, extended_info_offsets,
ARRAY_SIZE(extended_info_offsets)); ARRAY_SIZE(extended_info_offsets));
...@@ -754,6 +760,17 @@ static int battery_notify(struct notifier_block *nb, ...@@ -754,6 +760,17 @@ static int battery_notify(struct notifier_block *nb,
return 0; return 0;
} }
static struct dmi_system_id bat_dmi_table[] = {
{
.ident = "NEC LZ750/LS",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "NEC"),
DMI_MATCH(DMI_PRODUCT_NAME, "PC-LZ750LS"),
},
},
{},
};
static int acpi_battery_add(struct acpi_device *device) static int acpi_battery_add(struct acpi_device *device)
{ {
int result = 0; int result = 0;
...@@ -846,6 +863,9 @@ static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie) ...@@ -846,6 +863,9 @@ static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie)
{ {
if (acpi_disabled) if (acpi_disabled)
return; return;
if (dmi_check_system(bat_dmi_table))
battery_bix_broken_package = 1;
acpi_bus_register_driver(&acpi_battery_driver); acpi_bus_register_driver(&acpi_battery_driver);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment