diff options
| -rw-r--r-- | Documentation/ABI/testing/sysfs-firmware-acpi | 16 | ||||
| -rw-r--r-- | drivers/acpi/events/evxfevnt.c | 6 | ||||
| -rw-r--r-- | drivers/acpi/system.c | 19 | ||||
| -rw-r--r-- | include/acpi/actypes.h | 1 |
4 files changed, 22 insertions, 20 deletions
diff --git a/Documentation/ABI/testing/sysfs-firmware-acpi b/Documentation/ABI/testing/sysfs-firmware-acpi index f27be7d1a49f..e8ffc70ffe12 100644 --- a/Documentation/ABI/testing/sysfs-firmware-acpi +++ b/Documentation/ABI/testing/sysfs-firmware-acpi | |||
| @@ -89,7 +89,7 @@ Description: | |||
| 89 | 89 | ||
| 90 | error - an interrupt that can't be accounted for above. | 90 | error - an interrupt that can't be accounted for above. |
| 91 | 91 | ||
| 92 | invalid: it's either a wakeup GPE or a GPE/Fixed Event that | 92 | invalid: it's either a GPE or a Fixed Event that |
| 93 | doesn't have an event handler. | 93 | doesn't have an event handler. |
| 94 | 94 | ||
| 95 | disable: the GPE/Fixed Event is valid but disabled. | 95 | disable: the GPE/Fixed Event is valid but disabled. |
| @@ -117,30 +117,30 @@ Description: | |||
| 117 | and other user space applications so that the machine won't shutdown | 117 | and other user space applications so that the machine won't shutdown |
| 118 | when pressing the power button. | 118 | when pressing the power button. |
| 119 | # cat ff_pwr_btn | 119 | # cat ff_pwr_btn |
| 120 | 0 | 120 | 0 enabled |
| 121 | # press the power button for 3 times; | 121 | # press the power button for 3 times; |
| 122 | # cat ff_pwr_btn | 122 | # cat ff_pwr_btn |
| 123 | 3 | 123 | 3 enabled |
| 124 | # echo disable > ff_pwr_btn | 124 | # echo disable > ff_pwr_btn |
| 125 | # cat ff_pwr_btn | 125 | # cat ff_pwr_btn |
| 126 | disable | 126 | 3 disabled |
| 127 | # press the power button for 3 times; | 127 | # press the power button for 3 times; |
| 128 | # cat ff_pwr_btn | 128 | # cat ff_pwr_btn |
| 129 | disable | 129 | 3 disabled |
| 130 | # echo enable > ff_pwr_btn | 130 | # echo enable > ff_pwr_btn |
| 131 | # cat ff_pwr_btn | 131 | # cat ff_pwr_btn |
| 132 | 4 | 132 | 4 enabled |
| 133 | /* | 133 | /* |
| 134 | * this is because the status bit is set even if the enable bit is cleared, | 134 | * this is because the status bit is set even if the enable bit is cleared, |
| 135 | * and it triggers an ACPI fixed event when the enable bit is set again | 135 | * and it triggers an ACPI fixed event when the enable bit is set again |
| 136 | */ | 136 | */ |
| 137 | # press the power button for 3 times; | 137 | # press the power button for 3 times; |
| 138 | # cat ff_pwr_btn | 138 | # cat ff_pwr_btn |
| 139 | 7 | 139 | 7 enabled |
| 140 | # echo disable > ff_pwr_btn | 140 | # echo disable > ff_pwr_btn |
| 141 | # press the power button for 3 times; | 141 | # press the power button for 3 times; |
| 142 | # echo clear > ff_pwr_btn /* clear the status bit */ | 142 | # echo clear > ff_pwr_btn /* clear the status bit */ |
| 143 | # echo disable > ff_pwr_btn | 143 | # echo disable > ff_pwr_btn |
| 144 | # cat ff_pwr_btn | 144 | # cat ff_pwr_btn |
| 145 | 7 | 145 | 7 enabled |
| 146 | 146 | ||
diff --git a/drivers/acpi/events/evxfevnt.c b/drivers/acpi/events/evxfevnt.c index 73bfd6bf962f..211e93a90e95 100644 --- a/drivers/acpi/events/evxfevnt.c +++ b/drivers/acpi/events/evxfevnt.c | |||
| @@ -521,6 +521,9 @@ acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status) | |||
| 521 | if (value) | 521 | if (value) |
| 522 | *event_status |= ACPI_EVENT_FLAG_SET; | 522 | *event_status |= ACPI_EVENT_FLAG_SET; |
| 523 | 523 | ||
| 524 | if (acpi_gbl_fixed_event_handlers[event].handler) | ||
| 525 | *event_status |= ACPI_EVENT_FLAG_HANDLE; | ||
| 526 | |||
| 524 | return_ACPI_STATUS(status); | 527 | return_ACPI_STATUS(status); |
| 525 | } | 528 | } |
| 526 | 529 | ||
| @@ -571,6 +574,9 @@ acpi_get_gpe_status(acpi_handle gpe_device, | |||
| 571 | 574 | ||
| 572 | status = acpi_hw_get_gpe_status(gpe_event_info, event_status); | 575 | status = acpi_hw_get_gpe_status(gpe_event_info, event_status); |
| 573 | 576 | ||
| 577 | if (gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) | ||
| 578 | *event_status |= ACPI_EVENT_FLAG_HANDLE; | ||
| 579 | |||
| 574 | unlock_and_exit: | 580 | unlock_and_exit: |
| 575 | if (flags & ACPI_NOT_ISR) { | 581 | if (flags & ACPI_NOT_ISR) { |
| 576 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); | 582 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); |
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c index 1d74171b7940..6d348dce0810 100644 --- a/drivers/acpi/system.c +++ b/drivers/acpi/system.c | |||
| @@ -167,7 +167,6 @@ static int acpi_system_sysfs_init(void) | |||
| 167 | #define COUNT_ERROR 2 /* other */ | 167 | #define COUNT_ERROR 2 /* other */ |
| 168 | #define NUM_COUNTERS_EXTRA 3 | 168 | #define NUM_COUNTERS_EXTRA 3 |
| 169 | 169 | ||
| 170 | #define ACPI_EVENT_VALID 0x01 | ||
| 171 | struct event_counter { | 170 | struct event_counter { |
| 172 | u32 count; | 171 | u32 count; |
| 173 | u32 flags; | 172 | u32 flags; |
| @@ -312,12 +311,6 @@ static int get_status(u32 index, acpi_event_status *status, acpi_handle *handle) | |||
| 312 | } else if (index < (num_gpes + ACPI_NUM_FIXED_EVENTS)) | 311 | } else if (index < (num_gpes + ACPI_NUM_FIXED_EVENTS)) |
| 313 | result = acpi_get_event_status(index - num_gpes, status); | 312 | result = acpi_get_event_status(index - num_gpes, status); |
| 314 | 313 | ||
| 315 | /* | ||
| 316 | * sleep/power button GPE/Fixed Event is enabled after acpi_system_init, | ||
| 317 | * check the status at runtime and mark it as valid once it's enabled | ||
| 318 | */ | ||
| 319 | if (!result && (*status & ACPI_EVENT_FLAG_ENABLED)) | ||
| 320 | all_counters[index].flags |= ACPI_EVENT_VALID; | ||
| 321 | end: | 314 | end: |
| 322 | return result; | 315 | return result; |
| 323 | } | 316 | } |
| @@ -346,12 +339,14 @@ static ssize_t counter_show(struct kobject *kobj, | |||
| 346 | if (result) | 339 | if (result) |
| 347 | goto end; | 340 | goto end; |
| 348 | 341 | ||
| 349 | if (!(all_counters[index].flags & ACPI_EVENT_VALID)) | 342 | if (!(status & ACPI_EVENT_FLAG_HANDLE)) |
| 350 | size += sprintf(buf + size, " invalid"); | 343 | size += sprintf(buf + size, " invalid"); |
| 351 | else if (status & ACPI_EVENT_FLAG_ENABLED) | 344 | else if (status & ACPI_EVENT_FLAG_ENABLED) |
| 352 | size += sprintf(buf + size, " enable"); | 345 | size += sprintf(buf + size, " enabled"); |
| 346 | else if (status & ACPI_EVENT_FLAG_WAKE_ENABLED) | ||
| 347 | size += sprintf(buf + size, " wake_enabled"); | ||
| 353 | else | 348 | else |
| 354 | size += sprintf(buf + size, " disable"); | 349 | size += sprintf(buf + size, " disabled"); |
| 355 | 350 | ||
| 356 | end: | 351 | end: |
| 357 | size += sprintf(buf + size, "\n"); | 352 | size += sprintf(buf + size, "\n"); |
| @@ -385,7 +380,7 @@ static ssize_t counter_set(struct kobject *kobj, | |||
| 385 | if (result) | 380 | if (result) |
| 386 | goto end; | 381 | goto end; |
| 387 | 382 | ||
| 388 | if (!(all_counters[index].flags & ACPI_EVENT_VALID)) { | 383 | if (!(status & ACPI_EVENT_FLAG_HANDLE)) { |
| 389 | printk(KERN_WARNING PREFIX | 384 | printk(KERN_WARNING PREFIX |
| 390 | "Can not change Invalid GPE/Fixed Event status\n"); | 385 | "Can not change Invalid GPE/Fixed Event status\n"); |
| 391 | return -EINVAL; | 386 | return -EINVAL; |
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index e8936ab59627..7220361790b3 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h | |||
| @@ -525,6 +525,7 @@ typedef u32 acpi_event_status; | |||
| 525 | #define ACPI_EVENT_FLAG_ENABLED (acpi_event_status) 0x01 | 525 | #define ACPI_EVENT_FLAG_ENABLED (acpi_event_status) 0x01 |
| 526 | #define ACPI_EVENT_FLAG_WAKE_ENABLED (acpi_event_status) 0x02 | 526 | #define ACPI_EVENT_FLAG_WAKE_ENABLED (acpi_event_status) 0x02 |
| 527 | #define ACPI_EVENT_FLAG_SET (acpi_event_status) 0x04 | 527 | #define ACPI_EVENT_FLAG_SET (acpi_event_status) 0x04 |
| 528 | #define ACPI_EVENT_FLAG_HANDLE (acpi_event_status) 0x08 | ||
| 528 | 529 | ||
| 529 | /* | 530 | /* |
| 530 | * General Purpose Events (GPE) | 531 | * General Purpose Events (GPE) |
