aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/intel_int0002_vgpio.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/platform/x86/intel_int0002_vgpio.c')
-rw-r--r--drivers/platform/x86/intel_int0002_vgpio.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/drivers/platform/x86/intel_int0002_vgpio.c b/drivers/platform/x86/intel_int0002_vgpio.c
index e89ad4964dc1..4b8f7305fc8a 100644
--- a/drivers/platform/x86/intel_int0002_vgpio.c
+++ b/drivers/platform/x86/intel_int0002_vgpio.c
@@ -1,3 +1,4 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * Intel INT0002 "Virtual GPIO" driver 3 * Intel INT0002 "Virtual GPIO" driver
3 * 4 *
@@ -9,10 +10,6 @@
9 * 10 *
10 * Author: Dyut Kumar Sil <dyut.k.sil@intel.com> 11 * Author: Dyut Kumar Sil <dyut.k.sil@intel.com>
11 * 12 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
15 *
16 * Some peripherals on Bay Trail and Cherry Trail platforms signal a Power 13 * Some peripherals on Bay Trail and Cherry Trail platforms signal a Power
17 * Management Event (PME) to the Power Management Controller (PMC) to wakeup 14 * Management Event (PME) to the Power Management Controller (PMC) to wakeup
18 * the system. When this happens software needs to clear the PME bus 0 status 15 * the system. When this happens software needs to clear the PME bus 0 status
@@ -57,11 +54,7 @@
57#define ICPU(model) { X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, } 54#define ICPU(model) { X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, }
58 55
59static const struct x86_cpu_id int0002_cpu_ids[] = { 56static const struct x86_cpu_id int0002_cpu_ids[] = {
60/* 57 ICPU(INTEL_FAM6_ATOM_SILVERMONT), /* Valleyview, Bay Trail */
61 * Limit ourselves to Cherry Trail for now, until testing shows we
62 * need to handle the INT0002 device on Baytrail too.
63 * ICPU(INTEL_FAM6_ATOM_SILVERMONT), * Valleyview, Bay Trail *
64 */
65 ICPU(INTEL_FAM6_ATOM_AIRMONT), /* Braswell, Cherry Trail */ 58 ICPU(INTEL_FAM6_ATOM_AIRMONT), /* Braswell, Cherry Trail */
66 {} 59 {}
67}; 60};
@@ -110,6 +103,21 @@ static void int0002_irq_mask(struct irq_data *data)
110 outl(gpe_en_reg, GPE0A_EN_PORT); 103 outl(gpe_en_reg, GPE0A_EN_PORT);
111} 104}
112 105
106static int int0002_irq_set_wake(struct irq_data *data, unsigned int on)
107{
108 struct gpio_chip *chip = irq_data_get_irq_chip_data(data);
109 struct platform_device *pdev = to_platform_device(chip->parent);
110 int irq = platform_get_irq(pdev, 0);
111
112 /* Propagate to parent irq */
113 if (on)
114 enable_irq_wake(irq);
115 else
116 disable_irq_wake(irq);
117
118 return 0;
119}
120
113static irqreturn_t int0002_irq(int irq, void *data) 121static irqreturn_t int0002_irq(int irq, void *data)
114{ 122{
115 struct gpio_chip *chip = data; 123 struct gpio_chip *chip = data;
@@ -132,6 +140,7 @@ static struct irq_chip int0002_irqchip = {
132 .irq_ack = int0002_irq_ack, 140 .irq_ack = int0002_irq_ack,
133 .irq_mask = int0002_irq_mask, 141 .irq_mask = int0002_irq_mask,
134 .irq_unmask = int0002_irq_unmask, 142 .irq_unmask = int0002_irq_unmask,
143 .irq_set_wake = int0002_irq_set_wake,
135}; 144};
136 145
137static int int0002_probe(struct platform_device *pdev) 146static int int0002_probe(struct platform_device *pdev)
@@ -216,4 +225,4 @@ module_platform_driver(int0002_driver);
216 225
217MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>"); 226MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>");
218MODULE_DESCRIPTION("Intel INT0002 Virtual GPIO driver"); 227MODULE_DESCRIPTION("Intel INT0002 Virtual GPIO driver");
219MODULE_LICENSE("GPL"); 228MODULE_LICENSE("GPL v2");