From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Mark Brown <broonie@kernel.org>,
Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Bartosz Golaszewski <brgl@kernel.org>,
linux-kernel@vger.kernel.org, driver-core@lists.linux.dev,
linux-gpio@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Danilo Krummrich <dakr@kernel.org>,
Linus Walleij <linusw@kernel.org>,
Michael Walle <mwalle@kernel.org>,
Yu-Chun Lin <eleanor.lin@realtek.com>,
William Breathitt Gray <wbg@kernel.org>
Subject: [PATCH v1 2/4] gpio: regmap: Provide default IRQ resource request and release callbacks
Date: Thu, 2 Jul 2026 14:42:55 +0200 [thread overview]
Message-ID: <20260702130903.1790633-3-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20260702130903.1790633-1-andriy.shevchenko@linux.intel.com>
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
next prev parent reply other threads:[~2026-07-02 13:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Andy Shevchenko [this message]
2026-07-03 11:29 ` [PATCH v1 2/4] gpio: regmap: Provide default " 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
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=20260702130903.1790633-3-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=brgl@kernel.org \
--cc=broonie@kernel.org \
--cc=dakr@kernel.org \
--cc=driver-core@lists.linux.dev \
--cc=eleanor.lin@realtek.com \
--cc=gregkh@linuxfoundation.org \
--cc=linusw@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.dubois-briand@bootlin.com \
--cc=mwalle@kernel.org \
--cc=rafael@kernel.org \
--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.