All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] platform/x86: intel-vbtn: Report switch events when event wakes device
@ 2019-05-16 21:56 Mathew King
  2019-05-20 15:40   ` Mario.Limonciello
  0 siblings, 1 reply; 3+ messages in thread
From: Mathew King @ 2019-05-16 21:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Mathew King, AceLan Kao, Darren Hart, Andy Shevchenko,
	platform-driver-x86

When a switch event, such as tablet mode/laptop mode or docked/undocked,
wakes a device make sure that the value of the swich is reported.
Without when a device is put in tablet mode from laptop mode when it is
suspended or vice versa the device will wake up but mode will be
incorrect.

Tested by suspending a device in laptop mode and putting it in tablet
mode, the device resumes and is in tablet mode. When suspending the
device in tablet mode and putting it in laptop mode the device resumes
and is in laptop mode.

Signed-off-by: Mathew King <mathewk@chromium.org>
---
 drivers/platform/x86/intel-vbtn.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/intel-vbtn.c b/drivers/platform/x86/intel-vbtn.c
index 06cd7e818ed5..990cc8c20872 100644
--- a/drivers/platform/x86/intel-vbtn.c
+++ b/drivers/platform/x86/intel-vbtn.c
@@ -76,12 +76,15 @@ static void notify_handler(acpi_handle handle, u32 event, void *context)
 	struct platform_device *device = context;
 	struct intel_vbtn_priv *priv = dev_get_drvdata(&device->dev);
 	unsigned int val = !(event & 1); /* Even=press, Odd=release */
-	const struct key_entry *ke_rel;
+	const struct key_entry *ke, *ke_rel;
 	bool autorelease;
 
 	if (priv->wakeup_mode) {
-		if (sparse_keymap_entry_from_scancode(priv->input_dev, event)) {
+		ke = sparse_keymap_entry_from_scancode(priv->input_dev, event);
+		if (ke) {
 			pm_wakeup_hard_event(&device->dev);
+			if (ke->type == KE_SW)
+				sparse_keymap_report_event(priv->input_dev, event, val, 0);
 			return;
 		}
 		goto out_unknown;
-- 
2.21.0.1020.gf2820cf01a-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] platform/x86: intel-vbtn: Report switch events when event wakes device
  2019-05-16 21:56 [PATCH] platform/x86: intel-vbtn: Report switch events when event wakes device Mathew King
@ 2019-05-20 15:40   ` Mario.Limonciello
  0 siblings, 0 replies; 3+ messages in thread
From: Mario.Limonciello @ 2019-05-20 15:40 UTC (permalink / raw)
  To: mathewk, linux-kernel; +Cc: acelan.kao, dvhart, andy, platform-driver-x86



> -----Original Message-----
> From: platform-driver-x86-owner@vger.kernel.org <platform-driver-x86-
> owner@vger.kernel.org> On Behalf Of Mathew King
> Sent: Thursday, May 16, 2019 4:56 PM
> To: linux-kernel@vger.kernel.org
> Cc: Mathew King; AceLan Kao; Darren Hart; Andy Shevchenko; platform-driver-
> x86@vger.kernel.org
> Subject: [PATCH] platform/x86: intel-vbtn: Report switch events when event wakes
> device
> 
> 
> [EXTERNAL EMAIL]
> 
> When a switch event, such as tablet mode/laptop mode or docked/undocked,
> wakes a device make sure that the value of the swich is reported.
> Without when a device is put in tablet mode from laptop mode when it is
> suspended or vice versa the device will wake up but mode will be
> incorrect.
> 
> Tested by suspending a device in laptop mode and putting it in tablet
> mode, the device resumes and is in tablet mode. When suspending the
> device in tablet mode and putting it in laptop mode the device resumes
> and is in laptop mode.
> 
> Signed-off-by: Mathew King <mathewk@chromium.org>

Reviewed-by: Mario Limonciello <mario.limonciello@dell.com>

> ---
>  drivers/platform/x86/intel-vbtn.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/platform/x86/intel-vbtn.c b/drivers/platform/x86/intel-vbtn.c
> index 06cd7e818ed5..990cc8c20872 100644
> --- a/drivers/platform/x86/intel-vbtn.c
> +++ b/drivers/platform/x86/intel-vbtn.c
> @@ -76,12 +76,15 @@ static void notify_handler(acpi_handle handle, u32 event,
> void *context)
>  	struct platform_device *device = context;
>  	struct intel_vbtn_priv *priv = dev_get_drvdata(&device->dev);
>  	unsigned int val = !(event & 1); /* Even=press, Odd=release */
> -	const struct key_entry *ke_rel;
> +	const struct key_entry *ke, *ke_rel;
>  	bool autorelease;
> 
>  	if (priv->wakeup_mode) {
> -		if (sparse_keymap_entry_from_scancode(priv->input_dev, event))
> {
> +		ke = sparse_keymap_entry_from_scancode(priv->input_dev,
> event);
> +		if (ke) {
>  			pm_wakeup_hard_event(&device->dev);
> +			if (ke->type == KE_SW)
> +				sparse_keymap_report_event(priv->input_dev,
> event, val, 0);
>  			return;
>  		}
>  		goto out_unknown;
> --
> 2.21.0.1020.gf2820cf01a-goog


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] platform/x86: intel-vbtn: Report switch events when event wakes device
@ 2019-05-20 15:40   ` Mario.Limonciello
  0 siblings, 0 replies; 3+ messages in thread
From: Mario.Limonciello @ 2019-05-20 15:40 UTC (permalink / raw)
  To: mathewk, linux-kernel; +Cc: acelan.kao, dvhart, andy, platform-driver-x86



> -----Original Message-----
> From: platform-driver-x86-owner@vger.kernel.org <platform-driver-x86-
> owner@vger.kernel.org> On Behalf Of Mathew King
> Sent: Thursday, May 16, 2019 4:56 PM
> To: linux-kernel@vger.kernel.org
> Cc: Mathew King; AceLan Kao; Darren Hart; Andy Shevchenko; platform-driver-
> x86@vger.kernel.org
> Subject: [PATCH] platform/x86: intel-vbtn: Report switch events when event wakes
> device
> 
> 
> [EXTERNAL EMAIL]
> 
> When a switch event, such as tablet mode/laptop mode or docked/undocked,
> wakes a device make sure that the value of the swich is reported.
> Without when a device is put in tablet mode from laptop mode when it is
> suspended or vice versa the device will wake up but mode will be
> incorrect.
> 
> Tested by suspending a device in laptop mode and putting it in tablet
> mode, the device resumes and is in tablet mode. When suspending the
> device in tablet mode and putting it in laptop mode the device resumes
> and is in laptop mode.
> 
> Signed-off-by: Mathew King <mathewk@chromium.org>

Reviewed-by: Mario Limonciello <mario.limonciello@dell.com>

> ---
>  drivers/platform/x86/intel-vbtn.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/platform/x86/intel-vbtn.c b/drivers/platform/x86/intel-vbtn.c
> index 06cd7e818ed5..990cc8c20872 100644
> --- a/drivers/platform/x86/intel-vbtn.c
> +++ b/drivers/platform/x86/intel-vbtn.c
> @@ -76,12 +76,15 @@ static void notify_handler(acpi_handle handle, u32 event,
> void *context)
>  	struct platform_device *device = context;
>  	struct intel_vbtn_priv *priv = dev_get_drvdata(&device->dev);
>  	unsigned int val = !(event & 1); /* Even=press, Odd=release */
> -	const struct key_entry *ke_rel;
> +	const struct key_entry *ke, *ke_rel;
>  	bool autorelease;
> 
>  	if (priv->wakeup_mode) {
> -		if (sparse_keymap_entry_from_scancode(priv->input_dev, event))
> {
> +		ke = sparse_keymap_entry_from_scancode(priv->input_dev,
> event);
> +		if (ke) {
>  			pm_wakeup_hard_event(&device->dev);
> +			if (ke->type == KE_SW)
> +				sparse_keymap_report_event(priv->input_dev,
> event, val, 0);
>  			return;
>  		}
>  		goto out_unknown;
> --
> 2.21.0.1020.gf2820cf01a-goog

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-20 15:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-16 21:56 [PATCH] platform/x86: intel-vbtn: Report switch events when event wakes device Mathew King
2019-05-20 15:40 ` Mario.Limonciello
2019-05-20 15:40   ` Mario.Limonciello

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.