1
0
Fork 0

gpio: Move irqdomain into struct gpio_irq_chip

In order to consolidate the multiple ways to associate an IRQ chip with
a GPIO chip, move more fields into the new struct gpio_irq_chip.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Acked-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
hifive-unleashed-5.1
Thierry Reding 2017-11-07 19:15:47 +01:00 committed by Linus Walleij
parent da80ff81a8
commit f0fbe7bce7
56 changed files with 78 additions and 71 deletions

View File

@ -254,7 +254,7 @@ GPIO irqchips usually fall in one of two categories:
static irqreturn_t omap_gpio_irq_handler(int irq, void *gpiobank) static irqreturn_t omap_gpio_irq_handler(int irq, void *gpiobank)
unsigned long wa_lock_flags; unsigned long wa_lock_flags;
raw_spin_lock_irqsave(&bank->wa_lock, wa_lock_flags); raw_spin_lock_irqsave(&bank->wa_lock, wa_lock_flags);
generic_handle_irq(irq_find_mapping(bank->chip.irqdomain, bit)); generic_handle_irq(irq_find_mapping(bank->chip.irq.domain, bit));
raw_spin_unlock_irqrestore(&bank->wa_lock, wa_lock_flags); raw_spin_unlock_irqrestore(&bank->wa_lock, wa_lock_flags);
* GENERIC CHAINED GPIO irqchips: these are the same as "CHAINED GPIO irqchips", * GENERIC CHAINED GPIO irqchips: these are the same as "CHAINED GPIO irqchips",

View File

@ -113,7 +113,7 @@ static irqreturn_t bcma_gpio_irq_handler(int irq, void *dev_id)
return IRQ_NONE; return IRQ_NONE;
for_each_set_bit(gpio, &irqs, gc->ngpio) for_each_set_bit(gpio, &irqs, gc->ngpio)
generic_handle_irq(irq_find_mapping(gc->irqdomain, gpio)); generic_handle_irq(irq_find_mapping(gc->irq.domain, gpio));
bcma_chipco_gpio_polarity(cc, irqs, val & irqs); bcma_chipco_gpio_polarity(cc, irqs, val & irqs);
return IRQ_HANDLED; return IRQ_HANDLED;

View File

@ -326,7 +326,7 @@ static irqreturn_t dio48e_irq_handler(int irq, void *dev_id)
unsigned long gpio; unsigned long gpio;
for_each_set_bit(gpio, &irq_mask, 2) for_each_set_bit(gpio, &irq_mask, 2)
generic_handle_irq(irq_find_mapping(chip->irqdomain, generic_handle_irq(irq_find_mapping(chip->irq.domain,
19 + gpio*24)); 19 + gpio*24));
raw_spin_lock(&dio48egpio->lock); raw_spin_lock(&dio48egpio->lock);

View File

@ -209,7 +209,7 @@ static irqreturn_t idi_48_irq_handler(int irq, void *dev_id)
for_each_set_bit(bit_num, &irq_mask, 8) { for_each_set_bit(bit_num, &irq_mask, 8) {
gpio = bit_num + boundary * 8; gpio = bit_num + boundary * 8;
generic_handle_irq(irq_find_mapping(chip->irqdomain, generic_handle_irq(irq_find_mapping(chip->irq.domain,
gpio)); gpio));
} }
} }

View File

@ -199,7 +199,7 @@ static irqreturn_t idio_16_irq_handler(int irq, void *dev_id)
int gpio; int gpio;
for_each_set_bit(gpio, &idio16gpio->irq_mask, chip->ngpio) for_each_set_bit(gpio, &idio16gpio->irq_mask, chip->ngpio)
generic_handle_irq(irq_find_mapping(chip->irqdomain, gpio)); generic_handle_irq(irq_find_mapping(chip->irq.domain, gpio));
raw_spin_lock(&idio16gpio->lock); raw_spin_lock(&idio16gpio->lock);

View File

@ -320,7 +320,7 @@ static irqreturn_t adnp_irq(int irq, void *data)
for_each_set_bit(bit, &pending, 8) { for_each_set_bit(bit, &pending, 8) {
unsigned int child_irq; unsigned int child_irq;
child_irq = irq_find_mapping(adnp->gpio.irqdomain, child_irq = irq_find_mapping(adnp->gpio.irq.domain,
base + bit); base + bit);
handle_nested_irq(child_irq); handle_nested_irq(child_irq);
} }

View File

@ -211,7 +211,7 @@ static void altera_gpio_irq_edge_handler(struct irq_desc *desc)
altera_gc = gpiochip_get_data(irq_desc_get_handler_data(desc)); altera_gc = gpiochip_get_data(irq_desc_get_handler_data(desc));
chip = irq_desc_get_chip(desc); chip = irq_desc_get_chip(desc);
mm_gc = &altera_gc->mmchip; mm_gc = &altera_gc->mmchip;
irqdomain = altera_gc->mmchip.gc.irqdomain; irqdomain = altera_gc->mmchip.gc.irq.domain;
chained_irq_enter(chip, desc); chained_irq_enter(chip, desc);
@ -239,7 +239,7 @@ static void altera_gpio_irq_leveL_high_handler(struct irq_desc *desc)
altera_gc = gpiochip_get_data(irq_desc_get_handler_data(desc)); altera_gc = gpiochip_get_data(irq_desc_get_handler_data(desc));
chip = irq_desc_get_chip(desc); chip = irq_desc_get_chip(desc);
mm_gc = &altera_gc->mmchip; mm_gc = &altera_gc->mmchip;
irqdomain = altera_gc->mmchip.gc.irqdomain; irqdomain = altera_gc->mmchip.gc.irq.domain;
chained_irq_enter(chip, desc); chained_irq_enter(chip, desc);

View File

@ -469,7 +469,7 @@ static void aspeed_gpio_irq_handler(struct irq_desc *desc)
reg = ioread32(bank_irq_reg(data, bank, GPIO_IRQ_STATUS)); reg = ioread32(bank_irq_reg(data, bank, GPIO_IRQ_STATUS));
for_each_set_bit(p, &reg, 32) { for_each_set_bit(p, &reg, 32) {
girq = irq_find_mapping(gc->irqdomain, i * 32 + p); girq = irq_find_mapping(gc->irq.domain, i * 32 + p);
generic_handle_irq(girq); generic_handle_irq(girq);
} }

View File

@ -209,7 +209,7 @@ static void ath79_gpio_irq_handler(struct irq_desc *desc)
if (pending) { if (pending) {
for_each_set_bit(irq, &pending, gc->ngpio) for_each_set_bit(irq, &pending, gc->ngpio)
generic_handle_irq( generic_handle_irq(
irq_linear_revmap(gc->irqdomain, irq)); irq_linear_revmap(gc->irq.domain, irq));
} }
chained_irq_exit(irqchip, desc); chained_irq_exit(irqchip, desc);

View File

@ -295,7 +295,7 @@ static irqreturn_t crystalcove_gpio_irq_handler(int irq, void *data)
for (gpio = 0; gpio < CRYSTALCOVE_GPIO_NUM; gpio++) { for (gpio = 0; gpio < CRYSTALCOVE_GPIO_NUM; gpio++) {
if (pending & BIT(gpio)) { if (pending & BIT(gpio)) {
virq = irq_find_mapping(cg->chip.irqdomain, gpio); virq = irq_find_mapping(cg->chip.irq.domain, gpio);
handle_nested_irq(virq); handle_nested_irq(virq);
} }
} }

View File

@ -420,7 +420,7 @@ static void dln2_gpio_event(struct platform_device *pdev, u16 echo,
return; return;
} }
irq = irq_find_mapping(dln2->gpio.irqdomain, pin); irq = irq_find_mapping(dln2->gpio.irq.domain, pin);
if (!irq) { if (!irq) {
dev_err(dln2->gpio.parent, "pin %d not mapped to IRQ\n", pin); dev_err(dln2->gpio.parent, "pin %d not mapped to IRQ\n", pin);
return; return;

View File

@ -149,7 +149,7 @@ static void ftgpio_gpio_irq_handler(struct irq_desc *desc)
stat = readl(g->base + GPIO_INT_STAT); stat = readl(g->base + GPIO_INT_STAT);
if (stat) if (stat)
for_each_set_bit(offset, &stat, gc->ngpio) for_each_set_bit(offset, &stat, gc->ngpio)
generic_handle_irq(irq_find_mapping(gc->irqdomain, generic_handle_irq(irq_find_mapping(gc->irq.domain,
offset)); offset));
chained_irq_exit(irqchip, desc); chained_irq_exit(irqchip, desc);

View File

@ -242,7 +242,7 @@ static void ingenic_gpio_irq_handler(struct irq_desc *desc)
flag = gpio_ingenic_read_reg(jzgc, JZ4740_GPIO_FLAG); flag = gpio_ingenic_read_reg(jzgc, JZ4740_GPIO_FLAG);
for_each_set_bit(i, &flag, 32) for_each_set_bit(i, &flag, 32)
generic_handle_irq(irq_linear_revmap(gc->irqdomain, i)); generic_handle_irq(irq_linear_revmap(gc->irq.domain, i));
chained_irq_exit(irq_chip, desc); chained_irq_exit(irq_chip, desc);
} }

View File

@ -295,7 +295,7 @@ static void intel_mid_irq_handler(struct irq_desc *desc)
mask = BIT(gpio); mask = BIT(gpio);
/* Clear before handling so we can't lose an edge */ /* Clear before handling so we can't lose an edge */
writel(mask, gedr); writel(mask, gedr);
generic_handle_irq(irq_find_mapping(gc->irqdomain, generic_handle_irq(irq_find_mapping(gc->irq.domain,
base + gpio)); base + gpio));
} }
} }

View File

@ -255,7 +255,7 @@ static void lp_gpio_irq_handler(struct irq_desc *desc)
mask = BIT(pin); mask = BIT(pin);
/* Clear before handling so we don't lose an edge */ /* Clear before handling so we don't lose an edge */
outl(mask, reg); outl(mask, reg);
irq = irq_find_mapping(lg->chip.irqdomain, base + pin); irq = irq_find_mapping(lg->chip.irq.domain, base + pin);
generic_handle_irq(irq); generic_handle_irq(irq);
} }
} }

View File

@ -486,7 +486,7 @@ static irqreturn_t max732x_irq_handler(int irq, void *devid)
do { do {
level = __ffs(pending); level = __ffs(pending);
handle_nested_irq(irq_find_mapping(chip->gpio_chip.irqdomain, handle_nested_irq(irq_find_mapping(chip->gpio_chip.irq.domain,
level)); level));
pending &= ~(1 << level); pending &= ~(1 << level);

View File

@ -357,7 +357,7 @@ static void mrfld_irq_handler(struct irq_desc *desc)
for_each_set_bit(gpio, &pending, 32) { for_each_set_bit(gpio, &pending, 32) {
unsigned int irq; unsigned int irq;
irq = irq_find_mapping(gc->irqdomain, base + gpio); irq = irq_find_mapping(gc->irq.domain, base + gpio);
generic_handle_irq(irq); generic_handle_irq(irq);
} }
} }

View File

@ -733,7 +733,7 @@ static irqreturn_t omap_gpio_irq_handler(int irq, void *gpiobank)
raw_spin_lock_irqsave(&bank->wa_lock, wa_lock_flags); raw_spin_lock_irqsave(&bank->wa_lock, wa_lock_flags);
generic_handle_irq(irq_find_mapping(bank->chip.irqdomain, generic_handle_irq(irq_find_mapping(bank->chip.irq.domain,
bit)); bit));
raw_spin_unlock_irqrestore(&bank->wa_lock, raw_spin_unlock_irqrestore(&bank->wa_lock,

View File

@ -608,7 +608,7 @@ static irqreturn_t pca953x_irq_handler(int irq, void *devid)
for (i = 0; i < NBANK(chip); i++) { for (i = 0; i < NBANK(chip); i++) {
while (pending[i]) { while (pending[i]) {
level = __ffs(pending[i]); level = __ffs(pending[i]);
handle_nested_irq(irq_find_mapping(chip->gpio_chip.irqdomain, handle_nested_irq(irq_find_mapping(chip->gpio_chip.irq.domain,
level + (BANK_SZ * i))); level + (BANK_SZ * i)));
pending[i] &= ~(1 << level); pending[i] &= ~(1 << level);
nhandled++; nhandled++;

View File

@ -196,7 +196,7 @@ static irqreturn_t pcf857x_irq(int irq, void *data)
mutex_unlock(&gpio->lock); mutex_unlock(&gpio->lock);
for_each_set_bit(i, &change, gpio->chip.ngpio) for_each_set_bit(i, &change, gpio->chip.ngpio)
handle_nested_irq(irq_find_mapping(gpio->chip.irqdomain, i)); handle_nested_irq(irq_find_mapping(gpio->chip.irq.domain, i));
return IRQ_HANDLED; return IRQ_HANDLED;
} }

View File

@ -240,7 +240,7 @@ static irqreturn_t idio_16_irq_handler(int irq, void *dev_id)
return IRQ_NONE; return IRQ_NONE;
for_each_set_bit(gpio, &idio16gpio->irq_mask, chip->ngpio) for_each_set_bit(gpio, &idio16gpio->irq_mask, chip->ngpio)
generic_handle_irq(irq_find_mapping(chip->irqdomain, gpio)); generic_handle_irq(irq_find_mapping(chip->irq.domain, gpio));
raw_spin_lock(&idio16gpio->lock); raw_spin_lock(&idio16gpio->lock);

View File

@ -221,7 +221,7 @@ static void pl061_irq_handler(struct irq_desc *desc)
pending = readb(pl061->base + GPIOMIS); pending = readb(pl061->base + GPIOMIS);
if (pending) { if (pending) {
for_each_set_bit(offset, &pending, PL061_GPIO_NR) for_each_set_bit(offset, &pending, PL061_GPIO_NR)
generic_handle_irq(irq_find_mapping(gc->irqdomain, generic_handle_irq(irq_find_mapping(gc->irq.domain,
offset)); offset));
} }

View File

@ -207,7 +207,7 @@ static irqreturn_t gpio_rcar_irq_handler(int irq, void *dev_id)
gpio_rcar_read(p, INTMSK))) { gpio_rcar_read(p, INTMSK))) {
offset = __ffs(pending); offset = __ffs(pending);
gpio_rcar_write(p, INTCLR, BIT(offset)); gpio_rcar_write(p, INTCLR, BIT(offset));
generic_handle_irq(irq_find_mapping(p->gpio_chip.irqdomain, generic_handle_irq(irq_find_mapping(p->gpio_chip.irq.domain,
offset)); offset));
irqs_handled++; irqs_handled++;
} }

View File

@ -103,8 +103,8 @@ static int gpio_reg_to_irq(struct gpio_chip *gc, unsigned offset)
struct gpio_reg *r = to_gpio_reg(gc); struct gpio_reg *r = to_gpio_reg(gc);
int irq = r->irqs[offset]; int irq = r->irqs[offset];
if (irq >= 0 && r->irqdomain) if (irq >= 0 && r->irq.domain)
irq = irq_find_mapping(r->irqdomain, irq); irq = irq_find_mapping(r->irq.domain, irq);
return irq; return irq;
} }

View File

@ -397,7 +397,7 @@ static irqreturn_t stmpe_gpio_irq(int irq, void *dev)
while (stat) { while (stat) {
int bit = __ffs(stat); int bit = __ffs(stat);
int line = bank * 8 + bit; int line = bank * 8 + bit;
int child_irq = irq_find_mapping(stmpe_gpio->chip.irqdomain, int child_irq = irq_find_mapping(stmpe_gpio->chip.irq.domain,
line); line);
handle_nested_irq(child_irq); handle_nested_irq(child_irq);

View File

@ -268,7 +268,7 @@ static irqreturn_t tc3589x_gpio_irq(int irq, void *dev)
while (stat) { while (stat) {
int bit = __ffs(stat); int bit = __ffs(stat);
int line = i * 8 + bit; int line = i * 8 + bit;
int irq = irq_find_mapping(tc3589x_gpio->chip.irqdomain, int irq = irq_find_mapping(tc3589x_gpio->chip.irq.domain,
line); line);
handle_nested_irq(irq); handle_nested_irq(irq);

View File

@ -160,7 +160,7 @@ static void vf610_gpio_irq_handler(struct irq_desc *desc)
for_each_set_bit(pin, &irq_isfr, VF610_GPIO_PER_PORT) { for_each_set_bit(pin, &irq_isfr, VF610_GPIO_PER_PORT) {
vf610_gpio_writel(BIT(pin), port->base + PORT_ISFR); vf610_gpio_writel(BIT(pin), port->base + PORT_ISFR);
generic_handle_irq(irq_find_mapping(port->gc.irqdomain, pin)); generic_handle_irq(irq_find_mapping(port->gc.irq.domain, pin));
} }
chained_irq_exit(chip, desc); chained_irq_exit(chip, desc);

View File

@ -350,7 +350,7 @@ static irqreturn_t wcove_gpio_irq_handler(int irq, void *data)
offset = (gpio > GROUP0_NR_IRQS) ? 1 : 0; offset = (gpio > GROUP0_NR_IRQS) ? 1 : 0;
mask = (offset == 1) ? BIT(gpio - GROUP0_NR_IRQS) : mask = (offset == 1) ? BIT(gpio - GROUP0_NR_IRQS) :
BIT(gpio); BIT(gpio);
virq = irq_find_mapping(wg->chip.irqdomain, gpio); virq = irq_find_mapping(wg->chip.irq.domain, gpio);
handle_nested_irq(virq); handle_nested_irq(virq);
regmap_update_bits(wg->regmap, IRQ_STATUS_BASE + offset, regmap_update_bits(wg->regmap, IRQ_STATUS_BASE + offset,
mask, mask); mask, mask);

View File

@ -332,7 +332,7 @@ static irqreturn_t ws16c48_irq_handler(int irq, void *dev_id)
int_id = inb(ws16c48gpio->base + 8 + port); int_id = inb(ws16c48gpio->base + 8 + port);
for_each_set_bit(gpio, &int_id, 8) for_each_set_bit(gpio, &int_id, 8)
generic_handle_irq(irq_find_mapping( generic_handle_irq(irq_find_mapping(
chip->irqdomain, gpio + 8*port)); chip->irq.domain, gpio + 8*port));
} }
int_pending = inb(ws16c48gpio->base + 6) & 0x7; int_pending = inb(ws16c48gpio->base + 6) & 0x7;

View File

@ -287,7 +287,7 @@ static int xgene_gpio_sb_probe(struct platform_device *pdev)
if (!priv->irq_domain) if (!priv->irq_domain)
return -ENODEV; return -ENODEV;
priv->gc.irqdomain = priv->irq_domain; priv->gc.irq.domain = priv->irq_domain;
ret = devm_gpiochip_add_data(&pdev->dev, &priv->gc, priv); ret = devm_gpiochip_add_data(&pdev->dev, &priv->gc, priv);
if (ret) { if (ret) {

View File

@ -225,7 +225,7 @@ static void xlp_gpio_generic_handler(struct irq_desc *desc)
if (gpio_stat & BIT(gpio % XLP_GPIO_REGSZ)) if (gpio_stat & BIT(gpio % XLP_GPIO_REGSZ))
generic_handle_irq(irq_find_mapping( generic_handle_irq(irq_find_mapping(
priv->chip.irqdomain, gpio)); priv->chip.irq.domain, gpio));
} }
chained_irq_exit(irqchip, desc); chained_irq_exit(irqchip, desc);
} }

View File

@ -170,7 +170,7 @@ static void zx_irq_handler(struct irq_desc *desc)
writew_relaxed(pending, chip->base + ZX_GPIO_IC); writew_relaxed(pending, chip->base + ZX_GPIO_IC);
if (pending) { if (pending) {
for_each_set_bit(offset, &pending, ZX_GPIO_NR) for_each_set_bit(offset, &pending, ZX_GPIO_NR)
generic_handle_irq(irq_find_mapping(gc->irqdomain, generic_handle_irq(irq_find_mapping(gc->irq.domain,
offset)); offset));
} }

View File

@ -562,7 +562,7 @@ static void zynq_gpio_handle_bank_irq(struct zynq_gpio *gpio,
unsigned long pending) unsigned long pending)
{ {
unsigned int bank_offset = gpio->p_data->bank_min[bank_num]; unsigned int bank_offset = gpio->p_data->bank_min[bank_num];
struct irq_domain *irqdomain = gpio->chip.irqdomain; struct irq_domain *irqdomain = gpio->chip.irq.domain;
int offset; int offset;
if (!pending) if (!pending)

View File

@ -1550,7 +1550,7 @@ static void gpiochip_set_cascaded_irqchip(struct gpio_chip *gpiochip,
{ {
unsigned int offset; unsigned int offset;
if (!gpiochip->irqdomain) { if (!gpiochip->irq.domain) {
chip_err(gpiochip, "called %s before setting up irqchip\n", chip_err(gpiochip, "called %s before setting up irqchip\n",
__func__); __func__);
return; return;
@ -1577,7 +1577,7 @@ static void gpiochip_set_cascaded_irqchip(struct gpio_chip *gpiochip,
for (offset = 0; offset < gpiochip->ngpio; offset++) { for (offset = 0; offset < gpiochip->ngpio; offset++) {
if (!gpiochip_irqchip_irq_valid(gpiochip, offset)) if (!gpiochip_irqchip_irq_valid(gpiochip, offset))
continue; continue;
irq_set_parent(irq_find_mapping(gpiochip->irqdomain, offset), irq_set_parent(irq_find_mapping(gpiochip->irq.domain, offset),
parent_irq); parent_irq);
} }
} }
@ -1708,7 +1708,7 @@ static int gpiochip_to_irq(struct gpio_chip *chip, unsigned offset)
{ {
if (!gpiochip_irqchip_irq_valid(chip, offset)) if (!gpiochip_irqchip_irq_valid(chip, offset))
return -ENXIO; return -ENXIO;
return irq_create_mapping(chip->irqdomain, offset); return irq_create_mapping(chip->irq.domain, offset);
} }
/** /**
@ -1719,7 +1719,7 @@ static int gpiochip_to_irq(struct gpio_chip *chip, unsigned offset)
*/ */
static void gpiochip_irqchip_remove(struct gpio_chip *gpiochip) static void gpiochip_irqchip_remove(struct gpio_chip *gpiochip)
{ {
unsigned int offset; unsigned int offset, irq;
acpi_gpiochip_free_interrupts(gpiochip); acpi_gpiochip_free_interrupts(gpiochip);
@ -1729,14 +1729,16 @@ static void gpiochip_irqchip_remove(struct gpio_chip *gpiochip)
} }
/* Remove all IRQ mappings and delete the domain */ /* Remove all IRQ mappings and delete the domain */
if (gpiochip->irqdomain) { if (gpiochip->irq.domain) {
for (offset = 0; offset < gpiochip->ngpio; offset++) { for (offset = 0; offset < gpiochip->ngpio; offset++) {
if (!gpiochip_irqchip_irq_valid(gpiochip, offset)) if (!gpiochip_irqchip_irq_valid(gpiochip, offset))
continue; continue;
irq_dispose_mapping(
irq_find_mapping(gpiochip->irqdomain, offset)); irq = irq_find_mapping(gpiochip->irq.domain, offset);
irq_dispose_mapping(irq);
} }
irq_domain_remove(gpiochip->irqdomain);
irq_domain_remove(gpiochip->irq.domain);
} }
if (gpiochip->irq.chip) { if (gpiochip->irq.chip) {
@ -1822,10 +1824,10 @@ int gpiochip_irqchip_add_key(struct gpio_chip *gpiochip,
gpiochip->irq_default_type = type; gpiochip->irq_default_type = type;
gpiochip->to_irq = gpiochip_to_irq; gpiochip->to_irq = gpiochip_to_irq;
gpiochip->lock_key = lock_key; gpiochip->lock_key = lock_key;
gpiochip->irqdomain = irq_domain_add_simple(of_node, gpiochip->irq.domain = irq_domain_add_simple(of_node,
gpiochip->ngpio, first_irq, gpiochip->ngpio, first_irq,
&gpiochip_domain_ops, gpiochip); &gpiochip_domain_ops, gpiochip);
if (!gpiochip->irqdomain) { if (!gpiochip->irq.domain) {
gpiochip->irq.chip = NULL; gpiochip->irq.chip = NULL;
return -EINVAL; return -EINVAL;
} }

View File

@ -383,7 +383,7 @@ static void bcm2835_gpio_irq_handle_bank(struct bcm2835_pinctrl *pc,
/* FIXME: no clue why the code looks up the type here */ /* FIXME: no clue why the code looks up the type here */
type = pc->irq_type[gpio]; type = pc->irq_type[gpio];
generic_handle_irq(irq_linear_revmap(pc->gpio_chip.irqdomain, generic_handle_irq(irq_linear_revmap(pc->gpio_chip.irq.irqdomain,
gpio)); gpio));
} }
} }
@ -665,7 +665,7 @@ static void bcm2835_pctl_pin_dbg_show(struct pinctrl_dev *pctldev,
enum bcm2835_fsel fsel = bcm2835_pinctrl_fsel_get(pc, offset); enum bcm2835_fsel fsel = bcm2835_pinctrl_fsel_get(pc, offset);
const char *fname = bcm2835_functions[fsel]; const char *fname = bcm2835_functions[fsel];
int value = bcm2835_gpio_get_bit(pc, GPLEV0, offset); int value = bcm2835_gpio_get_bit(pc, GPLEV0, offset);
int irq = irq_find_mapping(chip->irqdomain, offset); int irq = irq_find_mapping(chip->irq.domain, offset);
seq_printf(s, "function %s in %s; irq %d (%s)", seq_printf(s, "function %s in %s; irq %d (%s)",
fname, value ? "hi" : "lo", fname, value ? "hi" : "lo",

View File

@ -172,7 +172,7 @@ static void iproc_gpio_irq_handler(struct irq_desc *desc)
for_each_set_bit(bit, &val, NGPIOS_PER_BANK) { for_each_set_bit(bit, &val, NGPIOS_PER_BANK) {
unsigned pin = NGPIOS_PER_BANK * i + bit; unsigned pin = NGPIOS_PER_BANK * i + bit;
int child_irq = irq_find_mapping(gc->irqdomain, pin); int child_irq = irq_find_mapping(gc->irq.domain, pin);
/* /*
* Clear the interrupt before invoking the * Clear the interrupt before invoking the

View File

@ -1627,7 +1627,7 @@ static void byt_gpio_irq_handler(struct irq_desc *desc)
pending = readl(reg); pending = readl(reg);
raw_spin_unlock(&vg->lock); raw_spin_unlock(&vg->lock);
for_each_set_bit(pin, &pending, 32) { for_each_set_bit(pin, &pending, 32) {
virq = irq_find_mapping(vg->chip.irqdomain, base + pin); virq = irq_find_mapping(vg->chip.irq.domain, base + pin);
generic_handle_irq(virq); generic_handle_irq(virq);
} }
} }

View File

@ -1523,7 +1523,7 @@ static void chv_gpio_irq_handler(struct irq_desc *desc)
unsigned irq, offset; unsigned irq, offset;
offset = pctrl->intr_lines[intr_line]; offset = pctrl->intr_lines[intr_line];
irq = irq_find_mapping(gc->irqdomain, offset); irq = irq_find_mapping(gc->irq.domain, offset);
generic_handle_irq(irq); generic_handle_irq(irq);
} }

View File

@ -1005,7 +1005,7 @@ static irqreturn_t intel_gpio_community_irq_handler(struct intel_pinctrl *pctrl,
if (padno >= community->npins) if (padno >= community->npins)
break; break;
irq = irq_find_mapping(gc->irqdomain, irq = irq_find_mapping(gc->irq.domain,
community->pin_base + padno); community->pin_base + padno);
generic_handle_irq(irq); generic_handle_irq(irq);

View File

@ -592,7 +592,7 @@ static void armada_37xx_irq_handler(struct irq_desc *desc)
struct gpio_chip *gc = irq_desc_get_handler_data(desc); struct gpio_chip *gc = irq_desc_get_handler_data(desc);
struct irq_chip *chip = irq_desc_get_chip(desc); struct irq_chip *chip = irq_desc_get_chip(desc);
struct armada_37xx_pinctrl *info = gpiochip_get_data(gc); struct armada_37xx_pinctrl *info = gpiochip_get_data(gc);
struct irq_domain *d = gc->irqdomain; struct irq_domain *d = gc->irq.domain;
int i; int i;
chained_irq_enter(chip, desc); chained_irq_enter(chip, desc);

View File

@ -413,7 +413,7 @@ nmk_gpio_disable_lazy_irq(struct nmk_gpio_chip *nmk_chip, unsigned offset)
u32 falling = nmk_chip->fimsc & BIT(offset); u32 falling = nmk_chip->fimsc & BIT(offset);
u32 rising = nmk_chip->rimsc & BIT(offset); u32 rising = nmk_chip->rimsc & BIT(offset);
int gpio = nmk_chip->chip.base + offset; int gpio = nmk_chip->chip.base + offset;
int irq = irq_find_mapping(nmk_chip->chip.irqdomain, offset); int irq = irq_find_mapping(nmk_chip->chip.irq.domain, offset);
struct irq_data *d = irq_get_irq_data(irq); struct irq_data *d = irq_get_irq_data(irq);
if (!rising && !falling) if (!rising && !falling)
@ -815,7 +815,7 @@ static void __nmk_gpio_irq_handler(struct irq_desc *desc, u32 status)
while (status) { while (status) {
int bit = __ffs(status); int bit = __ffs(status);
generic_handle_irq(irq_find_mapping(chip->irqdomain, bit)); generic_handle_irq(irq_find_mapping(chip->irq.domain, bit));
status &= ~BIT(bit); status &= ~BIT(bit);
} }

View File

@ -532,7 +532,7 @@ static irqreturn_t amd_gpio_irq_handler(int irq, void *dev_id)
regval = readl(regs + i); regval = readl(regs + i);
if (!(regval & PIN_IRQ_PENDING)) if (!(regval & PIN_IRQ_PENDING))
continue; continue;
irq = irq_find_mapping(gc->irqdomain, irqnr + i); irq = irq_find_mapping(gc->irq.domain, irqnr + i);
generic_handle_irq(irq); generic_handle_irq(irq);
/* Clear interrupt */ /* Clear interrupt */
writel(regval, regs + i); writel(regval, regs + i);

View File

@ -1603,7 +1603,7 @@ static void gpio_irq_handler(struct irq_desc *desc)
for_each_set_bit(n, &isr, BITS_PER_LONG) { for_each_set_bit(n, &isr, BITS_PER_LONG) {
generic_handle_irq(irq_find_mapping( generic_handle_irq(irq_find_mapping(
gpio_chip->irqdomain, n)); gpio_chip->irq.domain, n));
} }
} }
chained_irq_exit(chip, desc); chained_irq_exit(chip, desc);

View File

@ -517,7 +517,7 @@ static void u300_gpio_irq_handler(struct irq_desc *desc)
for_each_set_bit(irqoffset, &val, U300_GPIO_PINS_PER_PORT) { for_each_set_bit(irqoffset, &val, U300_GPIO_PINS_PER_PORT) {
int offset = pinoffset + irqoffset; int offset = pinoffset + irqoffset;
int pin_irq = irq_find_mapping(chip->irqdomain, offset); int pin_irq = irq_find_mapping(chip->irq.domain, offset);
dev_dbg(gpio->dev, "GPIO IRQ %d on pin %d\n", dev_dbg(gpio->dev, "GPIO IRQ %d on pin %d\n",
pin_irq, offset); pin_irq, offset);

View File

@ -537,7 +537,7 @@ static irqreturn_t mcp23s08_irq(int irq, void *data)
((gpio_bit_changed || intcap_changed) && ((gpio_bit_changed || intcap_changed) &&
(BIT(i) & mcp->irq_fall) && !gpio_set) || (BIT(i) & mcp->irq_fall) && !gpio_set) ||
defval_changed) { defval_changed) {
child_irq = irq_find_mapping(mcp->chip.irqdomain, i); child_irq = irq_find_mapping(mcp->chip.irq.domain, i);
handle_nested_irq(child_irq); handle_nested_irq(child_irq);
} }
} }

View File

@ -1064,7 +1064,7 @@ static void oxnas_gpio_irq_handler(struct irq_desc *desc)
stat = readl(bank->reg_base + IRQ_PENDING); stat = readl(bank->reg_base + IRQ_PENDING);
for_each_set_bit(pin, &stat, BITS_PER_LONG) for_each_set_bit(pin, &stat, BITS_PER_LONG)
generic_handle_irq(irq_linear_revmap(gc->irqdomain, pin)); generic_handle_irq(irq_linear_revmap(gc->irq.domain, pin));
chained_irq_exit(chip, desc); chained_irq_exit(chip, desc);
} }

View File

@ -2106,7 +2106,7 @@ static void pic32_gpio_irq_handler(struct irq_desc *desc)
pending = pic32_gpio_get_pending(gc, stat); pending = pic32_gpio_get_pending(gc, stat);
for_each_set_bit(pin, &pending, BITS_PER_LONG) for_each_set_bit(pin, &pending, BITS_PER_LONG)
generic_handle_irq(irq_linear_revmap(gc->irqdomain, pin)); generic_handle_irq(irq_linear_revmap(gc->irq.domain, pin));
chained_irq_exit(chip, desc); chained_irq_exit(chip, desc);
} }

View File

@ -1307,7 +1307,7 @@ static void pistachio_gpio_irq_handler(struct irq_desc *desc)
pending = gpio_readl(bank, GPIO_INTERRUPT_STATUS) & pending = gpio_readl(bank, GPIO_INTERRUPT_STATUS) &
gpio_readl(bank, GPIO_INTERRUPT_EN); gpio_readl(bank, GPIO_INTERRUPT_EN);
for_each_set_bit(pin, &pending, 16) for_each_set_bit(pin, &pending, 16)
generic_handle_irq(irq_linear_revmap(gc->irqdomain, pin)); generic_handle_irq(irq_linear_revmap(gc->irq.domain, pin));
chained_irq_exit(chip, desc); chained_irq_exit(chip, desc);
} }

View File

@ -1408,7 +1408,7 @@ static void __gpio_irq_handler(struct st_gpio_bank *bank)
continue; continue;
} }
generic_handle_irq(irq_find_mapping(bank->gpio_chip.irqdomain, n)); generic_handle_irq(irq_find_mapping(bank->gpio_chip.irq.domain, n));
} }
} }
} }

View File

@ -561,7 +561,7 @@ static irqreturn_t sx150x_irq_thread_fn(int irq, void *dev_id)
status = val; status = val;
for_each_set_bit(n, &status, pctl->data->ngpios) for_each_set_bit(n, &status, pctl->data->ngpios)
handle_nested_irq(irq_find_mapping(pctl->gpio.irqdomain, n)); handle_nested_irq(irq_find_mapping(pctl->gpio.irq.domain, n));
return IRQ_HANDLED; return IRQ_HANDLED;
} }

View File

@ -795,7 +795,7 @@ static void msm_gpio_irq_handler(struct irq_desc *desc)
g = &pctrl->soc->groups[i]; g = &pctrl->soc->groups[i];
val = readl(pctrl->regs + g->intr_status_reg); val = readl(pctrl->regs + g->intr_status_reg);
if (val & BIT(g->intr_status_bit)) { if (val & BIT(g->intr_status_bit)) {
irq_pin = irq_find_mapping(gc->irqdomain, i); irq_pin = irq_find_mapping(gc->irq.domain, i);
generic_handle_irq(irq_pin); generic_handle_irq(irq_pin);
handled++; handled++;
} }

View File

@ -5820,7 +5820,7 @@ static void atlas7_gpio_handle_irq(struct irq_desc *desc)
__func__, gc->label, __func__, gc->label,
bank->gpio_offset + pin_in_bank); bank->gpio_offset + pin_in_bank);
generic_handle_irq( generic_handle_irq(
irq_find_mapping(gc->irqdomain, irq_find_mapping(gc->irq.domain,
bank->gpio_offset + pin_in_bank)); bank->gpio_offset + pin_in_bank));
} }

View File

@ -587,7 +587,7 @@ static void sirfsoc_gpio_handle_irq(struct irq_desc *desc)
if ((status & 0x1) && (ctrl & SIRFSOC_GPIO_CTL_INTR_EN_MASK)) { if ((status & 0x1) && (ctrl & SIRFSOC_GPIO_CTL_INTR_EN_MASK)) {
pr_debug("%s: gpio id %d idx %d happens\n", pr_debug("%s: gpio id %d idx %d happens\n",
__func__, bank->id, idx); __func__, bank->id, idx);
generic_handle_irq(irq_find_mapping(gc->irqdomain, idx + generic_handle_irq(irq_find_mapping(gc->irq.domain, idx +
bank->id * SIRFSOC_GPIO_BANK_SIZE)); bank->id * SIRFSOC_GPIO_BANK_SIZE));
} }

View File

@ -401,7 +401,7 @@ static void plgpio_irq_handler(struct irq_desc *desc)
/* get correct irq line number */ /* get correct irq line number */
pin = i * MAX_GPIO_PER_REG + pin; pin = i * MAX_GPIO_PER_REG + pin;
generic_handle_irq( generic_handle_irq(
irq_find_mapping(gc->irqdomain, pin)); irq_find_mapping(gc->irq.domain, pin));
} }
} }
chained_irq_exit(irqchip, desc); chained_irq_exit(irqchip, desc);

View File

@ -119,7 +119,7 @@ static irqreturn_t int0002_irq(int irq, void *data)
if (!(gpe_sts_reg & GPE0A_PME_B0_STS_BIT)) if (!(gpe_sts_reg & GPE0A_PME_B0_STS_BIT))
return IRQ_NONE; return IRQ_NONE;
generic_handle_irq(irq_find_mapping(chip->irqdomain, generic_handle_irq(irq_find_mapping(chip->irq.domain,
GPE0A_PME_B0_VIRT_GPIO_PIN)); GPE0A_PME_B0_VIRT_GPIO_PIN));
pm_system_wakeup(); pm_system_wakeup();

View File

@ -31,6 +31,14 @@ struct gpio_irq_chip {
*/ */
struct irq_chip *chip; struct irq_chip *chip;
/**
* @domain:
*
* Interrupt translation domain; responsible for mapping between GPIO
* hwirq number and Linux IRQ number.
*/
struct irq_domain *domain;
/** /**
* @domain_ops: * @domain_ops:
* *
@ -124,8 +132,6 @@ static inline struct gpio_irq_chip *to_gpio_irq_chip(struct irq_chip *chip)
* safely. * safely.
* @bgpio_dir: shadowed direction register for generic GPIO to clear/set * @bgpio_dir: shadowed direction register for generic GPIO to clear/set
* direction safely. * direction safely.
* @irqdomain: Interrupt translation domain; responsible for mapping
* between GPIO hwirq number and linux irq number
* @irq_handler: the irq handler to use (often a predefined irq core function) * @irq_handler: the irq handler to use (often a predefined irq core function)
* for GPIO IRQs, provided by GPIO driver * for GPIO IRQs, provided by GPIO driver
* @irq_default_type: default IRQ triggering type applied during GPIO driver * @irq_default_type: default IRQ triggering type applied during GPIO driver
@ -208,7 +214,6 @@ struct gpio_chip {
* With CONFIG_GPIOLIB_IRQCHIP we get an irqchip inside the gpiolib * With CONFIG_GPIOLIB_IRQCHIP we get an irqchip inside the gpiolib
* to handle IRQs for most practical cases. * to handle IRQs for most practical cases.
*/ */
struct irq_domain *irqdomain;
irq_flow_handler_t irq_handler; irq_flow_handler_t irq_handler;
unsigned int irq_default_type; unsigned int irq_default_type;
unsigned int irq_chained_parent; unsigned int irq_chained_parent;