Merge branches 'acpi-pm', 'acpi-enumeration' and 'acpi-sysfs'

* acpi-pm:
ACPI / PM: Enable all wakeup GPEs in suspend-to-idle
ACPI / sleep: Drop acpi_suspend() which is not used

* acpi-enumeration:
ACPI: Add acpi_device_uid() for convenience
ACPI: Update GPIO documentation to mention _DSD

* acpi-sysfs:
ACPI / sysfs: Treat the count field of counter_show() as unsigned

+27 -21
+23 -3
Documentation/acpi/enumeration.txt
··· 254 ~~~~~~~~~~~~ 255 ACPI 5 introduced two new resources to describe GPIO connections: GpioIo 256 and GpioInt. These resources are used be used to pass GPIO numbers used by 257 - the device to the driver. For example: 258 259 Method (_CRS, 0, NotSerialized) 260 { 261 Name (SBUF, ResourceTemplate() ··· 290 Return (SBUF) 291 } 292 293 These GPIO numbers are controller relative and path "\\_SB.PCI0.GPI0" 294 specifies the path to the controller. In order to use these GPIOs in Linux 295 we need to translate them to the corresponding Linux GPIO descriptors. ··· 317 318 struct gpio_desc *irq_desc, *power_desc; 319 320 - irq_desc = gpiod_get_index(dev, NULL, 1); 321 if (IS_ERR(irq_desc)) 322 /* handle error */ 323 324 - power_desc = gpiod_get_index(dev, NULL, 0); 325 if (IS_ERR(power_desc)) 326 /* handle error */ 327 ··· 329 330 There are also devm_* versions of these functions which release the 331 descriptors once the device is released. 332 333 MFD devices 334 ~~~~~~~~~~~
··· 254 ~~~~~~~~~~~~ 255 ACPI 5 introduced two new resources to describe GPIO connections: GpioIo 256 and GpioInt. These resources are used be used to pass GPIO numbers used by 257 + the device to the driver. ACPI 5.1 extended this with _DSD (Device 258 + Specific Data) which made it possible to name the GPIOs among other things. 259 260 + For example: 261 + 262 + Device (DEV) 263 + { 264 Method (_CRS, 0, NotSerialized) 265 { 266 Name (SBUF, ResourceTemplate() ··· 285 Return (SBUF) 286 } 287 288 + // ACPI 5.1 _DSD used for naming the GPIOs 289 + Name (_DSD, Package () 290 + { 291 + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 292 + Package () 293 + { 294 + Package () {"power-gpios", Package() {^DEV, 0, 0, 0 }}, 295 + Package () {"irq-gpios", Package() {^DEV, 1, 0, 0 }}, 296 + } 297 + }) 298 + ... 299 + 300 These GPIO numbers are controller relative and path "\\_SB.PCI0.GPI0" 301 specifies the path to the controller. In order to use these GPIOs in Linux 302 we need to translate them to the corresponding Linux GPIO descriptors. ··· 300 301 struct gpio_desc *irq_desc, *power_desc; 302 303 + irq_desc = gpiod_get(dev, "irq"); 304 if (IS_ERR(irq_desc)) 305 /* handle error */ 306 307 + power_desc = gpiod_get(dev, "power"); 308 if (IS_ERR(power_desc)) 309 /* handle error */ 310 ··· 312 313 There are also devm_* versions of these functions which release the 314 descriptors once the device is released. 315 + 316 + See Documentation/acpi/gpio-properties.txt for more information about the 317 + _DSD binding related to GPIOs. 318 319 MFD devices 320 ~~~~~~~~~~~
+2 -15
drivers/acpi/sleep.c
··· 629 630 static int acpi_freeze_prepare(void) 631 { 632 acpi_enable_all_wakeup_gpes(); 633 acpi_os_wait_events_complete(); 634 enable_irq_wake(acpi_gbl_FADT.sci_interrupt); ··· 638 639 static void acpi_freeze_restore(void) 640 { 641 disable_irq_wake(acpi_gbl_FADT.sci_interrupt); 642 acpi_enable_all_runtime_gpes(); 643 } ··· 807 #else /* !CONFIG_HIBERNATION */ 808 static inline void acpi_sleep_hibernate_setup(void) {} 809 #endif /* !CONFIG_HIBERNATION */ 810 - 811 - int acpi_suspend(u32 acpi_state) 812 - { 813 - suspend_state_t states[] = { 814 - [1] = PM_SUSPEND_STANDBY, 815 - [3] = PM_SUSPEND_MEM, 816 - [5] = PM_SUSPEND_MAX 817 - }; 818 - 819 - if (acpi_state < 6 && states[acpi_state]) 820 - return pm_suspend(states[acpi_state]); 821 - if (acpi_state == 4) 822 - return hibernate(); 823 - return -EINVAL; 824 - } 825 826 static void acpi_power_off_prepare(void) 827 {
··· 629 630 static int acpi_freeze_prepare(void) 631 { 632 + acpi_enable_wakeup_devices(ACPI_STATE_S0); 633 acpi_enable_all_wakeup_gpes(); 634 acpi_os_wait_events_complete(); 635 enable_irq_wake(acpi_gbl_FADT.sci_interrupt); ··· 637 638 static void acpi_freeze_restore(void) 639 { 640 + acpi_disable_wakeup_devices(ACPI_STATE_S0); 641 disable_irq_wake(acpi_gbl_FADT.sci_interrupt); 642 acpi_enable_all_runtime_gpes(); 643 } ··· 805 #else /* !CONFIG_HIBERNATION */ 806 static inline void acpi_sleep_hibernate_setup(void) {} 807 #endif /* !CONFIG_HIBERNATION */ 808 809 static void acpi_power_off_prepare(void) 810 {
-2
drivers/acpi/sleep.h
··· 1 2 - extern int acpi_suspend(u32 state); 3 - 4 extern void acpi_enable_wakeup_devices(u8 sleep_state); 5 extern void acpi_disable_wakeup_devices(u8 sleep_state); 6
··· 1 2 extern void acpi_enable_wakeup_devices(u8 sleep_state); 3 extern void acpi_disable_wakeup_devices(u8 sleep_state); 4
+1 -1
drivers/acpi/sysfs.c
··· 527 acpi_irq_not_handled; 528 all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_GPE].count = 529 acpi_gpe_count; 530 - size = sprintf(buf, "%8d", all_counters[index].count); 531 532 /* "gpe_all" or "sci" */ 533 if (index >= num_gpes + ACPI_NUM_FIXED_EVENTS)
··· 527 acpi_irq_not_handled; 528 all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_GPE].count = 529 acpi_gpe_count; 530 + size = sprintf(buf, "%8u", all_counters[index].count); 531 532 /* "gpe_all" or "sci" */ 533 if (index >= num_gpes + ACPI_NUM_FIXED_EVENTS)
+1
include/acpi/acpi_bus.h
··· 252 #define acpi_device_bid(d) ((d)->pnp.bus_id) 253 #define acpi_device_adr(d) ((d)->pnp.bus_address) 254 const char *acpi_device_hid(struct acpi_device *device); 255 #define acpi_device_name(d) ((d)->pnp.device_name) 256 #define acpi_device_class(d) ((d)->pnp.device_class) 257
··· 252 #define acpi_device_bid(d) ((d)->pnp.bus_id) 253 #define acpi_device_adr(d) ((d)->pnp.bus_address) 254 const char *acpi_device_hid(struct acpi_device *device); 255 + #define acpi_device_uid(d) ((d)->pnp.unique_id) 256 #define acpi_device_name(d) ((d)->pnp.device_name) 257 #define acpi_device_class(d) ((d)->pnp.device_class) 258