]> Git Repo - linux.git/commitdiff
Merge tag 'acpi-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael...
authorLinus Torvalds <[email protected]>
Tue, 5 Jun 2018 17:08:27 +0000 (10:08 -0700)
committerLinus Torvalds <[email protected]>
Tue, 5 Jun 2018 17:08:27 +0000 (10:08 -0700)
Pull ACPI updates from Rafael Wysocki:
 "These update the ACPICA code in the kernel to the 20180508 upstream
  revision and make it support the RT patch, add CPPC v3 support to the
  ACPI CPPC library, add a WDAT-based watchdog quirk to prevent clashes
  with the RTC, add quirks to the ACPI AC and battery drivers, and
  update the ACPI SoC drivers.

  Specifics:

   - Update the ACPICA code in the kernel to the 20180508 upstream
     revision including:
       * iASL -tc option enhancement (Bob Moore).
       * Debugger improvements (Bob Moore).
       * Support for tables larger than 1 MB in acpidump/acpixtract (Bob
         Moore).
       * Minor fixes and cleanups (Colin Ian King, Toomas Soome).

   - Make the ACPICA code in the kernel support the RT patch (Sebastian
     Andrzej Siewior, Steven Rostedt).

   - Add a kmemleak annotation to the ACPICA code (Larry Finger).

   - Add CPPC v3 support to the ACPI CPPC library and fix two issues
     related to CPPC (Prashanth Prakash, Al Stone).

   - Add an ACPI WDAT-based watchdog quirk to prefer iTCO_wdt on systems
     where WDAT clashes with the RTC SRAM (Mika Westerberg).

   - Add some quirks to the ACPI AC and battery drivers (Carlo Caione,
     Hans de Goede).

   - Update the ACPI SoC drivers for Intel (LPSS) and AMD (APD)
     platforms (Akshu Agrawal, Hans de Goede).

   - Fix up some assorted minor issues (Al Stone, Laszlo Toth, Mathieu
     Malaterre)"

* tag 'acpi-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (32 commits)
  ACPICA: Mark acpi_ut_create_internal_object_dbg() memory allocations as non-leaks
  ACPI / watchdog: Prefer iTCO_wdt always when WDAT table uses RTC SRAM
  mailbox: PCC: erroneous error message when parsing ACPI PCCT
  ACPICA: Update version to 20180508
  ACPICA: acpidump/acpixtract: Support for tables larger than 1MB
  ACPI: APD: Add AMD misc clock handler support
  clk: x86: Add ST oscout platform clock
  ACPICA: Update version to 20180427
  ACPICA: Debugger: Removed direct support for EC address space in "Test Objects"
  ACPICA: Debugger: Add Package support for "test objects" command
  ACPICA: Improve error messages for the namespace root node
  ACPICA: Fix potential infinite loop in acpi_rs_dump_byte_list
  ACPICA: vsnprintf: this statement may fall through
  ACPICA: Tables: Fix spelling mistake in comment
  ACPICA: iASL: Enhance the -tc option (create AML hex file in C)
  ACPI: Add missing prototype_for arch_post_acpi_subsys_init()
  ACPI / tables: improve comments regarding acpi_parse_entries_array()
  ACPICA: Convert acpi_gbl_hardware lock back to an acpi_raw_spinlock
  ACPICA: provide abstraction for raw_spinlock_t
  ACPI / CPPC: Fix invalid PCC channel status errors
  ...

1  2 
drivers/acpi/ac.c
drivers/acpi/battery.c
include/acpi/acpixf.h
include/linux/acpi.h

diff --combined drivers/acpi/ac.c
index 84fdfa70920a2ce6cc7e0896750405e8ff2d589e,b823a86c166dc6aef1721934187d680ef112537b..cdd3136829f15182464b865be099c141a8dd4f67
@@@ -82,10 -82,12 +82,11 @@@ static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NU
  #ifdef CONFIG_ACPI_PROCFS_POWER
  extern struct proc_dir_entry *acpi_lock_ac_dir(void);
  extern void *acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir);
 -static int acpi_ac_open_fs(struct inode *inode, struct file *file);
  #endif
  
  
  static int ac_sleep_before_get_state_ms;
+ static int ac_check_pmic = 1;
  
  static struct acpi_driver acpi_ac_driver = {
        .name = "ac",
@@@ -110,6 -112,16 +111,6 @@@ struct acpi_ac 
  
  #define to_acpi_ac(x) power_supply_get_drvdata(x)
  
 -#ifdef CONFIG_ACPI_PROCFS_POWER
 -static const struct file_operations acpi_ac_fops = {
 -      .owner = THIS_MODULE,
 -      .open = acpi_ac_open_fs,
 -      .read = seq_read,
 -      .llseek = seq_lseek,
 -      .release = single_release,
 -};
 -#endif
 -
  /* --------------------------------------------------------------------------
                                 AC Adapter Management
     -------------------------------------------------------------------------- */
@@@ -198,6 -210,11 +199,6 @@@ static int acpi_ac_seq_show(struct seq_
        return 0;
  }
  
 -static int acpi_ac_open_fs(struct inode *inode, struct file *file)
 -{
 -      return single_open(file, acpi_ac_seq_show, PDE_DATA(inode));
 -}
 -
  static int acpi_ac_add_fs(struct acpi_ac *ac)
  {
        struct proc_dir_entry *entry = NULL;
        }
  
        /* 'state' [R] */
 -      entry = proc_create_data(ACPI_AC_FILE_STATE,
 -                               S_IRUGO, acpi_device_dir(ac->device),
 -                               &acpi_ac_fops, ac);
 +      entry = proc_create_single_data(ACPI_AC_FILE_STATE, S_IRUGO,
 +                      acpi_device_dir(ac->device), acpi_ac_seq_show, ac);
        if (!entry)
                return -ENODEV;
        return 0;
@@@ -293,21 -311,43 +294,43 @@@ static int acpi_ac_battery_notify(struc
        return NOTIFY_OK;
  }
  
- static int thinkpad_e530_quirk(const struct dmi_system_id *d)
+ static int __init thinkpad_e530_quirk(const struct dmi_system_id *d)
  {
        ac_sleep_before_get_state_ms = 1000;
        return 0;
  }
  
- static const struct dmi_system_id ac_dmi_table[] = {
+ static int __init ac_do_not_check_pmic_quirk(const struct dmi_system_id *d)
+ {
+       ac_check_pmic = 0;
+       return 0;
+ }
+ static const struct dmi_system_id ac_dmi_table[]  __initconst = {
        {
+       /* Thinkpad e530 */
        .callback = thinkpad_e530_quirk,
-       .ident = "thinkpad e530",
        .matches = {
                DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
                DMI_MATCH(DMI_PRODUCT_NAME, "32597CG"),
                },
        },
+       {
+               /* ECS EF20EA */
+               .callback = ac_do_not_check_pmic_quirk,
+               .matches = {
+                       DMI_MATCH(DMI_PRODUCT_NAME, "EF20EA"),
+               },
+       },
+       {
+               /* Lenovo Ideapad Miix 320 */
+               .callback = ac_do_not_check_pmic_quirk,
+               .matches = {
+                 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+                 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "80XF"),
+                 DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"),
+               },
+       },
        {},
  };
  
@@@ -367,7 -407,6 +390,6 @@@ end
                kfree(ac);
        }
  
-       dmi_check_system(ac_dmi_table);
        return result;
  }
  
@@@ -425,13 -464,17 +447,17 @@@ static int __init acpi_ac_init(void
        if (acpi_disabled)
                return -ENODEV;
  
-       for (i = 0; i < ARRAY_SIZE(acpi_ac_blacklist); i++)
-               if (acpi_dev_present(acpi_ac_blacklist[i].hid, "1",
-                                    acpi_ac_blacklist[i].hrv)) {
-                       pr_info(PREFIX "AC: found native %s PMIC, not loading\n",
-                               acpi_ac_blacklist[i].hid);
-                       return -ENODEV;
-               }
+       dmi_check_system(ac_dmi_table);
+       if (ac_check_pmic) {
+               for (i = 0; i < ARRAY_SIZE(acpi_ac_blacklist); i++)
+                       if (acpi_dev_present(acpi_ac_blacklist[i].hid, "1",
+                                            acpi_ac_blacklist[i].hrv)) {
+                               pr_info(PREFIX "AC: found native %s PMIC, not loading\n",
+                                       acpi_ac_blacklist[i].hid);
+                               return -ENODEV;
+                       }
+       }
  
  #ifdef CONFIG_ACPI_PROCFS_POWER
        acpi_ac_dir = acpi_lock_ac_dir();
diff --combined drivers/acpi/battery.c
index 76550689ce10ff1cbd7eadc17dc1a5ce8038cb0f,572845fafb007edcc5f650e08ad2a6d776e88c58..b0113a5802a3c073f5787de456bc601f0f8c11cd
@@@ -74,6 -74,8 +74,8 @@@ static async_cookie_t async_cookie
  static bool battery_driver_registered;
  static int battery_bix_broken_package;
  static int battery_notification_delay_ms;
+ static int battery_ac_is_broken;
+ static int battery_check_pmic = 1;
  static unsigned int cache_time = 1000;
  module_param(cache_time, uint, 0644);
  MODULE_PARM_DESC(cache_time, "cache time in milliseconds");
  #ifdef CONFIG_ACPI_PROCFS_POWER
  extern struct proc_dir_entry *acpi_lock_battery_dir(void);
  extern void *acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir);
 -
 -enum acpi_battery_files {
 -      info_tag = 0,
 -      state_tag,
 -      alarm_tag,
 -      ACPI_BATTERY_NUMFILES,
 -};
 -
  #endif
  
  static const struct acpi_device_id battery_device_ids[] = {
@@@ -207,6 -217,20 +209,20 @@@ static bool acpi_battery_is_degraded(st
                battery->full_charge_capacity < battery->design_capacity;
  }
  
+ static int acpi_battery_handle_discharging(struct acpi_battery *battery)
+ {
+       /*
+        * Some devices wrongly report discharging if the battery's charge level
+        * was above the device's start charging threshold atm the AC adapter
+        * was plugged in and the device thus did not start a new charge cycle.
+        */
+       if ((battery_ac_is_broken || power_supply_is_system_supplied()) &&
+           battery->rate_now == 0)
+               return POWER_SUPPLY_STATUS_NOT_CHARGING;
+       return POWER_SUPPLY_STATUS_DISCHARGING;
+ }
  static int acpi_battery_get_property(struct power_supply *psy,
                                     enum power_supply_property psp,
                                     union power_supply_propval *val)
        switch (psp) {
        case POWER_SUPPLY_PROP_STATUS:
                if (battery->state & ACPI_BATTERY_STATE_DISCHARGING)
-                       val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
+                       val->intval = acpi_battery_handle_discharging(battery);
                else if (battery->state & ACPI_BATTERY_STATE_CHARGING)
                        val->intval = POWER_SUPPLY_STATUS_CHARGING;
                else if (acpi_battery_is_charged(battery))
@@@ -977,10 -1001,9 +993,10 @@@ static const char *acpi_battery_units(c
                "mA" : "mW";
  }
  
 -static int acpi_battery_print_info(struct seq_file *seq, int result)
 +static int acpi_battery_info_proc_show(struct seq_file *seq, void *offset)
  {
        struct acpi_battery *battery = seq->private;
 +      int result = acpi_battery_update(battery, false);
  
        if (result)
                goto end;
        return result;
  }
  
 -static int acpi_battery_print_state(struct seq_file *seq, int result)
 +static int acpi_battery_state_proc_show(struct seq_file *seq, void *offset)
  {
        struct acpi_battery *battery = seq->private;
 +      int result = acpi_battery_update(battery, false);
  
        if (result)
                goto end;
        return result;
  }
  
 -static int acpi_battery_print_alarm(struct seq_file *seq, int result)
 +static int acpi_battery_alarm_proc_show(struct seq_file *seq, void *offset)
  {
        struct acpi_battery *battery = seq->private;
 +      int result = acpi_battery_update(battery, false);
  
        if (result)
                goto end;
@@@ -1137,22 -1158,82 +1153,22 @@@ static ssize_t acpi_battery_write_alarm
        return result;
  }
  
 -typedef int(*print_func)(struct seq_file *seq, int result);
 -
 -static print_func acpi_print_funcs[ACPI_BATTERY_NUMFILES] = {
 -      acpi_battery_print_info,
 -      acpi_battery_print_state,
 -      acpi_battery_print_alarm,
 -};
 -
 -static int acpi_battery_read(int fid, struct seq_file *seq)
 +static int acpi_battery_alarm_proc_open(struct inode *inode, struct file *file)
  {
 -      struct acpi_battery *battery = seq->private;
 -      int result = acpi_battery_update(battery, false);
 -      return acpi_print_funcs[fid](seq, result);
 +      return single_open(file, acpi_battery_alarm_proc_show, PDE_DATA(inode));
  }
  
 -#define DECLARE_FILE_FUNCTIONS(_name) \
 -static int acpi_battery_read_##_name(struct seq_file *seq, void *offset) \
 -{ \
 -      return acpi_battery_read(_name##_tag, seq); \
 -} \
 -static int acpi_battery_##_name##_open_fs(struct inode *inode, struct file *file) \
 -{ \
 -      return single_open(file, acpi_battery_read_##_name, PDE_DATA(inode)); \
 -}
 -
 -DECLARE_FILE_FUNCTIONS(info);
 -DECLARE_FILE_FUNCTIONS(state);
 -DECLARE_FILE_FUNCTIONS(alarm);
 -
 -#undef DECLARE_FILE_FUNCTIONS
 -
 -#define FILE_DESCRIPTION_RO(_name) \
 -      { \
 -      .name = __stringify(_name), \
 -      .mode = S_IRUGO, \
 -      .ops = { \
 -              .open = acpi_battery_##_name##_open_fs, \
 -              .read = seq_read, \
 -              .llseek = seq_lseek, \
 -              .release = single_release, \
 -              .owner = THIS_MODULE, \
 -              }, \
 -      }
 -
 -#define FILE_DESCRIPTION_RW(_name) \
 -      { \
 -      .name = __stringify(_name), \
 -      .mode = S_IFREG | S_IRUGO | S_IWUSR, \
 -      .ops = { \
 -              .open = acpi_battery_##_name##_open_fs, \
 -              .read = seq_read, \
 -              .llseek = seq_lseek, \
 -              .write = acpi_battery_write_##_name, \
 -              .release = single_release, \
 -              .owner = THIS_MODULE, \
 -              }, \
 -      }
 -
 -static const struct battery_file {
 -      struct file_operations ops;
 -      umode_t mode;
 -      const char *name;
 -} acpi_battery_file[] = {
 -      FILE_DESCRIPTION_RO(info),
 -      FILE_DESCRIPTION_RO(state),
 -      FILE_DESCRIPTION_RW(alarm),
 +static const struct file_operations acpi_battery_alarm_fops = {
 +      .owner          = THIS_MODULE,
 +      .open           = acpi_battery_alarm_proc_open,
 +      .read           = seq_read,
 +      .write          = acpi_battery_write_alarm,
 +      .llseek         = seq_lseek,
 +      .release        = single_release,
  };
  
 -#undef FILE_DESCRIPTION_RO
 -#undef FILE_DESCRIPTION_RW
 -
  static int acpi_battery_add_fs(struct acpi_device *device)
  {
 -      struct proc_dir_entry *entry = NULL;
 -      int i;
 -
        printk(KERN_WARNING PREFIX "Deprecated procfs I/F for battery is loaded,"
                        " please retry with CONFIG_ACPI_PROCFS_POWER cleared\n");
        if (!acpi_device_dir(device)) {
                        return -ENODEV;
        }
  
 -      for (i = 0; i < ACPI_BATTERY_NUMFILES; ++i) {
 -              entry = proc_create_data(acpi_battery_file[i].name,
 -                                       acpi_battery_file[i].mode,
 -                                       acpi_device_dir(device),
 -                                       &acpi_battery_file[i].ops,
 -                                       acpi_driver_data(device));
 -              if (!entry)
 -                      return -ENODEV;
 -      }
 +      if (!proc_create_single_data("info", S_IRUGO, acpi_device_dir(device),
 +                      acpi_battery_info_proc_show, acpi_driver_data(device)))
 +              return -ENODEV;
 +      if (!proc_create_single_data("state", S_IRUGO, acpi_device_dir(device),
 +                      acpi_battery_state_proc_show, acpi_driver_data(device)))
 +              return -ENODEV;
 +      if (!proc_create_data("alarm", S_IFREG | S_IRUGO | S_IWUSR,
 +                      acpi_device_dir(device), &acpi_battery_alarm_fops,
 +                      acpi_driver_data(device)))
 +              return -ENODEV;
        return 0;
  }
  
  static void acpi_battery_remove_fs(struct acpi_device *device)
  {
 -      int i;
        if (!acpi_device_dir(device))
                return;
 -      for (i = 0; i < ACPI_BATTERY_NUMFILES; ++i)
 -              remove_proc_entry(acpi_battery_file[i].name,
 -                                acpi_device_dir(device));
 -
 -      remove_proc_entry(acpi_device_bid(device), acpi_battery_dir);
 +      remove_proc_subtree(acpi_device_bid(device), acpi_battery_dir);
        acpi_device_dir(device) = NULL;
  }
  
@@@ -1263,23 -1348,64 +1279,64 @@@ battery_notification_delay_quirk(const 
        return 0;
  }
  
+ static int __init
+ battery_ac_is_broken_quirk(const struct dmi_system_id *d)
+ {
+       battery_ac_is_broken = 1;
+       return 0;
+ }
+ static int __init
+ battery_do_not_check_pmic_quirk(const struct dmi_system_id *d)
+ {
+       battery_check_pmic = 0;
+       return 0;
+ }
  static const struct dmi_system_id bat_dmi_table[] __initconst = {
        {
+               /* NEC LZ750/LS */
                .callback = battery_bix_broken_package_quirk,
-               .ident = "NEC LZ750/LS",
                .matches = {
                        DMI_MATCH(DMI_SYS_VENDOR, "NEC"),
                        DMI_MATCH(DMI_PRODUCT_NAME, "PC-LZ750LS"),
                },
        },
        {
+               /* Acer Aspire V5-573G */
                .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"),
                },
        },
+       {
+               /* Point of View mobii wintab p800w */
+               .callback = battery_ac_is_broken_quirk,
+               .matches = {
+                       DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
+                       DMI_MATCH(DMI_BOARD_NAME, "Aptio CRB"),
+                       DMI_MATCH(DMI_BIOS_VERSION, "3BAIR1013"),
+                       /* Above matches are too generic, add bios-date match */
+                       DMI_MATCH(DMI_BIOS_DATE, "08/22/2014"),
+               },
+       },
+       {
+               /* ECS EF20EA */
+               .callback = battery_do_not_check_pmic_quirk,
+               .matches = {
+                       DMI_MATCH(DMI_PRODUCT_NAME, "EF20EA"),
+               },
+       },
+       {
+               /* Lenovo Ideapad Miix 320 */
+               .callback = battery_do_not_check_pmic_quirk,
+               .matches = {
+                 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+                 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "80XF"),
+                 DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"),
+               },
+       },
        {},
  };
  
@@@ -1419,16 -1545,18 +1476,18 @@@ static void __init acpi_battery_init_as
        unsigned int i;
        int result;
  
-       for (i = 0; i < ARRAY_SIZE(acpi_battery_blacklist); i++)
-               if (acpi_dev_present(acpi_battery_blacklist[i], "1", -1)) {
-                       pr_info(PREFIX ACPI_BATTERY_DEVICE_NAME
-                               ": found native %s PMIC, not loading\n",
-                               acpi_battery_blacklist[i]);
-                       return;
-               }
        dmi_check_system(bat_dmi_table);
  
+       if (battery_check_pmic) {
+               for (i = 0; i < ARRAY_SIZE(acpi_battery_blacklist); i++)
+                       if (acpi_dev_present(acpi_battery_blacklist[i], "1", -1)) {
+                               pr_info(PREFIX ACPI_BATTERY_DEVICE_NAME
+                                       ": found native %s PMIC, not loading\n",
+                                       acpi_battery_blacklist[i]);
+                               return;
+                       }
+       }
  #ifdef CONFIG_ACPI_PROCFS_POWER
        acpi_battery_dir = acpi_lock_battery_dir();
        if (!acpi_battery_dir)
diff --combined include/acpi/acpixf.h
index c01d790c17c2e4d218d2b6e5d2ff7af8622d9b5f,e8c9199bf98f3d01d59877ce5c01f64c2b4c9bdd..77d71bd1be39abcc4e1d4528f26158b130fd1615
@@@ -12,7 -12,7 +12,7 @@@
  
  /* Current ACPICA subsystem version in YYYYMMDD format */
  
- #define ACPI_CA_VERSION                 0x20180313
+ #define ACPI_CA_VERSION                 0x20180508
  
  #include <acpi/acconfig.h>
  #include <acpi/actypes.h>
@@@ -753,7 -753,6 +753,7 @@@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_st
                                                     u32 gpe_number,
                                                     acpi_event_status
                                                     *event_status))
 +ACPI_HW_DEPENDENT_RETURN_VOID(void acpi_dispatch_gpe(acpi_handle gpe_device, u32 gpe_number))
  ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_disable_all_gpes(void))
  ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable_all_runtime_gpes(void))
  ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable_all_wakeup_gpes(void))
diff --combined include/linux/acpi.h
index c01675b3d93f45726ee1deec60836fbc7e19a658,cb4d7b6b085cb368040d9581f28daab893196959..fd0ea6af9e36c47ab2eee9cf3f44c4759da258f3
@@@ -578,6 -578,7 +578,7 @@@ int acpi_match_platform_list(const stru
  
  extern void acpi_early_init(void);
  extern void acpi_subsystem_init(void);
+ extern void arch_post_acpi_subsys_init(void);
  
  extern int acpi_nvs_register(__u64 start, __u64 size);
  
@@@ -899,7 -900,7 +900,7 @@@ static inline int acpi_subsys_runtime_s
  static inline int acpi_subsys_runtime_resume(struct device *dev) { return 0; }
  static inline int acpi_dev_pm_attach(struct device *dev, bool power_on)
  {
 -      return -ENODEV;
 +      return 0;
  }
  #endif
  
This page took 0.084929 seconds and 4 git commands to generate.