diff options
-rw-r--r-- | Documentation/acpi/acpi-lid.txt | 16 | ||||
-rw-r--r-- | drivers/acpi/button.c | 9 | ||||
-rw-r--r-- | tools/power/acpi/.gitignore | 4 |
3 files changed, 25 insertions, 4 deletions
diff --git a/Documentation/acpi/acpi-lid.txt b/Documentation/acpi/acpi-lid.txt index 22cb3091f297..effe7af3a5af 100644 --- a/Documentation/acpi/acpi-lid.txt +++ b/Documentation/acpi/acpi-lid.txt | |||
@@ -59,20 +59,28 @@ button driver uses the following 3 modes in order not to trigger issues. | |||
59 | If the userspace hasn't been prepared to ignore the unreliable "opened" | 59 | If the userspace hasn't been prepared to ignore the unreliable "opened" |
60 | events and the unreliable initial state notification, Linux users can use | 60 | events and the unreliable initial state notification, Linux users can use |
61 | the following kernel parameters to handle the possible issues: | 61 | the following kernel parameters to handle the possible issues: |
62 | A. button.lid_init_state=open: | 62 | A. button.lid_init_state=method: |
63 | When this option is specified, the ACPI button driver reports the | ||
64 | initial lid state using the returning value of the _LID control method | ||
65 | and whether the "opened"/"closed" events are paired fully relies on the | ||
66 | firmware implementation. | ||
67 | This option can be used to fix some platforms where the returning value | ||
68 | of the _LID control method is reliable but the initial lid state | ||
69 | notification is missing. | ||
70 | This option is the default behavior during the period the userspace | ||
71 | isn't ready to handle the buggy AML tables. | ||
72 | B. button.lid_init_state=open: | ||
63 | When this option is specified, the ACPI button driver always reports the | 73 | When this option is specified, the ACPI button driver always reports the |
64 | initial lid state as "opened" and whether the "opened"/"closed" events | 74 | initial lid state as "opened" and whether the "opened"/"closed" events |
65 | are paired fully relies on the firmware implementation. | 75 | are paired fully relies on the firmware implementation. |
66 | This may fix some platforms where the returning value of the _LID | 76 | This may fix some platforms where the returning value of the _LID |
67 | control method is not reliable and the initial lid state notification is | 77 | control method is not reliable and the initial lid state notification is |
68 | missing. | 78 | missing. |
69 | This option is the default behavior during the period the userspace | ||
70 | isn't ready to handle the buggy AML tables. | ||
71 | 79 | ||
72 | If the userspace has been prepared to ignore the unreliable "opened" events | 80 | If the userspace has been prepared to ignore the unreliable "opened" events |
73 | and the unreliable initial state notification, Linux users should always | 81 | and the unreliable initial state notification, Linux users should always |
74 | use the following kernel parameter: | 82 | use the following kernel parameter: |
75 | B. button.lid_init_state=ignore: | 83 | C. button.lid_init_state=ignore: |
76 | When this option is specified, the ACPI button driver never reports the | 84 | When this option is specified, the ACPI button driver never reports the |
77 | initial lid state and there is a compensation mechanism implemented to | 85 | initial lid state and there is a compensation mechanism implemented to |
78 | ensure that the reliable "closed" notifications can always be delievered | 86 | ensure that the reliable "closed" notifications can always be delievered |
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index b7c2a06963d6..25aba9b107dd 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c | |||
@@ -57,6 +57,7 @@ | |||
57 | 57 | ||
58 | #define ACPI_BUTTON_LID_INIT_IGNORE 0x00 | 58 | #define ACPI_BUTTON_LID_INIT_IGNORE 0x00 |
59 | #define ACPI_BUTTON_LID_INIT_OPEN 0x01 | 59 | #define ACPI_BUTTON_LID_INIT_OPEN 0x01 |
60 | #define ACPI_BUTTON_LID_INIT_METHOD 0x02 | ||
60 | 61 | ||
61 | #define _COMPONENT ACPI_BUTTON_COMPONENT | 62 | #define _COMPONENT ACPI_BUTTON_COMPONENT |
62 | ACPI_MODULE_NAME("button"); | 63 | ACPI_MODULE_NAME("button"); |
@@ -376,6 +377,9 @@ static void acpi_lid_initialize_state(struct acpi_device *device) | |||
376 | case ACPI_BUTTON_LID_INIT_OPEN: | 377 | case ACPI_BUTTON_LID_INIT_OPEN: |
377 | (void)acpi_lid_notify_state(device, 1); | 378 | (void)acpi_lid_notify_state(device, 1); |
378 | break; | 379 | break; |
380 | case ACPI_BUTTON_LID_INIT_METHOD: | ||
381 | (void)acpi_lid_update_state(device); | ||
382 | break; | ||
379 | case ACPI_BUTTON_LID_INIT_IGNORE: | 383 | case ACPI_BUTTON_LID_INIT_IGNORE: |
380 | default: | 384 | default: |
381 | break; | 385 | break; |
@@ -560,6 +564,9 @@ static int param_set_lid_init_state(const char *val, struct kernel_param *kp) | |||
560 | if (!strncmp(val, "open", sizeof("open") - 1)) { | 564 | if (!strncmp(val, "open", sizeof("open") - 1)) { |
561 | lid_init_state = ACPI_BUTTON_LID_INIT_OPEN; | 565 | lid_init_state = ACPI_BUTTON_LID_INIT_OPEN; |
562 | pr_info("Notify initial lid state as open\n"); | 566 | pr_info("Notify initial lid state as open\n"); |
567 | } else if (!strncmp(val, "method", sizeof("method") - 1)) { | ||
568 | lid_init_state = ACPI_BUTTON_LID_INIT_METHOD; | ||
569 | pr_info("Notify initial lid state with _LID return value\n"); | ||
563 | } else if (!strncmp(val, "ignore", sizeof("ignore") - 1)) { | 570 | } else if (!strncmp(val, "ignore", sizeof("ignore") - 1)) { |
564 | lid_init_state = ACPI_BUTTON_LID_INIT_IGNORE; | 571 | lid_init_state = ACPI_BUTTON_LID_INIT_IGNORE; |
565 | pr_info("Do not notify initial lid state\n"); | 572 | pr_info("Do not notify initial lid state\n"); |
@@ -573,6 +580,8 @@ static int param_get_lid_init_state(char *buffer, struct kernel_param *kp) | |||
573 | switch (lid_init_state) { | 580 | switch (lid_init_state) { |
574 | case ACPI_BUTTON_LID_INIT_OPEN: | 581 | case ACPI_BUTTON_LID_INIT_OPEN: |
575 | return sprintf(buffer, "open"); | 582 | return sprintf(buffer, "open"); |
583 | case ACPI_BUTTON_LID_INIT_METHOD: | ||
584 | return sprintf(buffer, "method"); | ||
576 | case ACPI_BUTTON_LID_INIT_IGNORE: | 585 | case ACPI_BUTTON_LID_INIT_IGNORE: |
577 | return sprintf(buffer, "ignore"); | 586 | return sprintf(buffer, "ignore"); |
578 | default: | 587 | default: |
diff --git a/tools/power/acpi/.gitignore b/tools/power/acpi/.gitignore new file mode 100644 index 000000000000..cba3d994995c --- /dev/null +++ b/tools/power/acpi/.gitignore | |||
@@ -0,0 +1,4 @@ | |||
1 | acpidbg | ||
2 | acpidump | ||
3 | ec | ||
4 | include | ||