From: Hans de Goede <hdegoede@redhat.com>
To: Mika Westerberg <mika.westerberg@linux.intel.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Bartosz Golaszewski <bgolaszewski@baylibre.com>,
Linus Walleij <linus.walleij@linaro.org>
Cc: Hans de Goede <hdegoede@redhat.com>,
linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org
Subject: [PATCH 3/3] pinctrl: cherryview: Pass irqchip when adding gpiochip
Date: Wed, 6 Nov 2019 13:09:56 +0100 [thread overview]
Message-ID: <20191106120956.119958-4-hdegoede@redhat.com> (raw)
In-Reply-To: <20191106120956.119958-1-hdegoede@redhat.com>
We need to convert all old gpio irqchips to pass the irqchip
setup along when adding the gpio_chip. For more info see
drivers/gpio/TODO.
For chained irqchips this is a pretty straight-forward conversion.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/pinctrl/intel/pinctrl-cherryview.c | 41 +++++++++++-----------
1 file changed, 20 insertions(+), 21 deletions(-)
diff --git a/drivers/pinctrl/intel/pinctrl-cherryview.c b/drivers/pinctrl/intel/pinctrl-cherryview.c
index 38b359db6013..1f9751ae0ed0 100644
--- a/drivers/pinctrl/intel/pinctrl-cherryview.c
+++ b/drivers/pinctrl/intel/pinctrl-cherryview.c
@@ -166,6 +166,7 @@ struct chv_pinctrl {
struct irq_chip irqchip;
void __iomem *regs;
bool need_valid_mask;
+ unsigned int irq;
unsigned intr_lines[16];
const struct chv_community *community;
u32 saved_intmask;
@@ -1619,16 +1620,25 @@ static int chv_gpio_probe(struct chv_pinctrl *pctrl, int irq)
chip->add_pin_ranges = chv_gpio_add_pin_ranges;
chip->parent = pctrl->dev;
chip->base = -1;
- if (pctrl->need_valid_mask)
- chip->irq.init_valid_mask = chv_init_irq_valid_mask;
- ret = devm_gpiochip_add_data(pctrl->dev, chip, pctrl);
- if (ret) {
- dev_err(pctrl->dev, "Failed to register gpiochip\n");
- return ret;
- }
+ pctrl->irq = irq;
+ pctrl->irqchip.name = "chv-gpio";
+ pctrl->irqchip.irq_startup = chv_gpio_irq_startup;
+ pctrl->irqchip.irq_ack = chv_gpio_irq_ack;
+ pctrl->irqchip.irq_mask = chv_gpio_irq_mask;
+ pctrl->irqchip.irq_unmask = chv_gpio_irq_unmask;
+ pctrl->irqchip.irq_set_type = chv_gpio_irq_type;
+ pctrl->irqchip.flags = IRQCHIP_SKIP_SET_WAKE;
- chv_gpio_irq_init_hw(chip);
+ chip->irq.chip = &pctrl->irqchip;
+ if (pctrl->need_valid_mask)
+ chip->irq.init_valid_mask = chv_init_irq_valid_mask;
+ chip->irq.init_hw = chv_gpio_irq_init_hw;
+ chip->irq.parent_handler = chv_gpio_irq_handler;
+ chip->irq.num_parents = 1;
+ chip->irq.parents = &pctrl->irq;
+ chip->irq.default_type = IRQ_TYPE_NONE;
+ chip->irq.handler = handle_bad_irq;
if (!pctrl->need_valid_mask) {
irq_base = devm_irq_alloc_descs(pctrl->dev, -1, 0,
@@ -1639,18 +1649,9 @@ static int chv_gpio_probe(struct chv_pinctrl *pctrl, int irq)
}
}
- pctrl->irqchip.name = "chv-gpio";
- pctrl->irqchip.irq_startup = chv_gpio_irq_startup;
- pctrl->irqchip.irq_ack = chv_gpio_irq_ack;
- pctrl->irqchip.irq_mask = chv_gpio_irq_mask;
- pctrl->irqchip.irq_unmask = chv_gpio_irq_unmask;
- pctrl->irqchip.irq_set_type = chv_gpio_irq_type;
- pctrl->irqchip.flags = IRQCHIP_SKIP_SET_WAKE;
-
- ret = gpiochip_irqchip_add(chip, &pctrl->irqchip, 0,
- handle_bad_irq, IRQ_TYPE_NONE);
+ ret = devm_gpiochip_add_data(pctrl->dev, chip, pctrl);
if (ret) {
- dev_err(pctrl->dev, "failed to add IRQ chip\n");
+ dev_err(pctrl->dev, "Failed to register gpiochip\n");
return ret;
}
@@ -1664,8 +1665,6 @@ static int chv_gpio_probe(struct chv_pinctrl *pctrl, int irq)
}
}
- gpiochip_set_chained_irqchip(chip, &pctrl->irqchip, irq,
- chv_gpio_irq_handler);
return 0;
}
--
2.23.0
next prev parent reply other threads:[~2019-11-06 12:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-06 12:09 [PATCH 0/3] pinctrl: cherryview: Pass irqchip when adding gpiochip Hans de Goede
2019-11-06 12:09 ` [PATCH 1/3] pinctrl: cherryview: Split out irq hw-init into a separate helper function Hans de Goede
2019-11-06 14:04 ` Mika Westerberg
2019-11-06 12:09 ` [PATCH 2/3] pinctrl: cherryview: Add GPIO <-> pin mapping ranges via callback Hans de Goede
2019-11-06 12:09 ` Hans de Goede [this message]
2019-11-06 14:05 ` [PATCH 3/3] pinctrl: cherryview: Pass irqchip when adding gpiochip Mika Westerberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191106120956.119958-4-hdegoede@redhat.com \
--to=hdegoede@redhat.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bgolaszewski@baylibre.com \
--cc=linus.walleij@linaro.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).