Linux driver-core infrastructure
 help / color / mirror / Atom feed
* [PATCH v1 0/4] gpio: regmap: Keep tracking IRQ requests and releases
@ 2026-07-02 12:42 Andy Shevchenko
  2026-07-02 12:42 ` [PATCH v1 1/4] regmap-irq: Provide IRQ resource request and release callbacks Andy Shevchenko
                   ` (6 more replies)
  0 siblings, 7 replies; 13+ messages in thread
From: Andy Shevchenko @ 2026-07-02 12:42 UTC (permalink / raw)
  To: Mark Brown, Mathieu Dubois-Briand, Andy Shevchenko,
	Bartosz Golaszewski, linux-kernel, driver-core, linux-gpio
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
	Linus Walleij, Michael Walle, Yu-Chun Lin, William Breathitt Gray

During the review of the v3 [1] of the series that adds a driver for
Realtek DHC RTD1625 SoC GPIO the gap in the GPIO regmap implementation
has been discovered, id est the IRQ chip that is created by regmap IRQ
doesn't have IRQ request and release callbacks and hence in terms of
GPIO does not track if any line is locked as IRQ. This might lead to
undesired and most likely faulty behaviour. This series is to fill that
gap. Currently it only fixes the only user of the automatic IRQ chip
creation facility provided by GPIO regmap, but also provides the exported
callbacks for others to be possible to call them from customised versions
of the callbacks in the respective drivers.

Most of the affected drivers if I am not mistaken are the Industrial PC104
ones, hence I Cc'ed William to look at this and perhaps even test.

Yu-Chun, can you give a try with your v3 based on this series? I believe
we can use regmap approach after all.

The merge strategy is to go via GPIO tree with the immutable branch or tag
provided for the first patch that can be done by regmap tree for others to
consume. Of course, there are possible options, I'm all ears if you think it
will be better in any other way.

Link: https://lore.kernel.org/all/20260512033317.1602537-1-eleanor.lin@realtek.com/ [1]

Andy Shevchenko (4):
  regmap-irq: Provide IRQ resource request and release callbacks
  gpio: regmap: Provide default IRQ resource request and release
    callbacks
  gpio: regmap: Apply default resource callbacks for regmap IRQ chip
  gpio: regmap: Order kernel-doc descriptions with the actual appearance

 drivers/base/regmap/regmap-irq.c | 22 ++++++++++++++++++++++
 drivers/gpio/gpio-max7360.c      |  7 ++++---
 drivers/gpio/gpio-regmap.c       | 25 +++++++++++++++++++++++++
 include/linux/gpio/regmap.h      | 21 ++++++++++++---------
 include/linux/regmap.h           |  2 ++
 5 files changed, 65 insertions(+), 12 deletions(-)

-- 
2.50.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v1 1/4] regmap-irq: Provide IRQ resource request and release callbacks
  2026-07-02 12:42 [PATCH v1 0/4] gpio: regmap: Keep tracking IRQ requests and releases Andy Shevchenko
@ 2026-07-02 12:42 ` Andy Shevchenko
  2026-07-03 15:29   ` Mark Brown
  2026-07-02 12:42 ` [PATCH v1 2/4] gpio: regmap: Provide default " Andy Shevchenko
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Andy Shevchenko @ 2026-07-02 12:42 UTC (permalink / raw)
  To: Mark Brown, Mathieu Dubois-Briand, Andy Shevchenko,
	Bartosz Golaszewski, linux-kernel, driver-core, linux-gpio
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
	Linus Walleij, Michael Walle, Yu-Chun Lin, William Breathitt Gray

The users which rely on regmap IRQ to create the IRQ chip may also
want to have an additional tracking of the IRQ requests and releases.
Provide a callback for them.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/base/regmap/regmap-irq.c | 22 ++++++++++++++++++++++
 include/linux/regmap.h           |  2 ++
 2 files changed, 24 insertions(+)

diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c
index 07234d415b51..99b55b1053ee 100644
--- a/drivers/base/regmap/regmap-irq.c
+++ b/drivers/base/regmap/regmap-irq.c
@@ -296,6 +296,26 @@ static int regmap_irq_set_wake(struct irq_data *data, unsigned int on)
 	return 0;
 }
 
+static int regmap_irq_reqres(struct irq_data *data)
+{
+	struct regmap_irq_chip_data *d = irq_data_get_irq_chip_data(data);
+	irq_hw_number_t hwirq = irqd_to_hwirq(data);
+
+	if (d->chip->irq_reqres)
+		return d->chip->irq_reqres(d->chip->irq_drv_data, hwirq);
+
+	return 0;
+}
+
+static void regmap_irq_relres(struct irq_data *data)
+{
+	struct regmap_irq_chip_data *d = irq_data_get_irq_chip_data(data);
+	irq_hw_number_t hwirq = irqd_to_hwirq(data);
+
+	if (d->chip->irq_relres)
+		d->chip->irq_relres(d->chip->irq_drv_data, hwirq);
+}
+
 static const struct irq_chip regmap_irq_chip = {
 	.irq_bus_lock		= regmap_irq_lock,
 	.irq_bus_sync_unlock	= regmap_irq_sync_unlock,
@@ -303,6 +323,8 @@ static const struct irq_chip regmap_irq_chip = {
 	.irq_enable		= regmap_irq_enable,
 	.irq_set_type		= regmap_irq_set_type,
 	.irq_set_wake		= regmap_irq_set_wake,
+	.irq_request_resources  = regmap_irq_reqres,
+	.irq_release_resources  = regmap_irq_relres,
 };
 
 static inline int read_sub_irq_data(struct regmap_irq_chip_data *data,
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index df44cb30f53b..370baa19db87 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -1770,6 +1770,8 @@ struct regmap_irq_chip {
 			       void *irq_drv_data);
 	unsigned int (*get_irq_reg)(struct regmap_irq_chip_data *data,
 				    unsigned int base, int index);
+	int (*irq_reqres)(void *irq_drv_data, irq_hw_number_t hwirq);
+	void (*irq_relres)(void *irq_drv_data, irq_hw_number_t hwirq);
 	void *irq_drv_data;
 };
 
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v1 2/4] gpio: regmap: Provide default IRQ resource request and release callbacks
  2026-07-02 12:42 [PATCH v1 0/4] gpio: regmap: Keep tracking IRQ requests and releases Andy Shevchenko
  2026-07-02 12:42 ` [PATCH v1 1/4] regmap-irq: Provide IRQ resource request and release callbacks Andy Shevchenko
@ 2026-07-02 12:42 ` Andy Shevchenko
  2026-07-03 11:29   ` Andy Shevchenko
  2026-07-02 12:42 ` [PATCH v1 3/4] gpio: regmap: Apply default resource callbacks for regmap IRQ chip Andy Shevchenko
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Andy Shevchenko @ 2026-07-02 12:42 UTC (permalink / raw)
  To: Mark Brown, Mathieu Dubois-Briand, Andy Shevchenko,
	Bartosz Golaszewski, linux-kernel, driver-core, linux-gpio
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
	Linus Walleij, Michael Walle, Yu-Chun Lin, William Breathitt Gray

When GPIO regmap based driver supplies its own IRQ domain, it might
still want to keep track of the IRQ requests and releases, in particular
to prevent a GPIO, which is used and locked as IRQ, to be requested
via standard ways. Provide default callbacks for such cases and keep
struct gpio_chip private to GPIO regmap implementation.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpio-regmap.c  | 22 ++++++++++++++++++++++
 include/linux/gpio/regmap.h |  3 +++
 2 files changed, 25 insertions(+)

diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c
index 51b4d69b8740..ad808d8d24b3 100644
--- a/drivers/gpio/gpio-regmap.c
+++ b/drivers/gpio/gpio-regmap.c
@@ -276,6 +276,28 @@ static int gpio_regmap_direction_output(struct gpio_chip *chip,
 	return gpio_regmap_set_direction(chip, offset, true);
 }
 
+int gpio_regmap_reqres_irq(struct gpio_regmap *gpio, unsigned int offset)
+{
+	return gpiochip_reqres_irq(&gpio->gpio_chip, offset);
+}
+EXPORT_SYMBOL_GPL(gpio_regmap_reqres_irq);
+
+void gpio_regmap_relres_irq(struct gpio_regmap *gpio, unsigned int offset)
+{
+	gpiochip_relres_irq(&gpio->gpio_chip, offset);
+}
+EXPORT_SYMBOL_GPL(gpio_regmap_relres_irq);
+
+static int gpio_regmap_irq_reqres(void *irq_drv_data, irq_hw_number_t hwirq)
+{
+	return gpio_regmap_reqres_irq(irq_drv_data, hwirq);
+}
+
+static void gpio_regmap_irq_relres(void *irq_drv_data, irq_hw_number_t hwirq)
+{
+	gpio_regmap_relres_irq(irq_drv_data, hwirq);
+}
+
 void *gpio_regmap_get_drvdata(struct gpio_regmap *gpio)
 {
 	return gpio->driver_data;
diff --git a/include/linux/gpio/regmap.h b/include/linux/gpio/regmap.h
index 06255756710d..e939709fde8d 100644
--- a/include/linux/gpio/regmap.h
+++ b/include/linux/gpio/regmap.h
@@ -121,4 +121,7 @@ struct gpio_regmap *devm_gpio_regmap_register(struct device *dev,
 					      const struct gpio_regmap_config *config);
 void *gpio_regmap_get_drvdata(struct gpio_regmap *gpio);
 
+int gpio_regmap_reqres_irq(struct gpio_regmap *gpio, unsigned int offset);
+void gpio_regmap_relres_irq(struct gpio_regmap *gpio, unsigned int offset);
+
 #endif /* _LINUX_GPIO_REGMAP_H */
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v1 3/4] gpio: regmap: Apply default resource callbacks for regmap IRQ chip
  2026-07-02 12:42 [PATCH v1 0/4] gpio: regmap: Keep tracking IRQ requests and releases Andy Shevchenko
  2026-07-02 12:42 ` [PATCH v1 1/4] regmap-irq: Provide IRQ resource request and release callbacks Andy Shevchenko
  2026-07-02 12:42 ` [PATCH v1 2/4] gpio: regmap: Provide default " Andy Shevchenko
@ 2026-07-02 12:42 ` Andy Shevchenko
  2026-07-03 20:52   ` Linus Walleij
  2026-07-02 12:42 ` [PATCH v1 4/4] gpio: regmap: Order kernel-doc descriptions with the actual appearance Andy Shevchenko
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Andy Shevchenko @ 2026-07-02 12:42 UTC (permalink / raw)
  To: Mark Brown, Mathieu Dubois-Briand, Andy Shevchenko,
	Bartosz Golaszewski, linux-kernel, driver-core, linux-gpio
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
	Linus Walleij, Michael Walle, Yu-Chun Lin, William Breathitt Gray

When GPIO regmap creates an IRQ chip on behalf of the user, it also
takes an ownership of the respective callbacks and driver data.
With that being done, apply default resource callbacks that keep
tracking the IRQ requests and releases.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpio-max7360.c | 7 ++++---
 drivers/gpio/gpio-regmap.c  | 3 +++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/gpio/gpio-max7360.c b/drivers/gpio/gpio-max7360.c
index d12cf1dc8d57..07eda49f375b 100644
--- a/drivers/gpio/gpio-max7360.c
+++ b/drivers/gpio/gpio-max7360.c
@@ -127,7 +127,7 @@ static int max7360_handle_mask_sync(const int index,
 				    const unsigned int mask_buf,
 				    void *const irq_drv_data)
 {
-	struct regmap *regmap = irq_drv_data;
+	struct regmap *regmap = gpio_regmap_get_drvdata(irq_drv_data);
 	int ret;
 
 	for (unsigned int i = 0; i < MAX7360_MAX_GPIO; i++) {
@@ -170,7 +170,6 @@ static int max7360_gpio_probe(struct platform_device *pdev)
 
 			/* Create custom IRQ configuration. */
 			irq_chip = devm_kzalloc(dev, sizeof(*irq_chip), GFP_KERNEL);
-			gpio_config.regmap_irq_chip = irq_chip;
 			if (!irq_chip)
 				return -ENOMEM;
 
@@ -181,7 +180,9 @@ static int max7360_gpio_probe(struct platform_device *pdev)
 			irq_chip->num_irqs = MAX7360_MAX_GPIO;
 			irq_chip->irqs = max7360_regmap_irqs;
 			irq_chip->handle_mask_sync = max7360_handle_mask_sync;
-			irq_chip->irq_drv_data = regmap;
+
+			gpio_config.regmap_irq_chip = irq_chip;
+			gpio_config.drvdata = regmap;
 
 			for (unsigned int i = 0; i < MAX7360_MAX_GPIO; i++) {
 				ret = regmap_write_bits(regmap, MAX7360_REG_PWMCFG(i),
diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c
index ad808d8d24b3..d0e65eac9f0b 100644
--- a/drivers/gpio/gpio-regmap.c
+++ b/drivers/gpio/gpio-regmap.c
@@ -419,6 +419,9 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config
 #ifdef CONFIG_REGMAP_IRQ
 	if (config->regmap_irq_chip) {
 		gpio->regmap_irq_line = config->regmap_irq_line;
+		config->regmap_irq_chip->irq_reqres = gpio_regmap_irq_reqres;
+		config->regmap_irq_chip->irq_relres = gpio_regmap_irq_relres;
+		config->regmap_irq_chip->irq_drv_data = gpio;
 		ret = regmap_add_irq_chip_fwnode(dev_fwnode(config->parent), config->regmap,
 						 config->regmap_irq_line, config->regmap_irq_flags,
 						 0, config->regmap_irq_chip, &gpio->irq_chip_data);
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v1 4/4] gpio: regmap: Order kernel-doc descriptions with the actual appearance
  2026-07-02 12:42 [PATCH v1 0/4] gpio: regmap: Keep tracking IRQ requests and releases Andy Shevchenko
                   ` (2 preceding siblings ...)
  2026-07-02 12:42 ` [PATCH v1 3/4] gpio: regmap: Apply default resource callbacks for regmap IRQ chip Andy Shevchenko
@ 2026-07-02 12:42 ` Andy Shevchenko
  2026-07-03 20:51   ` Linus Walleij
  2026-07-03  8:17 ` [PATCH v1 0/4] gpio: regmap: Keep tracking IRQ requests and releases Yu-Chun Lin [林祐君]
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Andy Shevchenko @ 2026-07-02 12:42 UTC (permalink / raw)
  To: Mark Brown, Mathieu Dubois-Briand, Andy Shevchenko,
	Bartosz Golaszewski, linux-kernel, driver-core, linux-gpio
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
	Linus Walleij, Michael Walle, Yu-Chun Lin, William Breathitt Gray

Order kernel-doc descriptions with the actual appearance.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 include/linux/gpio/regmap.h | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/include/linux/gpio/regmap.h b/include/linux/gpio/regmap.h
index e939709fde8d..a3ba8242c353 100644
--- a/include/linux/gpio/regmap.h
+++ b/include/linux/gpio/regmap.h
@@ -34,10 +34,6 @@ struct regmap;
  * @ngpio_per_reg:	(Optional) Number of GPIOs per register
  * @irq_domain:		(Optional) IRQ domain if the controller is
  *			interrupt-capable
- * @reg_mask_xlate:     (Optional) Translates base address and GPIO
- *			offset to a register/bitmask pair. If not
- *			given the default gpio_regmap_simple_xlate()
- *			is used.
  * @fixed_direction_mask:
  *			(Optional) Bitmap representing the GPIO lines that
  *			make use of the @fixed_direction_output list to
@@ -48,16 +44,20 @@ struct regmap;
  *			(Optional) Bitmap representing the fixed direction of
  *			the GPIO lines. Useful when there are GPIO lines with a
  *			fixed direction mixed together in the same register.
- * @drvdata:		(Optional) Pointer to driver specific data which is
- *			not used by gpio-remap but is provided "as is" to the
- *			driver callback(s).
- * @init_valid_mask:	(Optional) Routine to initialize @valid_mask, to be used
- *			if not all GPIOs are valid.
  * @regmap_irq_chip:	(Optional) Pointer on an regmap_irq_chip structure. If
  *			set, a regmap-irq device will be created and the IRQ
  *			domain will be set accordingly.
  * @regmap_irq_line:	(Optional) The IRQ the device uses to signal interrupts.
  * @regmap_irq_flags:	(Optional) The IRQF_ flags to use for the interrupt.
+ * @reg_mask_xlate:     (Optional) Translates base address and GPIO
+ *			offset to a register/bitmask pair. If not
+ *			given the default gpio_regmap_simple_xlate()
+ *			is used.
+ * @init_valid_mask:	(Optional) Routine to initialize @valid_mask, to be used
+ *			if not all GPIOs are valid.
+ * @drvdata:		(Optional) Pointer to driver specific data which is
+ *			not used by gpio-remap but is provided "as is" to the
+ *			driver callback(s).
  *
  * The ->reg_mask_xlate translates a given base address and GPIO offset to
  * register and mask pair. The base address is one of the given register
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* RE: [PATCH v1 0/4] gpio: regmap: Keep tracking IRQ requests and releases
  2026-07-02 12:42 [PATCH v1 0/4] gpio: regmap: Keep tracking IRQ requests and releases Andy Shevchenko
                   ` (3 preceding siblings ...)
  2026-07-02 12:42 ` [PATCH v1 4/4] gpio: regmap: Order kernel-doc descriptions with the actual appearance Andy Shevchenko
@ 2026-07-03  8:17 ` Yu-Chun Lin [林祐君]
  2026-07-03  8:34   ` Bartosz Golaszewski
  2026-07-03 15:29 ` (subset) " Mark Brown
  2026-07-04  5:21 ` William Breathitt Gray
  6 siblings, 1 reply; 13+ messages in thread
From: Yu-Chun Lin [林祐君] @ 2026-07-03  8:17 UTC (permalink / raw)
  To: Andy Shevchenko, Mark Brown, Mathieu Dubois-Briand,
	Bartosz Golaszewski, linux-kernel@vger.kernel.org,
	driver-core@lists.linux.dev, linux-gpio@vger.kernel.org
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
	Linus Walleij, Michael Walle, William Breathitt Gray,
	CY_Huang[黃鉦晏],
	Stanley Chang[昌育德],
	James Tai [戴志峰],
	TY_Chang[張子逸]

Hi Andy,

Thanks for your patches!

> During the review of the v3 [1] of the series that adds a driver for Realtek DHC
> RTD1625 SoC GPIO the gap in the GPIO regmap implementation has been
> discovered, id est the IRQ chip that is created by regmap IRQ doesn't have IRQ
> request and release callbacks and hence in terms of GPIO does not track if any
> line is locked as IRQ. This might lead to undesired and most likely faulty
> behaviour. This series is to fill that gap. Currently it only fixes the only user of
> the automatic IRQ chip creation facility provided by GPIO regmap, but also
> provides the exported callbacks for others to be possible to call them from
> customised versions of the callbacks in the respective drivers.
> 
> Most of the affected drivers if I am not mistaken are the Industrial PC104 ones,
> hence I Cc'ed William to look at this and perhaps even test.
> 
> Yu-Chun, can you give a try with your v3 based on this series? I believe we can
> use regmap approach after all.
> 

I tested them on the rtd1625 SoC board and it looks good. If no one else
has any issues with Andy's patch series, I'll send out v6, which will be
based on my v3 and this series.

Best Regards,
Yu-Chun

> The merge strategy is to go via GPIO tree with the immutable branch or tag
> provided for the first patch that can be done by regmap tree for others to
> consume. Of course, there are possible options, I'm all ears if you think it will
> be better in any other way.
> 
> Link:
> https://lore.kernel.org/all/20260512033317.1602537-1-eleanor.lin@realtek.co
> m/ [1]
> 
> Andy Shevchenko (4):
>   regmap-irq: Provide IRQ resource request and release callbacks
>   gpio: regmap: Provide default IRQ resource request and release
>     callbacks
>   gpio: regmap: Apply default resource callbacks for regmap IRQ chip
>   gpio: regmap: Order kernel-doc descriptions with the actual appearance
> 
>  drivers/base/regmap/regmap-irq.c | 22 ++++++++++++++++++++++
>  drivers/gpio/gpio-max7360.c      |  7 ++++---
>  drivers/gpio/gpio-regmap.c       | 25 +++++++++++++++++++++++++
>  include/linux/gpio/regmap.h      | 21 ++++++++++++---------
>  include/linux/regmap.h           |  2 ++
>  5 files changed, 65 insertions(+), 12 deletions(-)
> 
> --
> 2.50.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v1 0/4] gpio: regmap: Keep tracking IRQ requests and releases
  2026-07-03  8:17 ` [PATCH v1 0/4] gpio: regmap: Keep tracking IRQ requests and releases Yu-Chun Lin [林祐君]
@ 2026-07-03  8:34   ` Bartosz Golaszewski
  0 siblings, 0 replies; 13+ messages in thread
From: Bartosz Golaszewski @ 2026-07-03  8:34 UTC (permalink / raw)
  To: Yu-Chun Lin [林祐君]
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
	Linus Walleij, Michael Walle, William Breathitt Gray,
	CY_Huang[黃鉦晏],
	Stanley Chang[昌育德],
	James Tai [戴志峰],
	TY_Chang[張子逸], Andy Shevchenko, Mark Brown,
	Mathieu Dubois-Briand, Bartosz Golaszewski,
	linux-kernel@vger.kernel.org, driver-core@lists.linux.dev,
	linux-gpio@vger.kernel.org

On Fri, 3 Jul 2026 10:17:04 +0200, "Yu-Chun Lin [林祐君]"
<eleanor.lin@realtek.com> said:
> Hi Andy,
>
> Thanks for your patches!
>
>> During the review of the v3 [1] of the series that adds a driver for Realtek DHC
>> RTD1625 SoC GPIO the gap in the GPIO regmap implementation has been
>> discovered, id est the IRQ chip that is created by regmap IRQ doesn't have IRQ
>> request and release callbacks and hence in terms of GPIO does not track if any
>> line is locked as IRQ. This might lead to undesired and most likely faulty
>> behaviour. This series is to fill that gap. Currently it only fixes the only user of
>> the automatic IRQ chip creation facility provided by GPIO regmap, but also
>> provides the exported callbacks for others to be possible to call them from
>> customised versions of the callbacks in the respective drivers.
>>
>> Most of the affected drivers if I am not mistaken are the Industrial PC104 ones,
>> hence I Cc'ed William to look at this and perhaps even test.
>>
>> Yu-Chun, can you give a try with your v3 based on this series? I believe we can
>> use regmap approach after all.
>>
>
> I tested them on the rtd1625 SoC board and it looks good. If no one else
> has any issues with Andy's patch series, I'll send out v6, which will be
> based on my v3 and this series.
>

Please just fold Andy's patches into your series for easier review.

Thanks,
Bartosz

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v1 2/4] gpio: regmap: Provide default IRQ resource request and release callbacks
  2026-07-02 12:42 ` [PATCH v1 2/4] gpio: regmap: Provide default " Andy Shevchenko
@ 2026-07-03 11:29   ` Andy Shevchenko
  0 siblings, 0 replies; 13+ messages in thread
From: Andy Shevchenko @ 2026-07-03 11:29 UTC (permalink / raw)
  To: Mark Brown, Mathieu Dubois-Briand, Bartosz Golaszewski,
	linux-kernel, driver-core, linux-gpio
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
	Linus Walleij, Michael Walle, Yu-Chun Lin, William Breathitt Gray

On Thu, Jul 02, 2026 at 02:42:55PM +0200, Andy Shevchenko wrote:
> When GPIO regmap based driver supplies its own IRQ domain, it might
> still want to keep track of the IRQ requests and releases, in particular
> to prevent a GPIO, which is used and locked as IRQ, to be requested
> via standard ways. Provide default callbacks for such cases and keep
> struct gpio_chip private to GPIO regmap implementation.

...

> +static int gpio_regmap_irq_reqres(void *irq_drv_data, irq_hw_number_t hwirq)
> +{
> +	return gpio_regmap_reqres_irq(irq_drv_data, hwirq);
> +}
> +
> +static void gpio_regmap_irq_relres(void *irq_drv_data, irq_hw_number_t hwirq)
> +{
> +	gpio_regmap_relres_irq(irq_drv_data, hwirq);
> +}

These two functions has to be part of the patch 3. I forgot to update this when
split a PoC to a series.


-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v1 1/4] regmap-irq: Provide IRQ resource request and release callbacks
  2026-07-02 12:42 ` [PATCH v1 1/4] regmap-irq: Provide IRQ resource request and release callbacks Andy Shevchenko
@ 2026-07-03 15:29   ` Mark Brown
  0 siblings, 0 replies; 13+ messages in thread
From: Mark Brown @ 2026-07-03 15:29 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Mathieu Dubois-Briand, Bartosz Golaszewski, linux-kernel,
	driver-core, linux-gpio, Greg Kroah-Hartman, Rafael J. Wysocki,
	Danilo Krummrich, Linus Walleij, Michael Walle, Yu-Chun Lin,
	William Breathitt Gray

[-- Attachment #1: Type: text/plain, Size: 1254 bytes --]

On Thu, Jul 02, 2026 at 02:42:54PM +0200, Andy Shevchenko wrote:
> The users which rely on regmap IRQ to create the IRQ chip may also
> want to have an additional tracking of the IRQ requests and releases.
> Provide a callback for them.

The following changes since commit dc59e4fea9d83f03bad6bddf3fa2e52491777482:

  Linux 7.2-rc1 (2026-06-28 12:01:31 -0700)

are available in the Git repository at:

  https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git tags/regmap-irq-reqrel

for you to fetch changes up to 9bb4c0b37d54fc7d61f2a21cfa635fa2e3a29ac5:

  regmap-irq: Provide IRQ resource request and release callbacks (2026-07-03 16:24:45 +0100)

----------------------------------------------------------------
regmap-irq: Provide IRQ resource request and release callbacks

The users which rely on regmap IRQ to create the IRQ chip may also
want to have an additional tracking of the IRQ requests and releases.
Provide a callback for them.

----------------------------------------------------------------
Andy Shevchenko (1):
      regmap-irq: Provide IRQ resource request and release callbacks

 drivers/base/regmap/regmap-irq.c | 22 ++++++++++++++++++++++
 include/linux/regmap.h           |  2 ++
 2 files changed, 24 insertions(+)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: (subset) [PATCH v1 0/4] gpio: regmap: Keep tracking IRQ requests and releases
  2026-07-02 12:42 [PATCH v1 0/4] gpio: regmap: Keep tracking IRQ requests and releases Andy Shevchenko
                   ` (4 preceding siblings ...)
  2026-07-03  8:17 ` [PATCH v1 0/4] gpio: regmap: Keep tracking IRQ requests and releases Yu-Chun Lin [林祐君]
@ 2026-07-03 15:29 ` Mark Brown
  2026-07-04  5:21 ` William Breathitt Gray
  6 siblings, 0 replies; 13+ messages in thread
From: Mark Brown @ 2026-07-03 15:29 UTC (permalink / raw)
  To: Mathieu Dubois-Briand, Bartosz Golaszewski, linux-kernel,
	driver-core, linux-gpio, Andy Shevchenko
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
	Linus Walleij, Michael Walle, Yu-Chun Lin, William Breathitt Gray

On Thu, 02 Jul 2026 14:42:53 +0200, Andy Shevchenko wrote:
> gpio: regmap: Keep tracking IRQ requests and releases
> 
> During the review of the v3 [1] of the series that adds a driver for
> Realtek DHC RTD1625 SoC GPIO the gap in the GPIO regmap implementation
> has been discovered, id est the IRQ chip that is created by regmap IRQ
> doesn't have IRQ request and release callbacks and hence in terms of
> GPIO does not track if any line is locked as IRQ. This might lead to
> undesired and most likely faulty behaviour. This series is to fill that
> gap. Currently it only fixes the only user of the automatic IRQ chip
> creation facility provided by GPIO regmap, but also provides the exported
> callbacks for others to be possible to call them from customised versions
> of the callbacks in the respective drivers.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git regmap-irq-reqrel

Thanks!

[1/4] regmap-irq: Provide IRQ resource request and release callbacks
      https://git.kernel.org/broonie/regmap/c/9bb4c0b37d54

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v1 4/4] gpio: regmap: Order kernel-doc descriptions with the actual appearance
  2026-07-02 12:42 ` [PATCH v1 4/4] gpio: regmap: Order kernel-doc descriptions with the actual appearance Andy Shevchenko
@ 2026-07-03 20:51   ` Linus Walleij
  0 siblings, 0 replies; 13+ messages in thread
From: Linus Walleij @ 2026-07-03 20:51 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Mark Brown, Mathieu Dubois-Briand, Bartosz Golaszewski,
	linux-kernel, driver-core, linux-gpio, Greg Kroah-Hartman,
	Rafael J. Wysocki, Danilo Krummrich, Michael Walle, Yu-Chun Lin,
	William Breathitt Gray

On Thu, Jul 2, 2026 at 3:09 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> Order kernel-doc descriptions with the actual appearance.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Reviewed-by: Linus Walleij <linusw@kernel.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v1 3/4] gpio: regmap: Apply default resource callbacks for regmap IRQ chip
  2026-07-02 12:42 ` [PATCH v1 3/4] gpio: regmap: Apply default resource callbacks for regmap IRQ chip Andy Shevchenko
@ 2026-07-03 20:52   ` Linus Walleij
  0 siblings, 0 replies; 13+ messages in thread
From: Linus Walleij @ 2026-07-03 20:52 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Mark Brown, Mathieu Dubois-Briand, Bartosz Golaszewski,
	linux-kernel, driver-core, linux-gpio, Greg Kroah-Hartman,
	Rafael J. Wysocki, Danilo Krummrich, Michael Walle, Yu-Chun Lin,
	William Breathitt Gray

On Thu, Jul 2, 2026 at 3:09 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> When GPIO regmap creates an IRQ chip on behalf of the user, it also
> takes an ownership of the respective callbacks and driver data.
> With that being done, apply default resource callbacks that keep
> tracking the IRQ requests and releases.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Reviewed-by: Linus Walleij <linusw@kernel.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v1 0/4] gpio: regmap: Keep tracking IRQ requests and releases
  2026-07-02 12:42 [PATCH v1 0/4] gpio: regmap: Keep tracking IRQ requests and releases Andy Shevchenko
                   ` (5 preceding siblings ...)
  2026-07-03 15:29 ` (subset) " Mark Brown
@ 2026-07-04  5:21 ` William Breathitt Gray
  6 siblings, 0 replies; 13+ messages in thread
From: William Breathitt Gray @ 2026-07-04  5:21 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: William Breathitt Gray, Mark Brown, Mathieu Dubois-Briand,
	Bartosz Golaszewski, linux-kernel, driver-core, linux-gpio,
	Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
	Linus Walleij, Michael Walle, Yu-Chun Lin, Fred Eckert,
	Matthew Mohn

On Thu, Jul 02, 2026 at 02:42:53PM +0200, Andy Shevchenko wrote:
> During the review of the v3 [1] of the series that adds a driver for
> Realtek DHC RTD1625 SoC GPIO the gap in the GPIO regmap implementation
> has been discovered, id est the IRQ chip that is created by regmap IRQ
> doesn't have IRQ request and release callbacks and hence in terms of
> GPIO does not track if any line is locked as IRQ. This might lead to
> undesired and most likely faulty behaviour. This series is to fill that
> gap. Currently it only fixes the only user of the automatic IRQ chip
> creation facility provided by GPIO regmap, but also provides the exported
> callbacks for others to be possible to call them from customised versions
> of the callbacks in the respective drivers.
> 
> Most of the affected drivers if I am not mistaken are the Industrial PC104
> ones, hence I Cc'ed William to look at this and perhaps even test.

Hi Andy,

I'll take a look at these patches when I get a chance. For now, I'll CC
Fred Eckert and Matthew Mohn who have tested these PC104 drivers in the
past and may be interested in this patchset.

Thanks,

William Breathitt Gray

> 
> Yu-Chun, can you give a try with your v3 based on this series? I believe
> we can use regmap approach after all.
> 
> The merge strategy is to go via GPIO tree with the immutable branch or tag
> provided for the first patch that can be done by regmap tree for others to
> consume. Of course, there are possible options, I'm all ears if you think it
> will be better in any other way.
> 
> Link: https://lore.kernel.org/all/20260512033317.1602537-1-eleanor.lin@realtek.com/ [1]
> 
> Andy Shevchenko (4):
>   regmap-irq: Provide IRQ resource request and release callbacks
>   gpio: regmap: Provide default IRQ resource request and release
>     callbacks
>   gpio: regmap: Apply default resource callbacks for regmap IRQ chip
>   gpio: regmap: Order kernel-doc descriptions with the actual appearance
> 
>  drivers/base/regmap/regmap-irq.c | 22 ++++++++++++++++++++++
>  drivers/gpio/gpio-max7360.c      |  7 ++++---
>  drivers/gpio/gpio-regmap.c       | 25 +++++++++++++++++++++++++
>  include/linux/gpio/regmap.h      | 21 ++++++++++++---------
>  include/linux/regmap.h           |  2 ++
>  5 files changed, 65 insertions(+), 12 deletions(-)
> 
> --
> 2.50.1
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2026-07-04  5:21 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-02 12:42 [PATCH v1 0/4] gpio: regmap: Keep tracking IRQ requests and releases Andy Shevchenko
2026-07-02 12:42 ` [PATCH v1 1/4] regmap-irq: Provide IRQ resource request and release callbacks Andy Shevchenko
2026-07-03 15:29   ` Mark Brown
2026-07-02 12:42 ` [PATCH v1 2/4] gpio: regmap: Provide default " Andy Shevchenko
2026-07-03 11:29   ` Andy Shevchenko
2026-07-02 12:42 ` [PATCH v1 3/4] gpio: regmap: Apply default resource callbacks for regmap IRQ chip Andy Shevchenko
2026-07-03 20:52   ` Linus Walleij
2026-07-02 12:42 ` [PATCH v1 4/4] gpio: regmap: Order kernel-doc descriptions with the actual appearance Andy Shevchenko
2026-07-03 20:51   ` Linus Walleij
2026-07-03  8:17 ` [PATCH v1 0/4] gpio: regmap: Keep tracking IRQ requests and releases Yu-Chun Lin [林祐君]
2026-07-03  8:34   ` Bartosz Golaszewski
2026-07-03 15:29 ` (subset) " Mark Brown
2026-07-04  5:21 ` William Breathitt Gray

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox