All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] platform/x86: intel_int0002_vgpio: Fix wakeups not working on Cherry Trail
@ 2019-08-23 17:48 Hans de Goede
  2019-08-23 17:48 ` [PATCH 2/2] platform/x86: intel_int0002_vgpio: Use device_init_wakeup Hans de Goede
  0 siblings, 1 reply; 3+ messages in thread
From: Hans de Goede @ 2019-08-23 17:48 UTC (permalink / raw)
  To: Darren Hart, Andy Shevchenko
  Cc: Hans de Goede, platform-driver-x86, linux-kernel, stable

Commit 871f1f2bcb01 ("platform/x86: intel_int0002_vgpio: Only implement
irq_set_wake on Bay Trail") removed the irq_set_wake method from the
struct irq_chip used on Cherry Trail, but it did not set
IRQCHIP_SKIP_SET_WAKE causing  kernel/irq/manage.c: set_irq_wake_real()
to return -ENXIO.

This causes the kernel to no longer see PME events reported through the
INT0002 device as wakeup events. Which e.g. breaks wakeup by the (USB)
keyboard on many Cherry Trail 2-in-1 devices.

Cc: stable@vger.kernel.org
Fixes: 871f1f2bcb01 ("platform/x86: intel_int0002_vgpio: Only implement irq_set_wake on Bay Trail")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/platform/x86/intel_int0002_vgpio.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/platform/x86/intel_int0002_vgpio.c b/drivers/platform/x86/intel_int0002_vgpio.c
index d9542c661ddc..9ea1a2a19f86 100644
--- a/drivers/platform/x86/intel_int0002_vgpio.c
+++ b/drivers/platform/x86/intel_int0002_vgpio.c
@@ -144,6 +144,7 @@ static struct irq_chip int0002_cht_irqchip = {
 	 * No set_wake, on CHT the IRQ is typically shared with the ACPI SCI
 	 * and we don't want to mess with the ACPI SCI irq settings.
 	 */
+	.flags			= IRQCHIP_SKIP_SET_WAKE,
 };
 
 static const struct x86_cpu_id int0002_cpu_ids[] = {
-- 
2.22.0


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

* [PATCH 2/2] platform/x86: intel_int0002_vgpio: Use device_init_wakeup
  2019-08-23 17:48 [PATCH 1/2] platform/x86: intel_int0002_vgpio: Fix wakeups not working on Cherry Trail Hans de Goede
@ 2019-08-23 17:48 ` Hans de Goede
  2019-09-07 17:45   ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Hans de Goede @ 2019-08-23 17:48 UTC (permalink / raw)
  To: Darren Hart, Andy Shevchenko
  Cc: Hans de Goede, platform-driver-x86, linux-kernel

Use device_init_wakeup and pm_wakeup_hard_event instead of directly
calling pm_system_wakeup(). This is the preferred way to do this and
this will allow the user to disable wakeup through INT0002 events
through sysfs.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/platform/x86/intel_int0002_vgpio.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/intel_int0002_vgpio.c b/drivers/platform/x86/intel_int0002_vgpio.c
index 9ea1a2a19f86..f9fee682a8a2 100644
--- a/drivers/platform/x86/intel_int0002_vgpio.c
+++ b/drivers/platform/x86/intel_int0002_vgpio.c
@@ -122,7 +122,7 @@ static irqreturn_t int0002_irq(int irq, void *data)
 	generic_handle_irq(irq_find_mapping(chip->irq.domain,
 					    GPE0A_PME_B0_VIRT_GPIO_PIN));
 
-	pm_system_wakeup();
+	pm_wakeup_hard_event(chip->parent);
 
 	return IRQ_HANDLED;
 }
@@ -217,6 +217,13 @@ static int int0002_probe(struct platform_device *pdev)
 
 	gpiochip_set_chained_irqchip(chip, irq_chip, irq, NULL);
 
+	device_init_wakeup(dev, true);
+	return 0;
+}
+
+static int int0002_remove(struct platform_device *pdev)
+{
+	device_init_wakeup(&pdev->dev, false);
 	return 0;
 }
 
@@ -232,6 +239,7 @@ static struct platform_driver int0002_driver = {
 		.acpi_match_table	= int0002_acpi_ids,
 	},
 	.probe	= int0002_probe,
+	.remove	= int0002_remove,
 };
 
 module_platform_driver(int0002_driver);
-- 
2.22.0


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

* Re: [PATCH 2/2] platform/x86: intel_int0002_vgpio: Use device_init_wakeup
  2019-08-23 17:48 ` [PATCH 2/2] platform/x86: intel_int0002_vgpio: Use device_init_wakeup Hans de Goede
@ 2019-09-07 17:45   ` Andy Shevchenko
  0 siblings, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2019-09-07 17:45 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Darren Hart, Andy Shevchenko, Platform Driver, Linux Kernel Mailing List

On Fri, Aug 23, 2019 at 8:48 PM Hans de Goede <hdegoede@redhat.com> wrote:
>
> Use device_init_wakeup and pm_wakeup_hard_event instead of directly
> calling pm_system_wakeup(). This is the preferred way to do this and
> this will allow the user to disable wakeup through INT0002 events
> through sysfs.
>

Pushed to my review and testing queue, thanks!

> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  drivers/platform/x86/intel_int0002_vgpio.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/platform/x86/intel_int0002_vgpio.c b/drivers/platform/x86/intel_int0002_vgpio.c
> index 9ea1a2a19f86..f9fee682a8a2 100644
> --- a/drivers/platform/x86/intel_int0002_vgpio.c
> +++ b/drivers/platform/x86/intel_int0002_vgpio.c
> @@ -122,7 +122,7 @@ static irqreturn_t int0002_irq(int irq, void *data)
>         generic_handle_irq(irq_find_mapping(chip->irq.domain,
>                                             GPE0A_PME_B0_VIRT_GPIO_PIN));
>
> -       pm_system_wakeup();
> +       pm_wakeup_hard_event(chip->parent);
>
>         return IRQ_HANDLED;
>  }
> @@ -217,6 +217,13 @@ static int int0002_probe(struct platform_device *pdev)
>
>         gpiochip_set_chained_irqchip(chip, irq_chip, irq, NULL);
>
> +       device_init_wakeup(dev, true);
> +       return 0;
> +}
> +
> +static int int0002_remove(struct platform_device *pdev)
> +{
> +       device_init_wakeup(&pdev->dev, false);
>         return 0;
>  }
>
> @@ -232,6 +239,7 @@ static struct platform_driver int0002_driver = {
>                 .acpi_match_table       = int0002_acpi_ids,
>         },
>         .probe  = int0002_probe,
> +       .remove = int0002_remove,
>  };
>
>  module_platform_driver(int0002_driver);
> --
> 2.22.0
>


--
With Best Regards,
Andy Shevchenko

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

end of thread, other threads:[~2019-09-07 17:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-23 17:48 [PATCH 1/2] platform/x86: intel_int0002_vgpio: Fix wakeups not working on Cherry Trail Hans de Goede
2019-08-23 17:48 ` [PATCH 2/2] platform/x86: intel_int0002_vgpio: Use device_init_wakeup Hans de Goede
2019-09-07 17:45   ` Andy Shevchenko

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.