* [PATCH 0/2] intel-hid: intel-vbtn: Suspend-related fix and update
@ 2019-08-08 8:40 Rafael J. Wysocki
2019-08-08 8:42 ` [PATCH 1/2] intel-hid: intel-vbtn: Avoid leaking wakeup_mode set Rafael J. Wysocki
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2019-08-08 8:40 UTC (permalink / raw)
To: platform-driver-x86; +Cc: Andy Shevchenko, LKML, Linux PM, Linux ACPI
Hi,
These two patches fix a minor issue related to system suspend in the intel-hid
and intel-vbtn drivers and update the suspend/resume handling in intel-hid to
reduce special-casing in it somewhat.
Please refer to the changelogs for details.
Thanks,
Rafael
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] intel-hid: intel-vbtn: Avoid leaking wakeup_mode set
2019-08-08 8:40 [PATCH 0/2] intel-hid: intel-vbtn: Suspend-related fix and update Rafael J. Wysocki
@ 2019-08-08 8:42 ` Rafael J. Wysocki
2019-08-08 8:44 ` [PATCH 2/2] intel-hid: Disable button array during suspend-to-idle Rafael J. Wysocki
2019-08-08 11:19 ` [PATCH 0/2] intel-hid: intel-vbtn: Suspend-related fix and update Andy Shevchenko
2 siblings, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2019-08-08 8:42 UTC (permalink / raw)
To: platform-driver-x86; +Cc: Andy Shevchenko, LKML, Linux PM, Linux ACPI
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Both intel-hid and intel-vbtn set a wakeup_mode flag causing them
to behave in a special way during system suspend and while suspended
in their "prepare" PM callbacks and clear it in their "resume" PM
callbacks. That may cause the wakeup_mode flag to remain set after
a system suspend failure (if some other driver's "suspend" callback
returns an error before the "suspend" callback of either intel-hid
or intel-vbtn is invoked).
After commit 10a08fd65ec1 ("ACPI: PM: Set up EC GPE for system wakeup
from drivers that need it") that also affects the "wakeup mask" bit
of the EC GPE, which may not be cleared after a failing system
suspend.
Fix this issue by adding "complete" PM callbacks to intel-hid and
intel-vbtn to clear the wakeup_mode flag and the "wakeup mask" bit
of the EC GPE if they have not been cleared earlier.
Fixes: 10a08fd65ec1 ("ACPI: PM: Set up EC GPE for system wakeup from drivers that need it")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
The commit pointed to by the Fixes: tag above is in linux-next only ATM.
The problem had been there before that commit, but it wasn't fixed by it and
the fix depends on that commit.
---
drivers/platform/x86/intel-hid.c | 17 ++++++++++++-----
drivers/platform/x86/intel-vbtn.c | 12 +++++++++---
2 files changed, 21 insertions(+), 8 deletions(-)
Index: linux-pm/drivers/platform/x86/intel-hid.c
===================================================================
--- linux-pm.orig/drivers/platform/x86/intel-hid.c
+++ linux-pm/drivers/platform/x86/intel-hid.c
@@ -262,6 +262,16 @@ static int intel_hid_pm_prepare(struct d
return 0;
}
+static void intel_hid_pm_complete(struct device *device)
+{
+ struct intel_hid_priv *priv = dev_get_drvdata(device);
+
+ if (priv->wakeup_mode) {
+ acpi_ec_set_gpe_wake_mask(ACPI_GPE_DISABLE);
+ priv->wakeup_mode = false;
+ }
+}
+
static int intel_hid_pl_suspend_handler(struct device *device)
{
if (pm_suspend_via_firmware()) {
@@ -273,12 +283,8 @@ static int intel_hid_pl_suspend_handler(
static int intel_hid_pl_resume_handler(struct device *device)
{
- if (device_may_wakeup(device)) {
- struct intel_hid_priv *priv = dev_get_drvdata(device);
+ intel_hid_pm_complete(device);
- acpi_ec_set_gpe_wake_mask(ACPI_GPE_DISABLE);
- priv->wakeup_mode = false;
- }
if (pm_resume_via_firmware()) {
intel_hid_set_enable(device, true);
intel_button_array_enable(device, true);
@@ -288,6 +294,7 @@ static int intel_hid_pl_resume_handler(s
static const struct dev_pm_ops intel_hid_pl_pm_ops = {
.prepare = intel_hid_pm_prepare,
+ .complete = intel_hid_pm_complete,
.freeze = intel_hid_pl_suspend_handler,
.thaw = intel_hid_pl_resume_handler,
.restore = intel_hid_pl_resume_handler,
Index: linux-pm/drivers/platform/x86/intel-vbtn.c
===================================================================
--- linux-pm.orig/drivers/platform/x86/intel-vbtn.c
+++ linux-pm/drivers/platform/x86/intel-vbtn.c
@@ -210,19 +210,25 @@ static int intel_vbtn_pm_prepare(struct
return 0;
}
-static int intel_vbtn_pm_resume(struct device *dev)
+static void intel_vbtn_pm_complete(struct device *dev)
{
- if (device_may_wakeup(dev)) {
- struct intel_vbtn_priv *priv = dev_get_drvdata(dev);
+ struct intel_vbtn_priv *priv = dev_get_drvdata(dev);
+ if (priv->wakeup_mode) {
acpi_ec_set_gpe_wake_mask(ACPI_GPE_DISABLE);
priv->wakeup_mode = false;
}
+}
+
+static int intel_vbtn_pm_resume(struct device *dev)
+{
+ intel_vbtn_pm_complete(dev);
return 0;
}
static const struct dev_pm_ops intel_vbtn_pm_ops = {
.prepare = intel_vbtn_pm_prepare,
+ .complete = intel_vbtn_pm_complete,
.resume = intel_vbtn_pm_resume,
.restore = intel_vbtn_pm_resume,
.thaw = intel_vbtn_pm_resume,
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] intel-hid: Disable button array during suspend-to-idle
2019-08-08 8:40 [PATCH 0/2] intel-hid: intel-vbtn: Suspend-related fix and update Rafael J. Wysocki
2019-08-08 8:42 ` [PATCH 1/2] intel-hid: intel-vbtn: Avoid leaking wakeup_mode set Rafael J. Wysocki
@ 2019-08-08 8:44 ` Rafael J. Wysocki
2019-08-08 11:19 ` [PATCH 0/2] intel-hid: intel-vbtn: Suspend-related fix and update Andy Shevchenko
2 siblings, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2019-08-08 8:44 UTC (permalink / raw)
To: platform-driver-x86; +Cc: Andy Shevchenko, LKML, Linux PM, Linux ACPI
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Notice that intel_button_array_enable() never disables the power
button which is the only one needed to wake up the system from
suspend-to-idle, so it can be safely called during suspend-to-idle
as well as during "regular" system suspend, and rearrange the
code in the driver's "suspend" and "resume" callbacks accordingly.
While at it, use pm_suspend_no_platform() to check if the current
suspend-resume cycle is suspend-to-idle, as that is the only
case when the device should be enabled while suspended.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/platform/x86/intel-hid.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
Index: linux-pm/drivers/platform/x86/intel-hid.c
===================================================================
--- linux-pm.orig/drivers/platform/x86/intel-hid.c
+++ linux-pm/drivers/platform/x86/intel-hid.c
@@ -274,10 +274,11 @@ static void intel_hid_pm_complete(struct
static int intel_hid_pl_suspend_handler(struct device *device)
{
- if (pm_suspend_via_firmware()) {
+ intel_button_array_enable(device, false);
+
+ if (!pm_suspend_no_platform())
intel_hid_set_enable(device, false);
- intel_button_array_enable(device, false);
- }
+
return 0;
}
@@ -285,10 +286,10 @@ static int intel_hid_pl_resume_handler(s
{
intel_hid_pm_complete(device);
- if (pm_resume_via_firmware()) {
+ if (!pm_suspend_no_platform())
intel_hid_set_enable(device, true);
- intel_button_array_enable(device, true);
- }
+
+ intel_button_array_enable(device, true);
return 0;
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] intel-hid: intel-vbtn: Suspend-related fix and update
2019-08-08 8:40 [PATCH 0/2] intel-hid: intel-vbtn: Suspend-related fix and update Rafael J. Wysocki
2019-08-08 8:42 ` [PATCH 1/2] intel-hid: intel-vbtn: Avoid leaking wakeup_mode set Rafael J. Wysocki
2019-08-08 8:44 ` [PATCH 2/2] intel-hid: Disable button array during suspend-to-idle Rafael J. Wysocki
@ 2019-08-08 11:19 ` Andy Shevchenko
2019-08-09 8:15 ` Rafael J. Wysocki
2 siblings, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2019-08-08 11:19 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: platform-driver-x86, LKML, Linux PM, Linux ACPI
On Thu, Aug 08, 2019 at 10:40:19AM +0200, Rafael J. Wysocki wrote:
> Hi,
>
> These two patches fix a minor issue related to system suspend in the intel-hid
> and intel-vbtn drivers and update the suspend/resume handling in intel-hid to
> reduce special-casing in it somewhat.
>
AFAIR the original patches go via other than PDx86 tree.
Thus, while patches are looking good to me,
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Please refer to the changelogs for details.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] intel-hid: intel-vbtn: Suspend-related fix and update
2019-08-08 11:19 ` [PATCH 0/2] intel-hid: intel-vbtn: Suspend-related fix and update Andy Shevchenko
@ 2019-08-09 8:15 ` Rafael J. Wysocki
0 siblings, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2019-08-09 8:15 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Rafael J. Wysocki, Platform Driver, LKML, Linux PM, Linux ACPI
On Thu, Aug 8, 2019 at 1:19 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Thu, Aug 08, 2019 at 10:40:19AM +0200, Rafael J. Wysocki wrote:
> > Hi,
> >
> > These two patches fix a minor issue related to system suspend in the intel-hid
> > and intel-vbtn drivers and update the suspend/resume handling in intel-hid to
> > reduce special-casing in it somewhat.
> >
>
> AFAIR the original patches go via other than PDx86 tree.
That's correct.
> Thus, while patches are looking good to me,
>
> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Thanks!
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-08-09 8:15 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-08 8:40 [PATCH 0/2] intel-hid: intel-vbtn: Suspend-related fix and update Rafael J. Wysocki
2019-08-08 8:42 ` [PATCH 1/2] intel-hid: intel-vbtn: Avoid leaking wakeup_mode set Rafael J. Wysocki
2019-08-08 8:44 ` [PATCH 2/2] intel-hid: Disable button array during suspend-to-idle Rafael J. Wysocki
2019-08-08 11:19 ` [PATCH 0/2] intel-hid: intel-vbtn: Suspend-related fix and update Andy Shevchenko
2019-08-09 8:15 ` Rafael J. Wysocki
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).