All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] platform/x86: intel_int0002_vgpio: Implement irq_set_wake
@ 2018-09-24 14:37 Hans de Goede
  2018-09-26  9:34 ` Andy Shevchenko
  2019-01-31 19:47 ` Maxim Mikityanskiy
  0 siblings, 2 replies; 8+ messages in thread
From: Hans de Goede @ 2018-09-24 14:37 UTC (permalink / raw)
  To: Darren Hart, Andy Shevchenko
  Cc: Hans de Goede, platform-driver-x86, linux-kernel

We were relying on the interrupt being shared with the ACPI SCI and the
ACPI core calling irq_set_wake. But that does not always happen on
Bay Trail devices, so we should do it ourselves.

This fixes wake from USB not working on various Bay Trail devices.

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

diff --git a/drivers/platform/x86/intel_int0002_vgpio.c b/drivers/platform/x86/intel_int0002_vgpio.c
index 987a3b03f225..33c3489f5bc1 100644
--- a/drivers/platform/x86/intel_int0002_vgpio.c
+++ b/drivers/platform/x86/intel_int0002_vgpio.c
@@ -106,6 +106,21 @@ static void int0002_irq_mask(struct irq_data *data)
 	outl(gpe_en_reg, GPE0A_EN_PORT);
 }
 
+static int int0002_irq_set_wake(struct irq_data *data, unsigned int on)
+{
+	struct gpio_chip *chip = irq_data_get_irq_chip_data(data);
+	struct platform_device *pdev = to_platform_device(chip->parent);
+	int irq = platform_get_irq(pdev, 0);
+
+	/* Propagate to parent irq */
+	if (on)
+		enable_irq_wake(irq);
+	else
+		disable_irq_wake(irq);
+
+	return 0;
+}
+
 static irqreturn_t int0002_irq(int irq, void *data)
 {
 	struct gpio_chip *chip = data;
@@ -128,6 +143,7 @@ static struct irq_chip int0002_irqchip = {
 	.irq_ack		= int0002_irq_ack,
 	.irq_mask		= int0002_irq_mask,
 	.irq_unmask		= int0002_irq_unmask,
+	.irq_set_wake		= int0002_irq_set_wake,
 };
 
 static int int0002_probe(struct platform_device *pdev)
-- 
2.19.0.rc1


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

end of thread, other threads:[~2019-02-03  9:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-24 14:37 [PATCH] platform/x86: intel_int0002_vgpio: Implement irq_set_wake Hans de Goede
2018-09-26  9:34 ` Andy Shevchenko
2019-01-31 19:47 ` Maxim Mikityanskiy
2019-02-01 22:52   ` Hans de Goede
2019-02-01 23:25     ` Andy Shevchenko
2019-02-02 10:50       ` Hans de Goede
2019-02-02 19:04     ` Maxim Mikityanskiy
2019-02-03  9:43       ` Hans de Goede

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.