* [PATCH 4/5] ACPI / button: Add SW_ACPI_LID for new usage model [not found] <cover.1467717304.git.lv.zheng@intel.com> @ 2016-07-05 11:18 ` Lv Zheng [not found] ` <cover.1467875142.git.lv.zheng@intel.com> ` (2 subsequent siblings) 3 siblings, 0 replies; 27+ messages in thread From: Lv Zheng @ 2016-07-05 11:18 UTC (permalink / raw) To: Rafael J. Wysocki, Rafael J. Wysocki, Len Brown Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi, Bastien Nocera:, Benjamin Tissoires, linux-input There are many AML tables reporting wrong initial lid state, and some of them never reports lid state. As a proxy layer acting between, ACPI button driver is not able to handle all such cases, but need to re-define the usage model of the ACPI lid. That is: 1. It's initial state is not reliable; 2. There may not be open event; 3. Userspace should only take action against the close event which is reliable, always sent after a real lid close. Link: https://lkml.org/2016/3/7/460 Link: https://github.com/systemd/systemd/issues/2087 Signed-off-by: Lv Zheng <lv.zheng@intel.com> Cc: Bastien Nocera: <hadess@hadess.net> Cc: Benjamin Tissoires <benjamin.tissoires@gmail.com> Cc: linux-input@vger.kernel.org --- Documentation/acpi/acpi-lid.txt | 42 ++++++++++++++++++++++++++++++++ drivers/acpi/button.c | 20 ++++++++++----- include/linux/mod_devicetable.h | 2 +- include/uapi/linux/input-event-codes.h | 3 ++- 4 files changed, 59 insertions(+), 8 deletions(-) create mode 100644 Documentation/acpi/acpi-lid.txt diff --git a/Documentation/acpi/acpi-lid.txt b/Documentation/acpi/acpi-lid.txt new file mode 100644 index 0000000..cba200d --- /dev/null +++ b/Documentation/acpi/acpi-lid.txt @@ -0,0 +1,42 @@ +Restrictions of ACPI Control Method LID Device + +1. Expections of _LID control method's returning value + +The _LID control method is described to return the "current" lid state. +However the word of "current" has ambiguity, many BIOSen return the lid +state upon the last lid notification instead of returning the lid state +upon the last _LID evaluation. There won't be difference when the _LID +control method is evaluated during the runtime, the problem is its initial +returning value. When the BIOSen implement this control method with cached +value, the initial returning value is likely not reliable. There are simply +so many examples always retuning "close" as initial lid state. + +2. Expections on lid events + +There are many BIOSen tables never notifying the lid open event. But it is +ensured that there is always lid close events reported when the lid is +closed. This is normally used to trigger system power saving operations on +Windows, thus it is fully tested and functions correctly. + +3. Linux ACPI Control Method LID Device Users + +The userspace should stop relying on /proc/acpi/button/lid/LID0/state to +obtain the lid state. This file is only used for the testing purpose. + +New userspace should rely on the lid close event to trigger power saving +operations and may stop taking actions according to the lid open event. A +new input event SW_ACPI_LID is prepared for the new userspace to implement +the ACPI control method lid device specific logics. + +During the period the userspace hasn't been switched to use the new +SW_ACPI_LID event, Linux users can use the following boot parameter to +handle possible issues: + button.lid_init_state=method: + This is the default behavior, Linux kernel reports initial lid state + using _LID control method's returning value. + This may fixes some platforms if the _LID control method's returning + value is reliable. + button.lid_init_state=open: + Linux kernel always reports an initial lid state as "open". + This may fixes some platforms if the _LID control method's returning + value is not reliable. diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 148f4e5..4ef94d2 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c @@ -130,7 +130,8 @@ static int acpi_lid_evaluate_state(struct acpi_device *device) return lid_state ? 1 : 0; } -static int acpi_lid_notify_state(struct acpi_device *device, int state) +static int acpi_lid_notify_state(struct acpi_device *device, + int state, bool notify_acpi) { struct acpi_button *button = acpi_driver_data(device); int ret; @@ -138,6 +139,11 @@ static int acpi_lid_notify_state(struct acpi_device *device, int state) /* input layer checks if event is redundant */ input_report_switch(button->input, SW_LID, !state); input_sync(button->input); + if (notify_acpi) { + input_report_switch(button->input, + SW_ACPI_LID, !state); + input_sync(button->input); + } if (state) pm_wakeup_event(&device->dev, 0); @@ -279,7 +285,8 @@ int acpi_lid_open(void) } EXPORT_SYMBOL(acpi_lid_open); -static int acpi_lid_update_state(struct acpi_device *device) +static int acpi_lid_update_state(struct acpi_device *device, + bool notify_acpi) { int state; @@ -287,17 +294,17 @@ static int acpi_lid_update_state(struct acpi_device *device) if (state < 0) return state; - return acpi_lid_notify_state(device, state); + return acpi_lid_notify_state(device, state, notify_acpi); } static void acpi_lid_initialize_state(struct acpi_device *device) { switch (lid_init_state) { case ACPI_BUTTON_LID_INIT_OPEN: - (void)acpi_lid_notify_state(device, 1); + (void)acpi_lid_notify_state(device, 1, false); break; case ACPI_BUTTON_LID_INIT_METHOD: - (void)acpi_lid_update_state(device); + (void)acpi_lid_update_state(device, false); break; case ACPI_BUTTON_LID_INIT_IGNORE: default: @@ -317,7 +324,7 @@ static void acpi_button_notify(struct acpi_device *device, u32 event) case ACPI_BUTTON_NOTIFY_STATUS: input = button->input; if (button->type == ACPI_BUTTON_TYPE_LID) { - acpi_lid_update_state(device); + acpi_lid_update_state(device, true); } else { int keycode; @@ -436,6 +443,7 @@ static int acpi_button_add(struct acpi_device *device) case ACPI_BUTTON_TYPE_LID: input_set_capability(input, EV_SW, SW_LID); + input_set_capability(input, EV_SW, SW_ACPI_LID); break; } diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index 6e4c645..1014968 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -291,7 +291,7 @@ struct pcmcia_device_id { #define INPUT_DEVICE_ID_LED_MAX 0x0f #define INPUT_DEVICE_ID_SND_MAX 0x07 #define INPUT_DEVICE_ID_FF_MAX 0x7f -#define INPUT_DEVICE_ID_SW_MAX 0x0f +#define INPUT_DEVICE_ID_SW_MAX 0x10 #define INPUT_DEVICE_ID_MATCH_BUS 1 #define INPUT_DEVICE_ID_MATCH_VENDOR 2 diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h index 737fa32..81c344c 100644 --- a/include/uapi/linux/input-event-codes.h +++ b/include/uapi/linux/input-event-codes.h @@ -780,7 +780,8 @@ #define SW_ROTATE_LOCK 0x0c /* set = rotate locked/disabled */ #define SW_LINEIN_INSERT 0x0d /* set = inserted */ #define SW_MUTE_DEVICE 0x0e /* set = device disabled */ -#define SW_MAX 0x0f +#define SW_ACPI_LID 0x0f /* set = lid shut */ +#define SW_MAX 0x10 #define SW_CNT (SW_MAX+1) /* -- 1.7.10 ^ permalink raw reply related [flat|nested] 27+ messages in thread
[parent not found: <cover.1467875142.git.lv.zheng@intel.com>]
* [PATCH v2 3/4] ACPI / button: Add SW_ACPI_LID for new usage model [not found] ` <cover.1467875142.git.lv.zheng@intel.com> @ 2016-07-07 7:10 ` Lv Zheng 2016-07-08 9:27 ` Benjamin Tissoires 2016-07-07 7:11 ` [PATCH v2 4/4] ACPI / button: Add document for ACPI control method lid device restrictions Lv Zheng 1 sibling, 1 reply; 27+ messages in thread From: Lv Zheng @ 2016-07-07 7:10 UTC (permalink / raw) To: Rafael J. Wysocki, Rafael J. Wysocki, Len Brown Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi, Bastien Nocera:, Benjamin Tissoires, linux-input There are many AML tables reporting wrong initial lid state, and some of them never reports lid state. As a proxy layer acting between, ACPI button driver is not able to handle all such cases, but need to re-define the usage model of the ACPI lid. That is: 1. It's initial state is not reliable; 2. There may not be open event; 3. Userspace should only take action against the close event which is reliable, always sent after a real lid close. This patch adds a new input key event so that new userspace programs can use it to handle this usage model correctly. And in the meanwhile, no old programs will be broken by the userspace changes. Link: https://lkml.org/2016/3/7/460 Link: https://github.com/systemd/systemd/issues/2087 Signed-off-by: Lv Zheng <lv.zheng@intel.com> Cc: Bastien Nocera: <hadess@hadess.net> Cc: Benjamin Tissoires <benjamin.tissoires@gmail.com> Cc: linux-input@vger.kernel.org --- drivers/acpi/button.c | 20 ++++++++++++++------ include/linux/mod_devicetable.h | 2 +- include/uapi/linux/input-event-codes.h | 3 ++- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 148f4e5..4ef94d2 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c @@ -130,7 +130,8 @@ static int acpi_lid_evaluate_state(struct acpi_device *device) return lid_state ? 1 : 0; } -static int acpi_lid_notify_state(struct acpi_device *device, int state) +static int acpi_lid_notify_state(struct acpi_device *device, + int state, bool notify_acpi) { struct acpi_button *button = acpi_driver_data(device); int ret; @@ -138,6 +139,11 @@ static int acpi_lid_notify_state(struct acpi_device *device, int state) /* input layer checks if event is redundant */ input_report_switch(button->input, SW_LID, !state); input_sync(button->input); + if (notify_acpi) { + input_report_switch(button->input, + SW_ACPI_LID, !state); + input_sync(button->input); + } if (state) pm_wakeup_event(&device->dev, 0); @@ -279,7 +285,8 @@ int acpi_lid_open(void) } EXPORT_SYMBOL(acpi_lid_open); -static int acpi_lid_update_state(struct acpi_device *device) +static int acpi_lid_update_state(struct acpi_device *device, + bool notify_acpi) { int state; @@ -287,17 +294,17 @@ static int acpi_lid_update_state(struct acpi_device *device) if (state < 0) return state; - return acpi_lid_notify_state(device, state); + return acpi_lid_notify_state(device, state, notify_acpi); } static void acpi_lid_initialize_state(struct acpi_device *device) { switch (lid_init_state) { case ACPI_BUTTON_LID_INIT_OPEN: - (void)acpi_lid_notify_state(device, 1); + (void)acpi_lid_notify_state(device, 1, false); break; case ACPI_BUTTON_LID_INIT_METHOD: - (void)acpi_lid_update_state(device); + (void)acpi_lid_update_state(device, false); break; case ACPI_BUTTON_LID_INIT_IGNORE: default: @@ -317,7 +324,7 @@ static void acpi_button_notify(struct acpi_device *device, u32 event) case ACPI_BUTTON_NOTIFY_STATUS: input = button->input; if (button->type == ACPI_BUTTON_TYPE_LID) { - acpi_lid_update_state(device); + acpi_lid_update_state(device, true); } else { int keycode; @@ -436,6 +443,7 @@ static int acpi_button_add(struct acpi_device *device) case ACPI_BUTTON_TYPE_LID: input_set_capability(input, EV_SW, SW_LID); + input_set_capability(input, EV_SW, SW_ACPI_LID); break; } diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index 6e4c645..1014968 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -291,7 +291,7 @@ struct pcmcia_device_id { #define INPUT_DEVICE_ID_LED_MAX 0x0f #define INPUT_DEVICE_ID_SND_MAX 0x07 #define INPUT_DEVICE_ID_FF_MAX 0x7f -#define INPUT_DEVICE_ID_SW_MAX 0x0f +#define INPUT_DEVICE_ID_SW_MAX 0x10 #define INPUT_DEVICE_ID_MATCH_BUS 1 #define INPUT_DEVICE_ID_MATCH_VENDOR 2 diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h index 737fa32..81c344c 100644 --- a/include/uapi/linux/input-event-codes.h +++ b/include/uapi/linux/input-event-codes.h @@ -780,7 +780,8 @@ #define SW_ROTATE_LOCK 0x0c /* set = rotate locked/disabled */ #define SW_LINEIN_INSERT 0x0d /* set = inserted */ #define SW_MUTE_DEVICE 0x0e /* set = device disabled */ -#define SW_MAX 0x0f +#define SW_ACPI_LID 0x0f /* set = lid shut */ +#define SW_MAX 0x10 #define SW_CNT (SW_MAX+1) /* -- 1.7.10 ^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH v2 3/4] ACPI / button: Add SW_ACPI_LID for new usage model 2016-07-07 7:10 ` [PATCH v2 3/4] " Lv Zheng @ 2016-07-08 9:27 ` Benjamin Tissoires 2016-07-08 17:55 ` Dmitry Torokhov 0 siblings, 1 reply; 27+ messages in thread From: Benjamin Tissoires @ 2016-07-08 9:27 UTC (permalink / raw) To: Lv Zheng Cc: Rafael J. Wysocki, Rafael J. Wysocki, Len Brown, Lv Zheng, linux-kernel@vger.kernel.org, ACPI Devel Maling List, Bastien Nocera:, linux-input, Dmitry Torokhov On Thu, Jul 7, 2016 at 9:10 AM, Lv Zheng <lv.zheng@intel.com> wrote: > There are many AML tables reporting wrong initial lid state, and some of > them never reports lid state. As a proxy layer acting between, ACPI button > driver is not able to handle all such cases, but need to re-define the > usage model of the ACPI lid. That is: > 1. It's initial state is not reliable; > 2. There may not be open event; > 3. Userspace should only take action against the close event which is > reliable, always sent after a real lid close. > This patch adds a new input key event so that new userspace programs can > use it to handle this usage model correctly. And in the meanwhile, no old > programs will be broken by the userspace changes. > > Link: https://lkml.org/2016/3/7/460 > Link: https://github.com/systemd/systemd/issues/2087 > Signed-off-by: Lv Zheng <lv.zheng@intel.com> > Cc: Bastien Nocera: <hadess@hadess.net> > Cc: Benjamin Tissoires <benjamin.tissoires@gmail.com> > Cc: linux-input@vger.kernel.org > --- > drivers/acpi/button.c | 20 ++++++++++++++------ > include/linux/mod_devicetable.h | 2 +- > include/uapi/linux/input-event-codes.h | 3 ++- > 3 files changed, 17 insertions(+), 8 deletions(-) > > diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c > index 148f4e5..4ef94d2 100644 > --- a/drivers/acpi/button.c > +++ b/drivers/acpi/button.c > @@ -130,7 +130,8 @@ static int acpi_lid_evaluate_state(struct acpi_device *device) > return lid_state ? 1 : 0; > } > > -static int acpi_lid_notify_state(struct acpi_device *device, int state) > +static int acpi_lid_notify_state(struct acpi_device *device, > + int state, bool notify_acpi) > { > struct acpi_button *button = acpi_driver_data(device); > int ret; > @@ -138,6 +139,11 @@ static int acpi_lid_notify_state(struct acpi_device *device, int state) > /* input layer checks if event is redundant */ > input_report_switch(button->input, SW_LID, !state); > input_sync(button->input); > + if (notify_acpi) { > + input_report_switch(button->input, > + SW_ACPI_LID, !state); > + input_sync(button->input); If you use a switch, you'll never send subsequent open state if you doesn't close it yourself. See my comments in 5/5 and please use a KEY event instead. > + } > > if (state) > pm_wakeup_event(&device->dev, 0); > @@ -279,7 +285,8 @@ int acpi_lid_open(void) > } > EXPORT_SYMBOL(acpi_lid_open); > > -static int acpi_lid_update_state(struct acpi_device *device) > +static int acpi_lid_update_state(struct acpi_device *device, > + bool notify_acpi) > { > int state; > > @@ -287,17 +294,17 @@ static int acpi_lid_update_state(struct acpi_device *device) > if (state < 0) > return state; > > - return acpi_lid_notify_state(device, state); > + return acpi_lid_notify_state(device, state, notify_acpi); > } > > static void acpi_lid_initialize_state(struct acpi_device *device) > { > switch (lid_init_state) { > case ACPI_BUTTON_LID_INIT_OPEN: > - (void)acpi_lid_notify_state(device, 1); > + (void)acpi_lid_notify_state(device, 1, false); > break; > case ACPI_BUTTON_LID_INIT_METHOD: > - (void)acpi_lid_update_state(device); > + (void)acpi_lid_update_state(device, false); > break; > case ACPI_BUTTON_LID_INIT_IGNORE: > default: > @@ -317,7 +324,7 @@ static void acpi_button_notify(struct acpi_device *device, u32 event) > case ACPI_BUTTON_NOTIFY_STATUS: > input = button->input; > if (button->type == ACPI_BUTTON_TYPE_LID) { > - acpi_lid_update_state(device); > + acpi_lid_update_state(device, true); > } else { > int keycode; > > @@ -436,6 +443,7 @@ static int acpi_button_add(struct acpi_device *device) > > case ACPI_BUTTON_TYPE_LID: > input_set_capability(input, EV_SW, SW_LID); > + input_set_capability(input, EV_SW, SW_ACPI_LID); Can't we export this new event only if the _LID function is not reliable? This could check for the module parameter lid_init_state and only enable it for ACPI_BUTTON_LID_INIT_OPEN. I really hope we will be able to find a reliable way to determine whether or not the platform support reliable LID state. If not, there might be a need to have a db of reliable switch platforms. This can be set in the kernel or with a hwdb entry in userspace. Cheers, Benjamin > break; > } > > diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h > index 6e4c645..1014968 100644 > --- a/include/linux/mod_devicetable.h > +++ b/include/linux/mod_devicetable.h > @@ -291,7 +291,7 @@ struct pcmcia_device_id { > #define INPUT_DEVICE_ID_LED_MAX 0x0f > #define INPUT_DEVICE_ID_SND_MAX 0x07 > #define INPUT_DEVICE_ID_FF_MAX 0x7f > -#define INPUT_DEVICE_ID_SW_MAX 0x0f > +#define INPUT_DEVICE_ID_SW_MAX 0x10 > > #define INPUT_DEVICE_ID_MATCH_BUS 1 > #define INPUT_DEVICE_ID_MATCH_VENDOR 2 > diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h > index 737fa32..81c344c 100644 > --- a/include/uapi/linux/input-event-codes.h > +++ b/include/uapi/linux/input-event-codes.h > @@ -780,7 +780,8 @@ > #define SW_ROTATE_LOCK 0x0c /* set = rotate locked/disabled */ > #define SW_LINEIN_INSERT 0x0d /* set = inserted */ > #define SW_MUTE_DEVICE 0x0e /* set = device disabled */ > -#define SW_MAX 0x0f > +#define SW_ACPI_LID 0x0f /* set = lid shut */ > +#define SW_MAX 0x10 > #define SW_CNT (SW_MAX+1) > > /* > -- > 1.7.10 > ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH v2 3/4] ACPI / button: Add SW_ACPI_LID for new usage model 2016-07-08 9:27 ` Benjamin Tissoires @ 2016-07-08 17:55 ` Dmitry Torokhov 0 siblings, 0 replies; 27+ messages in thread From: Dmitry Torokhov @ 2016-07-08 17:55 UTC (permalink / raw) To: Benjamin Tissoires Cc: Lv Zheng, Rafael J. Wysocki, Rafael J. Wysocki, Len Brown, Lv Zheng, linux-kernel@vger.kernel.org, ACPI Devel Maling List, Bastien Nocera:, linux-input On Fri, Jul 08, 2016 at 11:27:23AM +0200, Benjamin Tissoires wrote: > On Thu, Jul 7, 2016 at 9:10 AM, Lv Zheng <lv.zheng@intel.com> wrote: > > There are many AML tables reporting wrong initial lid state, and some of > > them never reports lid state. As a proxy layer acting between, ACPI button > > driver is not able to handle all such cases, but need to re-define the > > usage model of the ACPI lid. That is: > > 1. It's initial state is not reliable; > > 2. There may not be open event; > > 3. Userspace should only take action against the close event which is > > reliable, always sent after a real lid close. > > This patch adds a new input key event so that new userspace programs can > > use it to handle this usage model correctly. And in the meanwhile, no old > > programs will be broken by the userspace changes. > > > > Link: https://lkml.org/2016/3/7/460 Does not work for me. > > Link: https://github.com/systemd/systemd/issues/2087 Gives me info about pull "Basic DNSSEC support, and unrelated fixes" > > Signed-off-by: Lv Zheng <lv.zheng@intel.com> > > Cc: Bastien Nocera: <hadess@hadess.net> > > Cc: Benjamin Tissoires <benjamin.tissoires@gmail.com> > > Cc: linux-input@vger.kernel.org > > --- > > drivers/acpi/button.c | 20 ++++++++++++++------ > > include/linux/mod_devicetable.h | 2 +- > > include/uapi/linux/input-event-codes.h | 3 ++- > > 3 files changed, 17 insertions(+), 8 deletions(-) > > > > diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c > > index 148f4e5..4ef94d2 100644 > > --- a/drivers/acpi/button.c > > +++ b/drivers/acpi/button.c > > @@ -130,7 +130,8 @@ static int acpi_lid_evaluate_state(struct acpi_device *device) > > return lid_state ? 1 : 0; > > } > > > > -static int acpi_lid_notify_state(struct acpi_device *device, int state) > > +static int acpi_lid_notify_state(struct acpi_device *device, > > + int state, bool notify_acpi) > > { > > struct acpi_button *button = acpi_driver_data(device); > > int ret; > > @@ -138,6 +139,11 @@ static int acpi_lid_notify_state(struct acpi_device *device, int state) > > /* input layer checks if event is redundant */ > > input_report_switch(button->input, SW_LID, !state); > > input_sync(button->input); > > + if (notify_acpi) { > > + input_report_switch(button->input, > > + SW_ACPI_LID, !state); > > + input_sync(button->input); > > If you use a switch, you'll never send subsequent open state if you > doesn't close it yourself. > See my comments in 5/5 and please use a KEY event instead. > > > + } > > > > if (state) > > pm_wakeup_event(&device->dev, 0); > > @@ -279,7 +285,8 @@ int acpi_lid_open(void) > > } > > EXPORT_SYMBOL(acpi_lid_open); > > > > -static int acpi_lid_update_state(struct acpi_device *device) > > +static int acpi_lid_update_state(struct acpi_device *device, > > + bool notify_acpi) > > { > > int state; > > > > @@ -287,17 +294,17 @@ static int acpi_lid_update_state(struct acpi_device *device) > > if (state < 0) > > return state; > > > > - return acpi_lid_notify_state(device, state); > > + return acpi_lid_notify_state(device, state, notify_acpi); > > } > > > > static void acpi_lid_initialize_state(struct acpi_device *device) > > { > > switch (lid_init_state) { > > case ACPI_BUTTON_LID_INIT_OPEN: > > - (void)acpi_lid_notify_state(device, 1); > > + (void)acpi_lid_notify_state(device, 1, false); > > break; > > case ACPI_BUTTON_LID_INIT_METHOD: > > - (void)acpi_lid_update_state(device); > > + (void)acpi_lid_update_state(device, false); > > break; > > case ACPI_BUTTON_LID_INIT_IGNORE: > > default: > > @@ -317,7 +324,7 @@ static void acpi_button_notify(struct acpi_device *device, u32 event) > > case ACPI_BUTTON_NOTIFY_STATUS: > > input = button->input; > > if (button->type == ACPI_BUTTON_TYPE_LID) { > > - acpi_lid_update_state(device); > > + acpi_lid_update_state(device, true); > > } else { > > int keycode; > > > > @@ -436,6 +443,7 @@ static int acpi_button_add(struct acpi_device *device) > > > > case ACPI_BUTTON_TYPE_LID: > > input_set_capability(input, EV_SW, SW_LID); > > + input_set_capability(input, EV_SW, SW_ACPI_LID); > > Can't we export this new event only if the _LID function is not > reliable? This could check for the module parameter lid_init_state and > only enable it for ACPI_BUTTON_LID_INIT_OPEN. > > I really hope we will be able to find a reliable way to determine > whether or not the platform support reliable LID state. If not, there > might be a need to have a db of reliable switch platforms. This can be > set in the kernel or with a hwdb entry in userspace. > > Cheers, > Benjamin > > > break; > > } > > > > diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h > > index 6e4c645..1014968 100644 > > --- a/include/linux/mod_devicetable.h > > +++ b/include/linux/mod_devicetable.h > > @@ -291,7 +291,7 @@ struct pcmcia_device_id { > > #define INPUT_DEVICE_ID_LED_MAX 0x0f > > #define INPUT_DEVICE_ID_SND_MAX 0x07 > > #define INPUT_DEVICE_ID_FF_MAX 0x7f > > -#define INPUT_DEVICE_ID_SW_MAX 0x0f > > +#define INPUT_DEVICE_ID_SW_MAX 0x10 > > > > #define INPUT_DEVICE_ID_MATCH_BUS 1 > > #define INPUT_DEVICE_ID_MATCH_VENDOR 2 > > diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h > > index 737fa32..81c344c 100644 > > --- a/include/uapi/linux/input-event-codes.h > > +++ b/include/uapi/linux/input-event-codes.h > > @@ -780,7 +780,8 @@ > > #define SW_ROTATE_LOCK 0x0c /* set = rotate locked/disabled */ > > #define SW_LINEIN_INSERT 0x0d /* set = inserted */ > > #define SW_MUTE_DEVICE 0x0e /* set = device disabled */ > > -#define SW_MAX 0x0f > > +#define SW_ACPI_LID 0x0f /* set = lid shut */ 0x0f is busy already. > > +#define SW_MAX 0x10 > > #define SW_CNT (SW_MAX+1) > > > > /* > > -- > > 1.7.10 > > -- Dmitry ^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH v2 4/4] ACPI / button: Add document for ACPI control method lid device restrictions [not found] ` <cover.1467875142.git.lv.zheng@intel.com> 2016-07-07 7:10 ` [PATCH v2 3/4] " Lv Zheng @ 2016-07-07 7:11 ` Lv Zheng 2016-07-08 9:17 ` Benjamin Tissoires 1 sibling, 1 reply; 27+ messages in thread From: Lv Zheng @ 2016-07-07 7:11 UTC (permalink / raw) To: Rafael J. Wysocki, Rafael J. Wysocki, Len Brown Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi, Bastien Nocera:, Benjamin Tissoires, linux-input There are many AML tables reporting wrong initial lid state, and some of them never reports lid state. As a proxy layer acting between, ACPI button driver is not able to handle all such cases, but need to re-define the usage model of the ACPI lid. That is: 1. It's initial state is not reliable; 2. There may not be open event; 3. Userspace should only take action against the close event which is reliable, always sent after a real lid close. This patch adds documentation of the usage model. Link: https://lkml.org/2016/3/7/460 Link: https://github.com/systemd/systemd/issues/2087 Signed-off-by: Lv Zheng <lv.zheng@intel.com> Cc: Bastien Nocera: <hadess@hadess.net> Cc: Benjamin Tissoires <benjamin.tissoires@gmail.com> Cc: linux-input@vger.kernel.org --- Documentation/acpi/acpi-lid.txt | 62 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 Documentation/acpi/acpi-lid.txt diff --git a/Documentation/acpi/acpi-lid.txt b/Documentation/acpi/acpi-lid.txt new file mode 100644 index 0000000..7e4f7ed --- /dev/null +++ b/Documentation/acpi/acpi-lid.txt @@ -0,0 +1,62 @@ +Usage Model of the ACPI Control Method Lid Device + +Copyright (C) 2016, Intel Corporation +Author: Lv Zheng <lv.zheng@intel.com> + + +Abstract: + +Platforms containing lids convey lid state (open/close) to OSPMs using a +control method lid device. To implement this, the AML tables issue +Notify(lid_device, 0x80) to notify the OSPMs whenever the lid state has +changed. The _LID control method for the lid device must be implemented to +report the "current" state of the lid as either "opened" or "closed". + +This document describes the restrictions and the expections of the Linux +ACPI lid device driver. + + +1. Restrictions of the returning value of the _LID control method + +The _LID control method is described to return the "current" lid state. +However the word of "current" has ambiguity, many AML tables return the lid +state upon the last lid notification instead of returning the lid state +upon the last _LID evaluation. There won't be difference when the _LID +control method is evaluated during the runtime, the problem is its initial +returning value. When the AML tables implement this control method with +cached value, the initial returning value is likely not reliable. There are +simply so many examples always retuning "closed" as initial lid state. + +2. Restrictions of the lid state change notifications + +There are many AML tables never notifying when the lid device state is +changed to "opened". But it is ensured that the AML tables always notify +"closed" when the lid state is changed to "closed". This is normally used +to trigger some system power saving operations on Windows. Since it is +fully tested, this notification is reliable for all AML tables. + +3. Expections for the userspace users of the ACPI lid device driver + +The userspace programs should stop relying on +/proc/acpi/button/lid/LID0/state to obtain the lid state. This file is only +used for the validation purpose. + +New userspace programs should rely on the lid "closed" notification to +trigger some power saving operations and may stop taking actions according +to the lid "opened" notification. A new input switch event - SW_ACPI_LID is +prepared for the new userspace to implement this ACPI control method lid +device specific logics. + +During the period the userspace hasn't been switched to use the new +SW_ACPI_LID event, Linux users can use the following boot parameter to +handle possible issues: + button.lid_init_state=method: + This is the default behavior of the Linux ACPI lid driver, Linux kernel + reports the initial lid state using the returning value of the _LID + control method. + This can be used to fix some platforms if the _LID control method's + returning value is reliable. + button.lid_init_state=open: + Linux kernel always reports the initial lid state as "opened". + This may fix some platforms if the returning value of the _LID control + method is not reliable. -- 1.7.10 ^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH v2 4/4] ACPI / button: Add document for ACPI control method lid device restrictions 2016-07-07 7:11 ` [PATCH v2 4/4] ACPI / button: Add document for ACPI control method lid device restrictions Lv Zheng @ 2016-07-08 9:17 ` Benjamin Tissoires 2016-07-08 17:51 ` Dmitry Torokhov 2016-07-11 3:20 ` Zheng, Lv 0 siblings, 2 replies; 27+ messages in thread From: Benjamin Tissoires @ 2016-07-08 9:17 UTC (permalink / raw) To: Lv Zheng Cc: Rafael J. Wysocki, Rafael J. Wysocki, Len Brown, Lv Zheng, linux-kernel@vger.kernel.org, ACPI Devel Maling List, Bastien Nocera:, linux-input, Dmitry Torokhov Hi, On Thu, Jul 7, 2016 at 9:11 AM, Lv Zheng <lv.zheng@intel.com> wrote: > There are many AML tables reporting wrong initial lid state, and some of > them never reports lid state. As a proxy layer acting between, ACPI button > driver is not able to handle all such cases, but need to re-define the > usage model of the ACPI lid. That is: > 1. It's initial state is not reliable; > 2. There may not be open event; > 3. Userspace should only take action against the close event which is > reliable, always sent after a real lid close. > This patch adds documentation of the usage model. > > Link: https://lkml.org/2016/3/7/460 > Link: https://github.com/systemd/systemd/issues/2087 > Signed-off-by: Lv Zheng <lv.zheng@intel.com> > Cc: Bastien Nocera: <hadess@hadess.net> > Cc: Benjamin Tissoires <benjamin.tissoires@gmail.com> > Cc: linux-input@vger.kernel.org > --- > Documentation/acpi/acpi-lid.txt | 62 +++++++++++++++++++++++++++++++++++++++ > 1 file changed, 62 insertions(+) > create mode 100644 Documentation/acpi/acpi-lid.txt > > diff --git a/Documentation/acpi/acpi-lid.txt b/Documentation/acpi/acpi-lid.txt > new file mode 100644 > index 0000000..7e4f7ed > --- /dev/null > +++ b/Documentation/acpi/acpi-lid.txt > @@ -0,0 +1,62 @@ > +Usage Model of the ACPI Control Method Lid Device > + > +Copyright (C) 2016, Intel Corporation > +Author: Lv Zheng <lv.zheng@intel.com> > + > + > +Abstract: > + > +Platforms containing lids convey lid state (open/close) to OSPMs using a > +control method lid device. To implement this, the AML tables issue > +Notify(lid_device, 0x80) to notify the OSPMs whenever the lid state has > +changed. The _LID control method for the lid device must be implemented to > +report the "current" state of the lid as either "opened" or "closed". > + > +This document describes the restrictions and the expections of the Linux > +ACPI lid device driver. > + > + > +1. Restrictions of the returning value of the _LID control method > + > +The _LID control method is described to return the "current" lid state. > +However the word of "current" has ambiguity, many AML tables return the lid > +state upon the last lid notification instead of returning the lid state > +upon the last _LID evaluation. There won't be difference when the _LID > +control method is evaluated during the runtime, the problem is its initial > +returning value. When the AML tables implement this control method with > +cached value, the initial returning value is likely not reliable. There are > +simply so many examples always retuning "closed" as initial lid state. > + > +2. Restrictions of the lid state change notifications > + > +There are many AML tables never notifying when the lid device state is > +changed to "opened". But it is ensured that the AML tables always notify > +"closed" when the lid state is changed to "closed". This is normally used > +to trigger some system power saving operations on Windows. Since it is > +fully tested, this notification is reliable for all AML tables. > + > +3. Expections for the userspace users of the ACPI lid device driver > + > +The userspace programs should stop relying on > +/proc/acpi/button/lid/LID0/state to obtain the lid state. This file is only > +used for the validation purpose. I'd say: this file actually calls the _LID method described above. And given the previous explanation, it is not reliable enough on some platforms. So it is strongly advised for user-space program to not solely rely on this file to determine the actual lid state. > + > +New userspace programs should rely on the lid "closed" notification to > +trigger some power saving operations and may stop taking actions according > +to the lid "opened" notification. A new input switch event - SW_ACPI_LID is > +prepared for the new userspace to implement this ACPI control method lid > +device specific logics. That's not entirely what we discussed before (to prevent regressions): - if the device doesn't have reliable LID switch state, then there would be the new input event, and so userspace should only rely on opened notifications. - if the device has reliable switch information, the new input event should not be exported and userspace knows that the current input switch event is reliable. Also, using a new "switch" event is a terrible idea. Switches have a state (open/close) and you are using this to forward a single open event. So using a switch just allows you to say to userspace you are using the "new" LID meaning, but you'll still have to manually reset the switch and you will have to document how this event is not a switch. Please use a simple KEY_LID_OPEN event you will send through [input_key_event(KEY_LID_OPEN, 1), input_sync(), input_key_event(KEY_LID_OPEN, 0), input_sync()], which userspace knows how to handle. > + > +During the period the userspace hasn't been switched to use the new > +SW_ACPI_LID event, Linux users can use the following boot parameter to > +handle possible issues: > + button.lid_init_state=method: > + This is the default behavior of the Linux ACPI lid driver, Linux kernel > + reports the initial lid state using the returning value of the _LID > + control method. > + This can be used to fix some platforms if the _LID control method's > + returning value is reliable. > + button.lid_init_state=open: > + Linux kernel always reports the initial lid state as "opened". > + This may fix some platforms if the returning value of the _LID control > + method is not reliable. This worries me as there is no plan after "During the period the userspace hasn't been switched to use the new event". I really hope you'll keep sending SW_LID for reliable LID platforms, and not remove it entirely as you will break platforms. Cheers, Benjamin > -- > 1.7.10 > ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH v2 4/4] ACPI / button: Add document for ACPI control method lid device restrictions 2016-07-08 9:17 ` Benjamin Tissoires @ 2016-07-08 17:51 ` Dmitry Torokhov 2016-07-11 11:34 ` Benjamin Tissoires 2016-07-19 7:17 ` Zheng, Lv 2016-07-11 3:20 ` Zheng, Lv 1 sibling, 2 replies; 27+ messages in thread From: Dmitry Torokhov @ 2016-07-08 17:51 UTC (permalink / raw) To: Benjamin Tissoires Cc: Lv Zheng, Rafael J. Wysocki, Rafael J. Wysocki, Len Brown, Lv Zheng, linux-kernel@vger.kernel.org, ACPI Devel Maling List, Bastien Nocera:, linux-input On Fri, Jul 08, 2016 at 11:17:39AM +0200, Benjamin Tissoires wrote: > Hi, > > On Thu, Jul 7, 2016 at 9:11 AM, Lv Zheng <lv.zheng@intel.com> wrote: > > There are many AML tables reporting wrong initial lid state, and some of > > them never reports lid state. As a proxy layer acting between, ACPI button > > driver is not able to handle all such cases, but need to re-define the > > usage model of the ACPI lid. That is: > > 1. It's initial state is not reliable; > > 2. There may not be open event; > > 3. Userspace should only take action against the close event which is > > reliable, always sent after a real lid close. > > This patch adds documentation of the usage model. > > > > Link: https://lkml.org/2016/3/7/460 > > Link: https://github.com/systemd/systemd/issues/2087 > > Signed-off-by: Lv Zheng <lv.zheng@intel.com> > > Cc: Bastien Nocera: <hadess@hadess.net> > > Cc: Benjamin Tissoires <benjamin.tissoires@gmail.com> > > Cc: linux-input@vger.kernel.org > > --- > > Documentation/acpi/acpi-lid.txt | 62 +++++++++++++++++++++++++++++++++++++++ > > 1 file changed, 62 insertions(+) > > create mode 100644 Documentation/acpi/acpi-lid.txt > > > > diff --git a/Documentation/acpi/acpi-lid.txt b/Documentation/acpi/acpi-lid.txt > > new file mode 100644 > > index 0000000..7e4f7ed > > --- /dev/null > > +++ b/Documentation/acpi/acpi-lid.txt > > @@ -0,0 +1,62 @@ > > +Usage Model of the ACPI Control Method Lid Device > > + > > +Copyright (C) 2016, Intel Corporation > > +Author: Lv Zheng <lv.zheng@intel.com> > > + > > + > > +Abstract: > > + > > +Platforms containing lids convey lid state (open/close) to OSPMs using a > > +control method lid device. To implement this, the AML tables issue > > +Notify(lid_device, 0x80) to notify the OSPMs whenever the lid state has > > +changed. The _LID control method for the lid device must be implemented to > > +report the "current" state of the lid as either "opened" or "closed". > > + > > +This document describes the restrictions and the expections of the Linux > > +ACPI lid device driver. > > + > > + > > +1. Restrictions of the returning value of the _LID control method > > + > > +The _LID control method is described to return the "current" lid state. > > +However the word of "current" has ambiguity, many AML tables return the lid > > +state upon the last lid notification instead of returning the lid state > > +upon the last _LID evaluation. There won't be difference when the _LID > > +control method is evaluated during the runtime, the problem is its initial > > +returning value. When the AML tables implement this control method with > > +cached value, the initial returning value is likely not reliable. There are > > +simply so many examples always retuning "closed" as initial lid state. > > + > > +2. Restrictions of the lid state change notifications > > + > > +There are many AML tables never notifying when the lid device state is > > +changed to "opened". But it is ensured that the AML tables always notify > > +"closed" when the lid state is changed to "closed". This is normally used > > +to trigger some system power saving operations on Windows. Since it is > > +fully tested, this notification is reliable for all AML tables. > > + > > +3. Expections for the userspace users of the ACPI lid device driver > > + > > +The userspace programs should stop relying on > > +/proc/acpi/button/lid/LID0/state to obtain the lid state. This file is only > > +used for the validation purpose. > > I'd say: this file actually calls the _LID method described above. And > given the previous explanation, it is not reliable enough on some > platforms. So it is strongly advised for user-space program to not > solely rely on this file to determine the actual lid state. > > > + > > +New userspace programs should rely on the lid "closed" notification to > > +trigger some power saving operations and may stop taking actions according > > +to the lid "opened" notification. A new input switch event - SW_ACPI_LID is > > +prepared for the new userspace to implement this ACPI control method lid > > +device specific logics. > > That's not entirely what we discussed before (to prevent regressions): > - if the device doesn't have reliable LID switch state, then there > would be the new input event, and so userspace should only rely on > opened notifications. > - if the device has reliable switch information, the new input event > should not be exported and userspace knows that the current input > switch event is reliable. > > Also, using a new "switch" event is a terrible idea. Switches have a > state (open/close) and you are using this to forward a single open > event. So using a switch just allows you to say to userspace you are > using the "new" LID meaning, but you'll still have to manually reset > the switch and you will have to document how this event is not a > switch. > > Please use a simple KEY_LID_OPEN event you will send through > [input_key_event(KEY_LID_OPEN, 1), input_sync(), > input_key_event(KEY_LID_OPEN, 0), input_sync()], which userspace knows > how to handle. > > > + > > +During the period the userspace hasn't been switched to use the new > > +SW_ACPI_LID event, Linux users can use the following boot parameter to > > +handle possible issues: > > + button.lid_init_state=method: > > + This is the default behavior of the Linux ACPI lid driver, Linux kernel > > + reports the initial lid state using the returning value of the _LID > > + control method. > > + This can be used to fix some platforms if the _LID control method's > > + returning value is reliable. > > + button.lid_init_state=open: > > + Linux kernel always reports the initial lid state as "opened". > > + This may fix some platforms if the returning value of the _LID control > > + method is not reliable. > > This worries me as there is no plan after "During the period the > userspace hasn't been switched to use the new event". > > I really hope you'll keep sending SW_LID for reliable LID platforms, > and not remove it entirely as you will break platforms. How about we leave the kernel alone and userspace (which would have to cope with the new KEY_LID_OPEN anyway) would just have to know that if switch's parent is PNP0C0D:00 (or phys is PNP0C0D/button/input0) then it can't trust the events and it needs additional heuristics. Thanks. -- Dmitry ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH v2 4/4] ACPI / button: Add document for ACPI control method lid device restrictions 2016-07-08 17:51 ` Dmitry Torokhov @ 2016-07-11 11:34 ` Benjamin Tissoires 2016-07-12 0:41 ` Dmitry Torokhov 2016-07-12 7:13 ` Zheng, Lv 2016-07-19 7:17 ` Zheng, Lv 1 sibling, 2 replies; 27+ messages in thread From: Benjamin Tissoires @ 2016-07-11 11:34 UTC (permalink / raw) To: Dmitry Torokhov Cc: Lv Zheng, Rafael J. Wysocki, Rafael J. Wysocki, Len Brown, Lv Zheng, linux-kernel@vger.kernel.org, ACPI Devel Maling List, Bastien Nocera:, linux-input On Fri, Jul 8, 2016 at 7:51 PM, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote: > On Fri, Jul 08, 2016 at 11:17:39AM +0200, Benjamin Tissoires wrote: >> Hi, >> >> On Thu, Jul 7, 2016 at 9:11 AM, Lv Zheng <lv.zheng@intel.com> wrote: >> > There are many AML tables reporting wrong initial lid state, and some of >> > them never reports lid state. As a proxy layer acting between, ACPI button >> > driver is not able to handle all such cases, but need to re-define the >> > usage model of the ACPI lid. That is: >> > 1. It's initial state is not reliable; >> > 2. There may not be open event; >> > 3. Userspace should only take action against the close event which is >> > reliable, always sent after a real lid close. >> > This patch adds documentation of the usage model. >> > >> > Link: https://lkml.org/2016/3/7/460 >> > Link: https://github.com/systemd/systemd/issues/2087 >> > Signed-off-by: Lv Zheng <lv.zheng@intel.com> >> > Cc: Bastien Nocera: <hadess@hadess.net> >> > Cc: Benjamin Tissoires <benjamin.tissoires@gmail.com> >> > Cc: linux-input@vger.kernel.org >> > --- >> > Documentation/acpi/acpi-lid.txt | 62 +++++++++++++++++++++++++++++++++++++++ >> > 1 file changed, 62 insertions(+) >> > create mode 100644 Documentation/acpi/acpi-lid.txt >> > >> > diff --git a/Documentation/acpi/acpi-lid.txt b/Documentation/acpi/acpi-lid.txt >> > new file mode 100644 >> > index 0000000..7e4f7ed >> > --- /dev/null >> > +++ b/Documentation/acpi/acpi-lid.txt >> > @@ -0,0 +1,62 @@ >> > +Usage Model of the ACPI Control Method Lid Device >> > + >> > +Copyright (C) 2016, Intel Corporation >> > +Author: Lv Zheng <lv.zheng@intel.com> >> > + >> > + >> > +Abstract: >> > + >> > +Platforms containing lids convey lid state (open/close) to OSPMs using a >> > +control method lid device. To implement this, the AML tables issue >> > +Notify(lid_device, 0x80) to notify the OSPMs whenever the lid state has >> > +changed. The _LID control method for the lid device must be implemented to >> > +report the "current" state of the lid as either "opened" or "closed". >> > + >> > +This document describes the restrictions and the expections of the Linux >> > +ACPI lid device driver. >> > + >> > + >> > +1. Restrictions of the returning value of the _LID control method >> > + >> > +The _LID control method is described to return the "current" lid state. >> > +However the word of "current" has ambiguity, many AML tables return the lid >> > +state upon the last lid notification instead of returning the lid state >> > +upon the last _LID evaluation. There won't be difference when the _LID >> > +control method is evaluated during the runtime, the problem is its initial >> > +returning value. When the AML tables implement this control method with >> > +cached value, the initial returning value is likely not reliable. There are >> > +simply so many examples always retuning "closed" as initial lid state. >> > + >> > +2. Restrictions of the lid state change notifications >> > + >> > +There are many AML tables never notifying when the lid device state is >> > +changed to "opened". But it is ensured that the AML tables always notify >> > +"closed" when the lid state is changed to "closed". This is normally used >> > +to trigger some system power saving operations on Windows. Since it is >> > +fully tested, this notification is reliable for all AML tables. >> > + >> > +3. Expections for the userspace users of the ACPI lid device driver >> > + >> > +The userspace programs should stop relying on >> > +/proc/acpi/button/lid/LID0/state to obtain the lid state. This file is only >> > +used for the validation purpose. >> >> I'd say: this file actually calls the _LID method described above. And >> given the previous explanation, it is not reliable enough on some >> platforms. So it is strongly advised for user-space program to not >> solely rely on this file to determine the actual lid state. >> >> > + >> > +New userspace programs should rely on the lid "closed" notification to >> > +trigger some power saving operations and may stop taking actions according >> > +to the lid "opened" notification. A new input switch event - SW_ACPI_LID is >> > +prepared for the new userspace to implement this ACPI control method lid >> > +device specific logics. >> >> That's not entirely what we discussed before (to prevent regressions): >> - if the device doesn't have reliable LID switch state, then there >> would be the new input event, and so userspace should only rely on >> opened notifications. >> - if the device has reliable switch information, the new input event >> should not be exported and userspace knows that the current input >> switch event is reliable. >> >> Also, using a new "switch" event is a terrible idea. Switches have a >> state (open/close) and you are using this to forward a single open >> event. So using a switch just allows you to say to userspace you are >> using the "new" LID meaning, but you'll still have to manually reset >> the switch and you will have to document how this event is not a >> switch. >> >> Please use a simple KEY_LID_OPEN event you will send through >> [input_key_event(KEY_LID_OPEN, 1), input_sync(), >> input_key_event(KEY_LID_OPEN, 0), input_sync()], which userspace knows >> how to handle. >> >> > + >> > +During the period the userspace hasn't been switched to use the new >> > +SW_ACPI_LID event, Linux users can use the following boot parameter to >> > +handle possible issues: >> > + button.lid_init_state=method: >> > + This is the default behavior of the Linux ACPI lid driver, Linux kernel >> > + reports the initial lid state using the returning value of the _LID >> > + control method. >> > + This can be used to fix some platforms if the _LID control method's >> > + returning value is reliable. >> > + button.lid_init_state=open: >> > + Linux kernel always reports the initial lid state as "opened". >> > + This may fix some platforms if the returning value of the _LID control >> > + method is not reliable. >> >> This worries me as there is no plan after "During the period the >> userspace hasn't been switched to use the new event". >> >> I really hope you'll keep sending SW_LID for reliable LID platforms, >> and not remove it entirely as you will break platforms. > > How about we leave the kernel alone and userspace (which would have to > cope with the new KEY_LID_OPEN anyway) would just have to know that if > switch's parent is PNP0C0D:00 (or phys is PNP0C0D/button/input0) then it > can't trust the events and it needs additional heuristics. > I really wished we could leave the kernel alone, but some platform need fixes: we are using an EV_SW, and on those platform, we only get the close event, which means it gets ignored by the input layer. Those platform have a form factor which makes the situation acceptable (tablet with cover, or very low cost laptops). However, switching away from a different EV_SW and tell userspace to ignore it would break systems when you are using a docking station. The acpi would provide fake values for the LID switch and this will screw the session if you are working on a docking station with an external monitor and the LID closed. My initial suggestion was: - detect in the kernel whether the ACPI LID information was judged as reliable - if reliable keep things as it - if not reliable add an extra KEY_LID_CLOSE to notify userspace that the SW_LID is not reliable (it will emulate the LID open events) and that it will only get true close events. After further thoughts, I think we can simply add the extra key, and have an hwdb entry in logind to enumerate the devices only relying on the close event. If the userspace is not updated, we can tell user to use the button.lid_init_state=open quirk to simulate the behavior logind should expect. That means only adding one extra key (and its events) in the kernel and let userspace decide what to do. Cheers, Benjamin ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH v2 4/4] ACPI / button: Add document for ACPI control method lid device restrictions 2016-07-11 11:34 ` Benjamin Tissoires @ 2016-07-12 0:41 ` Dmitry Torokhov 2016-07-12 7:43 ` Zheng, Lv 2016-07-20 3:21 ` Zheng, Lv 2016-07-12 7:13 ` Zheng, Lv 1 sibling, 2 replies; 27+ messages in thread From: Dmitry Torokhov @ 2016-07-12 0:41 UTC (permalink / raw) To: Benjamin Tissoires Cc: Lv Zheng, Rafael J. Wysocki, Rafael J. Wysocki, Len Brown, Lv Zheng, linux-kernel@vger.kernel.org, ACPI Devel Maling List, Bastien Nocera:, linux-input On Mon, Jul 11, 2016 at 01:34:08PM +0200, Benjamin Tissoires wrote: > On Fri, Jul 8, 2016 at 7:51 PM, Dmitry Torokhov > <dmitry.torokhov@gmail.com> wrote: > > On Fri, Jul 08, 2016 at 11:17:39AM +0200, Benjamin Tissoires wrote: > >> Hi, > >> > >> On Thu, Jul 7, 2016 at 9:11 AM, Lv Zheng <lv.zheng@intel.com> wrote: > >> > There are many AML tables reporting wrong initial lid state, and some of > >> > them never reports lid state. As a proxy layer acting between, ACPI button > >> > driver is not able to handle all such cases, but need to re-define the > >> > usage model of the ACPI lid. That is: > >> > 1. It's initial state is not reliable; > >> > 2. There may not be open event; > >> > 3. Userspace should only take action against the close event which is > >> > reliable, always sent after a real lid close. > >> > This patch adds documentation of the usage model. > >> > > >> > Link: https://lkml.org/2016/3/7/460 > >> > Link: https://github.com/systemd/systemd/issues/2087 > >> > Signed-off-by: Lv Zheng <lv.zheng@intel.com> > >> > Cc: Bastien Nocera: <hadess@hadess.net> > >> > Cc: Benjamin Tissoires <benjamin.tissoires@gmail.com> > >> > Cc: linux-input@vger.kernel.org > >> > --- > >> > Documentation/acpi/acpi-lid.txt | 62 +++++++++++++++++++++++++++++++++++++++ > >> > 1 file changed, 62 insertions(+) > >> > create mode 100644 Documentation/acpi/acpi-lid.txt > >> > > >> > diff --git a/Documentation/acpi/acpi-lid.txt b/Documentation/acpi/acpi-lid.txt > >> > new file mode 100644 > >> > index 0000000..7e4f7ed > >> > --- /dev/null > >> > +++ b/Documentation/acpi/acpi-lid.txt > >> > @@ -0,0 +1,62 @@ > >> > +Usage Model of the ACPI Control Method Lid Device > >> > + > >> > +Copyright (C) 2016, Intel Corporation > >> > +Author: Lv Zheng <lv.zheng@intel.com> > >> > + > >> > + > >> > +Abstract: > >> > + > >> > +Platforms containing lids convey lid state (open/close) to OSPMs using a > >> > +control method lid device. To implement this, the AML tables issue > >> > +Notify(lid_device, 0x80) to notify the OSPMs whenever the lid state has > >> > +changed. The _LID control method for the lid device must be implemented to > >> > +report the "current" state of the lid as either "opened" or "closed". > >> > + > >> > +This document describes the restrictions and the expections of the Linux > >> > +ACPI lid device driver. > >> > + > >> > + > >> > +1. Restrictions of the returning value of the _LID control method > >> > + > >> > +The _LID control method is described to return the "current" lid state. > >> > +However the word of "current" has ambiguity, many AML tables return the lid > >> > +state upon the last lid notification instead of returning the lid state > >> > +upon the last _LID evaluation. There won't be difference when the _LID > >> > +control method is evaluated during the runtime, the problem is its initial > >> > +returning value. When the AML tables implement this control method with > >> > +cached value, the initial returning value is likely not reliable. There are > >> > +simply so many examples always retuning "closed" as initial lid state. > >> > + > >> > +2. Restrictions of the lid state change notifications > >> > + > >> > +There are many AML tables never notifying when the lid device state is > >> > +changed to "opened". But it is ensured that the AML tables always notify > >> > +"closed" when the lid state is changed to "closed". This is normally used > >> > +to trigger some system power saving operations on Windows. Since it is > >> > +fully tested, this notification is reliable for all AML tables. > >> > + > >> > +3. Expections for the userspace users of the ACPI lid device driver > >> > + > >> > +The userspace programs should stop relying on > >> > +/proc/acpi/button/lid/LID0/state to obtain the lid state. This file is only > >> > +used for the validation purpose. > >> > >> I'd say: this file actually calls the _LID method described above. And > >> given the previous explanation, it is not reliable enough on some > >> platforms. So it is strongly advised for user-space program to not > >> solely rely on this file to determine the actual lid state. > >> > >> > + > >> > +New userspace programs should rely on the lid "closed" notification to > >> > +trigger some power saving operations and may stop taking actions according > >> > +to the lid "opened" notification. A new input switch event - SW_ACPI_LID is > >> > +prepared for the new userspace to implement this ACPI control method lid > >> > +device specific logics. > >> > >> That's not entirely what we discussed before (to prevent regressions): > >> - if the device doesn't have reliable LID switch state, then there > >> would be the new input event, and so userspace should only rely on > >> opened notifications. > >> - if the device has reliable switch information, the new input event > >> should not be exported and userspace knows that the current input > >> switch event is reliable. > >> > >> Also, using a new "switch" event is a terrible idea. Switches have a > >> state (open/close) and you are using this to forward a single open > >> event. So using a switch just allows you to say to userspace you are > >> using the "new" LID meaning, but you'll still have to manually reset > >> the switch and you will have to document how this event is not a > >> switch. > >> > >> Please use a simple KEY_LID_OPEN event you will send through > >> [input_key_event(KEY_LID_OPEN, 1), input_sync(), > >> input_key_event(KEY_LID_OPEN, 0), input_sync()], which userspace knows > >> how to handle. > >> > >> > + > >> > +During the period the userspace hasn't been switched to use the new > >> > +SW_ACPI_LID event, Linux users can use the following boot parameter to > >> > +handle possible issues: > >> > + button.lid_init_state=method: > >> > + This is the default behavior of the Linux ACPI lid driver, Linux kernel > >> > + reports the initial lid state using the returning value of the _LID > >> > + control method. > >> > + This can be used to fix some platforms if the _LID control method's > >> > + returning value is reliable. > >> > + button.lid_init_state=open: > >> > + Linux kernel always reports the initial lid state as "opened". > >> > + This may fix some platforms if the returning value of the _LID control > >> > + method is not reliable. > >> > >> This worries me as there is no plan after "During the period the > >> userspace hasn't been switched to use the new event". > >> > >> I really hope you'll keep sending SW_LID for reliable LID platforms, > >> and not remove it entirely as you will break platforms. > > > > How about we leave the kernel alone and userspace (which would have to > > cope with the new KEY_LID_OPEN anyway) would just have to know that if > > switch's parent is PNP0C0D:00 (or phys is PNP0C0D/button/input0) then it > > can't trust the events and it needs additional heuristics. > > > > I really wished we could leave the kernel alone, but some platform > need fixes: we are using an EV_SW, and on those platform, we only get > the close event, which means it gets ignored by the input layer. OK. Can we then emit missing "open" if we get "close" and the state is already closed? Thanks. -- Dmitry ^ permalink raw reply [flat|nested] 27+ messages in thread
* RE: [PATCH v2 4/4] ACPI / button: Add document for ACPI control method lid device restrictions 2016-07-12 0:41 ` Dmitry Torokhov @ 2016-07-12 7:43 ` Zheng, Lv 2016-07-20 3:21 ` Zheng, Lv 1 sibling, 0 replies; 27+ messages in thread From: Zheng, Lv @ 2016-07-12 7:43 UTC (permalink / raw) To: Dmitry Torokhov, Benjamin Tissoires Cc: Wysocki, Rafael J, Rafael J. Wysocki, Brown, Len, Lv Zheng, linux-kernel@vger.kernel.org, ACPI Devel Maling List, Bastien Nocera:, linux-input Hi, Dmitry > From: Dmitry Torokhov [mailto:dmitry.torokhov@gmail.com] > Subject: Re: [PATCH v2 4/4] ACPI / button: Add document for ACPI control > method lid device restrictions > > On Mon, Jul 11, 2016 at 01:34:08PM +0200, Benjamin Tissoires wrote: > > On Fri, Jul 8, 2016 at 7:51 PM, Dmitry Torokhov > > <dmitry.torokhov@gmail.com> wrote: > > > On Fri, Jul 08, 2016 at 11:17:39AM +0200, Benjamin Tissoires wrote: > > >> Hi, > > >> > > >> On Thu, Jul 7, 2016 at 9:11 AM, Lv Zheng <lv.zheng@intel.com> > wrote: > > >> > There are many AML tables reporting wrong initial lid state, and > some of > > >> > them never reports lid state. As a proxy layer acting between, ACPI > button > > >> > driver is not able to handle all such cases, but need to re-define the > > >> > usage model of the ACPI lid. That is: > > >> > 1. It's initial state is not reliable; > > >> > 2. There may not be open event; > > >> > 3. Userspace should only take action against the close event which > is > > >> > reliable, always sent after a real lid close. > > >> > This patch adds documentation of the usage model. > > >> > > > >> > Link: https://lkml.org/2016/3/7/460 > > >> > Link: https://github.com/systemd/systemd/issues/2087 > > >> > Signed-off-by: Lv Zheng <lv.zheng@intel.com> > > >> > Cc: Bastien Nocera: <hadess@hadess.net> > > >> > Cc: Benjamin Tissoires <benjamin.tissoires@gmail.com> > > >> > Cc: linux-input@vger.kernel.org > > >> > --- > > >> > Documentation/acpi/acpi-lid.txt | 62 > +++++++++++++++++++++++++++++++++++++++ > > >> > 1 file changed, 62 insertions(+) > > >> > create mode 100644 Documentation/acpi/acpi-lid.txt > > >> > > > >> > diff --git a/Documentation/acpi/acpi-lid.txt > b/Documentation/acpi/acpi-lid.txt > > >> > new file mode 100644 > > >> > index 0000000..7e4f7ed > > >> > --- /dev/null > > >> > +++ b/Documentation/acpi/acpi-lid.txt > > >> > @@ -0,0 +1,62 @@ > > >> > +Usage Model of the ACPI Control Method Lid Device > > >> > + > > >> > +Copyright (C) 2016, Intel Corporation > > >> > +Author: Lv Zheng <lv.zheng@intel.com> > > >> > + > > >> > + > > >> > +Abstract: > > >> > + > > >> > +Platforms containing lids convey lid state (open/close) to OSPMs > using a > > >> > +control method lid device. To implement this, the AML tables issue > > >> > +Notify(lid_device, 0x80) to notify the OSPMs whenever the lid > state has > > >> > +changed. The _LID control method for the lid device must be > implemented to > > >> > +report the "current" state of the lid as either "opened" or "closed". > > >> > + > > >> > +This document describes the restrictions and the expections of the > Linux > > >> > +ACPI lid device driver. > > >> > + > > >> > + > > >> > +1. Restrictions of the returning value of the _LID control method > > >> > + > > >> > +The _LID control method is described to return the "current" lid > state. > > >> > +However the word of "current" has ambiguity, many AML tables > return the lid > > >> > +state upon the last lid notification instead of returning the lid state > > >> > +upon the last _LID evaluation. There won't be difference when the > _LID > > >> > +control method is evaluated during the runtime, the problem is its > initial > > >> > +returning value. When the AML tables implement this control > method with > > >> > +cached value, the initial returning value is likely not reliable. There > are > > >> > +simply so many examples always retuning "closed" as initial lid > state. > > >> > + > > >> > +2. Restrictions of the lid state change notifications > > >> > + > > >> > +There are many AML tables never notifying when the lid device > state is > > >> > +changed to "opened". But it is ensured that the AML tables always > notify > > >> > +"closed" when the lid state is changed to "closed". This is normally > used > > >> > +to trigger some system power saving operations on Windows. > Since it is > > >> > +fully tested, this notification is reliable for all AML tables. > > >> > + > > >> > +3. Expections for the userspace users of the ACPI lid device driver > > >> > + > > >> > +The userspace programs should stop relying on > > >> > +/proc/acpi/button/lid/LID0/state to obtain the lid state. This file is > only > > >> > +used for the validation purpose. > > >> > > >> I'd say: this file actually calls the _LID method described above. And > > >> given the previous explanation, it is not reliable enough on some > > >> platforms. So it is strongly advised for user-space program to not > > >> solely rely on this file to determine the actual lid state. > > >> > > >> > + > > >> > +New userspace programs should rely on the lid "closed" > notification to > > >> > +trigger some power saving operations and may stop taking actions > according > > >> > +to the lid "opened" notification. A new input switch event - > SW_ACPI_LID is > > >> > +prepared for the new userspace to implement this ACPI control > method lid > > >> > +device specific logics. > > >> > > >> That's not entirely what we discussed before (to prevent regressions): > > >> - if the device doesn't have reliable LID switch state, then there > > >> would be the new input event, and so userspace should only rely on > > >> opened notifications. > > >> - if the device has reliable switch information, the new input event > > >> should not be exported and userspace knows that the current input > > >> switch event is reliable. > > >> > > >> Also, using a new "switch" event is a terrible idea. Switches have a > > >> state (open/close) and you are using this to forward a single open > > >> event. So using a switch just allows you to say to userspace you are > > >> using the "new" LID meaning, but you'll still have to manually reset > > >> the switch and you will have to document how this event is not a > > >> switch. > > >> > > >> Please use a simple KEY_LID_OPEN event you will send through > > >> [input_key_event(KEY_LID_OPEN, 1), input_sync(), > > >> input_key_event(KEY_LID_OPEN, 0), input_sync()], which userspace > knows > > >> how to handle. > > >> > > >> > + > > >> > +During the period the userspace hasn't been switched to use the > new > > >> > +SW_ACPI_LID event, Linux users can use the following boot > parameter to > > >> > +handle possible issues: > > >> > + button.lid_init_state=method: > > >> > + This is the default behavior of the Linux ACPI lid driver, Linux > kernel > > >> > + reports the initial lid state using the returning value of the _LID > > >> > + control method. > > >> > + This can be used to fix some platforms if the _LID control > method's > > >> > + returning value is reliable. > > >> > + button.lid_init_state=open: > > >> > + Linux kernel always reports the initial lid state as "opened". > > >> > + This may fix some platforms if the returning value of the _LID > control > > >> > + method is not reliable. > > >> > > >> This worries me as there is no plan after "During the period the > > >> userspace hasn't been switched to use the new event". > > >> > > >> I really hope you'll keep sending SW_LID for reliable LID platforms, > > >> and not remove it entirely as you will break platforms. > > > > > > How about we leave the kernel alone and userspace (which would have > to > > > cope with the new KEY_LID_OPEN anyway) would just have to know > that if > > > switch's parent is PNP0C0D:00 (or phys is PNP0C0D/button/input0) > then it > > > can't trust the events and it needs additional heuristics. > > > > > > > I really wished we could leave the kernel alone, but some platform > > need fixes: we are using an EV_SW, and on those platform, we only get > > the close event, which means it gets ignored by the input layer. > > OK. Can we then emit missing "open" if we get "close" and the state is > already closed? [Lv Zheng] The problem is systemd/logind thinks SW_LID is a switch event, thus it must be paired. While the real world is: there are platforms, SW_LID may not be paired for ACPI control method lid device. As the events are provided by the BIOS tables, the Linux ACPI subsystem actually has no idea on how to get the missing "open" back. Unless we hire people to wait for the bug reports and fix the BIOS tables. Thanks and best regards -Lv ^ permalink raw reply [flat|nested] 27+ messages in thread
* RE: [PATCH v2 4/4] ACPI / button: Add document for ACPI control method lid device restrictions 2016-07-12 0:41 ` Dmitry Torokhov 2016-07-12 7:43 ` Zheng, Lv @ 2016-07-20 3:21 ` Zheng, Lv 1 sibling, 0 replies; 27+ messages in thread From: Zheng, Lv @ 2016-07-20 3:21 UTC (permalink / raw) To: Dmitry Torokhov, Benjamin Tissoires Cc: Wysocki, Rafael J, Rafael J. Wysocki, Brown, Len, Lv Zheng, linux-kernel@vger.kernel.org, ACPI Devel Maling List, Bastien Nocera:, linux-input Hi, Dmitry > From: Dmitry Torokhov [mailto:dmitry.torokhov@gmail.com] > Subject: Re: [PATCH v2 4/4] ACPI / button: Add document for ACPI control > method lid device restrictions > > On Mon, Jul 11, 2016 at 01:34:08PM +0200, Benjamin Tissoires wrote: > > On Fri, Jul 8, 2016 at 7:51 PM, Dmitry Torokhov > > <dmitry.torokhov@gmail.com> wrote: > > > On Fri, Jul 08, 2016 at 11:17:39AM +0200, Benjamin Tissoires wrote: > > >> Hi, > > >> > > >> On Thu, Jul 7, 2016 at 9:11 AM, Lv Zheng <lv.zheng@intel.com> > wrote: > > >> > There are many AML tables reporting wrong initial lid state, and > some of > > >> > them never reports lid state. As a proxy layer acting between, ACPI > button > > >> > driver is not able to handle all such cases, but need to re-define the > > >> > usage model of the ACPI lid. That is: > > >> > 1. It's initial state is not reliable; > > >> > 2. There may not be open event; > > >> > 3. Userspace should only take action against the close event which > is > > >> > reliable, always sent after a real lid close. > > >> > This patch adds documentation of the usage model. > > >> > > > >> > Link: https://lkml.org/2016/3/7/460 > > >> > Link: https://github.com/systemd/systemd/issues/2087 > > >> > Signed-off-by: Lv Zheng <lv.zheng@intel.com> > > >> > Cc: Bastien Nocera: <hadess@hadess.net> > > >> > Cc: Benjamin Tissoires <benjamin.tissoires@gmail.com> > > >> > Cc: linux-input@vger.kernel.org > > >> > --- > > >> > Documentation/acpi/acpi-lid.txt | 62 > +++++++++++++++++++++++++++++++++++++++ > > >> > 1 file changed, 62 insertions(+) > > >> > create mode 100644 Documentation/acpi/acpi-lid.txt > > >> > > > >> > diff --git a/Documentation/acpi/acpi-lid.txt > b/Documentation/acpi/acpi-lid.txt > > >> > new file mode 100644 > > >> > index 0000000..7e4f7ed > > >> > --- /dev/null > > >> > +++ b/Documentation/acpi/acpi-lid.txt > > >> > @@ -0,0 +1,62 @@ > > >> > +Usage Model of the ACPI Control Method Lid Device > > >> > + > > >> > +Copyright (C) 2016, Intel Corporation > > >> > +Author: Lv Zheng <lv.zheng@intel.com> > > >> > + > > >> > + > > >> > +Abstract: > > >> > + > > >> > +Platforms containing lids convey lid state (open/close) to OSPMs > using a > > >> > +control method lid device. To implement this, the AML tables issue > > >> > +Notify(lid_device, 0x80) to notify the OSPMs whenever the lid > state has > > >> > +changed. The _LID control method for the lid device must be > implemented to > > >> > +report the "current" state of the lid as either "opened" or "closed". > > >> > + > > >> > +This document describes the restrictions and the expections of the > Linux > > >> > +ACPI lid device driver. > > >> > + > > >> > + > > >> > +1. Restrictions of the returning value of the _LID control method > > >> > + > > >> > +The _LID control method is described to return the "current" lid > state. > > >> > +However the word of "current" has ambiguity, many AML tables > return the lid > > >> > +state upon the last lid notification instead of returning the lid state > > >> > +upon the last _LID evaluation. There won't be difference when the > _LID > > >> > +control method is evaluated during the runtime, the problem is its > initial > > >> > +returning value. When the AML tables implement this control > method with > > >> > +cached value, the initial returning value is likely not reliable. There > are > > >> > +simply so many examples always retuning "closed" as initial lid > state. > > >> > + > > >> > +2. Restrictions of the lid state change notifications > > >> > + > > >> > +There are many AML tables never notifying when the lid device > state is > > >> > +changed to "opened". But it is ensured that the AML tables always > notify > > >> > +"closed" when the lid state is changed to "closed". This is normally > used > > >> > +to trigger some system power saving operations on Windows. > Since it is > > >> > +fully tested, this notification is reliable for all AML tables. > > >> > + > > >> > +3. Expections for the userspace users of the ACPI lid device driver > > >> > + > > >> > +The userspace programs should stop relying on > > >> > +/proc/acpi/button/lid/LID0/state to obtain the lid state. This file is > only > > >> > +used for the validation purpose. > > >> > > >> I'd say: this file actually calls the _LID method described above. And > > >> given the previous explanation, it is not reliable enough on some > > >> platforms. So it is strongly advised for user-space program to not > > >> solely rely on this file to determine the actual lid state. > > >> > > >> > + > > >> > +New userspace programs should rely on the lid "closed" > notification to > > >> > +trigger some power saving operations and may stop taking actions > according > > >> > +to the lid "opened" notification. A new input switch event - > SW_ACPI_LID is > > >> > +prepared for the new userspace to implement this ACPI control > method lid > > >> > +device specific logics. > > >> > > >> That's not entirely what we discussed before (to prevent regressions): > > >> - if the device doesn't have reliable LID switch state, then there > > >> would be the new input event, and so userspace should only rely on > > >> opened notifications. > > >> - if the device has reliable switch information, the new input event > > >> should not be exported and userspace knows that the current input > > >> switch event is reliable. > > >> > > >> Also, using a new "switch" event is a terrible idea. Switches have a > > >> state (open/close) and you are using this to forward a single open > > >> event. So using a switch just allows you to say to userspace you are > > >> using the "new" LID meaning, but you'll still have to manually reset > > >> the switch and you will have to document how this event is not a > > >> switch. > > >> > > >> Please use a simple KEY_LID_OPEN event you will send through > > >> [input_key_event(KEY_LID_OPEN, 1), input_sync(), > > >> input_key_event(KEY_LID_OPEN, 0), input_sync()], which userspace > knows > > >> how to handle. > > >> > > >> > + > > >> > +During the period the userspace hasn't been switched to use the > new > > >> > +SW_ACPI_LID event, Linux users can use the following boot > parameter to > > >> > +handle possible issues: > > >> > + button.lid_init_state=method: > > >> > + This is the default behavior of the Linux ACPI lid driver, Linux > kernel > > >> > + reports the initial lid state using the returning value of the _LID > > >> > + control method. > > >> > + This can be used to fix some platforms if the _LID control > method's > > >> > + returning value is reliable. > > >> > + button.lid_init_state=open: > > >> > + Linux kernel always reports the initial lid state as "opened". > > >> > + This may fix some platforms if the returning value of the _LID > control > > >> > + method is not reliable. > > >> > > >> This worries me as there is no plan after "During the period the > > >> userspace hasn't been switched to use the new event". > > >> > > >> I really hope you'll keep sending SW_LID for reliable LID platforms, > > >> and not remove it entirely as you will break platforms. > > > > > > How about we leave the kernel alone and userspace (which would have > to > > > cope with the new KEY_LID_OPEN anyway) would just have to know > that if > > > switch's parent is PNP0C0D:00 (or phys is PNP0C0D/button/input0) > then it > > > can't trust the events and it needs additional heuristics. > > > > > > > I really wished we could leave the kernel alone, but some platform > > need fixes: we are using an EV_SW, and on those platform, we only get > > the close event, which means it gets ignored by the input layer. > > OK. Can we then emit missing "open" if we get "close" and the state is > already closed? [Lv Zheng] I've been considering this again. I think you may mean we can improve SW_LID by reporting SW_LID(open) when a new close event is arrived. So that we may be able to fix old programs. Possibly the code should be looked like: If (!!state != last_state && time_after(jiffies, last_jiffies)) { input_report_switch(..., state); } input_report_switch(..., !state); However, there are tables never reporting "open". If we do things in this way, there will be a very long period between the last close and the next close. Which means there will be a too long period between the close and the open switch events. IMO, this cannot fix old user space programs. Currently, logind has a timeout mechanism. If it cannot receive "open" within this period, it will suspend the system again right after resuming. Thus we can still see that suspending right after resuming could be resulted. However the new key events allow the new user space to fix the issue without changing the timeout logic. For the old user space programs, I have no idea how we can fix them on such platforms (no open events). Thanks and best regards -Lv ^ permalink raw reply [flat|nested] 27+ messages in thread
* RE: [PATCH v2 4/4] ACPI / button: Add document for ACPI control method lid device restrictions 2016-07-11 11:34 ` Benjamin Tissoires 2016-07-12 0:41 ` Dmitry Torokhov @ 2016-07-12 7:13 ` Zheng, Lv 1 sibling, 0 replies; 27+ messages in thread From: Zheng, Lv @ 2016-07-12 7:13 UTC (permalink / raw) To: Benjamin Tissoires, Dmitry Torokhov Cc: Wysocki, Rafael J, Rafael J. Wysocki, Brown, Len, Lv Zheng, linux-kernel@vger.kernel.org, ACPI Devel Maling List, Bastien Nocera:, linux-input Hi, > From: Benjamin Tissoires [mailto:benjamin.tissoires@gmail.com] > Subject: Re: [PATCH v2 4/4] ACPI / button: Add document for ACPI control > method lid device restrictions > > On Fri, Jul 8, 2016 at 7:51 PM, Dmitry Torokhov > <dmitry.torokhov@gmail.com> wrote: > > On Fri, Jul 08, 2016 at 11:17:39AM +0200, Benjamin Tissoires wrote: > >> Hi, > >> > >> On Thu, Jul 7, 2016 at 9:11 AM, Lv Zheng <lv.zheng@intel.com> wrote: > >> > There are many AML tables reporting wrong initial lid state, and some > of > >> > them never reports lid state. As a proxy layer acting between, ACPI > button > >> > driver is not able to handle all such cases, but need to re-define the > >> > usage model of the ACPI lid. That is: > >> > 1. It's initial state is not reliable; > >> > 2. There may not be open event; > >> > 3. Userspace should only take action against the close event which is > >> > reliable, always sent after a real lid close. > >> > This patch adds documentation of the usage model. > >> > > >> > Link: https://lkml.org/2016/3/7/460 > >> > Link: https://github.com/systemd/systemd/issues/2087 > >> > Signed-off-by: Lv Zheng <lv.zheng@intel.com> > >> > Cc: Bastien Nocera: <hadess@hadess.net> > >> > Cc: Benjamin Tissoires <benjamin.tissoires@gmail.com> > >> > Cc: linux-input@vger.kernel.org > >> > --- > >> > Documentation/acpi/acpi-lid.txt | 62 > +++++++++++++++++++++++++++++++++++++++ > >> > 1 file changed, 62 insertions(+) > >> > create mode 100644 Documentation/acpi/acpi-lid.txt > >> > > >> > diff --git a/Documentation/acpi/acpi-lid.txt > b/Documentation/acpi/acpi-lid.txt > >> > new file mode 100644 > >> > index 0000000..7e4f7ed > >> > --- /dev/null > >> > +++ b/Documentation/acpi/acpi-lid.txt > >> > @@ -0,0 +1,62 @@ > >> > +Usage Model of the ACPI Control Method Lid Device > >> > + > >> > +Copyright (C) 2016, Intel Corporation > >> > +Author: Lv Zheng <lv.zheng@intel.com> > >> > + > >> > + > >> > +Abstract: > >> > + > >> > +Platforms containing lids convey lid state (open/close) to OSPMs > using a > >> > +control method lid device. To implement this, the AML tables issue > >> > +Notify(lid_device, 0x80) to notify the OSPMs whenever the lid state > has > >> > +changed. The _LID control method for the lid device must be > implemented to > >> > +report the "current" state of the lid as either "opened" or "closed". > >> > + > >> > +This document describes the restrictions and the expections of the > Linux > >> > +ACPI lid device driver. > >> > + > >> > + > >> > +1. Restrictions of the returning value of the _LID control method > >> > + > >> > +The _LID control method is described to return the "current" lid > state. > >> > +However the word of "current" has ambiguity, many AML tables > return the lid > >> > +state upon the last lid notification instead of returning the lid state > >> > +upon the last _LID evaluation. There won't be difference when the > _LID > >> > +control method is evaluated during the runtime, the problem is its > initial > >> > +returning value. When the AML tables implement this control > method with > >> > +cached value, the initial returning value is likely not reliable. There > are > >> > +simply so many examples always retuning "closed" as initial lid state. > >> > + > >> > +2. Restrictions of the lid state change notifications > >> > + > >> > +There are many AML tables never notifying when the lid device state > is > >> > +changed to "opened". But it is ensured that the AML tables always > notify > >> > +"closed" when the lid state is changed to "closed". This is normally > used > >> > +to trigger some system power saving operations on Windows. Since > it is > >> > +fully tested, this notification is reliable for all AML tables. > >> > + > >> > +3. Expections for the userspace users of the ACPI lid device driver > >> > + > >> > +The userspace programs should stop relying on > >> > +/proc/acpi/button/lid/LID0/state to obtain the lid state. This file is > only > >> > +used for the validation purpose. > >> > >> I'd say: this file actually calls the _LID method described above. And > >> given the previous explanation, it is not reliable enough on some > >> platforms. So it is strongly advised for user-space program to not > >> solely rely on this file to determine the actual lid state. > >> > >> > + > >> > +New userspace programs should rely on the lid "closed" notification > to > >> > +trigger some power saving operations and may stop taking actions > according > >> > +to the lid "opened" notification. A new input switch event - > SW_ACPI_LID is > >> > +prepared for the new userspace to implement this ACPI control > method lid > >> > +device specific logics. > >> > >> That's not entirely what we discussed before (to prevent regressions): > >> - if the device doesn't have reliable LID switch state, then there > >> would be the new input event, and so userspace should only rely on > >> opened notifications. > >> - if the device has reliable switch information, the new input event > >> should not be exported and userspace knows that the current input > >> switch event is reliable. > >> > >> Also, using a new "switch" event is a terrible idea. Switches have a > >> state (open/close) and you are using this to forward a single open > >> event. So using a switch just allows you to say to userspace you are > >> using the "new" LID meaning, but you'll still have to manually reset > >> the switch and you will have to document how this event is not a > >> switch. > >> > >> Please use a simple KEY_LID_OPEN event you will send through > >> [input_key_event(KEY_LID_OPEN, 1), input_sync(), > >> input_key_event(KEY_LID_OPEN, 0), input_sync()], which userspace > knows > >> how to handle. > >> > >> > + > >> > +During the period the userspace hasn't been switched to use the > new > >> > +SW_ACPI_LID event, Linux users can use the following boot > parameter to > >> > +handle possible issues: > >> > + button.lid_init_state=method: > >> > + This is the default behavior of the Linux ACPI lid driver, Linux kernel > >> > + reports the initial lid state using the returning value of the _LID > >> > + control method. > >> > + This can be used to fix some platforms if the _LID control method's > >> > + returning value is reliable. > >> > + button.lid_init_state=open: > >> > + Linux kernel always reports the initial lid state as "opened". > >> > + This may fix some platforms if the returning value of the _LID > control > >> > + method is not reliable. > >> > >> This worries me as there is no plan after "During the period the > >> userspace hasn't been switched to use the new event". > >> > >> I really hope you'll keep sending SW_LID for reliable LID platforms, > >> and not remove it entirely as you will break platforms. > > > > How about we leave the kernel alone and userspace (which would have > to > > cope with the new KEY_LID_OPEN anyway) would just have to know that > if > > switch's parent is PNP0C0D:00 (or phys is PNP0C0D/button/input0) then > it > > can't trust the events and it needs additional heuristics. > > > > I really wished we could leave the kernel alone, but some platform > need fixes: we are using an EV_SW, and on those platform, we only get > the close event, which means it gets ignored by the input layer. > Those platform have a form factor which makes the situation acceptable > (tablet with cover, or very low cost laptops). > However, switching away from a different EV_SW and tell userspace to > ignore it would break systems when you are using a docking station. > The acpi would provide fake values for the LID switch and this will > screw the session if you are working on a docking station with an > external monitor and the LID closed. > > My initial suggestion was: > - detect in the kernel whether the ACPI LID information was judged as > reliable > - if reliable keep things as it > - if not reliable add an extra KEY_LID_CLOSE to notify userspace that > the SW_LID is not reliable (it will emulate the LID open events) and > that it will only get true close events. [Lv Zheng] The problem is: ACPI subsystem has no idea if it is reliable. The only possible mean to get this awareness is: 1. Waiting for the user report, 2. Check the AML tables and confirm if this is the problem, 3. Add a quirk in the kernel. As there could be many such kind of "unreliable tables", the quirk list will be endless. That's the motivation of this discussion: We need to find a way, end the need of introducing such kind of endless quirk list into the kernel. The kernel parameter "button.lid_init_state" is a solution to eliminate the need of writing such an endless quirk table. However, it doesn't fix anything. Some unwanted power consumptions are caused by the userspace behavior. And it is not fixable in the kernel. That's the motivation for us to discuss here. > > After further thoughts, I think we can simply add the extra key, and > have an hwdb entry in logind to enumerate the devices only relying on > the close event. If the userspace is not updated, we can tell user to > use the button.lid_init_state=open quirk to simulate the behavior > logind should expect. > > That means only adding one extra key (and its events) in the kernel > and let userspace decide what to do. [Lv Zheng] Yes. All sounds reasonable. But TBH, I really do not know how can ACPI subsystem determine the following stuffs automatically: 1. if _LID initial state is reliable or not, 2. will open event be sent by the platform or not. So my choice will be: Leaving this to be determined by the users. We can have a kernel parameter, switching acpi button driver between SW_LID and KEY_LID_CLOSE. IMO, this should be sufficient for the vendors. Thanks and best regards -Lv ^ permalink raw reply [flat|nested] 27+ messages in thread
* RE: [PATCH v2 4/4] ACPI / button: Add document for ACPI control method lid device restrictions 2016-07-08 17:51 ` Dmitry Torokhov 2016-07-11 11:34 ` Benjamin Tissoires @ 2016-07-19 7:17 ` Zheng, Lv 2016-07-19 8:40 ` Benjamin Tissoires 1 sibling, 1 reply; 27+ messages in thread From: Zheng, Lv @ 2016-07-19 7:17 UTC (permalink / raw) To: Dmitry Torokhov, Benjamin Tissoires Cc: Wysocki, Rafael J, Rafael J. Wysocki, Brown, Len, Lv Zheng, linux-kernel@vger.kernel.org, ACPI Devel Maling List, Bastien Nocera:, linux-input Hi, Dmitry > From: Dmitry Torokhov [mailto:dmitry.torokhov@gmail.com] > Subject: Re: [PATCH v2 4/4] ACPI / button: Add document for ACPI control > method lid device restrictions > > On Fri, Jul 08, 2016 at 11:17:39AM +0200, Benjamin Tissoires wrote: > > Hi, > > > > On Thu, Jul 7, 2016 at 9:11 AM, Lv Zheng <lv.zheng@intel.com> wrote: > > > There are many AML tables reporting wrong initial lid state, and some > of > > > them never reports lid state. As a proxy layer acting between, ACPI > button > > > driver is not able to handle all such cases, but need to re-define the > > > usage model of the ACPI lid. That is: > > > 1. It's initial state is not reliable; > > > 2. There may not be open event; > > > 3. Userspace should only take action against the close event which is > > > reliable, always sent after a real lid close. > > > This patch adds documentation of the usage model. > > > > > > Link: https://lkml.org/2016/3/7/460 > > > Link: https://github.com/systemd/systemd/issues/2087 > > > Signed-off-by: Lv Zheng <lv.zheng@intel.com> > > > Cc: Bastien Nocera: <hadess@hadess.net> > > > Cc: Benjamin Tissoires <benjamin.tissoires@gmail.com> > > > Cc: linux-input@vger.kernel.org > > > --- > > > Documentation/acpi/acpi-lid.txt | 62 > +++++++++++++++++++++++++++++++++++++++ > > > 1 file changed, 62 insertions(+) > > > create mode 100644 Documentation/acpi/acpi-lid.txt > > > > > > diff --git a/Documentation/acpi/acpi-lid.txt > b/Documentation/acpi/acpi-lid.txt > > > new file mode 100644 > > > index 0000000..7e4f7ed > > > --- /dev/null > > > +++ b/Documentation/acpi/acpi-lid.txt > > > @@ -0,0 +1,62 @@ > > > +Usage Model of the ACPI Control Method Lid Device > > > + > > > +Copyright (C) 2016, Intel Corporation > > > +Author: Lv Zheng <lv.zheng@intel.com> > > > + > > > + > > > +Abstract: > > > + > > > +Platforms containing lids convey lid state (open/close) to OSPMs > using a > > > +control method lid device. To implement this, the AML tables issue > > > +Notify(lid_device, 0x80) to notify the OSPMs whenever the lid state > has > > > +changed. The _LID control method for the lid device must be > implemented to > > > +report the "current" state of the lid as either "opened" or "closed". > > > + > > > +This document describes the restrictions and the expections of the > Linux > > > +ACPI lid device driver. > > > + > > > + > > > +1. Restrictions of the returning value of the _LID control method > > > + > > > +The _LID control method is described to return the "current" lid state. > > > +However the word of "current" has ambiguity, many AML tables > return the lid > > > +state upon the last lid notification instead of returning the lid state > > > +upon the last _LID evaluation. There won't be difference when the > _LID > > > +control method is evaluated during the runtime, the problem is its > initial > > > +returning value. When the AML tables implement this control method > with > > > +cached value, the initial returning value is likely not reliable. There are > > > +simply so many examples always retuning "closed" as initial lid state. > > > + > > > +2. Restrictions of the lid state change notifications > > > + > > > +There are many AML tables never notifying when the lid device state > is > > > +changed to "opened". But it is ensured that the AML tables always > notify > > > +"closed" when the lid state is changed to "closed". This is normally > used > > > +to trigger some system power saving operations on Windows. Since it > is > > > +fully tested, this notification is reliable for all AML tables. > > > + > > > +3. Expections for the userspace users of the ACPI lid device driver > > > + > > > +The userspace programs should stop relying on > > > +/proc/acpi/button/lid/LID0/state to obtain the lid state. This file is > only > > > +used for the validation purpose. > > > > I'd say: this file actually calls the _LID method described above. And > > given the previous explanation, it is not reliable enough on some > > platforms. So it is strongly advised for user-space program to not > > solely rely on this file to determine the actual lid state. > > > > > + > > > +New userspace programs should rely on the lid "closed" notification > to > > > +trigger some power saving operations and may stop taking actions > according > > > +to the lid "opened" notification. A new input switch event - > SW_ACPI_LID is > > > +prepared for the new userspace to implement this ACPI control > method lid > > > +device specific logics. > > > > That's not entirely what we discussed before (to prevent regressions): > > - if the device doesn't have reliable LID switch state, then there > > would be the new input event, and so userspace should only rely on > > opened notifications. > > - if the device has reliable switch information, the new input event > > should not be exported and userspace knows that the current input > > switch event is reliable. > > > > Also, using a new "switch" event is a terrible idea. Switches have a > > state (open/close) and you are using this to forward a single open > > event. So using a switch just allows you to say to userspace you are > > using the "new" LID meaning, but you'll still have to manually reset > > the switch and you will have to document how this event is not a > > switch. > > > > Please use a simple KEY_LID_OPEN event you will send through > > [input_key_event(KEY_LID_OPEN, 1), input_sync(), > > input_key_event(KEY_LID_OPEN, 0), input_sync()], which userspace > knows > > how to handle. > > > > > + > > > +During the period the userspace hasn't been switched to use the new > > > +SW_ACPI_LID event, Linux users can use the following boot parameter > to > > > +handle possible issues: > > > + button.lid_init_state=method: > > > + This is the default behavior of the Linux ACPI lid driver, Linux kernel > > > + reports the initial lid state using the returning value of the _LID > > > + control method. > > > + This can be used to fix some platforms if the _LID control method's > > > + returning value is reliable. > > > + button.lid_init_state=open: > > > + Linux kernel always reports the initial lid state as "opened". > > > + This may fix some platforms if the returning value of the _LID > control > > > + method is not reliable. > > > > This worries me as there is no plan after "During the period the > > userspace hasn't been switched to use the new event". > > > > I really hope you'll keep sending SW_LID for reliable LID platforms, > > and not remove it entirely as you will break platforms. > > How about we leave the kernel alone and userspace (which would have to > cope with the new KEY_LID_OPEN anyway) would just have to know that if > switch's parent is PNP0C0D:00 (or phys is PNP0C0D/button/input0) then > it > can't trust the events and it needs additional heuristics. [Lv Zheng] I found a problem with the key event approach. And need your suggestions. Some AML tables invoke Notify(lid_device, ...) in several different places. It may be invoked from different functions. Finally, it's not guaranteed that one "lid close" action can only trigger one key close notification. If we use EV_KEY, then there should be many platforms triggering multiple "lid close" events to the user space. Original switch event based design can automatically eliminate the redundant events. Does input layer has an event type that can handle such situation? Or shall ACPI button driver handle this? Thanks, -Lv ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH v2 4/4] ACPI / button: Add document for ACPI control method lid device restrictions 2016-07-19 7:17 ` Zheng, Lv @ 2016-07-19 8:40 ` Benjamin Tissoires 2016-07-19 8:57 ` Zheng, Lv 0 siblings, 1 reply; 27+ messages in thread From: Benjamin Tissoires @ 2016-07-19 8:40 UTC (permalink / raw) To: Zheng, Lv Cc: Dmitry Torokhov, Wysocki, Rafael J, Rafael J. Wysocki, Brown, Len, Lv Zheng, linux-kernel@vger.kernel.org, ACPI Devel Maling List, Bastien Nocera:, linux-input On Tue, Jul 19, 2016 at 9:17 AM, Zheng, Lv <lv.zheng@intel.com> wrote: > Hi, Dmitry > >> From: Dmitry Torokhov [mailto:dmitry.torokhov@gmail.com] >> Subject: Re: [PATCH v2 4/4] ACPI / button: Add document for ACPI control >> method lid device restrictions >> >> On Fri, Jul 08, 2016 at 11:17:39AM +0200, Benjamin Tissoires wrote: >> > Hi, >> > >> > On Thu, Jul 7, 2016 at 9:11 AM, Lv Zheng <lv.zheng@intel.com> wrote: >> > > There are many AML tables reporting wrong initial lid state, and some >> of >> > > them never reports lid state. As a proxy layer acting between, ACPI >> button >> > > driver is not able to handle all such cases, but need to re-define the >> > > usage model of the ACPI lid. That is: >> > > 1. It's initial state is not reliable; >> > > 2. There may not be open event; >> > > 3. Userspace should only take action against the close event which is >> > > reliable, always sent after a real lid close. >> > > This patch adds documentation of the usage model. >> > > >> > > Link: https://lkml.org/2016/3/7/460 >> > > Link: https://github.com/systemd/systemd/issues/2087 >> > > Signed-off-by: Lv Zheng <lv.zheng@intel.com> >> > > Cc: Bastien Nocera: <hadess@hadess.net> >> > > Cc: Benjamin Tissoires <benjamin.tissoires@gmail.com> >> > > Cc: linux-input@vger.kernel.org >> > > --- >> > > Documentation/acpi/acpi-lid.txt | 62 >> +++++++++++++++++++++++++++++++++++++++ >> > > 1 file changed, 62 insertions(+) >> > > create mode 100644 Documentation/acpi/acpi-lid.txt >> > > >> > > diff --git a/Documentation/acpi/acpi-lid.txt >> b/Documentation/acpi/acpi-lid.txt >> > > new file mode 100644 >> > > index 0000000..7e4f7ed >> > > --- /dev/null >> > > +++ b/Documentation/acpi/acpi-lid.txt >> > > @@ -0,0 +1,62 @@ >> > > +Usage Model of the ACPI Control Method Lid Device >> > > + >> > > +Copyright (C) 2016, Intel Corporation >> > > +Author: Lv Zheng <lv.zheng@intel.com> >> > > + >> > > + >> > > +Abstract: >> > > + >> > > +Platforms containing lids convey lid state (open/close) to OSPMs >> using a >> > > +control method lid device. To implement this, the AML tables issue >> > > +Notify(lid_device, 0x80) to notify the OSPMs whenever the lid state >> has >> > > +changed. The _LID control method for the lid device must be >> implemented to >> > > +report the "current" state of the lid as either "opened" or "closed". >> > > + >> > > +This document describes the restrictions and the expections of the >> Linux >> > > +ACPI lid device driver. >> > > + >> > > + >> > > +1. Restrictions of the returning value of the _LID control method >> > > + >> > > +The _LID control method is described to return the "current" lid state. >> > > +However the word of "current" has ambiguity, many AML tables >> return the lid >> > > +state upon the last lid notification instead of returning the lid state >> > > +upon the last _LID evaluation. There won't be difference when the >> _LID >> > > +control method is evaluated during the runtime, the problem is its >> initial >> > > +returning value. When the AML tables implement this control method >> with >> > > +cached value, the initial returning value is likely not reliable. There are >> > > +simply so many examples always retuning "closed" as initial lid state. >> > > + >> > > +2. Restrictions of the lid state change notifications >> > > + >> > > +There are many AML tables never notifying when the lid device state >> is >> > > +changed to "opened". But it is ensured that the AML tables always >> notify >> > > +"closed" when the lid state is changed to "closed". This is normally >> used >> > > +to trigger some system power saving operations on Windows. Since it >> is >> > > +fully tested, this notification is reliable for all AML tables. >> > > + >> > > +3. Expections for the userspace users of the ACPI lid device driver >> > > + >> > > +The userspace programs should stop relying on >> > > +/proc/acpi/button/lid/LID0/state to obtain the lid state. This file is >> only >> > > +used for the validation purpose. >> > >> > I'd say: this file actually calls the _LID method described above. And >> > given the previous explanation, it is not reliable enough on some >> > platforms. So it is strongly advised for user-space program to not >> > solely rely on this file to determine the actual lid state. >> > >> > > + >> > > +New userspace programs should rely on the lid "closed" notification >> to >> > > +trigger some power saving operations and may stop taking actions >> according >> > > +to the lid "opened" notification. A new input switch event - >> SW_ACPI_LID is >> > > +prepared for the new userspace to implement this ACPI control >> method lid >> > > +device specific logics. >> > >> > That's not entirely what we discussed before (to prevent regressions): >> > - if the device doesn't have reliable LID switch state, then there >> > would be the new input event, and so userspace should only rely on >> > opened notifications. >> > - if the device has reliable switch information, the new input event >> > should not be exported and userspace knows that the current input >> > switch event is reliable. >> > >> > Also, using a new "switch" event is a terrible idea. Switches have a >> > state (open/close) and you are using this to forward a single open >> > event. So using a switch just allows you to say to userspace you are >> > using the "new" LID meaning, but you'll still have to manually reset >> > the switch and you will have to document how this event is not a >> > switch. >> > >> > Please use a simple KEY_LID_OPEN event you will send through >> > [input_key_event(KEY_LID_OPEN, 1), input_sync(), >> > input_key_event(KEY_LID_OPEN, 0), input_sync()], which userspace >> knows >> > how to handle. >> > >> > > + >> > > +During the period the userspace hasn't been switched to use the new >> > > +SW_ACPI_LID event, Linux users can use the following boot parameter >> to >> > > +handle possible issues: >> > > + button.lid_init_state=method: >> > > + This is the default behavior of the Linux ACPI lid driver, Linux kernel >> > > + reports the initial lid state using the returning value of the _LID >> > > + control method. >> > > + This can be used to fix some platforms if the _LID control method's >> > > + returning value is reliable. >> > > + button.lid_init_state=open: >> > > + Linux kernel always reports the initial lid state as "opened". >> > > + This may fix some platforms if the returning value of the _LID >> control >> > > + method is not reliable. >> > >> > This worries me as there is no plan after "During the period the >> > userspace hasn't been switched to use the new event". >> > >> > I really hope you'll keep sending SW_LID for reliable LID platforms, >> > and not remove it entirely as you will break platforms. >> >> How about we leave the kernel alone and userspace (which would have to >> cope with the new KEY_LID_OPEN anyway) would just have to know that if >> switch's parent is PNP0C0D:00 (or phys is PNP0C0D/button/input0) then >> it >> can't trust the events and it needs additional heuristics. > > [Lv Zheng] > I found a problem with the key event approach. > And need your suggestions. > > Some AML tables invoke Notify(lid_device, ...) in several different places. > It may be invoked from different functions. > > Finally, it's not guaranteed that one "lid close" action can only trigger one key close notification. > If we use EV_KEY, then there should be many platforms triggering multiple "lid close" events to the user space. > > Original switch event based design can automatically eliminate the redundant events. > > Does input layer has an event type that can handle such situation? > Or shall ACPI button driver handle this? > Keys also have some redundant event elimination, but it's as long as you are holding the key in the press (or released) position. So in your case, that would mean sending input_key(1), wait a little while other notifications are processed, and then sending input_key(0) (assuming each notification comes in with its own thread). Not sure you will gain anything from the new implementation you just sent with the rate-limit. Cheers, Benjamin ^ permalink raw reply [flat|nested] 27+ messages in thread
* RE: [PATCH v2 4/4] ACPI / button: Add document for ACPI control method lid device restrictions 2016-07-19 8:40 ` Benjamin Tissoires @ 2016-07-19 8:57 ` Zheng, Lv 2016-07-19 9:07 ` Benjamin Tissoires 0 siblings, 1 reply; 27+ messages in thread From: Zheng, Lv @ 2016-07-19 8:57 UTC (permalink / raw) To: Benjamin Tissoires Cc: Dmitry Torokhov, Wysocki, Rafael J, Rafael J. Wysocki, Brown, Len, Lv Zheng, linux-kernel@vger.kernel.org, ACPI Devel Maling List, Bastien Nocera:, linux-input Hi, Benjamin > From: Benjamin Tissoires [mailto:benjamin.tissoires@gmail.com] > Subject: Re: [PATCH v2 4/4] ACPI / button: Add document for ACPI control > method lid device restrictions > > On Tue, Jul 19, 2016 at 9:17 AM, Zheng, Lv <lv.zheng@intel.com> wrote: > > Hi, Dmitry > > > >> From: Dmitry Torokhov [mailto:dmitry.torokhov@gmail.com] > >> Subject: Re: [PATCH v2 4/4] ACPI / button: Add document for ACPI > control > >> method lid device restrictions > >> > >> On Fri, Jul 08, 2016 at 11:17:39AM +0200, Benjamin Tissoires wrote: > >> > Hi, > >> > > >> > On Thu, Jul 7, 2016 at 9:11 AM, Lv Zheng <lv.zheng@intel.com> > wrote: > >> > > There are many AML tables reporting wrong initial lid state, and > some > >> of > >> > > them never reports lid state. As a proxy layer acting between, ACPI > >> button > >> > > driver is not able to handle all such cases, but need to re-define the > >> > > usage model of the ACPI lid. That is: > >> > > 1. It's initial state is not reliable; > >> > > 2. There may not be open event; > >> > > 3. Userspace should only take action against the close event which > is > >> > > reliable, always sent after a real lid close. > >> > > This patch adds documentation of the usage model. > >> > > > >> > > Link: https://lkml.org/2016/3/7/460 > >> > > Link: https://github.com/systemd/systemd/issues/2087 > >> > > Signed-off-by: Lv Zheng <lv.zheng@intel.com> > >> > > Cc: Bastien Nocera: <hadess@hadess.net> > >> > > Cc: Benjamin Tissoires <benjamin.tissoires@gmail.com> > >> > > Cc: linux-input@vger.kernel.org > >> > > --- > >> > > Documentation/acpi/acpi-lid.txt | 62 > >> +++++++++++++++++++++++++++++++++++++++ > >> > > 1 file changed, 62 insertions(+) > >> > > create mode 100644 Documentation/acpi/acpi-lid.txt > >> > > > >> > > diff --git a/Documentation/acpi/acpi-lid.txt > >> b/Documentation/acpi/acpi-lid.txt > >> > > new file mode 100644 > >> > > index 0000000..7e4f7ed > >> > > --- /dev/null > >> > > +++ b/Documentation/acpi/acpi-lid.txt > >> > > @@ -0,0 +1,62 @@ > >> > > +Usage Model of the ACPI Control Method Lid Device > >> > > + > >> > > +Copyright (C) 2016, Intel Corporation > >> > > +Author: Lv Zheng <lv.zheng@intel.com> > >> > > + > >> > > + > >> > > +Abstract: > >> > > + > >> > > +Platforms containing lids convey lid state (open/close) to OSPMs > >> using a > >> > > +control method lid device. To implement this, the AML tables issue > >> > > +Notify(lid_device, 0x80) to notify the OSPMs whenever the lid > state > >> has > >> > > +changed. The _LID control method for the lid device must be > >> implemented to > >> > > +report the "current" state of the lid as either "opened" or "closed". > >> > > + > >> > > +This document describes the restrictions and the expections of the > >> Linux > >> > > +ACPI lid device driver. > >> > > + > >> > > + > >> > > +1. Restrictions of the returning value of the _LID control method > >> > > + > >> > > +The _LID control method is described to return the "current" lid > state. > >> > > +However the word of "current" has ambiguity, many AML tables > >> return the lid > >> > > +state upon the last lid notification instead of returning the lid state > >> > > +upon the last _LID evaluation. There won't be difference when the > >> _LID > >> > > +control method is evaluated during the runtime, the problem is its > >> initial > >> > > +returning value. When the AML tables implement this control > method > >> with > >> > > +cached value, the initial returning value is likely not reliable. There > are > >> > > +simply so many examples always retuning "closed" as initial lid > state. > >> > > + > >> > > +2. Restrictions of the lid state change notifications > >> > > + > >> > > +There are many AML tables never notifying when the lid device > state > >> is > >> > > +changed to "opened". But it is ensured that the AML tables always > >> notify > >> > > +"closed" when the lid state is changed to "closed". This is normally > >> used > >> > > +to trigger some system power saving operations on Windows. > Since it > >> is > >> > > +fully tested, this notification is reliable for all AML tables. > >> > > + > >> > > +3. Expections for the userspace users of the ACPI lid device driver > >> > > + > >> > > +The userspace programs should stop relying on > >> > > +/proc/acpi/button/lid/LID0/state to obtain the lid state. This file is > >> only > >> > > +used for the validation purpose. > >> > > >> > I'd say: this file actually calls the _LID method described above. And > >> > given the previous explanation, it is not reliable enough on some > >> > platforms. So it is strongly advised for user-space program to not > >> > solely rely on this file to determine the actual lid state. > >> > > >> > > + > >> > > +New userspace programs should rely on the lid "closed" > notification > >> to > >> > > +trigger some power saving operations and may stop taking actions > >> according > >> > > +to the lid "opened" notification. A new input switch event - > >> SW_ACPI_LID is > >> > > +prepared for the new userspace to implement this ACPI control > >> method lid > >> > > +device specific logics. > >> > > >> > That's not entirely what we discussed before (to prevent regressions): > >> > - if the device doesn't have reliable LID switch state, then there > >> > would be the new input event, and so userspace should only rely on > >> > opened notifications. > >> > - if the device has reliable switch information, the new input event > >> > should not be exported and userspace knows that the current input > >> > switch event is reliable. > >> > > >> > Also, using a new "switch" event is a terrible idea. Switches have a > >> > state (open/close) and you are using this to forward a single open > >> > event. So using a switch just allows you to say to userspace you are > >> > using the "new" LID meaning, but you'll still have to manually reset > >> > the switch and you will have to document how this event is not a > >> > switch. > >> > > >> > Please use a simple KEY_LID_OPEN event you will send through > >> > [input_key_event(KEY_LID_OPEN, 1), input_sync(), > >> > input_key_event(KEY_LID_OPEN, 0), input_sync()], which userspace > >> knows > >> > how to handle. > >> > > >> > > + > >> > > +During the period the userspace hasn't been switched to use the > new > >> > > +SW_ACPI_LID event, Linux users can use the following boot > parameter > >> to > >> > > +handle possible issues: > >> > > + button.lid_init_state=method: > >> > > + This is the default behavior of the Linux ACPI lid driver, Linux > kernel > >> > > + reports the initial lid state using the returning value of the _LID > >> > > + control method. > >> > > + This can be used to fix some platforms if the _LID control > method's > >> > > + returning value is reliable. > >> > > + button.lid_init_state=open: > >> > > + Linux kernel always reports the initial lid state as "opened". > >> > > + This may fix some platforms if the returning value of the _LID > >> control > >> > > + method is not reliable. > >> > > >> > This worries me as there is no plan after "During the period the > >> > userspace hasn't been switched to use the new event". > >> > > >> > I really hope you'll keep sending SW_LID for reliable LID platforms, > >> > and not remove it entirely as you will break platforms. > >> > >> How about we leave the kernel alone and userspace (which would have > to > >> cope with the new KEY_LID_OPEN anyway) would just have to know > that if > >> switch's parent is PNP0C0D:00 (or phys is PNP0C0D/button/input0) > then > >> it > >> can't trust the events and it needs additional heuristics. > > > > [Lv Zheng] > > I found a problem with the key event approach. > > And need your suggestions. > > > > Some AML tables invoke Notify(lid_device, ...) in several different places. > > It may be invoked from different functions. > > > > Finally, it's not guaranteed that one "lid close" action can only trigger > one key close notification. > > If we use EV_KEY, then there should be many platforms triggering > multiple "lid close" events to the user space. > > > > Original switch event based design can automatically eliminate the > redundant events. > > > > Does input layer has an event type that can handle such situation? > > Or shall ACPI button driver handle this? > > > > Keys also have some redundant event elimination, but it's as long as > you are holding the key in the press (or released) position. So in > your case, that would mean sending input_key(1), wait a little while > other notifications are processed, and then sending input_key(0) > (assuming each notification comes in with its own thread). Not sure > you will gain anything from the new implementation you just sent with > the rate-limit. [Lv Zheng] However this key is virtual. The multiple notifications are just triggered by the AML code. The Notify(lid_device, xxx) may be invoked in a function. And this function may be invoked multiple times by other control methods. So I do not know when it is "released". Using the feature of the keys, it sounds like that I should setup a timer. When the state is changed, I should report input_key(1) and prepare the timer. Then report the input_key(0) when the timer times out. The side effect is the input_key(0) will be deferred. I just refreshed the patch as v4 with an ACPI button driver internal workaround. By adding a time_after() check which looks more lightweight than setting up a timer. Could you also help to check if that solution is OK? Thanks in advance. Best regards -Lv ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH v2 4/4] ACPI / button: Add document for ACPI control method lid device restrictions 2016-07-19 8:57 ` Zheng, Lv @ 2016-07-19 9:07 ` Benjamin Tissoires 0 siblings, 0 replies; 27+ messages in thread From: Benjamin Tissoires @ 2016-07-19 9:07 UTC (permalink / raw) To: Zheng, Lv Cc: Dmitry Torokhov, Wysocki, Rafael J, Rafael J. Wysocki, Brown, Len, Lv Zheng, linux-kernel@vger.kernel.org, ACPI Devel Maling List, Bastien Nocera:, linux-input On Tue, Jul 19, 2016 at 10:57 AM, Zheng, Lv <lv.zheng@intel.com> wrote: > Hi, Benjamin > >> From: Benjamin Tissoires [mailto:benjamin.tissoires@gmail.com] >> Subject: Re: [PATCH v2 4/4] ACPI / button: Add document for ACPI control >> method lid device restrictions >> >> On Tue, Jul 19, 2016 at 9:17 AM, Zheng, Lv <lv.zheng@intel.com> wrote: >> > Hi, Dmitry >> > >> >> From: Dmitry Torokhov [mailto:dmitry.torokhov@gmail.com] >> >> Subject: Re: [PATCH v2 4/4] ACPI / button: Add document for ACPI >> control >> >> method lid device restrictions >> >> >> >> On Fri, Jul 08, 2016 at 11:17:39AM +0200, Benjamin Tissoires wrote: >> >> > Hi, >> >> > >> >> > On Thu, Jul 7, 2016 at 9:11 AM, Lv Zheng <lv.zheng@intel.com> >> wrote: >> >> > > There are many AML tables reporting wrong initial lid state, and >> some >> >> of >> >> > > them never reports lid state. As a proxy layer acting between, ACPI >> >> button >> >> > > driver is not able to handle all such cases, but need to re-define the >> >> > > usage model of the ACPI lid. That is: >> >> > > 1. It's initial state is not reliable; >> >> > > 2. There may not be open event; >> >> > > 3. Userspace should only take action against the close event which >> is >> >> > > reliable, always sent after a real lid close. >> >> > > This patch adds documentation of the usage model. >> >> > > >> >> > > Link: https://lkml.org/2016/3/7/460 >> >> > > Link: https://github.com/systemd/systemd/issues/2087 >> >> > > Signed-off-by: Lv Zheng <lv.zheng@intel.com> >> >> > > Cc: Bastien Nocera: <hadess@hadess.net> >> >> > > Cc: Benjamin Tissoires <benjamin.tissoires@gmail.com> >> >> > > Cc: linux-input@vger.kernel.org >> >> > > --- >> >> > > Documentation/acpi/acpi-lid.txt | 62 >> >> +++++++++++++++++++++++++++++++++++++++ >> >> > > 1 file changed, 62 insertions(+) >> >> > > create mode 100644 Documentation/acpi/acpi-lid.txt >> >> > > >> >> > > diff --git a/Documentation/acpi/acpi-lid.txt >> >> b/Documentation/acpi/acpi-lid.txt >> >> > > new file mode 100644 >> >> > > index 0000000..7e4f7ed >> >> > > --- /dev/null >> >> > > +++ b/Documentation/acpi/acpi-lid.txt >> >> > > @@ -0,0 +1,62 @@ >> >> > > +Usage Model of the ACPI Control Method Lid Device >> >> > > + >> >> > > +Copyright (C) 2016, Intel Corporation >> >> > > +Author: Lv Zheng <lv.zheng@intel.com> >> >> > > + >> >> > > + >> >> > > +Abstract: >> >> > > + >> >> > > +Platforms containing lids convey lid state (open/close) to OSPMs >> >> using a >> >> > > +control method lid device. To implement this, the AML tables issue >> >> > > +Notify(lid_device, 0x80) to notify the OSPMs whenever the lid >> state >> >> has >> >> > > +changed. The _LID control method for the lid device must be >> >> implemented to >> >> > > +report the "current" state of the lid as either "opened" or "closed". >> >> > > + >> >> > > +This document describes the restrictions and the expections of the >> >> Linux >> >> > > +ACPI lid device driver. >> >> > > + >> >> > > + >> >> > > +1. Restrictions of the returning value of the _LID control method >> >> > > + >> >> > > +The _LID control method is described to return the "current" lid >> state. >> >> > > +However the word of "current" has ambiguity, many AML tables >> >> return the lid >> >> > > +state upon the last lid notification instead of returning the lid state >> >> > > +upon the last _LID evaluation. There won't be difference when the >> >> _LID >> >> > > +control method is evaluated during the runtime, the problem is its >> >> initial >> >> > > +returning value. When the AML tables implement this control >> method >> >> with >> >> > > +cached value, the initial returning value is likely not reliable. There >> are >> >> > > +simply so many examples always retuning "closed" as initial lid >> state. >> >> > > + >> >> > > +2. Restrictions of the lid state change notifications >> >> > > + >> >> > > +There are many AML tables never notifying when the lid device >> state >> >> is >> >> > > +changed to "opened". But it is ensured that the AML tables always >> >> notify >> >> > > +"closed" when the lid state is changed to "closed". This is normally >> >> used >> >> > > +to trigger some system power saving operations on Windows. >> Since it >> >> is >> >> > > +fully tested, this notification is reliable for all AML tables. >> >> > > + >> >> > > +3. Expections for the userspace users of the ACPI lid device driver >> >> > > + >> >> > > +The userspace programs should stop relying on >> >> > > +/proc/acpi/button/lid/LID0/state to obtain the lid state. This file is >> >> only >> >> > > +used for the validation purpose. >> >> > >> >> > I'd say: this file actually calls the _LID method described above. And >> >> > given the previous explanation, it is not reliable enough on some >> >> > platforms. So it is strongly advised for user-space program to not >> >> > solely rely on this file to determine the actual lid state. >> >> > >> >> > > + >> >> > > +New userspace programs should rely on the lid "closed" >> notification >> >> to >> >> > > +trigger some power saving operations and may stop taking actions >> >> according >> >> > > +to the lid "opened" notification. A new input switch event - >> >> SW_ACPI_LID is >> >> > > +prepared for the new userspace to implement this ACPI control >> >> method lid >> >> > > +device specific logics. >> >> > >> >> > That's not entirely what we discussed before (to prevent regressions): >> >> > - if the device doesn't have reliable LID switch state, then there >> >> > would be the new input event, and so userspace should only rely on >> >> > opened notifications. >> >> > - if the device has reliable switch information, the new input event >> >> > should not be exported and userspace knows that the current input >> >> > switch event is reliable. >> >> > >> >> > Also, using a new "switch" event is a terrible idea. Switches have a >> >> > state (open/close) and you are using this to forward a single open >> >> > event. So using a switch just allows you to say to userspace you are >> >> > using the "new" LID meaning, but you'll still have to manually reset >> >> > the switch and you will have to document how this event is not a >> >> > switch. >> >> > >> >> > Please use a simple KEY_LID_OPEN event you will send through >> >> > [input_key_event(KEY_LID_OPEN, 1), input_sync(), >> >> > input_key_event(KEY_LID_OPEN, 0), input_sync()], which userspace >> >> knows >> >> > how to handle. >> >> > >> >> > > + >> >> > > +During the period the userspace hasn't been switched to use the >> new >> >> > > +SW_ACPI_LID event, Linux users can use the following boot >> parameter >> >> to >> >> > > +handle possible issues: >> >> > > + button.lid_init_state=method: >> >> > > + This is the default behavior of the Linux ACPI lid driver, Linux >> kernel >> >> > > + reports the initial lid state using the returning value of the _LID >> >> > > + control method. >> >> > > + This can be used to fix some platforms if the _LID control >> method's >> >> > > + returning value is reliable. >> >> > > + button.lid_init_state=open: >> >> > > + Linux kernel always reports the initial lid state as "opened". >> >> > > + This may fix some platforms if the returning value of the _LID >> >> control >> >> > > + method is not reliable. >> >> > >> >> > This worries me as there is no plan after "During the period the >> >> > userspace hasn't been switched to use the new event". >> >> > >> >> > I really hope you'll keep sending SW_LID for reliable LID platforms, >> >> > and not remove it entirely as you will break platforms. >> >> >> >> How about we leave the kernel alone and userspace (which would have >> to >> >> cope with the new KEY_LID_OPEN anyway) would just have to know >> that if >> >> switch's parent is PNP0C0D:00 (or phys is PNP0C0D/button/input0) >> then >> >> it >> >> can't trust the events and it needs additional heuristics. >> > >> > [Lv Zheng] >> > I found a problem with the key event approach. >> > And need your suggestions. >> > >> > Some AML tables invoke Notify(lid_device, ...) in several different places. >> > It may be invoked from different functions. >> > >> > Finally, it's not guaranteed that one "lid close" action can only trigger >> one key close notification. >> > If we use EV_KEY, then there should be many platforms triggering >> multiple "lid close" events to the user space. >> > >> > Original switch event based design can automatically eliminate the >> redundant events. >> > >> > Does input layer has an event type that can handle such situation? >> > Or shall ACPI button driver handle this? >> > >> >> Keys also have some redundant event elimination, but it's as long as >> you are holding the key in the press (or released) position. So in >> your case, that would mean sending input_key(1), wait a little while >> other notifications are processed, and then sending input_key(0) >> (assuming each notification comes in with its own thread). Not sure >> you will gain anything from the new implementation you just sent with >> the rate-limit. > > [Lv Zheng] > However this key is virtual. > The multiple notifications are just triggered by the AML code. > The Notify(lid_device, xxx) may be invoked in a function. > And this function may be invoked multiple times by other control methods. Yes, I understood. In this particular case, when I sad "pressed" or "released" please understand logical 1 or logical 0. > So I do not know when it is "released". Yep, that's the problem. > > Using the feature of the keys, it sounds like that I should setup a timer. > When the state is changed, I should report input_key(1) and prepare the timer. > Then report the input_key(0) when the timer times out. > The side effect is the input_key(0) will be deferred. That's not an issue. If it were an issue, logind can just get triggered when it receives the key(1), and ignore the key(0). But given that the action will likely be power suspend, I don't think even a 500ms delay will be an issue. > > I just refreshed the patch as v4 with an ACPI button driver internal workaround. > By adding a time_after() check which looks more lightweight than setting up a timer. > Could you also help to check if that solution is OK? Yes, that's fine by me. I already sent my rev-by. Cheers, Benjamin > Thanks in advance. > > Best regards > -Lv ^ permalink raw reply [flat|nested] 27+ messages in thread
* RE: [PATCH v2 4/4] ACPI / button: Add document for ACPI control method lid device restrictions 2016-07-08 9:17 ` Benjamin Tissoires 2016-07-08 17:51 ` Dmitry Torokhov @ 2016-07-11 3:20 ` Zheng, Lv 2016-07-11 10:58 ` Bastien Nocera 2016-07-11 11:42 ` Benjamin Tissoires 1 sibling, 2 replies; 27+ messages in thread From: Zheng, Lv @ 2016-07-11 3:20 UTC (permalink / raw) To: Benjamin Tissoires Cc: Wysocki, Rafael J, Rafael J. Wysocki, Brown, Len, Lv Zheng, linux-kernel@vger.kernel.org, ACPI Devel Maling List, Bastien Nocera:, linux-input, Dmitry Torokhov Hi, > From: Benjamin Tissoires [mailto:benjamin.tissoires@gmail.com] > Subject: Re: [PATCH v2 4/4] ACPI / button: Add document for ACPI control > method lid device restrictions > > Hi, > > On Thu, Jul 7, 2016 at 9:11 AM, Lv Zheng <lv.zheng@intel.com> wrote: > > There are many AML tables reporting wrong initial lid state, and some of > > them never reports lid state. As a proxy layer acting between, ACPI > button > > driver is not able to handle all such cases, but need to re-define the > > usage model of the ACPI lid. That is: > > 1. It's initial state is not reliable; > > 2. There may not be open event; > > 3. Userspace should only take action against the close event which is > > reliable, always sent after a real lid close. > > This patch adds documentation of the usage model. > > > > Link: https://lkml.org/2016/3/7/460 > > Link: https://github.com/systemd/systemd/issues/2087 > > Signed-off-by: Lv Zheng <lv.zheng@intel.com> > > Cc: Bastien Nocera: <hadess@hadess.net> > > Cc: Benjamin Tissoires <benjamin.tissoires@gmail.com> > > Cc: linux-input@vger.kernel.org > > --- > > Documentation/acpi/acpi-lid.txt | 62 > +++++++++++++++++++++++++++++++++++++++ > > 1 file changed, 62 insertions(+) > > create mode 100644 Documentation/acpi/acpi-lid.txt > > > > diff --git a/Documentation/acpi/acpi-lid.txt b/Documentation/acpi/acpi- > lid.txt > > new file mode 100644 > > index 0000000..7e4f7ed > > --- /dev/null > > +++ b/Documentation/acpi/acpi-lid.txt > > @@ -0,0 +1,62 @@ > > +Usage Model of the ACPI Control Method Lid Device > > + > > +Copyright (C) 2016, Intel Corporation > > +Author: Lv Zheng <lv.zheng@intel.com> > > + > > + > > +Abstract: > > + > > +Platforms containing lids convey lid state (open/close) to OSPMs using > a > > +control method lid device. To implement this, the AML tables issue > > +Notify(lid_device, 0x80) to notify the OSPMs whenever the lid state has > > +changed. The _LID control method for the lid device must be > implemented to > > +report the "current" state of the lid as either "opened" or "closed". > > + > > +This document describes the restrictions and the expections of the > Linux > > +ACPI lid device driver. > > + > > + > > +1. Restrictions of the returning value of the _LID control method > > + > > +The _LID control method is described to return the "current" lid state. > > +However the word of "current" has ambiguity, many AML tables return > the lid > > +state upon the last lid notification instead of returning the lid state > > +upon the last _LID evaluation. There won't be difference when the _LID > > +control method is evaluated during the runtime, the problem is its > initial > > +returning value. When the AML tables implement this control method > with > > +cached value, the initial returning value is likely not reliable. There are > > +simply so many examples always retuning "closed" as initial lid state. > > + > > +2. Restrictions of the lid state change notifications > > + > > +There are many AML tables never notifying when the lid device state is > > +changed to "opened". But it is ensured that the AML tables always > notify > > +"closed" when the lid state is changed to "closed". This is normally used > > +to trigger some system power saving operations on Windows. Since it is > > +fully tested, this notification is reliable for all AML tables. > > + > > +3. Expections for the userspace users of the ACPI lid device driver > > + > > +The userspace programs should stop relying on > > +/proc/acpi/button/lid/LID0/state to obtain the lid state. This file is only > > +used for the validation purpose. > > I'd say: this file actually calls the _LID method described above. And > given the previous explanation, it is not reliable enough on some > platforms. So it is strongly advised for user-space program to not > solely rely on this file to determine the actual lid state. [Lv Zheng] OK. > > > + > > +New userspace programs should rely on the lid "closed" notification to > > +trigger some power saving operations and may stop taking actions > according > > +to the lid "opened" notification. A new input switch event - > SW_ACPI_LID is > > +prepared for the new userspace to implement this ACPI control method > lid > > +device specific logics. > > That's not entirely what we discussed before (to prevent regressions): > - if the device doesn't have reliable LID switch state, then there > would be the new input event, and so userspace should only rely on > opened notifications. > - if the device has reliable switch information, the new input event > should not be exported and userspace knows that the current input > switch event is reliable. > > Also, using a new "switch" event is a terrible idea. Switches have a > state (open/close) and you are using this to forward a single open > event. So using a switch just allows you to say to userspace you are > using the "new" LID meaning, but you'll still have to manually reset > the switch and you will have to document how this event is not a > switch. > > Please use a simple KEY_LID_OPEN event you will send through > [input_key_event(KEY_LID_OPEN, 1), input_sync(), > input_key_event(KEY_LID_OPEN, 0), input_sync()], which userspace knows > how to handle. [Lv Zheng] It should be KEY_LID_CLOSE. However I checked the KEY code definitions. It seems their values are highly dependent on the HID specification. I'm not sure which key code value should I use for this. Could you point me out? > > > + > > +During the period the userspace hasn't been switched to use the new > > +SW_ACPI_LID event, Linux users can use the following boot parameter > to > > +handle possible issues: > > + button.lid_init_state=method: > > + This is the default behavior of the Linux ACPI lid driver, Linux kernel > > + reports the initial lid state using the returning value of the _LID > > + control method. > > + This can be used to fix some platforms if the _LID control method's > > + returning value is reliable. > > + button.lid_init_state=open: > > + Linux kernel always reports the initial lid state as "opened". > > + This may fix some platforms if the returning value of the _LID control > > + method is not reliable. > > This worries me as there is no plan after "During the period the > userspace hasn't been switched to use the new event". > > I really hope you'll keep sending SW_LID for reliable LID platforms, > and not remove it entirely as you will break platforms. [Lv Zheng] We won't remove SW_LID from the kernel :). And we haven't removed SW_LID from the acpi button driver. We'll just stop sending "initial lid state" from acpi button driver, i.e., the behavior carried out by "button.lid_init_state=ignore". Maybe it is not sufficient, after the userspace has been changed to support the new event, we should stop sending SW_LID from acpi button driver. Cheers, -Lv ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH v2 4/4] ACPI / button: Add document for ACPI control method lid device restrictions 2016-07-11 3:20 ` Zheng, Lv @ 2016-07-11 10:58 ` Bastien Nocera 2016-07-12 7:06 ` Zheng, Lv 2016-07-11 11:42 ` Benjamin Tissoires 1 sibling, 1 reply; 27+ messages in thread From: Bastien Nocera @ 2016-07-11 10:58 UTC (permalink / raw) To: Zheng, Lv, Benjamin Tissoires Cc: Wysocki, Rafael J, Rafael J. Wysocki, Brown, Len, Lv Zheng, linux-kernel@vger.kernel.org, ACPI Devel Maling List, linux-input, Dmitry Torokhov On Mon, 2016-07-11 at 03:20 +0000, Zheng, Lv wrote: > <snip> > > This worries me as there is no plan after "During the period the > > userspace hasn't been switched to use the new event". > > > > I really hope you'll keep sending SW_LID for reliable LID > > platforms, > > and not remove it entirely as you will break platforms. > > [Lv Zheng] > We won't remove SW_LID from the kernel :). > > And we haven't removed SW_LID from the acpi button driver. > We'll just stop sending "initial lid state" from acpi button driver, > i.e., the behavior carried out by "button.lid_init_state=ignore". > > Maybe it is not sufficient, after the userspace has been changed to > support the new event, we should stop sending SW_LID from acpi button > driver. For the affected devices? Sure, but I don't think that's a reasonable thing to do for "all" the devices. We have a majority of laptops where this isn't a problem, and it's not even a problem any more on one of the devices that triggered this discussion (there's a patch for make the LID status match reality for the Surface 3). ^ permalink raw reply [flat|nested] 27+ messages in thread
* RE: [PATCH v2 4/4] ACPI / button: Add document for ACPI control method lid device restrictions 2016-07-11 10:58 ` Bastien Nocera @ 2016-07-12 7:06 ` Zheng, Lv 0 siblings, 0 replies; 27+ messages in thread From: Zheng, Lv @ 2016-07-12 7:06 UTC (permalink / raw) To: Bastien Nocera, Benjamin Tissoires Cc: Wysocki, Rafael J, Rafael J. Wysocki, Brown, Len, Lv Zheng, linux-kernel@vger.kernel.org, ACPI Devel Maling List, linux-input, Dmitry Torokhov Hi, > From: Bastien Nocera [mailto:hadess@hadess.net] > Subject: Re: [PATCH v2 4/4] ACPI / button: Add document for ACPI control > method lid device restrictions > > On Mon, 2016-07-11 at 03:20 +0000, Zheng, Lv wrote: > > > <snip> > > > This worries me as there is no plan after "During the period the > > > userspace hasn't been switched to use the new event". > > > > > > I really hope you'll keep sending SW_LID for reliable LID > > > platforms, > > > and not remove it entirely as you will break platforms. > > > > [Lv Zheng] > > We won't remove SW_LID from the kernel :). > > > > And we haven't removed SW_LID from the acpi button driver. > > We'll just stop sending "initial lid state" from acpi button driver, > > i.e., the behavior carried out by "button.lid_init_state=ignore". > > > > Maybe it is not sufficient, after the userspace has been changed to > > support the new event, we should stop sending SW_LID from acpi button > > driver. > > For the affected devices? Sure, but I don't think that's a reasonable > thing to do for "all" the devices. We have a majority of laptops where > this isn't a problem, and it's not even a problem any more on one of > the devices that triggered this discussion (there's a patch for make > the LID status match reality for the Surface 3). [Lv Zheng] It looks, even with this fixed, there are tables never generating "lid open" event. Thus the lid notification is definitely not a "switch event". Thanks and best regards -Lv ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH v2 4/4] ACPI / button: Add document for ACPI control method lid device restrictions 2016-07-11 3:20 ` Zheng, Lv 2016-07-11 10:58 ` Bastien Nocera @ 2016-07-11 11:42 ` Benjamin Tissoires 2016-07-11 11:47 ` Benjamin Tissoires 1 sibling, 1 reply; 27+ messages in thread From: Benjamin Tissoires @ 2016-07-11 11:42 UTC (permalink / raw) To: Zheng, Lv Cc: Wysocki, Rafael J, Rafael J. Wysocki, Brown, Len, Lv Zheng, linux-kernel@vger.kernel.org, ACPI Devel Maling List, Bastien Nocera:, linux-input, Dmitry Torokhov On Mon, Jul 11, 2016 at 5:20 AM, Zheng, Lv <lv.zheng@intel.com> wrote: > Hi, > >> From: Benjamin Tissoires [mailto:benjamin.tissoires@gmail.com] >> Subject: Re: [PATCH v2 4/4] ACPI / button: Add document for ACPI control >> method lid device restrictions >> >> Hi, >> >> On Thu, Jul 7, 2016 at 9:11 AM, Lv Zheng <lv.zheng@intel.com> wrote: >> > There are many AML tables reporting wrong initial lid state, and some of >> > them never reports lid state. As a proxy layer acting between, ACPI >> button >> > driver is not able to handle all such cases, but need to re-define the >> > usage model of the ACPI lid. That is: >> > 1. It's initial state is not reliable; >> > 2. There may not be open event; >> > 3. Userspace should only take action against the close event which is >> > reliable, always sent after a real lid close. >> > This patch adds documentation of the usage model. >> > >> > Link: https://lkml.org/2016/3/7/460 >> > Link: https://github.com/systemd/systemd/issues/2087 >> > Signed-off-by: Lv Zheng <lv.zheng@intel.com> >> > Cc: Bastien Nocera: <hadess@hadess.net> >> > Cc: Benjamin Tissoires <benjamin.tissoires@gmail.com> >> > Cc: linux-input@vger.kernel.org >> > --- >> > Documentation/acpi/acpi-lid.txt | 62 >> +++++++++++++++++++++++++++++++++++++++ >> > 1 file changed, 62 insertions(+) >> > create mode 100644 Documentation/acpi/acpi-lid.txt >> > >> > diff --git a/Documentation/acpi/acpi-lid.txt b/Documentation/acpi/acpi- >> lid.txt >> > new file mode 100644 >> > index 0000000..7e4f7ed >> > --- /dev/null >> > +++ b/Documentation/acpi/acpi-lid.txt >> > @@ -0,0 +1,62 @@ >> > +Usage Model of the ACPI Control Method Lid Device >> > + >> > +Copyright (C) 2016, Intel Corporation >> > +Author: Lv Zheng <lv.zheng@intel.com> >> > + >> > + >> > +Abstract: >> > + >> > +Platforms containing lids convey lid state (open/close) to OSPMs using >> a >> > +control method lid device. To implement this, the AML tables issue >> > +Notify(lid_device, 0x80) to notify the OSPMs whenever the lid state has >> > +changed. The _LID control method for the lid device must be >> implemented to >> > +report the "current" state of the lid as either "opened" or "closed". >> > + >> > +This document describes the restrictions and the expections of the >> Linux >> > +ACPI lid device driver. >> > + >> > + >> > +1. Restrictions of the returning value of the _LID control method >> > + >> > +The _LID control method is described to return the "current" lid state. >> > +However the word of "current" has ambiguity, many AML tables return >> the lid >> > +state upon the last lid notification instead of returning the lid state >> > +upon the last _LID evaluation. There won't be difference when the _LID >> > +control method is evaluated during the runtime, the problem is its >> initial >> > +returning value. When the AML tables implement this control method >> with >> > +cached value, the initial returning value is likely not reliable. There are >> > +simply so many examples always retuning "closed" as initial lid state. >> > + >> > +2. Restrictions of the lid state change notifications >> > + >> > +There are many AML tables never notifying when the lid device state is >> > +changed to "opened". But it is ensured that the AML tables always >> notify >> > +"closed" when the lid state is changed to "closed". This is normally used >> > +to trigger some system power saving operations on Windows. Since it is >> > +fully tested, this notification is reliable for all AML tables. >> > + >> > +3. Expections for the userspace users of the ACPI lid device driver >> > + >> > +The userspace programs should stop relying on >> > +/proc/acpi/button/lid/LID0/state to obtain the lid state. This file is only >> > +used for the validation purpose. >> >> I'd say: this file actually calls the _LID method described above. And >> given the previous explanation, it is not reliable enough on some >> platforms. So it is strongly advised for user-space program to not >> solely rely on this file to determine the actual lid state. > [Lv Zheng] > OK. > >> >> > + >> > +New userspace programs should rely on the lid "closed" notification to >> > +trigger some power saving operations and may stop taking actions >> according >> > +to the lid "opened" notification. A new input switch event - >> SW_ACPI_LID is >> > +prepared for the new userspace to implement this ACPI control method >> lid >> > +device specific logics. >> >> That's not entirely what we discussed before (to prevent regressions): >> - if the device doesn't have reliable LID switch state, then there >> would be the new input event, and so userspace should only rely on >> opened notifications. >> - if the device has reliable switch information, the new input event >> should not be exported and userspace knows that the current input >> switch event is reliable. >> >> Also, using a new "switch" event is a terrible idea. Switches have a >> state (open/close) and you are using this to forward a single open >> event. So using a switch just allows you to say to userspace you are >> using the "new" LID meaning, but you'll still have to manually reset >> the switch and you will have to document how this event is not a >> switch. >> >> Please use a simple KEY_LID_OPEN event you will send through >> [input_key_event(KEY_LID_OPEN, 1), input_sync(), >> input_key_event(KEY_LID_OPEN, 0), input_sync()], which userspace knows >> how to handle. > [Lv Zheng] > It should be KEY_LID_CLOSE. yep, sorry. > However I checked the KEY code definitions. > It seems their values are highly dependent on the HID specification. That was convenient enough when the code was written. Now, we can extend new keycodes as we want, as long as Dmitry agrees :) > I'm not sure which key code value should I use for this. > Could you point me out? > >> >> > + >> > +During the period the userspace hasn't been switched to use the new >> > +SW_ACPI_LID event, Linux users can use the following boot parameter >> to >> > +handle possible issues: >> > + button.lid_init_state=method: >> > + This is the default behavior of the Linux ACPI lid driver, Linux kernel >> > + reports the initial lid state using the returning value of the _LID >> > + control method. >> > + This can be used to fix some platforms if the _LID control method's >> > + returning value is reliable. >> > + button.lid_init_state=open: >> > + Linux kernel always reports the initial lid state as "opened". >> > + This may fix some platforms if the returning value of the _LID control >> > + method is not reliable. >> >> This worries me as there is no plan after "During the period the >> userspace hasn't been switched to use the new event". >> >> I really hope you'll keep sending SW_LID for reliable LID platforms, >> and not remove it entirely as you will break platforms. > > [Lv Zheng] > We won't remove SW_LID from the kernel :). > > And we haven't removed SW_LID from the acpi button driver. > We'll just stop sending "initial lid state" from acpi button driver, i.e., the behavior carried out by "button.lid_init_state=ignore". > > Maybe it is not sufficient, after the userspace has been changed to support the new event, we should stop sending SW_LID from acpi button driver. > > Cheers, > -Lv ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH v2 4/4] ACPI / button: Add document for ACPI control method lid device restrictions 2016-07-11 11:42 ` Benjamin Tissoires @ 2016-07-11 11:47 ` Benjamin Tissoires 2016-07-12 7:34 ` Zheng, Lv 0 siblings, 1 reply; 27+ messages in thread From: Benjamin Tissoires @ 2016-07-11 11:47 UTC (permalink / raw) To: Zheng, Lv Cc: Wysocki, Rafael J, Rafael J. Wysocki, Brown, Len, Lv Zheng, linux-kernel@vger.kernel.org, ACPI Devel Maling List, Bastien Nocera:, linux-input, Dmitry Torokhov [I just realised Ctrl+enter means "send" for gmail, see the end of the answers] On Mon, Jul 11, 2016 at 1:42 PM, Benjamin Tissoires <benjamin.tissoires@gmail.com> wrote: > On Mon, Jul 11, 2016 at 5:20 AM, Zheng, Lv <lv.zheng@intel.com> wrote: >> Hi, >> >>> From: Benjamin Tissoires [mailto:benjamin.tissoires@gmail.com] >>> Subject: Re: [PATCH v2 4/4] ACPI / button: Add document for ACPI control >>> method lid device restrictions >>> >>> Hi, >>> >>> On Thu, Jul 7, 2016 at 9:11 AM, Lv Zheng <lv.zheng@intel.com> wrote: >>> > There are many AML tables reporting wrong initial lid state, and some of >>> > them never reports lid state. As a proxy layer acting between, ACPI >>> button >>> > driver is not able to handle all such cases, but need to re-define the >>> > usage model of the ACPI lid. That is: >>> > 1. It's initial state is not reliable; >>> > 2. There may not be open event; >>> > 3. Userspace should only take action against the close event which is >>> > reliable, always sent after a real lid close. >>> > This patch adds documentation of the usage model. >>> > >>> > Link: https://lkml.org/2016/3/7/460 >>> > Link: https://github.com/systemd/systemd/issues/2087 >>> > Signed-off-by: Lv Zheng <lv.zheng@intel.com> >>> > Cc: Bastien Nocera: <hadess@hadess.net> >>> > Cc: Benjamin Tissoires <benjamin.tissoires@gmail.com> >>> > Cc: linux-input@vger.kernel.org >>> > --- >>> > Documentation/acpi/acpi-lid.txt | 62 >>> +++++++++++++++++++++++++++++++++++++++ >>> > 1 file changed, 62 insertions(+) >>> > create mode 100644 Documentation/acpi/acpi-lid.txt >>> > >>> > diff --git a/Documentation/acpi/acpi-lid.txt b/Documentation/acpi/acpi- >>> lid.txt >>> > new file mode 100644 >>> > index 0000000..7e4f7ed >>> > --- /dev/null >>> > +++ b/Documentation/acpi/acpi-lid.txt >>> > @@ -0,0 +1,62 @@ >>> > +Usage Model of the ACPI Control Method Lid Device >>> > + >>> > +Copyright (C) 2016, Intel Corporation >>> > +Author: Lv Zheng <lv.zheng@intel.com> >>> > + >>> > + >>> > +Abstract: >>> > + >>> > +Platforms containing lids convey lid state (open/close) to OSPMs using >>> a >>> > +control method lid device. To implement this, the AML tables issue >>> > +Notify(lid_device, 0x80) to notify the OSPMs whenever the lid state has >>> > +changed. The _LID control method for the lid device must be >>> implemented to >>> > +report the "current" state of the lid as either "opened" or "closed". >>> > + >>> > +This document describes the restrictions and the expections of the >>> Linux >>> > +ACPI lid device driver. >>> > + >>> > + >>> > +1. Restrictions of the returning value of the _LID control method >>> > + >>> > +The _LID control method is described to return the "current" lid state. >>> > +However the word of "current" has ambiguity, many AML tables return >>> the lid >>> > +state upon the last lid notification instead of returning the lid state >>> > +upon the last _LID evaluation. There won't be difference when the _LID >>> > +control method is evaluated during the runtime, the problem is its >>> initial >>> > +returning value. When the AML tables implement this control method >>> with >>> > +cached value, the initial returning value is likely not reliable. There are >>> > +simply so many examples always retuning "closed" as initial lid state. >>> > + >>> > +2. Restrictions of the lid state change notifications >>> > + >>> > +There are many AML tables never notifying when the lid device state is >>> > +changed to "opened". But it is ensured that the AML tables always >>> notify >>> > +"closed" when the lid state is changed to "closed". This is normally used >>> > +to trigger some system power saving operations on Windows. Since it is >>> > +fully tested, this notification is reliable for all AML tables. >>> > + >>> > +3. Expections for the userspace users of the ACPI lid device driver >>> > + >>> > +The userspace programs should stop relying on >>> > +/proc/acpi/button/lid/LID0/state to obtain the lid state. This file is only >>> > +used for the validation purpose. >>> >>> I'd say: this file actually calls the _LID method described above. And >>> given the previous explanation, it is not reliable enough on some >>> platforms. So it is strongly advised for user-space program to not >>> solely rely on this file to determine the actual lid state. >> [Lv Zheng] >> OK. >> >>> >>> > + >>> > +New userspace programs should rely on the lid "closed" notification to >>> > +trigger some power saving operations and may stop taking actions >>> according >>> > +to the lid "opened" notification. A new input switch event - >>> SW_ACPI_LID is >>> > +prepared for the new userspace to implement this ACPI control method >>> lid >>> > +device specific logics. >>> >>> That's not entirely what we discussed before (to prevent regressions): >>> - if the device doesn't have reliable LID switch state, then there >>> would be the new input event, and so userspace should only rely on >>> opened notifications. >>> - if the device has reliable switch information, the new input event >>> should not be exported and userspace knows that the current input >>> switch event is reliable. >>> >>> Also, using a new "switch" event is a terrible idea. Switches have a >>> state (open/close) and you are using this to forward a single open >>> event. So using a switch just allows you to say to userspace you are >>> using the "new" LID meaning, but you'll still have to manually reset >>> the switch and you will have to document how this event is not a >>> switch. >>> >>> Please use a simple KEY_LID_OPEN event you will send through >>> [input_key_event(KEY_LID_OPEN, 1), input_sync(), >>> input_key_event(KEY_LID_OPEN, 0), input_sync()], which userspace knows >>> how to handle. >> [Lv Zheng] >> It should be KEY_LID_CLOSE. > > yep, sorry. > >> However I checked the KEY code definitions. >> It seems their values are highly dependent on the HID specification. > > That was convenient enough when the code was written. Now, we can > extend new keycodes as we want, as long as Dmitry agrees :) > >> I'm not sure which key code value should I use for this. >> Could you point me out? >> > I think using 0x277 (or 0x278 given that KEY_DATA is reusing KEY_FASTREVERSE) would be fine. > >>> >>> > + >>> > +During the period the userspace hasn't been switched to use the new >>> > +SW_ACPI_LID event, Linux users can use the following boot parameter >>> to >>> > +handle possible issues: >>> > + button.lid_init_state=method: >>> > + This is the default behavior of the Linux ACPI lid driver, Linux kernel >>> > + reports the initial lid state using the returning value of the _LID >>> > + control method. >>> > + This can be used to fix some platforms if the _LID control method's >>> > + returning value is reliable. >>> > + button.lid_init_state=open: >>> > + Linux kernel always reports the initial lid state as "opened". >>> > + This may fix some platforms if the returning value of the _LID control >>> > + method is not reliable. >>> >>> This worries me as there is no plan after "During the period the >>> userspace hasn't been switched to use the new event". >>> >>> I really hope you'll keep sending SW_LID for reliable LID platforms, >>> and not remove it entirely as you will break platforms. >> >> [Lv Zheng] >> We won't remove SW_LID from the kernel :). >> >> And we haven't removed SW_LID from the acpi button driver. >> We'll just stop sending "initial lid state" from acpi button driver, i.e., the behavior carried out by "button.lid_init_state=ignore". That won't do for the very same use case than before. It makes sense to boot a laptop while the LID is closed if you have an external monitor plugged in (the docking station allows to have an extra power button accessible when the lid is closed). >> >> Maybe it is not sufficient, after the userspace has been changed to support the new event, we should stop sending SW_LID from acpi button driver. I'd say do not touch SW_LID at all (and allow users to tweak its behavior for local fixes, which is what you currently have). Just send the extra KEY_LID_CLOSE, no matter what. And start listing which devices have troubles, and we can add those into a hwdb file shipped with logind. I hope the systemd team will agree with me. Cheers, Benjamin >> >> Cheers, >> -Lv ^ permalink raw reply [flat|nested] 27+ messages in thread
* RE: [PATCH v2 4/4] ACPI / button: Add document for ACPI control method lid device restrictions 2016-07-11 11:47 ` Benjamin Tissoires @ 2016-07-12 7:34 ` Zheng, Lv 0 siblings, 0 replies; 27+ messages in thread From: Zheng, Lv @ 2016-07-12 7:34 UTC (permalink / raw) To: Benjamin Tissoires Cc: Wysocki, Rafael J, Rafael J. Wysocki, Brown, Len, Lv Zheng, linux-kernel@vger.kernel.org, ACPI Devel Maling List, Bastien Nocera:, linux-input, Dmitry Torokhov Hi, > From: linux-acpi-owner@vger.kernel.org [mailto:linux-acpi- > owner@vger.kernel.org] On Behalf Of Benjamin Tissoires > Subject: Re: [PATCH v2 4/4] ACPI / button: Add document for ACPI control > method lid device restrictions > > [I just realised Ctrl+enter means "send" for gmail, see the end of the > answers] > > On Mon, Jul 11, 2016 at 1:42 PM, Benjamin Tissoires > <benjamin.tissoires@gmail.com> wrote: > > On Mon, Jul 11, 2016 at 5:20 AM, Zheng, Lv <lv.zheng@intel.com> wrote: > >> Hi, > >> > >>> From: Benjamin Tissoires [mailto:benjamin.tissoires@gmail.com] > >>> Subject: Re: [PATCH v2 4/4] ACPI / button: Add document for ACPI > control > >>> method lid device restrictions > >>> > >>> Hi, > >>> > >>> On Thu, Jul 7, 2016 at 9:11 AM, Lv Zheng <lv.zheng@intel.com> wrote: > >>> > There are many AML tables reporting wrong initial lid state, and > some of > >>> > them never reports lid state. As a proxy layer acting between, ACPI > >>> button > >>> > driver is not able to handle all such cases, but need to re-define the > >>> > usage model of the ACPI lid. That is: > >>> > 1. It's initial state is not reliable; > >>> > 2. There may not be open event; > >>> > 3. Userspace should only take action against the close event which is > >>> > reliable, always sent after a real lid close. > >>> > This patch adds documentation of the usage model. > >>> > > >>> > Link: https://lkml.org/2016/3/7/460 > >>> > Link: https://github.com/systemd/systemd/issues/2087 > >>> > Signed-off-by: Lv Zheng <lv.zheng@intel.com> > >>> > Cc: Bastien Nocera: <hadess@hadess.net> > >>> > Cc: Benjamin Tissoires <benjamin.tissoires@gmail.com> > >>> > Cc: linux-input@vger.kernel.org > >>> > --- > >>> > Documentation/acpi/acpi-lid.txt | 62 > >>> +++++++++++++++++++++++++++++++++++++++ > >>> > 1 file changed, 62 insertions(+) > >>> > create mode 100644 Documentation/acpi/acpi-lid.txt > >>> > > >>> > diff --git a/Documentation/acpi/acpi-lid.txt > b/Documentation/acpi/acpi- > >>> lid.txt > >>> > new file mode 100644 > >>> > index 0000000..7e4f7ed > >>> > --- /dev/null > >>> > +++ b/Documentation/acpi/acpi-lid.txt > >>> > @@ -0,0 +1,62 @@ > >>> > +Usage Model of the ACPI Control Method Lid Device > >>> > + > >>> > +Copyright (C) 2016, Intel Corporation > >>> > +Author: Lv Zheng <lv.zheng@intel.com> > >>> > + > >>> > + > >>> > +Abstract: > >>> > + > >>> > +Platforms containing lids convey lid state (open/close) to OSPMs > using > >>> a > >>> > +control method lid device. To implement this, the AML tables issue > >>> > +Notify(lid_device, 0x80) to notify the OSPMs whenever the lid state > has > >>> > +changed. The _LID control method for the lid device must be > >>> implemented to > >>> > +report the "current" state of the lid as either "opened" or "closed". > >>> > + > >>> > +This document describes the restrictions and the expections of the > >>> Linux > >>> > +ACPI lid device driver. > >>> > + > >>> > + > >>> > +1. Restrictions of the returning value of the _LID control method > >>> > + > >>> > +The _LID control method is described to return the "current" lid > state. > >>> > +However the word of "current" has ambiguity, many AML tables > return > >>> the lid > >>> > +state upon the last lid notification instead of returning the lid state > >>> > +upon the last _LID evaluation. There won't be difference when the > _LID > >>> > +control method is evaluated during the runtime, the problem is its > >>> initial > >>> > +returning value. When the AML tables implement this control > method > >>> with > >>> > +cached value, the initial returning value is likely not reliable. There > are > >>> > +simply so many examples always retuning "closed" as initial lid > state. > >>> > + > >>> > +2. Restrictions of the lid state change notifications > >>> > + > >>> > +There are many AML tables never notifying when the lid device > state is > >>> > +changed to "opened". But it is ensured that the AML tables always > >>> notify > >>> > +"closed" when the lid state is changed to "closed". This is normally > used > >>> > +to trigger some system power saving operations on Windows. > Since it is > >>> > +fully tested, this notification is reliable for all AML tables. > >>> > + > >>> > +3. Expections for the userspace users of the ACPI lid device driver > >>> > + > >>> > +The userspace programs should stop relying on > >>> > +/proc/acpi/button/lid/LID0/state to obtain the lid state. This file is > only > >>> > +used for the validation purpose. > >>> > >>> I'd say: this file actually calls the _LID method described above. And > >>> given the previous explanation, it is not reliable enough on some > >>> platforms. So it is strongly advised for user-space program to not > >>> solely rely on this file to determine the actual lid state. > >> [Lv Zheng] > >> OK. > >> > >>> > >>> > + > >>> > +New userspace programs should rely on the lid "closed" > notification to > >>> > +trigger some power saving operations and may stop taking actions > >>> according > >>> > +to the lid "opened" notification. A new input switch event - > >>> SW_ACPI_LID is > >>> > +prepared for the new userspace to implement this ACPI control > method > >>> lid > >>> > +device specific logics. > >>> > >>> That's not entirely what we discussed before (to prevent regressions): > >>> - if the device doesn't have reliable LID switch state, then there > >>> would be the new input event, and so userspace should only rely on > >>> opened notifications. > >>> - if the device has reliable switch information, the new input event > >>> should not be exported and userspace knows that the current input > >>> switch event is reliable. > >>> > >>> Also, using a new "switch" event is a terrible idea. Switches have a > >>> state (open/close) and you are using this to forward a single open > >>> event. So using a switch just allows you to say to userspace you are > >>> using the "new" LID meaning, but you'll still have to manually reset > >>> the switch and you will have to document how this event is not a > >>> switch. > >>> > >>> Please use a simple KEY_LID_OPEN event you will send through > >>> [input_key_event(KEY_LID_OPEN, 1), input_sync(), > >>> input_key_event(KEY_LID_OPEN, 0), input_sync()], which userspace > knows > >>> how to handle. > >> [Lv Zheng] > >> It should be KEY_LID_CLOSE. > > > > yep, sorry. > > > >> However I checked the KEY code definitions. > >> It seems their values are highly dependent on the HID specification. > > > > That was convenient enough when the code was written. Now, we can > > extend new keycodes as we want, as long as Dmitry agrees :) > > > >> I'm not sure which key code value should I use for this. > >> Could you point me out? > >> > > > > I think using 0x277 (or 0x278 given that KEY_DATA is reusing > KEY_FASTREVERSE) would be fine. [Lv Zheng] Got it! Thanks. > > > > >>> > >>> > + > >>> > +During the period the userspace hasn't been switched to use the > new > >>> > +SW_ACPI_LID event, Linux users can use the following boot > parameter > >>> to > >>> > +handle possible issues: > >>> > + button.lid_init_state=method: > >>> > + This is the default behavior of the Linux ACPI lid driver, Linux > kernel > >>> > + reports the initial lid state using the returning value of the _LID > >>> > + control method. > >>> > + This can be used to fix some platforms if the _LID control > method's > >>> > + returning value is reliable. > >>> > + button.lid_init_state=open: > >>> > + Linux kernel always reports the initial lid state as "opened". > >>> > + This may fix some platforms if the returning value of the _LID > control > >>> > + method is not reliable. > >>> > >>> This worries me as there is no plan after "During the period the > >>> userspace hasn't been switched to use the new event". > >>> > >>> I really hope you'll keep sending SW_LID for reliable LID platforms, > >>> and not remove it entirely as you will break platforms. > >> > >> [Lv Zheng] > >> We won't remove SW_LID from the kernel :). > >> > >> And we haven't removed SW_LID from the acpi button driver. > >> We'll just stop sending "initial lid state" from acpi button driver, i.e., > the behavior carried out by "button.lid_init_state=ignore". > > That won't do for the very same use case than before. It makes sense > to boot a laptop while the LID is closed if you have an external > monitor plugged in (the docking station allows to have an extra power > button accessible when the lid is closed). [Lv Zheng] Exactly. The "button.lid_init_state=ignore" is the original behavior of the ACPI button driver. > > >> > >> Maybe it is not sufficient, after the userspace has been changed to > support the new event, we should stop sending SW_LID from acpi button > driver. > > I'd say do not touch SW_LID at all (and allow users to tweak its > behavior for local fixes, which is what you currently have). > Just send the extra KEY_LID_CLOSE, no matter what. > And start listing which devices have troubles, and we can add those > into a hwdb file shipped with logind. I hope the systemd team will > agree with me. [Lv Zheng] OK. We'll provide the dmidecode files for those platforms via an off-list way after the agreement is reached. Thanks for the help. Cheers -Lv ^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH v3 1/2] ACPI / button: Add KEY_LID_CLOSE for new usage model [not found] <cover.1467717304.git.lv.zheng@intel.com> 2016-07-05 11:18 ` [PATCH 4/5] ACPI / button: Add SW_ACPI_LID for new usage model Lv Zheng [not found] ` <cover.1467875142.git.lv.zheng@intel.com> @ 2016-07-12 10:17 ` Lv Zheng 2016-07-18 7:53 ` Benjamin Tissoires 2016-07-12 10:17 ` [PATCH v3 2/2] ACPI / button: Add document for ACPI control method lid device restrictions Lv Zheng 3 siblings, 1 reply; 27+ messages in thread From: Lv Zheng @ 2016-07-12 10:17 UTC (permalink / raw) To: Rafael J. Wysocki, Rafael J. Wysocki, Len Brown Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi, Dmitry Torokhov, Benjamin Tissoires, Bastien Nocera:, linux-input There are many AML tables reporting wrong initial lid state, and some of them never reports lid open state. As a proxy layer acting between, ACPI button driver is not able to handle all such cases, but need to re-define the usage model of the ACPI lid. That is: 1. It's initial state is not reliable; 2. There may not be an open event; 3. Userspace should only take action against the close event which is reliable, always sent after a real lid close. This patch adds a new input key event so that the new userspace programs can use it to handle this usage model correctly. And in the meanwhile, no old programs will be broken by the userspace changes. This patch also adds a button.lid_event_type parameter to allow the users to switch between the 2 event types. Signed-off-by: Lv Zheng <lv.zheng@intel.com> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> Cc: Benjamin Tissoires <benjamin.tissoires@gmail.com> Cc: Bastien Nocera: <hadess@hadess.net> Cc: linux-input@vger.kernel.org --- drivers/acpi/button.c | 109 +++++++++++++++++++++++++------- include/uapi/linux/input-event-codes.h | 6 ++ 2 files changed, 91 insertions(+), 24 deletions(-) diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 148f4e5..1298ef8 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c @@ -57,6 +57,9 @@ #define ACPI_BUTTON_LID_INIT_OPEN 0x01 #define ACPI_BUTTON_LID_INIT_METHOD 0x02 +#define ACPI_BUTTON_LID_EVENT_KEY 0x00 +#define ACPI_BUTTON_LID_EVENT_SWITCH 0x01 + #define _COMPONENT ACPI_BUTTON_COMPONENT ACPI_MODULE_NAME("button"); @@ -110,6 +113,7 @@ struct acpi_button { static BLOCKING_NOTIFIER_HEAD(acpi_lid_notifier); static struct acpi_device *lid_device; static u8 lid_init_state = ACPI_BUTTON_LID_INIT_METHOD; +static u8 lid_event_type = ACPI_BUTTON_LID_EVENT_SWITCH; /* -------------------------------------------------------------------------- FS Interface (/proc) @@ -136,8 +140,17 @@ static int acpi_lid_notify_state(struct acpi_device *device, int state) int ret; /* input layer checks if event is redundant */ - input_report_switch(button->input, SW_LID, !state); - input_sync(button->input); + if (lid_event_type == ACPI_BUTTON_LID_EVENT_SWITCH) { + input_report_switch(button->input, SW_LID, !state); + input_sync(button->input); + } + if (lid_event_type == ACPI_BUTTON_LID_EVENT_KEY && + !state) { + input_report_key(button->input, KEY_LID_CLOSE, 1); + input_sync(button->input); + input_report_key(button->input, KEY_LID_CLOSE, 0); + input_sync(button->input); + } if (state) pm_wakeup_event(&device->dev, 0); @@ -292,6 +305,9 @@ static int acpi_lid_update_state(struct acpi_device *device) static void acpi_lid_initialize_state(struct acpi_device *device) { + if (lid_event_type == ACPI_BUTTON_LID_EVENT_KEY) + return; + switch (lid_init_state) { case ACPI_BUTTON_LID_INIT_OPEN: (void)acpi_lid_notify_state(device, 1); @@ -436,6 +452,7 @@ static int acpi_button_add(struct acpi_device *device) case ACPI_BUTTON_TYPE_LID: input_set_capability(input, EV_SW, SW_LID); + input_set_capability(input, EV_KEY, KEY_LID_CLOSE); break; } @@ -475,35 +492,49 @@ static int acpi_button_remove(struct acpi_device *device) static int param_set_lid_init_state(const char *val, struct kernel_param *kp) { - int result = 0; - - if (!strncmp(val, "open", sizeof("open") - 1)) { - lid_init_state = ACPI_BUTTON_LID_INIT_OPEN; - pr_info("Notify initial lid state as open\n"); - } else if (!strncmp(val, "method", sizeof("method") - 1)) { - lid_init_state = ACPI_BUTTON_LID_INIT_METHOD; - pr_info("Notify initial lid state with _LID return value\n"); - } else if (!strncmp(val, "ignore", sizeof("ignore") - 1)) { - lid_init_state = ACPI_BUTTON_LID_INIT_IGNORE; - pr_info("Do not notify initial lid state\n"); - } else - result = -EINVAL; + int result = -EINVAL; + + switch (lid_event_type) { + case ACPI_BUTTON_LID_EVENT_KEY: + if (!strncmp(val, "ignore", sizeof("ignore") - 1)) { + lid_init_state = ACPI_BUTTON_LID_INIT_IGNORE; + pr_info("Do not notify initial lid state\n"); + } + break; + case ACPI_BUTTON_LID_EVENT_SWITCH: + if (!strncmp(val, "open", sizeof("open") - 1)) { + lid_init_state = ACPI_BUTTON_LID_INIT_OPEN; + pr_info("Notify initial lid state as open\n"); + } else if (!strncmp(val, "method", sizeof("method") - 1)) { + lid_init_state = ACPI_BUTTON_LID_INIT_METHOD; + pr_info("Notify initial lid state" + " with _LID return value\n"); + } else if (!strncmp(val, "ignore", sizeof("ignore") - 1)) { + lid_init_state = ACPI_BUTTON_LID_INIT_IGNORE; + pr_info("Do not notify initial lid state\n"); + } + break; + } return result; } static int param_get_lid_init_state(char *buffer, struct kernel_param *kp) { - switch (lid_init_state) { - case ACPI_BUTTON_LID_INIT_OPEN: - return sprintf(buffer, "open"); - case ACPI_BUTTON_LID_INIT_METHOD: - return sprintf(buffer, "method"); - case ACPI_BUTTON_LID_INIT_IGNORE: + switch (lid_event_type) { + case ACPI_BUTTON_LID_EVENT_KEY: return sprintf(buffer, "ignore"); - default: - return sprintf(buffer, "invalid"); + case ACPI_BUTTON_LID_EVENT_SWITCH: + switch (lid_init_state) { + case ACPI_BUTTON_LID_INIT_OPEN: + return sprintf(buffer, "open"); + case ACPI_BUTTON_LID_INIT_METHOD: + return sprintf(buffer, "method"); + case ACPI_BUTTON_LID_INIT_IGNORE: + return sprintf(buffer, "ignore"); + } + break; } - return 0; + return sprintf(buffer, "invalid"); } module_param_call(lid_init_state, @@ -511,4 +542,34 @@ module_param_call(lid_init_state, NULL, 0644); MODULE_PARM_DESC(lid_init_state, "Behavior for reporting LID initial state"); +static int param_set_lid_event_type(const char *val, struct kernel_param *kp) +{ + int result = -EINVAL; + + if (!strncmp(val, "key", sizeof("key") - 1)) { + lid_event_type = ACPI_BUTTON_LID_EVENT_KEY; + pr_info("Notify lid state using key event\n"); + } else if (!strncmp(val, "switch", sizeof("switch") - 1)) { + lid_event_type = ACPI_BUTTON_LID_EVENT_SWITCH; + pr_info("Notify lid state using switch event\n"); + } + return result; +} + +static int param_get_lid_event_type(char *buffer, struct kernel_param *kp) +{ + switch (lid_event_type) { + case ACPI_BUTTON_LID_EVENT_KEY: + return sprintf(buffer, "key"); + case ACPI_BUTTON_LID_EVENT_SWITCH: + return sprintf(buffer, "switch"); + } + return sprintf(buffer, "invalid"); +} + +module_param_call(lid_event_type, + param_set_lid_event_type, param_get_lid_event_type, + NULL, 0644); +MODULE_PARM_DESC(lid_event_type, "Event type for reporting LID state"); + module_acpi_driver(acpi_button_driver); diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h index 737fa32..df7c0c0 100644 --- a/include/uapi/linux/input-event-codes.h +++ b/include/uapi/linux/input-event-codes.h @@ -641,6 +641,12 @@ * e.g. teletext or data broadcast application (MHEG, MHP, HbbTV, etc.) */ #define KEY_DATA 0x275 +/* + * Special event sent by the lid drivers. The drivers may not be able to + * issue "open" event, in which case, they send KEY_LID_CLOSE instead of + * SW_LID. + */ +#define KEY_LID_CLOSE 0x278 #define BTN_TRIGGER_HAPPY 0x2c0 #define BTN_TRIGGER_HAPPY1 0x2c0 -- 1.7.10 ^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH v3 1/2] ACPI / button: Add KEY_LID_CLOSE for new usage model 2016-07-12 10:17 ` [PATCH v3 1/2] ACPI / button: Add KEY_LID_CLOSE for new usage model Lv Zheng @ 2016-07-18 7:53 ` Benjamin Tissoires 2016-07-18 15:51 ` Bastien Nocera 2016-07-19 4:48 ` Zheng, Lv 0 siblings, 2 replies; 27+ messages in thread From: Benjamin Tissoires @ 2016-07-18 7:53 UTC (permalink / raw) To: Lv Zheng Cc: Rafael J. Wysocki, Rafael J. Wysocki, Len Brown, Lv Zheng, linux-kernel@vger.kernel.org, ACPI Devel Maling List, Dmitry Torokhov, Bastien Nocera:, linux-input Hi, On Tue, Jul 12, 2016 at 12:17 PM, Lv Zheng <lv.zheng@intel.com> wrote: > There are many AML tables reporting wrong initial lid state, and some of > them never reports lid open state. As a proxy layer acting between, ACPI > button driver is not able to handle all such cases, but need to re-define > the usage model of the ACPI lid. That is: > 1. It's initial state is not reliable; > 2. There may not be an open event; > 3. Userspace should only take action against the close event which is > reliable, always sent after a real lid close. > This patch adds a new input key event so that the new userspace programs > can use it to handle this usage model correctly. And in the meanwhile, no > old programs will be broken by the userspace changes. > This patch also adds a button.lid_event_type parameter to allow the users > to switch between the 2 event types. I think we are getting closer to what would be acceptable for user-space, but I still have a few comments: > > Signed-off-by: Lv Zheng <lv.zheng@intel.com> > Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> > Cc: Benjamin Tissoires <benjamin.tissoires@gmail.com> > Cc: Bastien Nocera: <hadess@hadess.net> > Cc: linux-input@vger.kernel.org > --- > drivers/acpi/button.c | 109 +++++++++++++++++++++++++------- > include/uapi/linux/input-event-codes.h | 6 ++ > 2 files changed, 91 insertions(+), 24 deletions(-) > > diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c > index 148f4e5..1298ef8 100644 > --- a/drivers/acpi/button.c > +++ b/drivers/acpi/button.c > @@ -57,6 +57,9 @@ > #define ACPI_BUTTON_LID_INIT_OPEN 0x01 > #define ACPI_BUTTON_LID_INIT_METHOD 0x02 > > +#define ACPI_BUTTON_LID_EVENT_KEY 0x00 > +#define ACPI_BUTTON_LID_EVENT_SWITCH 0x01 > + > #define _COMPONENT ACPI_BUTTON_COMPONENT > ACPI_MODULE_NAME("button"); > > @@ -110,6 +113,7 @@ struct acpi_button { > static BLOCKING_NOTIFIER_HEAD(acpi_lid_notifier); > static struct acpi_device *lid_device; > static u8 lid_init_state = ACPI_BUTTON_LID_INIT_METHOD; > +static u8 lid_event_type = ACPI_BUTTON_LID_EVENT_SWITCH; > > /* -------------------------------------------------------------------------- > FS Interface (/proc) > @@ -136,8 +140,17 @@ static int acpi_lid_notify_state(struct acpi_device *device, int state) > int ret; > > /* input layer checks if event is redundant */ > - input_report_switch(button->input, SW_LID, !state); > - input_sync(button->input); > + if (lid_event_type == ACPI_BUTTON_LID_EVENT_SWITCH) { > + input_report_switch(button->input, SW_LID, !state); > + input_sync(button->input); > + } > + if (lid_event_type == ACPI_BUTTON_LID_EVENT_KEY && > + !state) { > + input_report_key(button->input, KEY_LID_CLOSE, 1); > + input_sync(button->input); > + input_report_key(button->input, KEY_LID_CLOSE, 0); > + input_sync(button->input); > + } > > if (state) > pm_wakeup_event(&device->dev, 0); > @@ -292,6 +305,9 @@ static int acpi_lid_update_state(struct acpi_device *device) > > static void acpi_lid_initialize_state(struct acpi_device *device) > { > + if (lid_event_type == ACPI_BUTTON_LID_EVENT_KEY) > + return; > + > switch (lid_init_state) { > case ACPI_BUTTON_LID_INIT_OPEN: > (void)acpi_lid_notify_state(device, 1); > @@ -436,6 +452,7 @@ static int acpi_button_add(struct acpi_device *device) > > case ACPI_BUTTON_TYPE_LID: > input_set_capability(input, EV_SW, SW_LID); > + input_set_capability(input, EV_KEY, KEY_LID_CLOSE); Here you are basically exporting the 2 input events but only update one of the 2. It will confuse userspace and it is generally better not to export unused input codes. However, as I'll say below, I think we should keep the code that way here. > break; > } > > @@ -475,35 +492,49 @@ static int acpi_button_remove(struct acpi_device *device) > > static int param_set_lid_init_state(const char *val, struct kernel_param *kp) > { > - int result = 0; > - > - if (!strncmp(val, "open", sizeof("open") - 1)) { > - lid_init_state = ACPI_BUTTON_LID_INIT_OPEN; > - pr_info("Notify initial lid state as open\n"); > - } else if (!strncmp(val, "method", sizeof("method") - 1)) { > - lid_init_state = ACPI_BUTTON_LID_INIT_METHOD; > - pr_info("Notify initial lid state with _LID return value\n"); > - } else if (!strncmp(val, "ignore", sizeof("ignore") - 1)) { > - lid_init_state = ACPI_BUTTON_LID_INIT_IGNORE; > - pr_info("Do not notify initial lid state\n"); > - } else > - result = -EINVAL; > + int result = -EINVAL; > + > + switch (lid_event_type) { > + case ACPI_BUTTON_LID_EVENT_KEY: > + if (!strncmp(val, "ignore", sizeof("ignore") - 1)) { > + lid_init_state = ACPI_BUTTON_LID_INIT_IGNORE; > + pr_info("Do not notify initial lid state\n"); > + } > + break; > + case ACPI_BUTTON_LID_EVENT_SWITCH: > + if (!strncmp(val, "open", sizeof("open") - 1)) { > + lid_init_state = ACPI_BUTTON_LID_INIT_OPEN; > + pr_info("Notify initial lid state as open\n"); > + } else if (!strncmp(val, "method", sizeof("method") - 1)) { > + lid_init_state = ACPI_BUTTON_LID_INIT_METHOD; > + pr_info("Notify initial lid state" > + " with _LID return value\n"); > + } else if (!strncmp(val, "ignore", sizeof("ignore") - 1)) { > + lid_init_state = ACPI_BUTTON_LID_INIT_IGNORE; > + pr_info("Do not notify initial lid state\n"); > + } > + break; > + } > return result; > } > > static int param_get_lid_init_state(char *buffer, struct kernel_param *kp) > { > - switch (lid_init_state) { > - case ACPI_BUTTON_LID_INIT_OPEN: > - return sprintf(buffer, "open"); > - case ACPI_BUTTON_LID_INIT_METHOD: > - return sprintf(buffer, "method"); > - case ACPI_BUTTON_LID_INIT_IGNORE: > + switch (lid_event_type) { > + case ACPI_BUTTON_LID_EVENT_KEY: > return sprintf(buffer, "ignore"); > - default: > - return sprintf(buffer, "invalid"); > + case ACPI_BUTTON_LID_EVENT_SWITCH: > + switch (lid_init_state) { > + case ACPI_BUTTON_LID_INIT_OPEN: > + return sprintf(buffer, "open"); > + case ACPI_BUTTON_LID_INIT_METHOD: > + return sprintf(buffer, "method"); > + case ACPI_BUTTON_LID_INIT_IGNORE: > + return sprintf(buffer, "ignore"); > + } > + break; > } > - return 0; > + return sprintf(buffer, "invalid"); > } > > module_param_call(lid_init_state, > @@ -511,4 +542,34 @@ module_param_call(lid_init_state, > NULL, 0644); > MODULE_PARM_DESC(lid_init_state, "Behavior for reporting LID initial state"); > > +static int param_set_lid_event_type(const char *val, struct kernel_param *kp) > +{ > + int result = -EINVAL; > + > + if (!strncmp(val, "key", sizeof("key") - 1)) { > + lid_event_type = ACPI_BUTTON_LID_EVENT_KEY; > + pr_info("Notify lid state using key event\n"); > + } else if (!strncmp(val, "switch", sizeof("switch") - 1)) { > + lid_event_type = ACPI_BUTTON_LID_EVENT_SWITCH; > + pr_info("Notify lid state using switch event\n"); > + } > + return result; > +} > + > +static int param_get_lid_event_type(char *buffer, struct kernel_param *kp) > +{ > + switch (lid_event_type) { > + case ACPI_BUTTON_LID_EVENT_KEY: > + return sprintf(buffer, "key"); > + case ACPI_BUTTON_LID_EVENT_SWITCH: > + return sprintf(buffer, "switch"); > + } > + return sprintf(buffer, "invalid"); > +} > + > +module_param_call(lid_event_type, > + param_set_lid_event_type, param_get_lid_event_type, > + NULL, 0644); > +MODULE_PARM_DESC(lid_event_type, "Event type for reporting LID state"); I don't think this is a good solution to have a kernel parameter. I thought the final decision were to have userspace decide which event was valid, and so we just need to export and emit both of events. _If_ you export a kernel parameter, it makes sense to have a dmi blacklist to have a good default experience, which is what you wanted to avoid. So if you just export and use both events at the same time, you will have: - correct ACPI machines will just have an extra KEY_LID_CLOSE event emitted, which will not harm logind - wrong ACPI machines will not have their SW_LID input event updated because it will be kept closed. But given that logind will ignore it, there is no harm either As Dmitry said, we could also have a KEY_LID_OPEN emitted for symmetrical purposes, but I am not entirely sure if this will confuse userspace or not. On the other hand, there are few users of these states, and we can teach them how to properly use them. So in the end, I think you should just get rid of the kernel parameter, export SW_LID, KEY_LID_CLOSE, KEY_LID_OPEN in the event node, and only add the KEY_LID_CLOSE|OPEN events on an actual acpi notification. Then a small hwdb entry set will teach logind/powerd if they need to ignore the SW_LID event or not. Cheers, Benjamin > + > module_acpi_driver(acpi_button_driver); > diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h > index 737fa32..df7c0c0 100644 > --- a/include/uapi/linux/input-event-codes.h > +++ b/include/uapi/linux/input-event-codes.h > @@ -641,6 +641,12 @@ > * e.g. teletext or data broadcast application (MHEG, MHP, HbbTV, etc.) > */ > #define KEY_DATA 0x275 > +/* > + * Special event sent by the lid drivers. The drivers may not be able to > + * issue "open" event, in which case, they send KEY_LID_CLOSE instead of > + * SW_LID. > + */ > +#define KEY_LID_CLOSE 0x278 > > #define BTN_TRIGGER_HAPPY 0x2c0 > #define BTN_TRIGGER_HAPPY1 0x2c0 > -- > 1.7.10 > ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH v3 1/2] ACPI / button: Add KEY_LID_CLOSE for new usage model 2016-07-18 7:53 ` Benjamin Tissoires @ 2016-07-18 15:51 ` Bastien Nocera 2016-07-19 4:48 ` Zheng, Lv 1 sibling, 0 replies; 27+ messages in thread From: Bastien Nocera @ 2016-07-18 15:51 UTC (permalink / raw) To: Benjamin Tissoires, Lv Zheng Cc: Rafael J. Wysocki, Rafael J. Wysocki, Len Brown, Lv Zheng, linux-kernel@vger.kernel.org, ACPI Devel Maling List, Dmitry Torokhov, linux-input On Mon, 2016-07-18 at 09:53 +0200, Benjamin Tissoires wrote: > <snip> > I don't think this is a good solution to have a kernel parameter. I > thought the final decision were to have userspace decide which event > was valid, and so we just need to export and emit both of events. > > _If_ you export a kernel parameter, it makes sense to have a dmi > blacklist to have a good default experience, which is what you wanted > to avoid. > So if you just export and use both events at the same time, you will > have: > - correct ACPI machines will just have an extra KEY_LID_CLOSE event > emitted, which will not harm logind > - wrong ACPI machines will not have their SW_LID input event updated > because it will be kept closed. But given that logind will ignore it, > there is no harm either > > As Dmitry said, we could also have a KEY_LID_OPEN emitted for > symmetrical purposes, but I am not entirely sure if this will confuse > userspace or not. On the other hand, there are few users of these > states, and we can teach them how to properly use them. > > So in the end, I think you should just get rid of the kernel > parameter, export SW_LID, KEY_LID_CLOSE, KEY_LID_OPEN in the event > node, and only add the KEY_LID_CLOSE|OPEN events on an actual acpi > notification. > > Then a small hwdb entry set will teach logind/powerd if they need to > ignore the SW_LID event or not. So user-space would have its own blacklist (likely in udev through an hwdb), instead of having it in the kernel? That seems like a fine idea to me, and one of the first consumers, logind, would have all the necessary data straight away. ^ permalink raw reply [flat|nested] 27+ messages in thread
* RE: [PATCH v3 1/2] ACPI / button: Add KEY_LID_CLOSE for new usage model 2016-07-18 7:53 ` Benjamin Tissoires 2016-07-18 15:51 ` Bastien Nocera @ 2016-07-19 4:48 ` Zheng, Lv 1 sibling, 0 replies; 27+ messages in thread From: Zheng, Lv @ 2016-07-19 4:48 UTC (permalink / raw) To: Benjamin Tissoires Cc: Wysocki, Rafael J, Rafael J. Wysocki, Brown, Len, Lv Zheng, linux-kernel@vger.kernel.org, ACPI Devel Maling List, Dmitry Torokhov, Bastien Nocera:, linux-input Hi, Benjamin > From: Benjamin Tissoires [mailto:benjamin.tissoires@gmail.com] > Subject: Re: [PATCH v3 1/2] ACPI / button: Add KEY_LID_CLOSE for new > usage model > > Hi, > > On Tue, Jul 12, 2016 at 12:17 PM, Lv Zheng <lv.zheng@intel.com> wrote: > > There are many AML tables reporting wrong initial lid state, and some of > > them never reports lid open state. As a proxy layer acting between, ACPI > > button driver is not able to handle all such cases, but need to re-define > > the usage model of the ACPI lid. That is: > > 1. It's initial state is not reliable; > > 2. There may not be an open event; > > 3. Userspace should only take action against the close event which is > > reliable, always sent after a real lid close. > > This patch adds a new input key event so that the new userspace > programs > > can use it to handle this usage model correctly. And in the meanwhile, no > > old programs will be broken by the userspace changes. > > This patch also adds a button.lid_event_type parameter to allow the > users > > to switch between the 2 event types. > > I think we are getting closer to what would be acceptable for > user-space, but I still have a few comments: [Lv Zheng] OK. > > > > > Signed-off-by: Lv Zheng <lv.zheng@intel.com> > > Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> > > Cc: Benjamin Tissoires <benjamin.tissoires@gmail.com> > > Cc: Bastien Nocera: <hadess@hadess.net> > > Cc: linux-input@vger.kernel.org > > --- > > drivers/acpi/button.c | 109 +++++++++++++++++++++++++-- > ----- > > include/uapi/linux/input-event-codes.h | 6 ++ > > 2 files changed, 91 insertions(+), 24 deletions(-) > > > > diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c > > index 148f4e5..1298ef8 100644 > > --- a/drivers/acpi/button.c > > +++ b/drivers/acpi/button.c > > @@ -57,6 +57,9 @@ > > #define ACPI_BUTTON_LID_INIT_OPEN 0x01 > > #define ACPI_BUTTON_LID_INIT_METHOD 0x02 > > > > +#define ACPI_BUTTON_LID_EVENT_KEY 0x00 > > +#define ACPI_BUTTON_LID_EVENT_SWITCH 0x01 > > + > > #define _COMPONENT ACPI_BUTTON_COMPONENT > > ACPI_MODULE_NAME("button"); > > > > @@ -110,6 +113,7 @@ struct acpi_button { > > static BLOCKING_NOTIFIER_HEAD(acpi_lid_notifier); > > static struct acpi_device *lid_device; > > static u8 lid_init_state = ACPI_BUTTON_LID_INIT_METHOD; > > +static u8 lid_event_type = ACPI_BUTTON_LID_EVENT_SWITCH; > > > > /* -------------------------------------------------------------------------- > > FS Interface (/proc) > > @@ -136,8 +140,17 @@ static int acpi_lid_notify_state(struct > acpi_device *device, int state) > > int ret; > > > > /* input layer checks if event is redundant */ > > - input_report_switch(button->input, SW_LID, !state); > > - input_sync(button->input); > > + if (lid_event_type == ACPI_BUTTON_LID_EVENT_SWITCH) { > > + input_report_switch(button->input, SW_LID, !state); > > + input_sync(button->input); > > + } > > + if (lid_event_type == ACPI_BUTTON_LID_EVENT_KEY && > > + !state) { > > + input_report_key(button->input, KEY_LID_CLOSE, 1); > > + input_sync(button->input); > > + input_report_key(button->input, KEY_LID_CLOSE, 0); > > + input_sync(button->input); > > + } > > > > if (state) > > pm_wakeup_event(&device->dev, 0); > > @@ -292,6 +305,9 @@ static int acpi_lid_update_state(struct > acpi_device *device) > > > > static void acpi_lid_initialize_state(struct acpi_device *device) > > { > > + if (lid_event_type == ACPI_BUTTON_LID_EVENT_KEY) > > + return; > > + > > switch (lid_init_state) { > > case ACPI_BUTTON_LID_INIT_OPEN: > > (void)acpi_lid_notify_state(device, 1); > > @@ -436,6 +452,7 @@ static int acpi_button_add(struct acpi_device > *device) > > > > case ACPI_BUTTON_TYPE_LID: > > input_set_capability(input, EV_SW, SW_LID); > > + input_set_capability(input, EV_KEY, KEY_LID_CLOSE); > > Here you are basically exporting the 2 input events but only update > one of the 2. It will confuse userspace and it is generally better not > to export unused input codes. [Lv Zheng] I just do not know if it is proper to clear the capability during runtime via module parameters. > > However, as I'll say below, I think we should keep the code that way here. [Lv Zheng] Great. So we needn't think about input_clear_capability(). > > > > break; > > } > > > > @@ -475,35 +492,49 @@ static int acpi_button_remove(struct > acpi_device *device) > > > > static int param_set_lid_init_state(const char *val, struct kernel_param > *kp) > > { > > - int result = 0; > > - > > - if (!strncmp(val, "open", sizeof("open") - 1)) { > > - lid_init_state = ACPI_BUTTON_LID_INIT_OPEN; > > - pr_info("Notify initial lid state as open\n"); > > - } else if (!strncmp(val, "method", sizeof("method") - 1)) { > > - lid_init_state = ACPI_BUTTON_LID_INIT_METHOD; > > - pr_info("Notify initial lid state with _LID return value\n"); > > - } else if (!strncmp(val, "ignore", sizeof("ignore") - 1)) { > > - lid_init_state = ACPI_BUTTON_LID_INIT_IGNORE; > > - pr_info("Do not notify initial lid state\n"); > > - } else > > - result = -EINVAL; > > + int result = -EINVAL; > > + > > + switch (lid_event_type) { > > + case ACPI_BUTTON_LID_EVENT_KEY: > > + if (!strncmp(val, "ignore", sizeof("ignore") - 1)) { > > + lid_init_state = ACPI_BUTTON_LID_INIT_IGNORE; > > + pr_info("Do not notify initial lid state\n"); > > + } > > + break; > > + case ACPI_BUTTON_LID_EVENT_SWITCH: > > + if (!strncmp(val, "open", sizeof("open") - 1)) { > > + lid_init_state = ACPI_BUTTON_LID_INIT_OPEN; > > + pr_info("Notify initial lid state as open\n"); > > + } else if (!strncmp(val, "method", sizeof("method") - 1)) { > > + lid_init_state = ACPI_BUTTON_LID_INIT_METHOD; > > + pr_info("Notify initial lid state" > > + " with _LID return value\n"); > > + } else if (!strncmp(val, "ignore", sizeof("ignore") - 1)) { > > + lid_init_state = ACPI_BUTTON_LID_INIT_IGNORE; > > + pr_info("Do not notify initial lid state\n"); > > + } > > + break; > > + } > > return result; > > } > > > > static int param_get_lid_init_state(char *buffer, struct kernel_param > *kp) > > { > > - switch (lid_init_state) { > > - case ACPI_BUTTON_LID_INIT_OPEN: > > - return sprintf(buffer, "open"); > > - case ACPI_BUTTON_LID_INIT_METHOD: > > - return sprintf(buffer, "method"); > > - case ACPI_BUTTON_LID_INIT_IGNORE: > > + switch (lid_event_type) { > > + case ACPI_BUTTON_LID_EVENT_KEY: > > return sprintf(buffer, "ignore"); > > - default: > > - return sprintf(buffer, "invalid"); > > + case ACPI_BUTTON_LID_EVENT_SWITCH: > > + switch (lid_init_state) { > > + case ACPI_BUTTON_LID_INIT_OPEN: > > + return sprintf(buffer, "open"); > > + case ACPI_BUTTON_LID_INIT_METHOD: > > + return sprintf(buffer, "method"); > > + case ACPI_BUTTON_LID_INIT_IGNORE: > > + return sprintf(buffer, "ignore"); > > + } > > + break; > > } > > - return 0; > > + return sprintf(buffer, "invalid"); > > } > > > > module_param_call(lid_init_state, > > @@ -511,4 +542,34 @@ module_param_call(lid_init_state, > > NULL, 0644); > > MODULE_PARM_DESC(lid_init_state, "Behavior for reporting LID initial > state"); > > > > +static int param_set_lid_event_type(const char *val, struct > kernel_param *kp) > > +{ > > + int result = -EINVAL; > > + > > + if (!strncmp(val, "key", sizeof("key") - 1)) { > > + lid_event_type = ACPI_BUTTON_LID_EVENT_KEY; > > + pr_info("Notify lid state using key event\n"); > > + } else if (!strncmp(val, "switch", sizeof("switch") - 1)) { > > + lid_event_type = ACPI_BUTTON_LID_EVENT_SWITCH; > > + pr_info("Notify lid state using switch event\n"); > > + } > > + return result; > > +} > > + > > +static int param_get_lid_event_type(char *buffer, struct kernel_param > *kp) > > +{ > > + switch (lid_event_type) { > > + case ACPI_BUTTON_LID_EVENT_KEY: > > + return sprintf(buffer, "key"); > > + case ACPI_BUTTON_LID_EVENT_SWITCH: > > + return sprintf(buffer, "switch"); > > + } > > + return sprintf(buffer, "invalid"); > > +} > > + > > +module_param_call(lid_event_type, > > + param_set_lid_event_type, param_get_lid_event_type, > > + NULL, 0644); > > +MODULE_PARM_DESC(lid_event_type, "Event type for reporting LID > state"); > > I don't think this is a good solution to have a kernel parameter. I > thought the final decision were to have userspace decide which event > was valid, and so we just need to export and emit both of events. [Lv Zheng] OK. > > _If_ you export a kernel parameter, it makes sense to have a dmi > blacklist to have a good default experience, which is what you wanted > to avoid. [Lv Zheng] I was thinking that the distribution vendors can configure a default boot parameters for a specific hardware. > So if you just export and use both events at the same time, you will have: > - correct ACPI machines will just have an extra KEY_LID_CLOSE event > emitted, which will not harm logind > - wrong ACPI machines will not have their SW_LID input event updated > because it will be kept closed. But given that logind will ignore it, > there is no harm either [Lv Zheng] I see. > > As Dmitry said, we could also have a KEY_LID_OPEN emitted for > symmetrical purposes, but I am not entirely sure if this will confuse > userspace or not. On the other hand, there are few users of these > states, and we can teach them how to properly use them. > > So in the end, I think you should just get rid of the kernel > parameter, export SW_LID, KEY_LID_CLOSE, KEY_LID_OPEN in the event > node, and only add the KEY_LID_CLOSE|OPEN events on an actual acpi > notification. [Lv Zheng] I'm sorry I didn't notice the KEY_LID_OPEN comment. Thanks for the reminder. > > Then a small hwdb entry set will teach logind/powerd if they need to > ignore the SW_LID event or not. [Lv Zheng] OK, I'll address what you've suggested in this email. Thanks and best regards -Lv > > Cheers, > Benjamin > > > + > > module_acpi_driver(acpi_button_driver); > > diff --git a/include/uapi/linux/input-event-codes.h > b/include/uapi/linux/input-event-codes.h > > index 737fa32..df7c0c0 100644 > > --- a/include/uapi/linux/input-event-codes.h > > +++ b/include/uapi/linux/input-event-codes.h > > @@ -641,6 +641,12 @@ > > * e.g. teletext or data broadcast application (MHEG, MHP, HbbTV, etc.) > > */ > > #define KEY_DATA 0x275 > > +/* > > + * Special event sent by the lid drivers. The drivers may not be able to > > + * issue "open" event, in which case, they send KEY_LID_CLOSE instead > of > > + * SW_LID. > > + */ > > +#define KEY_LID_CLOSE 0x278 > > > > #define BTN_TRIGGER_HAPPY 0x2c0 > > #define BTN_TRIGGER_HAPPY1 0x2c0 > > -- > > 1.7.10 > > ^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH v3 2/2] ACPI / button: Add document for ACPI control method lid device restrictions [not found] <cover.1467717304.git.lv.zheng@intel.com> ` (2 preceding siblings ...) 2016-07-12 10:17 ` [PATCH v3 1/2] ACPI / button: Add KEY_LID_CLOSE for new usage model Lv Zheng @ 2016-07-12 10:17 ` Lv Zheng 3 siblings, 0 replies; 27+ messages in thread From: Lv Zheng @ 2016-07-12 10:17 UTC (permalink / raw) To: Rafael J. Wysocki, Rafael J. Wysocki, Len Brown Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi, Dmitry Torokhov, Benjamin Tissoires, Bastien Nocera:, linux-input There are many AML tables reporting wrong initial lid state, and some of them never reports lid open state. As a proxy layer acting between, ACPI button driver is not able to handle all such cases, but need to re-define the usage model of the ACPI lid. That is: 1. It's initial state is not reliable; 2. There may not be an open event; 3. Userspace should only take action against the close event which is reliable, always sent after a real lid close. This patch adds documentation of the usage model. Signed-off-by: Lv Zheng <lv.zheng@intel.com> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> Cc: Benjamin Tissoires <benjamin.tissoires@gmail.com> Cc: Bastien Nocera: <hadess@hadess.net> Cc: linux-input@vger.kernel.org --- Documentation/acpi/acpi-lid.txt | 89 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 Documentation/acpi/acpi-lid.txt diff --git a/Documentation/acpi/acpi-lid.txt b/Documentation/acpi/acpi-lid.txt new file mode 100644 index 0000000..5cf587c --- /dev/null +++ b/Documentation/acpi/acpi-lid.txt @@ -0,0 +1,89 @@ +Usage Model of the ACPI Control Method Lid Device + +Copyright (C) 2016, Intel Corporation +Author: Lv Zheng <lv.zheng@intel.com> + + +Abstract: + +Platforms containing lids convey lid state (open/close) to OSPMs using a +control method lid device. To implement this, the AML tables issue +Notify(lid_device, 0x80) to notify the OSPMs whenever the lid state has +changed. The _LID control method for the lid device must be implemented to +report the "current" state of the lid as either "opened" or "closed". + +This document describes the restrictions and the expections of the Linux +ACPI lid device driver. + + +1. Restrictions of the returning value of the _LID control method + +The _LID control method is described to return the "current" lid state. +However the word of "current" has ambiguity, many AML tables return the lid +state upon the last lid notification instead of returning the lid state +upon the last _LID evaluation. There won't be difference when the _LID +control method is evaluated during the runtime, the problem is its initial +returning value. When the AML tables implement this control method with +cached value, the initial returning value is likely not reliable. There are +simply so many examples always retuning "closed" as initial lid state. + +2. Restrictions of the lid state change notifications + +There are many AML tables never notifying when the lid device state is +changed to "opened". Thus the "opened" notification is not guaranteed. + +But it is guaranteed that the AML tables always notify "closed" when the +lid state is changed to "closed". The "closed" notification is normally +used to trigger some system power saving operations on Windows. Since it is +fully tested, the "closed" notification is reliable for all AML tables. + +3. Expections for the userspace users of the ACPI lid device driver + +The ACPI button driver exports the lid state to the userspace via the +following file: + /proc/acpi/button/lid/LID0/state +This file actually calls the _LID control method described above. And given +the previous explanation, it is not reliable enough on some platforms. So +it is advised for the userspace program to not to solely rely on this file +to determine the actual lid state. + +Linux users can switch the ACPI button driver behavior via the following +kernel parameters: +A. button.lid_event_type=switch: + When the lid state/event is reliable, the users can specify this option + (or nothing as this is the default option) to load the ACPI button + driver. The ACPI button driver will send the traditional "SW_LID" event + to the userspace. +B. button.lid_event_type=key: + When the lid state/event is not reliable, the users can specify this + option to load the ACPI button driver. The ACPI button driver will send + the "KEY_LID_CLOSE" event instead of the "SW_LID" to the userspace. + +If the userspace hasn't been prepared to handle the new KEY_LID_CLOSE +event, Linux users can use the following kernel parameters to handle the +possible issues triggered because of the unreliable lid state/event: +C. button.lid_init_state=method: + This option is only effective when the event type is "switch". When this + option is specified, the ACPI button driver reports the initial lid + state using the returning value of the _LID control method. + This option can be used to fix some platforms where the _LID control + method's returning value is reliable but the initial lid state + notification is missing. +D. button.lid_init_state=open: + This option is only effective when the event type is "switch". When this + option is specified, the ACPI button driver always reports the initial + lid state as "opened". + This may fix some platforms where the returning value of the _LID + control method is not reliable and the initial lid state notification is + missing. + +If the userspace has been prepared to handle the new KEY_LID_CLOSE event, +Linux users should always use the following kernel parameter: +E. button.lid_init_state=ignore: + This option allows the users to switch the "event type" between the + "switch" and the "key". When this option is specified, the ACPI button + driver never reports the initial lid state. However, the platform may + automatically report a correct initial lid state and there is no "open" + event missing. When this is the case (everything is correctly + implemented by the platform firmware), the "event type" should be + "switch", otherwise, the "event type" should be "key". -- 1.7.10 ^ permalink raw reply related [flat|nested] 27+ messages in thread
end of thread, other threads:[~2016-07-20 3:21 UTC | newest] Thread overview: 27+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <cover.1467717304.git.lv.zheng@intel.com> 2016-07-05 11:18 ` [PATCH 4/5] ACPI / button: Add SW_ACPI_LID for new usage model Lv Zheng [not found] ` <cover.1467875142.git.lv.zheng@intel.com> 2016-07-07 7:10 ` [PATCH v2 3/4] " Lv Zheng 2016-07-08 9:27 ` Benjamin Tissoires 2016-07-08 17:55 ` Dmitry Torokhov 2016-07-07 7:11 ` [PATCH v2 4/4] ACPI / button: Add document for ACPI control method lid device restrictions Lv Zheng 2016-07-08 9:17 ` Benjamin Tissoires 2016-07-08 17:51 ` Dmitry Torokhov 2016-07-11 11:34 ` Benjamin Tissoires 2016-07-12 0:41 ` Dmitry Torokhov 2016-07-12 7:43 ` Zheng, Lv 2016-07-20 3:21 ` Zheng, Lv 2016-07-12 7:13 ` Zheng, Lv 2016-07-19 7:17 ` Zheng, Lv 2016-07-19 8:40 ` Benjamin Tissoires 2016-07-19 8:57 ` Zheng, Lv 2016-07-19 9:07 ` Benjamin Tissoires 2016-07-11 3:20 ` Zheng, Lv 2016-07-11 10:58 ` Bastien Nocera 2016-07-12 7:06 ` Zheng, Lv 2016-07-11 11:42 ` Benjamin Tissoires 2016-07-11 11:47 ` Benjamin Tissoires 2016-07-12 7:34 ` Zheng, Lv 2016-07-12 10:17 ` [PATCH v3 1/2] ACPI / button: Add KEY_LID_CLOSE for new usage model Lv Zheng 2016-07-18 7:53 ` Benjamin Tissoires 2016-07-18 15:51 ` Bastien Nocera 2016-07-19 4:48 ` Zheng, Lv 2016-07-12 10:17 ` [PATCH v3 2/2] ACPI / button: Add document for ACPI control method lid device restrictions Lv Zheng
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).