* [PATCH v2 0/2] mfd: arizona: Move IRQ GPIO to GPIO descriptor
@ 2026-03-17 9:28 Linus Walleij
2026-03-17 9:28 ` [PATCH v2 1/2] dt-bindings: mfd: wlf,arizona: Add irq-gpios Linus Walleij
2026-03-17 9:28 ` [PATCH v2 2/2] mfd: arizona: Convert GPIO IRQ handling to descriptors Linus Walleij
0 siblings, 2 replies; 5+ messages in thread
From: Linus Walleij @ 2026-03-17 9:28 UTC (permalink / raw)
To: Lee Jones, Bartosz Golaszewski, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: patches, linux-kernel, linux-gpio, devicetree, Linus Walleij
Move the hack using a platform data-provided GPIO line to use
a proper devicetree-provided GPIO descriptor to poll the IRQ.
Signed-off-by: Linus Walleij <linusw@kernel.org>
---
Changes in v2:
- Instead of deleting the feature, migrate it properly to devicetree.
- Add irq-gpios devicetree bindings.
- Add code to handle irq-gpios for GPIO polling of IRQ line.
- Link to v1: https://lore.kernel.org/r/20260314-mfd-arizona-irq-v1-1-4b77f524f832@kernel.org
---
Linus Walleij (2):
dt-bindings: mfd: wlf,arizona: Add irq-gpios
mfd: arizona: Convert GPIO IRQ handling to descriptors
.../devicetree/bindings/mfd/wlf,arizona.yaml | 9 +++++
drivers/mfd/arizona-irq.c | 45 ++++++++++------------
include/linux/mfd/arizona/core.h | 2 +
include/linux/mfd/arizona/pdata.h | 5 ---
4 files changed, 32 insertions(+), 29 deletions(-)
---
base-commit: 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f
change-id: 20260314-mfd-arizona-irq-6fe7fe179a09
Best regards,
--
Linus Walleij <linusw@kernel.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/2] dt-bindings: mfd: wlf,arizona: Add irq-gpios
2026-03-17 9:28 [PATCH v2 0/2] mfd: arizona: Move IRQ GPIO to GPIO descriptor Linus Walleij
@ 2026-03-17 9:28 ` Linus Walleij
2026-03-17 13:22 ` Charles Keepax
2026-03-17 9:28 ` [PATCH v2 2/2] mfd: arizona: Convert GPIO IRQ handling to descriptors Linus Walleij
1 sibling, 1 reply; 5+ messages in thread
From: Linus Walleij @ 2026-03-17 9:28 UTC (permalink / raw)
To: Lee Jones, Bartosz Golaszewski, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: patches, linux-kernel, linux-gpio, devicetree, Linus Walleij
The Wolfson Microelectronics Arizona sometimes needs to poll the
GPIO line corresponding to the IRQ to counter bugs in the hardware
that appear on edge-triggered IRQs.
For this situation, provide the optional irq-gpios property.
Signed-off-by: Linus Walleij <linusw@kernel.org>
---
Documentation/devicetree/bindings/mfd/wlf,arizona.yaml | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/Documentation/devicetree/bindings/mfd/wlf,arizona.yaml b/Documentation/devicetree/bindings/mfd/wlf,arizona.yaml
index 7902f3c5d289..dbf1f1e0a57e 100644
--- a/Documentation/devicetree/bindings/mfd/wlf,arizona.yaml
+++ b/Documentation/devicetree/bindings/mfd/wlf,arizona.yaml
@@ -194,6 +194,15 @@ properties:
reset-gpios:
maxItems: 1
+ irq-gpios:
+ maxItems: 1
+ description:
+ Nominally a functional IRQ should be provided in the interrupts
+ property. However due to glitches in the hardware, the GPIO line
+ corresponding to the IRQ sometimes need to be iteratively polled to
+ check for the triggering edge. If this bug is present, the GPIO line
+ should be passed here.
+
wlf,reset:
description:
GPIO specifier for the GPIO controlling RESET
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 2/2] mfd: arizona: Convert GPIO IRQ handling to descriptors
2026-03-17 9:28 [PATCH v2 0/2] mfd: arizona: Move IRQ GPIO to GPIO descriptor Linus Walleij
2026-03-17 9:28 ` [PATCH v2 1/2] dt-bindings: mfd: wlf,arizona: Add irq-gpios Linus Walleij
@ 2026-03-17 9:28 ` Linus Walleij
2026-03-17 13:13 ` Charles Keepax
1 sibling, 1 reply; 5+ messages in thread
From: Linus Walleij @ 2026-03-17 9:28 UTC (permalink / raw)
To: Lee Jones, Bartosz Golaszewski, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: patches, linux-kernel, linux-gpio, devicetree, Linus Walleij
Convert the arizona polling GPIO handling to use a GPIO descripor
instead of passing a global GPIO number as platform data.
This mechanism is not used in the kernel, but let's preserve
the mechanism to be nice.
Users can define "irq-gpios" in the devicetree or software node
for the Arizona chip to provide the GPIO line corresponding to
the IRQ.
Signed-off-by: Linus Walleij <linusw@kernel.org>
---
drivers/mfd/arizona-irq.c | 45 ++++++++++++++++++---------------------
include/linux/mfd/arizona/core.h | 2 ++
include/linux/mfd/arizona/pdata.h | 5 -----
3 files changed, 23 insertions(+), 29 deletions(-)
diff --git a/drivers/mfd/arizona-irq.c b/drivers/mfd/arizona-irq.c
index 544016d420fe..b6f63031268e 100644
--- a/drivers/mfd/arizona-irq.c
+++ b/drivers/mfd/arizona-irq.c
@@ -136,21 +136,19 @@ static irqreturn_t arizona_irq_thread(int irq, void *data)
dev_err(arizona->dev,
"Failed to read main IRQ status: %d\n", ret);
}
-#ifdef CONFIG_GPIOLIB_LEGACY
/*
* Poll the IRQ pin status to see if we're really done
* if the interrupt controller can't do it for us.
*/
- if (!arizona->pdata.irq_gpio) {
+ if (!arizona->irq_gpiod) {
break;
} else if (arizona->pdata.irq_flags & IRQF_TRIGGER_RISING &&
- gpio_get_value_cansleep(arizona->pdata.irq_gpio)) {
+ gpiod_get_value_cansleep(arizona->irq_gpiod)) {
poll = true;
} else if (arizona->pdata.irq_flags & IRQF_TRIGGER_FALLING &&
- !gpio_get_value_cansleep(arizona->pdata.irq_gpio)) {
+ !gpiod_get_value_cansleep(arizona->irq_gpiod)) {
poll = true;
}
-#endif
} while (poll);
pm_runtime_put_autosuspend(arizona->dev);
@@ -350,27 +348,25 @@ int arizona_irq_init(struct arizona *arizona)
goto err_map_main_irq;
}
-#ifdef CONFIG_GPIOLIB_LEGACY
- /* Used to emulate edge trigger and to work around broken pinmux */
- if (arizona->pdata.irq_gpio) {
- if (gpio_to_irq(arizona->pdata.irq_gpio) != arizona->irq) {
- dev_warn(arizona->dev, "IRQ %d is not GPIO %d (%d)\n",
- arizona->irq, arizona->pdata.irq_gpio,
- gpio_to_irq(arizona->pdata.irq_gpio));
- arizona->irq = gpio_to_irq(arizona->pdata.irq_gpio);
- }
-
- ret = devm_gpio_request_one(arizona->dev,
- arizona->pdata.irq_gpio,
- GPIOF_IN, "arizona IRQ");
- if (ret != 0) {
- dev_err(arizona->dev,
- "Failed to request IRQ GPIO %d:: %d\n",
- arizona->pdata.irq_gpio, ret);
- arizona->pdata.irq_gpio = 0;
+ /*
+ * Used to emulate edge trigger and to work around broken pinmux
+ * define "irq-gpios" in device tree or software node.
+ */
+ arizona->irq_gpiod = devm_gpiod_get_optional(arizona->dev, "irq",
+ GPIOD_IN);
+ if (IS_ERR(arizona->irq_gpiod)) {
+ ret = PTR_ERR(arizona->irq_gpiod);
+ dev_err(arizona->dev, "error getting IRQ GPIO (%d)\n", ret);
+ goto err_irq_gpiod;
+ }
+ if (arizona->irq_gpiod) {
+ if (gpiod_to_irq(arizona->irq_gpiod) != arizona->irq) {
+ dev_warn(arizona->dev, "IRQ %d is not right GPIO\n",
+ arizona->irq);
+ arizona->irq = gpiod_to_irq(arizona->irq_gpiod);
}
+ gpiod_set_consumer_name(arizona->irq_gpiod, "arizona IRQ");
}
-#endif
ret = request_threaded_irq(arizona->irq, NULL, arizona_irq_thread,
flags, "arizona", arizona);
@@ -409,6 +405,7 @@ int arizona_irq_init(struct arizona *arizona)
arizona_free_irq(arizona, ARIZONA_IRQ_BOOT_DONE, arizona);
err_boot_done:
free_irq(arizona->irq, arizona);
+err_irq_gpiod:
err_main_irq:
regmap_del_irq_chip(irq_find_mapping(arizona->virq,
ARIZONA_MAIN_IRQ_INDEX),
diff --git a/include/linux/mfd/arizona/core.h b/include/linux/mfd/arizona/core.h
index 6d6f96b2b29f..7129651c9af6 100644
--- a/include/linux/mfd/arizona/core.h
+++ b/include/linux/mfd/arizona/core.h
@@ -11,6 +11,7 @@
#define _WM_ARIZONA_CORE_H
#include <linux/clk.h>
+#include <linux/gpio/consumer.h>
#include <linux/interrupt.h>
#include <linux/notifier.h>
#include <linux/regmap.h>
@@ -136,6 +137,7 @@ struct arizona {
struct irq_domain *virq;
struct regmap_irq_chip_data *aod_irq_chip;
struct regmap_irq_chip_data *irq_chip;
+ struct gpio_desc *irq_gpiod;
bool hpdet_clamp;
unsigned int hp_ena;
diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h
index f72e6d4b14a7..20118bad869a 100644
--- a/include/linux/mfd/arizona/pdata.h
+++ b/include/linux/mfd/arizona/pdata.h
@@ -188,11 +188,6 @@ struct arizona_pdata {
/** Haptic actuator type */
unsigned int hap_act;
-#ifdef CONFIG_GPIOLIB_LEGACY
- /** GPIO for primary IRQ (used for edge triggered emulation) */
- int irq_gpio;
-#endif
-
/** General purpose switch control */
unsigned int gpsw;
};
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 2/2] mfd: arizona: Convert GPIO IRQ handling to descriptors
2026-03-17 9:28 ` [PATCH v2 2/2] mfd: arizona: Convert GPIO IRQ handling to descriptors Linus Walleij
@ 2026-03-17 13:13 ` Charles Keepax
0 siblings, 0 replies; 5+ messages in thread
From: Charles Keepax @ 2026-03-17 13:13 UTC (permalink / raw)
To: Linus Walleij
Cc: Lee Jones, Bartosz Golaszewski, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, patches, linux-kernel, linux-gpio, devicetree
On Tue, Mar 17, 2026 at 10:28:32AM +0100, Linus Walleij wrote:
> Convert the arizona polling GPIO handling to use a GPIO descripor
> instead of passing a global GPIO number as platform data.
>
> This mechanism is not used in the kernel, but let's preserve
> the mechanism to be nice.
>
> Users can define "irq-gpios" in the devicetree or software node
> for the Arizona chip to provide the GPIO line corresponding to
> the IRQ.
>
> Signed-off-by: Linus Walleij <linusw@kernel.org>
> ---
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Thanks,
Charles
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/2] dt-bindings: mfd: wlf,arizona: Add irq-gpios
2026-03-17 9:28 ` [PATCH v2 1/2] dt-bindings: mfd: wlf,arizona: Add irq-gpios Linus Walleij
@ 2026-03-17 13:22 ` Charles Keepax
0 siblings, 0 replies; 5+ messages in thread
From: Charles Keepax @ 2026-03-17 13:22 UTC (permalink / raw)
To: Linus Walleij
Cc: Lee Jones, Bartosz Golaszewski, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, patches, linux-kernel, linux-gpio, devicetree
On Tue, Mar 17, 2026 at 10:28:31AM +0100, Linus Walleij wrote:
> The Wolfson Microelectronics Arizona sometimes needs to poll the
> GPIO line corresponding to the IRQ to counter bugs in the hardware
> that appear on edge-triggered IRQs.
>
> For this situation, provide the optional irq-gpios property.
>
> Signed-off-by: Linus Walleij <linusw@kernel.org>
> ---
> Documentation/devicetree/bindings/mfd/wlf,arizona.yaml | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/mfd/wlf,arizona.yaml b/Documentation/devicetree/bindings/mfd/wlf,arizona.yaml
> index 7902f3c5d289..dbf1f1e0a57e 100644
> --- a/Documentation/devicetree/bindings/mfd/wlf,arizona.yaml
> +++ b/Documentation/devicetree/bindings/mfd/wlf,arizona.yaml
> @@ -194,6 +194,15 @@ properties:
> reset-gpios:
> maxItems: 1
>
> + irq-gpios:
> + maxItems: 1
> + description:
> + Nominally a functional IRQ should be provided in the interrupts
> + property. However due to glitches in the hardware, the GPIO line
> + corresponding to the IRQ sometimes need to be iteratively polled to
> + check for the triggering edge. If this bug is present, the GPIO line
> + should be passed here.
I would perhaps reword this a little. Its not really about
bugs/glitches. This feature is for hosts that only support edge
triggered IRQs. The codec IRQ output is level based, so if the
host only supports edge triggered IRQs then IRQs can be missed
as they don't necessarily generate another edge. This adds a
polling loop to ensure the IRQ line has deasserted before exiting
the IRQ handler, forcing the next IRQ to generate another edge.
Perhaps something like:
A functional IRQ should be provided in the interrupts
property. This property enables edge triggered IRQ emulation
for hosts that don't support the codecs level triggered IRQ
output. The GPIO line corresponding to the IRQ will be polled
until all IRQs have been handled, ensuring an edge is generated
for the next IRQ.
Thanks,
Charles
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-03-17 13:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-17 9:28 [PATCH v2 0/2] mfd: arizona: Move IRQ GPIO to GPIO descriptor Linus Walleij
2026-03-17 9:28 ` [PATCH v2 1/2] dt-bindings: mfd: wlf,arizona: Add irq-gpios Linus Walleij
2026-03-17 13:22 ` Charles Keepax
2026-03-17 9:28 ` [PATCH v2 2/2] mfd: arizona: Convert GPIO IRQ handling to descriptors Linus Walleij
2026-03-17 13:13 ` Charles Keepax
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox