diff options
| -rw-r--r-- | Documentation/acpi/enumeration.txt | 26 | ||||
| -rw-r--r-- | drivers/acpi/sleep.c | 17 | ||||
| -rw-r--r-- | drivers/acpi/sleep.h | 2 | ||||
| -rw-r--r-- | drivers/acpi/sysfs.c | 2 | ||||
| -rw-r--r-- | include/acpi/acpi_bus.h | 1 |
5 files changed, 27 insertions, 21 deletions
diff --git a/Documentation/acpi/enumeration.txt b/Documentation/acpi/enumeration.txt index 9b121a569ab4..750401f91341 100644 --- a/Documentation/acpi/enumeration.txt +++ b/Documentation/acpi/enumeration.txt | |||
| @@ -254,8 +254,13 @@ GPIO support | |||
| 254 | ~~~~~~~~~~~~ | 254 | ~~~~~~~~~~~~ |
| 255 | ACPI 5 introduced two new resources to describe GPIO connections: GpioIo | 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 | 256 | and GpioInt. These resources are used be used to pass GPIO numbers used by |
| 257 | the device to the driver. For example: | 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. | ||
| 258 | 259 | ||
| 260 | For example: | ||
| 261 | |||
| 262 | Device (DEV) | ||
| 263 | { | ||
| 259 | Method (_CRS, 0, NotSerialized) | 264 | Method (_CRS, 0, NotSerialized) |
| 260 | { | 265 | { |
| 261 | Name (SBUF, ResourceTemplate() | 266 | Name (SBUF, ResourceTemplate() |
| @@ -285,6 +290,18 @@ the device to the driver. For example: | |||
| 285 | Return (SBUF) | 290 | Return (SBUF) |
| 286 | } | 291 | } |
| 287 | 292 | ||
| 293 | // ACPI 5.1 _DSD used for naming the GPIOs | ||
| 294 | Name (_DSD, Package () | ||
| 295 | { | ||
| 296 | ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), | ||
| 297 | Package () | ||
| 298 | { | ||
| 299 | Package () {"power-gpios", Package() {^DEV, 0, 0, 0 }}, | ||
| 300 | Package () {"irq-gpios", Package() {^DEV, 1, 0, 0 }}, | ||
| 301 | } | ||
| 302 | }) | ||
| 303 | ... | ||
| 304 | |||
| 288 | These GPIO numbers are controller relative and path "\\_SB.PCI0.GPI0" | 305 | These GPIO numbers are controller relative and path "\\_SB.PCI0.GPI0" |
| 289 | specifies the path to the controller. In order to use these GPIOs in Linux | 306 | specifies the path to the controller. In order to use these GPIOs in Linux |
| 290 | we need to translate them to the corresponding Linux GPIO descriptors. | 307 | we need to translate them to the corresponding Linux GPIO descriptors. |
| @@ -300,11 +317,11 @@ a code like this: | |||
| 300 | 317 | ||
| 301 | struct gpio_desc *irq_desc, *power_desc; | 318 | struct gpio_desc *irq_desc, *power_desc; |
| 302 | 319 | ||
| 303 | irq_desc = gpiod_get_index(dev, NULL, 1); | 320 | irq_desc = gpiod_get(dev, "irq"); |
| 304 | if (IS_ERR(irq_desc)) | 321 | if (IS_ERR(irq_desc)) |
| 305 | /* handle error */ | 322 | /* handle error */ |
| 306 | 323 | ||
| 307 | power_desc = gpiod_get_index(dev, NULL, 0); | 324 | power_desc = gpiod_get(dev, "power"); |
| 308 | if (IS_ERR(power_desc)) | 325 | if (IS_ERR(power_desc)) |
| 309 | /* handle error */ | 326 | /* handle error */ |
| 310 | 327 | ||
| @@ -313,6 +330,9 @@ a code like this: | |||
| 313 | There are also devm_* versions of these functions which release the | 330 | There are also devm_* versions of these functions which release the |
| 314 | descriptors once the device is released. | 331 | descriptors once the device is released. |
| 315 | 332 | ||
| 333 | See Documentation/acpi/gpio-properties.txt for more information about the | ||
| 334 | _DSD binding related to GPIOs. | ||
| 335 | |||
| 316 | MFD devices | 336 | MFD devices |
| 317 | ~~~~~~~~~~~ | 337 | ~~~~~~~~~~~ |
| 318 | The MFD devices register their children as platform devices. For the child | 338 | The MFD devices register their children as platform devices. For the child |
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 7f251dd1a687..2f0d4db40a9e 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
| @@ -629,6 +629,7 @@ static int acpi_freeze_begin(void) | |||
| 629 | 629 | ||
| 630 | static int acpi_freeze_prepare(void) | 630 | static int acpi_freeze_prepare(void) |
| 631 | { | 631 | { |
| 632 | acpi_enable_wakeup_devices(ACPI_STATE_S0); | ||
| 632 | acpi_enable_all_wakeup_gpes(); | 633 | acpi_enable_all_wakeup_gpes(); |
| 633 | acpi_os_wait_events_complete(); | 634 | acpi_os_wait_events_complete(); |
| 634 | enable_irq_wake(acpi_gbl_FADT.sci_interrupt); | 635 | enable_irq_wake(acpi_gbl_FADT.sci_interrupt); |
| @@ -637,6 +638,7 @@ static int acpi_freeze_prepare(void) | |||
| 637 | 638 | ||
| 638 | static void acpi_freeze_restore(void) | 639 | static void acpi_freeze_restore(void) |
| 639 | { | 640 | { |
| 641 | acpi_disable_wakeup_devices(ACPI_STATE_S0); | ||
| 640 | disable_irq_wake(acpi_gbl_FADT.sci_interrupt); | 642 | disable_irq_wake(acpi_gbl_FADT.sci_interrupt); |
| 641 | acpi_enable_all_runtime_gpes(); | 643 | acpi_enable_all_runtime_gpes(); |
| 642 | } | 644 | } |
| @@ -806,21 +808,6 @@ static void acpi_sleep_hibernate_setup(void) | |||
| 806 | static inline void acpi_sleep_hibernate_setup(void) {} | 808 | static inline void acpi_sleep_hibernate_setup(void) {} |
| 807 | #endif /* !CONFIG_HIBERNATION */ | 809 | #endif /* !CONFIG_HIBERNATION */ |
| 808 | 810 | ||
| 809 | int acpi_suspend(u32 acpi_state) | ||
| 810 | { | ||
| 811 | suspend_state_t states[] = { | ||
| 812 | [1] = PM_SUSPEND_STANDBY, | ||
| 813 | [3] = PM_SUSPEND_MEM, | ||
| 814 | [5] = PM_SUSPEND_MAX | ||
| 815 | }; | ||
| 816 | |||
| 817 | if (acpi_state < 6 && states[acpi_state]) | ||
| 818 | return pm_suspend(states[acpi_state]); | ||
| 819 | if (acpi_state == 4) | ||
| 820 | return hibernate(); | ||
| 821 | return -EINVAL; | ||
| 822 | } | ||
| 823 | |||
| 824 | static void acpi_power_off_prepare(void) | 811 | static void acpi_power_off_prepare(void) |
| 825 | { | 812 | { |
| 826 | /* Prepare to power off the system */ | 813 | /* Prepare to power off the system */ |
diff --git a/drivers/acpi/sleep.h b/drivers/acpi/sleep.h index 0143540a2519..c797ffa568d5 100644 --- a/drivers/acpi/sleep.h +++ b/drivers/acpi/sleep.h | |||
| @@ -1,6 +1,4 @@ | |||
| 1 | 1 | ||
| 2 | extern int acpi_suspend(u32 state); | ||
| 3 | |||
| 4 | extern void acpi_enable_wakeup_devices(u8 sleep_state); | 2 | extern void acpi_enable_wakeup_devices(u8 sleep_state); |
| 5 | extern void acpi_disable_wakeup_devices(u8 sleep_state); | 3 | extern void acpi_disable_wakeup_devices(u8 sleep_state); |
| 6 | 4 | ||
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c index 13e577c80201..0876d77b3206 100644 --- a/drivers/acpi/sysfs.c +++ b/drivers/acpi/sysfs.c | |||
| @@ -527,7 +527,7 @@ static ssize_t counter_show(struct kobject *kobj, | |||
| 527 | acpi_irq_not_handled; | 527 | acpi_irq_not_handled; |
| 528 | all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_GPE].count = | 528 | all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_GPE].count = |
| 529 | acpi_gpe_count; | 529 | acpi_gpe_count; |
| 530 | size = sprintf(buf, "%8d", all_counters[index].count); | 530 | size = sprintf(buf, "%8u", all_counters[index].count); |
| 531 | 531 | ||
| 532 | /* "gpe_all" or "sci" */ | 532 | /* "gpe_all" or "sci" */ |
| 533 | if (index >= num_gpes + ACPI_NUM_FIXED_EVENTS) | 533 | if (index >= num_gpes + ACPI_NUM_FIXED_EVENTS) |
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 61e32ec1fc4d..f8009d99190a 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
| @@ -252,6 +252,7 @@ struct acpi_device_pnp { | |||
| 252 | #define acpi_device_bid(d) ((d)->pnp.bus_id) | 252 | #define acpi_device_bid(d) ((d)->pnp.bus_id) |
| 253 | #define acpi_device_adr(d) ((d)->pnp.bus_address) | 253 | #define acpi_device_adr(d) ((d)->pnp.bus_address) |
| 254 | const char *acpi_device_hid(struct acpi_device *device); | 254 | const char *acpi_device_hid(struct acpi_device *device); |
| 255 | #define acpi_device_uid(d) ((d)->pnp.unique_id) | ||
| 255 | #define acpi_device_name(d) ((d)->pnp.device_name) | 256 | #define acpi_device_name(d) ((d)->pnp.device_name) |
| 256 | #define acpi_device_class(d) ((d)->pnp.device_class) | 257 | #define acpi_device_class(d) ((d)->pnp.device_class) |
| 257 | 258 | ||
