]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Merge branches 'acpi-general', 'acpi-processor', 'acpi-lpss' and 'acpi-battery'
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 19 Jun 2014 12:40:48 +0000 (14:40 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 19 Jun 2014 12:40:48 +0000 (14:40 +0200)
* acpi-general:
  ACPI: use kstrto*() instead of simple_strto*()

* acpi-processor:
  ACPI / processor replace __attribute__((packed)) by __packed

* acpi-lpss:
  ACPI / LPSS: Take I2C host controllers out of reset

* acpi-battery:
  ACPI / battery: add quirk for Acer Aspire V5-573G
  ACPI / battery: use callback for setting up quirks

1  2  3  4  5 
drivers/acpi/battery.c

diff --combined drivers/acpi/battery.c
index e48fc98e71c48379694bbbd76119dd1c222660ac,5963e6f0a1ed1cbae53f3852e7129173ad421bf6,e48fc98e71c48379694bbbd76119dd1c222660ac,e48fc98e71c48379694bbbd76119dd1c222660ac,1ce197f499f1cfa0a1bd38596880f057842ee194..0d7116f34b95aa32f0e2ef044205cdf28df107fe
     #include <linux/jiffies.h>
     #include <linux/async.h>
     #include <linux/dmi.h>
++++ #include <linux/delay.h>
     #include <linux/slab.h>
     #include <linux/suspend.h>
     #include <asm/unaligned.h>
@@@@@@ -70,6 -70,6 -70,6 -70,6 -71,7 +71,7 @@@@@@ MODULE_DESCRIPTION("ACPI Battery Driver
     MODULE_LICENSE("GPL");
     
     static int battery_bix_broken_package;
++++ static int battery_notification_delay_ms;
     static unsigned int cache_time = 1000;
     module_param(cache_time, uint, 0644);
     MODULE_PARM_DESC(cache_time, "cache time in milliseconds");
@@@@@@ -930,7 -930,10 -930,7 -930,7 -932,7 +932,10 @@@@@@ static ssize_t acpi_battery_write_alarm
                goto end;
        }
        alarm_string[count] = '\0';
- ---   battery->alarm = simple_strtol(alarm_string, NULL, 0);
+ +++   if (kstrtoint(alarm_string, 0, &battery->alarm)) {
+ +++           result = -EINVAL;
+ +++           goto end;
+ +++   }
        result = acpi_battery_set_alarm(battery);
           end:
        if (!result)
@@@@@@ -1062,6 -1065,6 -1062,6 -1062,6 -1064,14 +1067,14 @@@@@@ static void acpi_battery_notify(struct 
        if (!battery)
                return;
        old = battery->bat.dev;
++++    /*
++++    * On Acer Aspire V5-573G 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.
++++    */
++++    if (battery_notification_delay_ms > 0)
++++            msleep(battery_notification_delay_ms);
        if (event == ACPI_BATTERY_NOTIFY_INFO)
                acpi_battery_refresh(battery);
        acpi_battery_update(battery, false);
@@@@@@ -1106,14 -1109,14 -1106,14 -1106,14 -1116,35 +1119,35 @@@@@@ static int battery_notify(struct notifi
        return 0;
     }
     
++++ static int battery_bix_broken_package_quirk(const struct dmi_system_id *d)
++++ {
++++    battery_bix_broken_package = 1;
++++    return 0;
++++ }
++++ 
++++ static int battery_notification_delay_quirk(const struct dmi_system_id *d)
++++ {
++++    battery_notification_delay_ms = 1000;
++++    return 0;
++++ }
++++ 
     static struct dmi_system_id bat_dmi_table[] = {
        {
++++            .callback = battery_bix_broken_package_quirk,
                .ident = "NEC LZ750/LS",
                .matches = {
                        DMI_MATCH(DMI_SYS_VENDOR, "NEC"),
                        DMI_MATCH(DMI_PRODUCT_NAME, "PC-LZ750LS"),
                },
        },
++++    {
++++            .callback = battery_notification_delay_quirk,
++++            .ident = "Acer Aspire V5-573G",
++++            .matches = {
++++                    DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
++++                    DMI_MATCH(DMI_PRODUCT_NAME, "Aspire V5-573G"),
++++            },
++++    },
        {},
     };
     
@@@@@@ -1227,8 -1230,8 -1227,8 -1227,8 -1258,7 +1261,7 @@@@@@ static void __init acpi_battery_init_as
        if (acpi_disabled)
                return;
     
----    if (dmi_check_system(bat_dmi_table))
----            battery_bix_broken_package = 1;
++++    dmi_check_system(bat_dmi_table);
        
     #ifdef CONFIG_ACPI_PROCFS_POWER
        acpi_battery_dir = acpi_lock_battery_dir();