drivers/platform/x86/intel/int0002_vgpio.c
Source file repositories/reference/linux-study-clean/drivers/platform/x86/intel/int0002_vgpio.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/platform/x86/intel/int0002_vgpio.c- Extension
.c- Size
- 7771 bytes
- Lines
- 294
- Domain
- Driver Families
- Bucket
- drivers/platform
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/acpi.hlinux/bitmap.hlinux/gpio/driver.hlinux/interrupt.hlinux/io.hlinux/kernel.hlinux/module.hlinux/platform_data/x86/soc.hlinux/platform_device.hlinux/slab.hlinux/suspend.h
Detected Declarations
struct int0002_datafunction int0002_gpio_getfunction int0002_gpio_setfunction int0002_gpio_direction_outputfunction int0002_irq_ackfunction int0002_irq_unmaskfunction int0002_irq_maskfunction int0002_irq_set_wakefunction int0002_irqfunction int0002_check_wakefunction int0002_init_irq_valid_maskfunction int0002_probefunction int0002_removefunction int0002_suspendfunction int0002_resume
Annotated Snippet
struct int0002_data {
struct gpio_chip chip;
int parent_irq;
int wake_enable_count;
};
/*
* As this is not a real GPIO at all, but just a hack to model an event in
* ACPI the get / set functions are dummy functions.
*/
static int int0002_gpio_get(struct gpio_chip *chip, unsigned int offset)
{
return 0;
}
static int int0002_gpio_set(struct gpio_chip *chip, unsigned int offset,
int value)
{
return 0;
}
static int int0002_gpio_direction_output(struct gpio_chip *chip,
unsigned int offset, int value)
{
return 0;
}
static void int0002_irq_ack(struct irq_data *data)
{
outl(GPE0A_PME_B0_STS_BIT, GPE0A_STS_PORT);
}
static void int0002_irq_unmask(struct irq_data *data)
{
struct gpio_chip *gc = irq_data_get_irq_chip_data(data);
irq_hw_number_t hwirq = irqd_to_hwirq(data);
u32 gpe_en_reg;
gpiochip_enable_irq(gc, hwirq);
gpe_en_reg = inl(GPE0A_EN_PORT);
gpe_en_reg |= GPE0A_PME_B0_EN_BIT;
outl(gpe_en_reg, GPE0A_EN_PORT);
}
static void int0002_irq_mask(struct irq_data *data)
{
struct gpio_chip *gc = irq_data_get_irq_chip_data(data);
irq_hw_number_t hwirq = irqd_to_hwirq(data);
u32 gpe_en_reg;
gpe_en_reg = inl(GPE0A_EN_PORT);
gpe_en_reg &= ~GPE0A_PME_B0_EN_BIT;
outl(gpe_en_reg, GPE0A_EN_PORT);
gpiochip_disable_irq(gc, hwirq);
}
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 int0002_data *int0002 = container_of(chip, struct int0002_data, chip);
/*
* Applying of the wakeup flag to our parent IRQ is delayed till system
* suspend, because we only want to do this when using s2idle.
*/
if (on)
int0002->wake_enable_count++;
else
int0002->wake_enable_count--;
return 0;
}
static irqreturn_t int0002_irq(int irq, void *data)
{
struct gpio_chip *chip = data;
u32 gpe_sts_reg;
gpe_sts_reg = inl(GPE0A_STS_PORT);
if (!(gpe_sts_reg & GPE0A_PME_B0_STS_BIT))
return IRQ_NONE;
generic_handle_domain_irq_safe(chip->irq.domain, GPE0A_PME_B0_VIRT_GPIO_PIN);
pm_wakeup_hard_event(chip->parent);
return IRQ_HANDLED;
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/bitmap.h`, `linux/gpio/driver.h`, `linux/interrupt.h`, `linux/io.h`, `linux/kernel.h`, `linux/module.h`, `linux/platform_data/x86/soc.h`.
- Detected declarations: `struct int0002_data`, `function int0002_gpio_get`, `function int0002_gpio_set`, `function int0002_gpio_direction_output`, `function int0002_irq_ack`, `function int0002_irq_unmask`, `function int0002_irq_mask`, `function int0002_irq_set_wake`, `function int0002_irq`, `function int0002_check_wake`.
- Atlas domain: Driver Families / drivers/platform.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.