diff options
author | Lv Zheng <lv.zheng@intel.com> | 2016-08-04 04:43:45 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-08-16 20:10:44 -0400 |
commit | 18864cc4892d207bf8bb81898f5dc7fe9e66d6f0 (patch) | |
tree | 1417480fa88b43c2ed0dc44877bce460555185f0 | |
parent | 6bd483c0367f1e1c9d4e970d6ccdadf53d571916 (diff) |
ACPI / sysfs: Use new GPE masking mechanism in GPE interface
Now GPE can be masked via the new acpi_mask_gpe() API and this patch
modifies /sys/firmware/acpi/interrupts/gpexx to use this new facility.
Writes "mask/unmask" to this file now invokes acpi_mask_gpe().
Reads from this file now returns new "EN/STS" when the corresponding GPE
hardware register's EN/STS bits are flagged, and new "masked/unmasked"
attribute to indicate the status of the masking mechanism.
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
[ rjw: Subject ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/acpi/sleep.c | 2 | ||||
-rw-r--r-- | drivers/acpi/sysfs.c | 33 |
2 files changed, 26 insertions, 9 deletions
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 2b38c1bb0446..97886634e39f 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
@@ -572,7 +572,7 @@ static int acpi_suspend_enter(suspend_state_t pm_state) | |||
572 | 572 | ||
573 | acpi_get_event_status(ACPI_EVENT_POWER_BUTTON, &pwr_btn_status); | 573 | acpi_get_event_status(ACPI_EVENT_POWER_BUTTON, &pwr_btn_status); |
574 | 574 | ||
575 | if (pwr_btn_status & ACPI_EVENT_FLAG_SET) { | 575 | if (pwr_btn_status & ACPI_EVENT_FLAG_STATUS_SET) { |
576 | acpi_clear_event(ACPI_EVENT_POWER_BUTTON); | 576 | acpi_clear_event(ACPI_EVENT_POWER_BUTTON); |
577 | /* Flag for later */ | 577 | /* Flag for later */ |
578 | pwr_btn_event_pending = true; | 578 | pwr_btn_event_pending = true; |
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c index 358165e9f5b8..703c993888b2 100644 --- a/drivers/acpi/sysfs.c +++ b/drivers/acpi/sysfs.c | |||
@@ -597,14 +597,27 @@ static ssize_t counter_show(struct kobject *kobj, | |||
597 | if (result) | 597 | if (result) |
598 | goto end; | 598 | goto end; |
599 | 599 | ||
600 | if (status & ACPI_EVENT_FLAG_ENABLE_SET) | ||
601 | size += sprintf(buf + size, " EN"); | ||
602 | else | ||
603 | size += sprintf(buf + size, " "); | ||
604 | if (status & ACPI_EVENT_FLAG_STATUS_SET) | ||
605 | size += sprintf(buf + size, " STS"); | ||
606 | else | ||
607 | size += sprintf(buf + size, " "); | ||
608 | |||
600 | if (!(status & ACPI_EVENT_FLAG_HAS_HANDLER)) | 609 | if (!(status & ACPI_EVENT_FLAG_HAS_HANDLER)) |
601 | size += sprintf(buf + size, " invalid"); | 610 | size += sprintf(buf + size, " invalid "); |
602 | else if (status & ACPI_EVENT_FLAG_ENABLED) | 611 | else if (status & ACPI_EVENT_FLAG_ENABLED) |
603 | size += sprintf(buf + size, " enabled"); | 612 | size += sprintf(buf + size, " enabled "); |
604 | else if (status & ACPI_EVENT_FLAG_WAKE_ENABLED) | 613 | else if (status & ACPI_EVENT_FLAG_WAKE_ENABLED) |
605 | size += sprintf(buf + size, " wake_enabled"); | 614 | size += sprintf(buf + size, " wake_enabled"); |
606 | else | 615 | else |
607 | size += sprintf(buf + size, " disabled"); | 616 | size += sprintf(buf + size, " disabled "); |
617 | if (status & ACPI_EVENT_FLAG_MASKED) | ||
618 | size += sprintf(buf + size, " masked "); | ||
619 | else | ||
620 | size += sprintf(buf + size, " unmasked"); | ||
608 | 621 | ||
609 | end: | 622 | end: |
610 | size += sprintf(buf + size, "\n"); | 623 | size += sprintf(buf + size, "\n"); |
@@ -655,8 +668,12 @@ static ssize_t counter_set(struct kobject *kobj, | |||
655 | !(status & ACPI_EVENT_FLAG_ENABLED)) | 668 | !(status & ACPI_EVENT_FLAG_ENABLED)) |
656 | result = acpi_enable_gpe(handle, index); | 669 | result = acpi_enable_gpe(handle, index); |
657 | else if (!strcmp(buf, "clear\n") && | 670 | else if (!strcmp(buf, "clear\n") && |
658 | (status & ACPI_EVENT_FLAG_SET)) | 671 | (status & ACPI_EVENT_FLAG_STATUS_SET)) |
659 | result = acpi_clear_gpe(handle, index); | 672 | result = acpi_clear_gpe(handle, index); |
673 | else if (!strcmp(buf, "mask\n")) | ||
674 | result = acpi_mask_gpe(handle, index, TRUE); | ||
675 | else if (!strcmp(buf, "unmask\n")) | ||
676 | result = acpi_mask_gpe(handle, index, FALSE); | ||
660 | else if (!kstrtoul(buf, 0, &tmp)) | 677 | else if (!kstrtoul(buf, 0, &tmp)) |
661 | all_counters[index].count = tmp; | 678 | all_counters[index].count = tmp; |
662 | else | 679 | else |
@@ -664,13 +681,13 @@ static ssize_t counter_set(struct kobject *kobj, | |||
664 | } else if (index < num_gpes + ACPI_NUM_FIXED_EVENTS) { | 681 | } else if (index < num_gpes + ACPI_NUM_FIXED_EVENTS) { |
665 | int event = index - num_gpes; | 682 | int event = index - num_gpes; |
666 | if (!strcmp(buf, "disable\n") && | 683 | if (!strcmp(buf, "disable\n") && |
667 | (status & ACPI_EVENT_FLAG_ENABLED)) | 684 | (status & ACPI_EVENT_FLAG_ENABLE_SET)) |
668 | result = acpi_disable_event(event, ACPI_NOT_ISR); | 685 | result = acpi_disable_event(event, ACPI_NOT_ISR); |
669 | else if (!strcmp(buf, "enable\n") && | 686 | else if (!strcmp(buf, "enable\n") && |
670 | !(status & ACPI_EVENT_FLAG_ENABLED)) | 687 | !(status & ACPI_EVENT_FLAG_ENABLE_SET)) |
671 | result = acpi_enable_event(event, ACPI_NOT_ISR); | 688 | result = acpi_enable_event(event, ACPI_NOT_ISR); |
672 | else if (!strcmp(buf, "clear\n") && | 689 | else if (!strcmp(buf, "clear\n") && |
673 | (status & ACPI_EVENT_FLAG_SET)) | 690 | (status & ACPI_EVENT_FLAG_STATUS_SET)) |
674 | result = acpi_clear_event(event); | 691 | result = acpi_clear_event(event); |
675 | else if (!kstrtoul(buf, 0, &tmp)) | 692 | else if (!kstrtoul(buf, 0, &tmp)) |
676 | all_counters[index].count = tmp; | 693 | all_counters[index].count = tmp; |