From: Michael Walle <mwalle@kernel.org>
To: William Breathitt Gray <wbg@kernel.org>,
Linus Walleij <linusw@kernel.org>,
Bartosz Golaszewski <brgl@kernel.org>,
Petar Stepanovic <pstepanovic@axiado.com>,
SriNavmani A <srinavmani@axiado.com>,
Prasad Bolisetty <pbolisetty@axiado.com>,
Tzu-Hao Wei <twei@axiado.com>,
Karthikeyan Mitran <kmitran@axiado.com>,
Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>,
Michael Walle <mwalle@kernel.org>, Lee Jones <lee@kernel.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Long Zhao <longzhao@ambarella.com>,
Joseph Telaak <joseph@telaak.dev>
Cc: linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: [RFT PATCH v2 13/14] gpio: i8255: create the regmap-irq chip from the gpio-regmap callback
Date: Fri, 27 Nov 2026 15:52:30 +0100 [thread overview]
Message-ID: <20261127145232.814492-14-mwalle@kernel.org> (raw)
In-Reply-To: <20261127145232.814492-1-mwalle@kernel.org>
Use the new gpio_regmap_add_irq_chip_nolock() helper to create the
regmap-irq domain. Use the _nolock() variant because the hwirq don't
match the GPIO offsets.
Signed-off-by: Michael Walle <mwalle@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/gpio/gpio-104-dio-48e.c | 31 +++++++++++++++++++++++--------
drivers/gpio/gpio-i8255.c | 3 ++-
drivers/gpio/gpio-i8255.h | 8 ++++++--
3 files changed, 31 insertions(+), 11 deletions(-)
diff --git a/drivers/gpio/gpio-104-dio-48e.c b/drivers/gpio/gpio-104-dio-48e.c
index 7ddf578ba530..27a3f94c6e79 100644
--- a/drivers/gpio/gpio-104-dio-48e.c
+++ b/drivers/gpio/gpio-104-dio-48e.c
@@ -9,6 +9,7 @@
#include <linux/bits.h>
#include <linux/device.h>
#include <linux/err.h>
+#include <linux/gpio/regmap.h>
#include <linux/i8254.h>
#include <linux/ioport.h>
#include <linux/irq.h>
@@ -113,6 +114,8 @@ static const struct regmap_irq dio48e_regmap_irqs[] = {
* @regs: virtual mapping for device registers
* @flags: IRQ flags saved during locking
* @irq_mask: Current IRQ mask state on the device
+ * @chip: regmap_irq_chip for the device
+ * @irq: Parent IRQ
*/
struct dio48e_gpio {
raw_spinlock_t lock;
@@ -120,6 +123,8 @@ struct dio48e_gpio {
void __iomem *regs;
unsigned long flags;
unsigned int irq_mask;
+ struct regmap_irq_chip *chip;
+ unsigned int irq;
};
static void dio48e_regmap_lock(void *lock_arg) __acquires(&dio48egpio->lock)
@@ -163,7 +168,7 @@ static int dio48e_handle_mask_sync(const int index,
const unsigned int mask_buf,
void *const irq_drv_data)
{
- struct dio48e_gpio *const dio48egpio = irq_drv_data;
+ struct dio48e_gpio *const dio48egpio = gpio_regmap_get_drvdata(irq_drv_data);
const unsigned int prev_mask = dio48egpio->irq_mask;
int err;
unsigned int val;
@@ -218,6 +223,19 @@ static int dio48e_irq_init_hw(struct regmap *const map)
return regmap_read(map, DIO48E_DISABLE_INTERRUPT, &val);
}
+static struct irq_domain *dio48e_create_irq_domain(struct gpio_regmap *gpio)
+{
+ struct dio48e_gpio *const dio48egpio = gpio_regmap_get_drvdata(gpio);
+ struct irq_domain *domain;
+
+ domain = gpio_regmap_add_irq_chip_nolock(gpio, dio48egpio->irq, 0, dio48egpio->chip);
+ if (IS_ERR(domain))
+ return dev_err_cast_probe(regmap_get_device(dio48egpio->map), domain,
+ "IRQ registration failed\n");
+
+ return domain;
+}
+
static int dio48e_probe(struct device *dev, unsigned int id)
{
const char *const name = dev_name(dev);
@@ -230,7 +248,6 @@ static int dio48e_probe(struct device *dev, unsigned int id)
int err;
struct regmap_irq_chip *chip;
struct dio48e_gpio *dio48egpio;
- struct regmap_irq_chip_data *chip_data;
if (!devm_request_region(dev, base[id], DIO48E_EXTENT, name)) {
dev_err(dev, "Unable to lock port addresses (0x%X-0x%X)\n",
@@ -302,17 +319,14 @@ static int dio48e_probe(struct device *dev, unsigned int id)
chip->irqs = dio48e_regmap_irqs;
chip->num_irqs = ARRAY_SIZE(dio48e_regmap_irqs);
chip->handle_mask_sync = dio48e_handle_mask_sync;
- chip->irq_drv_data = dio48egpio;
+ dio48egpio->chip = chip;
+ dio48egpio->irq = irq[id];
/* Initialize to prevent spurious interrupts before we're ready */
err = dio48e_irq_init_hw(map);
if (err)
return err;
- err = devm_regmap_add_irq_chip(dev, map, irq[id], 0, 0, chip, &chip_data);
- if (err)
- return dev_err_probe(dev, err, "IRQ registration failed\n");
-
pit_config.parent = dev;
err = devm_i8254_regmap_register(dev, &pit_config);
@@ -323,7 +337,8 @@ static int dio48e_probe(struct device *dev, unsigned int id)
config.map = map;
config.num_ppi = DIO48E_NUM_PPI;
config.names = dio48e_names;
- config.domain = regmap_irq_get_domain(chip_data);
+ config.drvdata = dio48egpio;
+ config.create_irq_domain = dio48e_create_irq_domain;
return devm_i8255_regmap_register(dev, &config);
}
diff --git a/drivers/gpio/gpio-i8255.c b/drivers/gpio/gpio-i8255.c
index 541a348447cd..8ac46bb2c235 100644
--- a/drivers/gpio/gpio-i8255.c
+++ b/drivers/gpio/gpio-i8255.c
@@ -129,7 +129,8 @@ int devm_i8255_regmap_register(struct device *const dev,
gpio_config.reg_set_base = GPIO_REGMAP_ADDR(I8255_REG_DAT_BASE);
gpio_config.reg_dir_in_base = GPIO_REGMAP_ADDR(I8255_REG_DIR_IN_BASE);
gpio_config.ngpio_per_reg = I8255_NGPIO_PER_REG;
- gpio_config.irq_domain = config->domain;
+ gpio_config.drvdata = config->drvdata;
+ gpio_config.create_irq_domain = config->create_irq_domain;
gpio_config.reg_mask_xlate = i8255_reg_mask_xlate;
return PTR_ERR_OR_ZERO(devm_gpio_regmap_register(dev, &gpio_config));
diff --git a/drivers/gpio/gpio-i8255.h b/drivers/gpio/gpio-i8255.h
index 9dcf639b94df..fa90044c9cd5 100644
--- a/drivers/gpio/gpio-i8255.h
+++ b/drivers/gpio/gpio-i8255.h
@@ -4,6 +4,7 @@
#define _I8255_H_
struct device;
+struct gpio_regmap;
struct irq_domain;
struct regmap;
@@ -15,7 +16,9 @@ struct regmap;
* @map: regmap for the i8255
* @num_ppi: number of i8255 Programmable Peripheral Interface
* @names: (optional) array of names for gpios
- * @domain: (optional) IRQ domain if the controller is interrupt-capable
+ * @drvdata: (optional) driver data, see gpio_regmap_get_drvdata()
+ * @create_irq_domain: (optional) create the IRQ domain if the controller is
+ * interrupt-capable, see struct gpio_regmap_config
*
* Note: The regmap is expected to have cache enabled and i8255 control
* registers not marked as volatile.
@@ -25,7 +28,8 @@ struct i8255_regmap_config {
struct regmap *map;
int num_ppi;
const char *const *names;
- struct irq_domain *domain;
+ void *drvdata;
+ struct irq_domain *(*create_irq_domain)(struct gpio_regmap *gpio);
};
int devm_i8255_regmap_register(struct device *dev,
--
2.47.3
next prev parent reply other threads:[~2026-11-27 14:53 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 14:52 [RFT PATCH v2 00/14] gpio: regmap: IRQ domain cleanups Michael Walle
2026-11-27 14:52 ` [RFT PATCH v2 01/14] gpio: regmap: use the correct number for .ngpio_per_reg Michael Walle
2026-11-27 17:19 ` Andy Shevchenko
2026-11-30 10:21 ` Michael Walle
2026-11-27 14:52 ` [RFT PATCH v2 02/14] gpio: regmap: remove gpiochip before tearing down irqchip Michael Walle
2026-11-27 14:52 ` [RFT PATCH v2 03/14] gpio: regmap: add callbacks to handle IRQ domains Michael Walle
2026-11-27 17:27 ` Andy Shevchenko
2026-11-27 14:52 ` [RFT PATCH v2 04/14] gpio: rtd1625: create the IRQ domain from the gpio-regmap callback Michael Walle
2026-11-27 18:30 ` Andy Shevchenko
2026-11-30 14:37 ` Michael Walle
2026-11-27 14:52 ` [RFT PATCH v2 05/14] gpio: axiado-sgpio: " Michael Walle
2026-11-27 18:35 ` Andy Shevchenko
2026-11-30 14:51 ` Petar Stepanovic
2026-11-27 14:52 ` [RFT PATCH v2 06/14] gpio: regmap: add helpers to add a regmap-irq chip Michael Walle
2026-11-27 18:43 ` Andy Shevchenko
2026-11-30 10:35 ` Michael Walle
2026-11-27 14:52 ` [RFT PATCH v2 07/14] gpio: max7360: create the regmap-irq chip from the gpio-regmap callback Michael Walle
2026-11-27 18:48 ` Andy Shevchenko
2026-11-30 12:58 ` Michael Walle
2026-11-27 14:52 ` [RFT PATCH v2 08/14] gpio: sl28cpld: " Michael Walle
2026-11-27 14:52 ` [RFT PATCH v2 09/14] gpio: idio-16: " Michael Walle
2026-11-27 14:52 ` [RFT PATCH v2 10/14] gpio: pcie-idio-24: " Michael Walle
2026-11-27 14:52 ` [RFT PATCH v2 11/14] gpio: ws16c48: " Michael Walle
2026-11-27 14:52 ` [RFT PATCH v2 12/14] gpio: 104-idi-48: " Michael Walle
2026-11-27 14:52 ` Michael Walle [this message]
2026-11-27 14:52 ` [RFT PATCH v2 14/14] gpio: regmap: remove irq_domain and the regmap-irq configuration Michael Walle
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=20261127145232.814492-14-mwalle@kernel.org \
--to=mwalle@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=brgl@kernel.org \
--cc=joseph@telaak.dev \
--cc=kmitran@axiado.com \
--cc=lee@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=longzhao@ambarella.com \
--cc=mathieu.dubois-briand@bootlin.com \
--cc=pbolisetty@axiado.com \
--cc=pstepanovic@axiado.com \
--cc=srinavmani@axiado.com \
--cc=twei@axiado.com \
--cc=wbg@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.