public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Ken Xue <Ken.Xue@amd.com>
Cc: linux-acpi@vger.kernel.org, rafael@kernel.org, cwhuang@linux.org.tw
Subject: Re: [PATCH V3] acpi: trigger wakeup key event from power button
Date: Tue, 12 Sep 2023 18:22:52 +0300	[thread overview]
Message-ID: <ZQCCTA9YblEHgKT8@smile.fi.intel.com> (raw)
In-Reply-To: <20230912131605.734829-1-Ken.Xue@amd.com>

On Tue, Sep 12, 2023 at 09:16:06PM +0800, Ken Xue wrote:
> Andorid can wakeup from various wakeup sources,
> but only several wakeup sources can wake up screen
> with right events(POWER, WAKEUP) from input device.


You still have a room for 10+ characters on each line in the above paragraph.
Why not use them?

> Regarding pressing acpi power button, it can resume system and
> ACPI_BITMASK_WAKE_STATUS and ACPI_BITMASK_POWER_BUTTON_STATUS
> are set in pm1a_sts, but kernel does not report any key
> event to user space during resume by default.
> 
> So, trigger wakeup key event to user space during resume
> from power button.
> 
> Signed-off-by: Ken Xue <Ken.Xue@amd.com>

...

> +void acpi_power_button_wakeup(struct acpi_device *dev)
> +{
> +	struct acpi_button *button = acpi_driver_data(dev);
> +	struct input_dev *input;

> +	if (button->type == ACPI_BUTTON_TYPE_POWER) {

It seems you missed the suggestion and I haven't heard an objection on written
the above as

	if (button->type != ACPI_BUTTON_TYPE_POWER)
		return;

> +		input = button->input;
> +		input_report_key(input, KEY_WAKEUP, 1);
> +		input_sync(input);
> +		input_report_key(input, KEY_WAKEUP, 0);
> +		input_sync(input);
> +	}
> +}

...

>  #include <linux/syscore_ops.h>
>  #include <asm/io.h>
>  #include <trace/events/power.h>
> +#include <acpi/button.h>

While at it, I would add a blank line here to distinguish groups of header
inclusions.

  #include <linux/syscore_ops.h>
  #include <asm/io.h>
  #include <trace/events/power.h>

  #include <acpi/button.h>

Or even

  #include <linux/syscore_ops.h>

  #include <asm/io.h>

  #include <trace/events/power.h>

  #include <acpi/button.h>


-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2023-09-12 15:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-12 13:16 [PATCH V3] acpi: trigger wakeup key event from power button Ken Xue
2023-09-12 15:22 ` Andy Shevchenko [this message]
2023-09-13  0:20   ` Ken Xue

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=ZQCCTA9YblEHgKT8@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=Ken.Xue@amd.com \
    --cc=cwhuang@linux.org.tw \
    --cc=linux-acpi@vger.kernel.org \
    --cc=rafael@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox