1 /* SPDX-License-Identifier: GPL-2.0 */
3 * IRQ is a type of interrupt controller used on recent Intel SoC.
5 * Copyright 2019 Google LLC
12 * Interrupt controller types available. You can find a particular one with
13 * irq_first_device_type()
16 X86_IRQT_BASE, /* Base controller */
17 X86_IRQT_ITSS, /* ITSS controller, e.g. on APL */
18 X86_IRQT_ACPI_GPE, /* ACPI General-Purpose Events controller */
19 SANDBOX_IRQT_BASE, /* Sandbox testing */
23 * struct irq_ops - Operations for the IRQ
27 * route_pmc_gpio_gpe() - Get the GPIO for an event
30 * @pmc_gpe_num: Event number to check
31 * @returns GPIO for the event, or -ENOENT if none
33 int (*route_pmc_gpio_gpe)(struct udevice *dev, uint pmc_gpe_num);
36 * set_polarity() - Set the IRQ polarity
39 * @irq: Interrupt number to set
40 * @active_low: true if active low, false for active high
41 * @return 0 if OK, -EINVAL if @irq is invalid
43 int (*set_polarity)(struct udevice *dev, uint irq, bool active_low);
46 * snapshot_polarities() - record IRQ polarities for later restore
51 int (*snapshot_polarities)(struct udevice *dev);
54 * restore_polarities() - restore IRQ polarities
59 int (*restore_polarities)(struct udevice *dev);
62 #define irq_get_ops(dev) ((struct irq_ops *)(dev)->driver->ops)
65 * irq_route_pmc_gpio_gpe() - Get the GPIO for an event
68 * @pmc_gpe_num: Event number to check
69 * @returns GPIO for the event, or -ENOENT if none
71 int irq_route_pmc_gpio_gpe(struct udevice *dev, uint pmc_gpe_num);
74 * irq_set_polarity() - Set the IRQ polarity
77 * @irq: Interrupt number to set
78 * @active_low: true if active low, false for active high
79 * @return 0 if OK, -EINVAL if @irq is invalid
81 int irq_set_polarity(struct udevice *dev, uint irq, bool active_low);
84 * irq_snapshot_polarities() - record IRQ polarities for later restore
89 int irq_snapshot_polarities(struct udevice *dev);
92 * irq_restore_polarities() - restore IRQ polarities
97 int irq_restore_polarities(struct udevice *dev);
100 * irq_first_device_type() - Get a particular interrupt controller
102 * On success this returns an activated interrupt device.
104 * @type: Type to find
105 * @devp: Returns the device, if found
106 * @return 0 if OK, -ENODEV if not found, other -ve error if uclass failed to
109 int irq_first_device_type(enum irq_dev_t type, struct udevice **devp);