From: William Breathitt Gray <william.gray@linaro.org>
To: linus.walleij@linaro.org, brgl@bgdev.pl
Cc: broonie@kernel.org, andriy.shevchenko@linux.intel.com,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
William Breathitt Gray <william.gray@linaro.org>
Subject: [PATCH v2 1/6] regmap-irq: Add no_status support
Date: Mon, 27 Feb 2023 11:45:22 -0500 [thread overview]
Message-ID: <bd501b4b5ff88da24d467f75e8c71b4e0e6f21e2.1677515341.git.william.gray@linaro.org> (raw)
In-Reply-To: <cover.1677515341.git.william.gray@linaro.org>
Some devices lack status registers, yet expect to handle interrupts.
Introduce a no_status flag to indicate such a configuration, where
rather than read a status register to verify, all interrupts received
are assumed to be active.
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
---
Changes in v2:
- Utilize memset32() to set status_buf for no_status case
- Utilize GENMASK() to generate status_buf mask
- Move no_status kernel doc line under runtime_pm line
drivers/base/regmap/regmap-irq.c | 22 +++++++++++++++-------
include/linux/regmap.h | 2 ++
2 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c
index a8f185430a07..290e26664a21 100644
--- a/drivers/base/regmap/regmap-irq.c
+++ b/drivers/base/regmap/regmap-irq.c
@@ -437,7 +437,10 @@ static irqreturn_t regmap_irq_thread(int irq, void *d)
* possible in order to reduce the I/O overheads.
*/
- if (chip->num_main_regs) {
+ if (chip->no_status) {
+ /* no status register so default to all active */
+ memset32(data->status_buf, GENMASK(31, 0), chip->num_regs);
+ } else if (chip->num_main_regs) {
unsigned int max_main_bits;
unsigned long size;
@@ -967,12 +970,17 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,
continue;
/* Ack masked but set interrupts */
- reg = d->get_irq_reg(d, d->chip->status_base, i);
- ret = regmap_read(map, reg, &d->status_buf[i]);
- if (ret != 0) {
- dev_err(map->dev, "Failed to read IRQ status: %d\n",
- ret);
- goto err_alloc;
+ if (d->chip->no_status) {
+ /* no status register so default to all active */
+ d->status_buf[i] = GENMASK(31, 0);
+ } else {
+ reg = d->get_irq_reg(d, d->chip->status_base, i);
+ ret = regmap_read(map, reg, &d->status_buf[i]);
+ if (ret != 0) {
+ dev_err(map->dev, "Failed to read IRQ status: %d\n",
+ ret);
+ goto err_alloc;
+ }
}
if (chip->status_invert)
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index a3bc695bcca0..c6d80d4e73de 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -1564,6 +1564,7 @@ struct regmap_irq_chip_data;
* the need for a @sub_reg_offsets table.
* @status_invert: Inverted status register: cleared bits are active interrupts.
* @runtime_pm: Hold a runtime PM lock on the device when accessing it.
+ * @no_status: No status register: all interrupts assumed generated by device.
*
* @num_regs: Number of registers in each control bank.
* @irqs: Descriptors for individual IRQs. Interrupt numbers are
@@ -1630,6 +1631,7 @@ struct regmap_irq_chip {
unsigned int clear_on_unmask:1;
unsigned int not_fixed_stride:1;
unsigned int status_invert:1;
+ unsigned int no_status:1;
int num_regs;
--
2.39.2
next prev parent reply other threads:[~2023-02-27 16:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-27 16:45 [PATCH v2 0/6] Migrate IDIO-16 GPIO drivers to regmap API William Breathitt Gray
2023-02-27 16:45 ` William Breathitt Gray [this message]
2023-03-06 10:11 ` [PATCH v2 1/6] regmap-irq: Add no_status support Bartosz Golaszewski
2023-03-10 12:01 ` William Breathitt Gray
2023-03-15 13:28 ` Mark Brown
2023-02-27 16:45 ` [PATCH v2 2/6] gpio: 104-dio-48e: Utilize no_status regmap-irq flag William Breathitt Gray
2023-02-27 16:45 ` [PATCH v2 3/6] gpio: idio-16: Migrate to the regmap API William Breathitt Gray
2023-02-27 16:45 ` [PATCH v2 4/6] gpio: 104-idio-16: " William Breathitt Gray
2023-02-27 16:45 ` [PATCH v2 5/6] gpio: pci-idio-16: " William Breathitt Gray
2023-03-22 16:37 ` Bartosz Golaszewski
2023-02-27 16:45 ` [PATCH v2 6/6] gpio: idio-16: Remove unused legacy interface William Breathitt Gray
2023-03-06 14:09 ` (subset) [PATCH v2 0/6] Migrate IDIO-16 GPIO drivers to regmap API Mark Brown
2023-03-06 14:12 ` Linus Walleij
2023-03-15 10:02 ` Bartosz Golaszewski
2023-03-15 10:14 ` Linus Walleij
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=bd501b4b5ff88da24d467f75e8c71b4e0e6f21e2.1677515341.git.william.gray@linaro.org \
--to=william.gray@linaro.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=brgl@bgdev.pl \
--cc=broonie@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®