All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Mark Gross <mgross@linux.intel.com>
Cc: Andy Shevchenko <andy@infradead.org>,
	platform-driver-x86@vger.kernel.org,
	Elia Devito <eliadevito@gmail.com>
Subject: Re: [PATCH 1/4] platform/x86: intel-vbtn: Rework wakeup handling in notify_handler()
Date: Mon, 25 Jan 2021 21:27:50 +0100	[thread overview]
Message-ID: <0e8551e0-db6b-b9af-a3d6-84d0a83906cd@redhat.com> (raw)
In-Reply-To: <20210115161850.117614-1-hdegoede@redhat.com>

Hi,

On 1/15/21 5:18 PM, Hans de Goede wrote:
> Rework the wakeup path inside notify_handler() to special case the
> buttons (KE_KEY) case instead of the switches case.
> 
> In case of a button wake event we want to skip reporting this,
> mirroring how the drivers/acpi/button.c code skips the reporting
> in the wakeup case (suspended flag set) too.
> 
> The reason to skip reporting in this case is that some Linux
> desktop-environments will immediately resuspend if we report an
> evdev event for the power-button press on wakeup.
> 
> Before this commit the skipping of the button-press was done
> in a round-about way: In case of a wakeup the regular
> sparse_keymap_report_event() would always be skipped by
> an early return, and then to avoid not reporting switch changes
> on wakeup there was a special KE_SW path with a duplicate
> sparse_keymap_report_event() call.
> 
> This commit refactors the wakeup handling to explicitly skip the
> reporting for button wake events, while using the regular
> reporting path for non button (switches) wakeup events.
> 
> No intentional functional impact.
> 
> Cc: Elia Devito <eliadevito@gmail.com>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

I've applied this series to my review-hans branch now, so this will
show up in for-next soon.

Regards,

Hans

> ---
>  drivers/platform/x86/intel-vbtn.c | 25 ++++++++++---------------
>  1 file changed, 10 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/platform/x86/intel-vbtn.c b/drivers/platform/x86/intel-vbtn.c
> index 30a9062d2b4b..e1bb37a03ba3 100644
> --- a/drivers/platform/x86/intel-vbtn.c
> +++ b/drivers/platform/x86/intel-vbtn.c
> @@ -131,22 +131,17 @@ static void notify_handler(acpi_handle handle, u32 event, void *context)
>  
>  	if (priv->wakeup_mode) {
>  		ke = sparse_keymap_entry_from_scancode(priv->input_dev, event);
> -		if (ke) {
> -			pm_wakeup_hard_event(&device->dev);
> -
> -			/*
> -			 * Switch events like tablet mode will wake the device
> -			 * and report the new switch position to the input
> -			 * subsystem.
> -			 */
> -			if (ke->type == KE_SW)
> -				sparse_keymap_report_event(priv->input_dev,
> -							   event,
> -							   val,
> -							   0);
> +		if (!ke)
> +			goto out_unknown;
> +
> +		pm_wakeup_hard_event(&device->dev);
> +
> +		/*
> +		 * Skip reporting an evdev event for button wake events,
> +		 * mirroring how the drivers/acpi/button.c code skips this too.
> +		 */
> +		if (ke->type == KE_KEY)
>  			return;
> -		}
> -		goto out_unknown;
>  	}
>  
>  	/*
> 


      parent reply	other threads:[~2021-01-25 20:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-15 16:18 [PATCH 1/4] platform/x86: intel-vbtn: Rework wakeup handling in notify_handler() Hans de Goede
2021-01-15 16:18 ` [PATCH 2/4] platform/x86: intel-vbtn: Create 2 separate input-devs for buttons and switches Hans de Goede
2021-01-15 16:18 ` [PATCH 3/4] platform/x86: intel-vbtn: Add alternative method to enable switches Hans de Goede
2021-01-15 16:18 ` [PATCH 4/4] platform/x86: intel-vbtn: Eval VBDL after registering our notifier Hans de Goede
2021-01-25 20:27 ` Hans de Goede [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0e8551e0-db6b-b9af-a3d6-84d0a83906cd@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=andy@infradead.org \
    --cc=eliadevito@gmail.com \
    --cc=mgross@linux.intel.com \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.