From nobody Thu Apr 2 22:13:15 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 702ECEEBB; Thu, 26 Mar 2026 10:51:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774522278; cv=none; b=SUdUT09lM08oXZJyXukvW4kdcFj7XiBR9PxjXfxCSgfwplfoMpGmhKkIpB5sWfXBx/uppurobngC5Gf3qobYpUfHTcP4meO8mIwVdADrSTQX1FOSzAjL3/ijXrlwRfMNMVEEkBH5Yhkq5XMdj84sQKy94stt0y4o2rHK0Dx7RHQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774522278; c=relaxed/simple; bh=UzMpocvzK7/GJbYoO7dKJYmAdG0iyEhvLzrRDBLlMfg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OjwT39TPgbhfBf1sdOrdZdGYa7z8kMLL2ANVWf9DyUlWeSaLQJcBHk+6uHUfNFywM8U2vpzJLD/vkRLs+B6mh8r8vX251sWpJ+I9UhGhddicFnc3jS+YA1EQqJ5G+mVglfVxBVkMdpD1WSubJo+635ON1G67dW6QNfDysCq020Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BINEQdGl; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BINEQdGl" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1D21C19423; Thu, 26 Mar 2026 10:51:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774522278; bh=UzMpocvzK7/GJbYoO7dKJYmAdG0iyEhvLzrRDBLlMfg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=BINEQdGlWixYuaogAjUGTc0rHz3+ZJFU1qFp+ysUhPxqSyx+5gVieEeS8AwjgN2tG hw1LI47EpXzE2JPr530Scf/zonv/LpWpaWTgoNryr5OVbNagjpzmaZp1pNMG8gvuOx otM9ocaF36BdXr8VH8zW+M/IRgbru3k1jwVJlkCtQCQHZdcgv1UkZcQQpaFcEByaML nOHuuXaupCge+qT38UfqQuum53ym7E/SGslggkTqgVtrzhiFUHx1idBVTdsYA8HdS2 BTVTMmov1KYRGRUS4yNNNWQpmEQl9AMYOskbUzuUUOk8UhxlwBxTCqkCHbLugfJ10b cjvjdyev9UqkQ== From: Linus Walleij Date: Thu, 26 Mar 2026 11:51:11 +0100 Subject: [PATCH v4 1/2] dt-bindings: mfd: wlf,arizona: Add irq-gpios Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260326-mfd-arizona-irq-v4-1-50c47ed0a18e@kernel.org> References: <20260326-mfd-arizona-irq-v4-0-50c47ed0a18e@kernel.org> In-Reply-To: <20260326-mfd-arizona-irq-v4-0-50c47ed0a18e@kernel.org> To: Lee Jones , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Charles Keepax Cc: patches@opensource.cirrus.com, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, Linus Walleij , Conor Dooley X-Mailer: b4 0.14.3 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. Acked-by: Conor Dooley Reviewed-by: Charles Keepax Signed-off-by: Linus Walleij Reviewed-by: Bartosz Golaszewski --- Documentation/devicetree/bindings/mfd/wlf,arizona.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Documentation/devicetree/bindings/mfd/wlf,arizona.yaml b/Docum= entation/devicetree/bindings/mfd/wlf,arizona.yaml index 7902f3c5d289..359e40b3dacb 100644 --- a/Documentation/devicetree/bindings/mfd/wlf,arizona.yaml +++ b/Documentation/devicetree/bindings/mfd/wlf,arizona.yaml @@ -194,6 +194,16 @@ properties: reset-gpios: maxItems: 1 =20 + irq-gpios: + maxItems: 1 + description: + 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. + wlf,reset: description: GPIO specifier for the GPIO controlling RESET --=20 2.53.0 From nobody Thu Apr 2 22:13:15 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CCEF73DDDD3; Thu, 26 Mar 2026 10:51:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774522280; cv=none; b=c7VV6mTM/7RUyOpX8oplHf4/4D18/+jjcnDP3Qb5AD1bMAJ4o4xa6g/bZcNwxME5HwCcyCYAKiB6iWoDZ+im2Gki+i9rsrwl3mfxc3yO9oHcoMHM+LghEDjzWExGo1Q1nF9dY7Rb+IAq8Vppv+q1xBtmxm0my3BaRAQyI7L7da4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774522280; c=relaxed/simple; bh=u6EZGlMh29IsIeDQA19WFLVtpE5oyFCv9a5xoycxBUI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RL9L6bz1Ixwb8TRjJdMUEJsDM8opy+UoNbXDyjMblZnfUesNYKsBhBUcMIH/VkLp+cdy+kIs6ozYy+vmr1iYRkIkS26gYeyLB29G8wDrsM5rYhssaQYA+VhOmL1heN7eDmTKA+jC8LCn78LoUbhHWpUSUvpTnJgmOA+oP9FUY2k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CPJIWRgp; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CPJIWRgp" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CA4AC116C6; Thu, 26 Mar 2026 10:51:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774522280; bh=u6EZGlMh29IsIeDQA19WFLVtpE5oyFCv9a5xoycxBUI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=CPJIWRgppRweaVYOahHej5lq9M383F3uuff0aKKodezrDAXutUsHUymx+mOio1QJ1 PAiak9q4Ceukp0VbvwT9uph3n1OIvR+ZchbEgBXYlroCvo6eZiS6DovFAk3JKyuQCN 1y74gfYaHqbqsHxTnNdQPkscr/WIdnbkSCfwxug2zuf90BdyYzabM7DsFcLHHOS6gB c/FcrUxKgbxFW4W3G6prq01j8mZdyn1fJ4jcxhsXbKkIueYUseKYGLYn+I3liSHdih r/AqNwnykFbzfIlcEKuAkvyGiqHP/dGsDGO7M/eI+iAm5YufNMNysGJ2c9DAJafLqK ERUFUQG9KgUhA== From: Linus Walleij Date: Thu, 26 Mar 2026 11:51:12 +0100 Subject: [PATCH v4 2/2] mfd: arizona: Convert GPIO IRQ handling to descriptors Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260326-mfd-arizona-irq-v4-2-50c47ed0a18e@kernel.org> References: <20260326-mfd-arizona-irq-v4-0-50c47ed0a18e@kernel.org> In-Reply-To: <20260326-mfd-arizona-irq-v4-0-50c47ed0a18e@kernel.org> To: Lee Jones , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Charles Keepax Cc: patches@opensource.cirrus.com, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, Linus Walleij X-Mailer: b4 0.14.3 Convert the arizona polling GPIO handling to use a GPIO descriptor 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. Reviewed-by: Charles Keepax Signed-off-by: Linus Walleij Reviewed-by: Bartosz Golaszewski --- drivers/mfd/arizona-irq.c | 46 +++++++++++++++++++----------------= ---- include/linux/mfd/arizona/core.h | 2 ++ include/linux/mfd/arizona/pdata.h | 5 ----- 3 files changed, 24 insertions(+), 29 deletions(-) diff --git a/drivers/mfd/arizona-irq.c b/drivers/mfd/arizona-irq.c index 544016d420fe..8b752a1257b1 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 =3D 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 =3D true; } -#endif } while (poll); =20 pm_runtime_put_autosuspend(arizona->dev); @@ -350,27 +348,26 @@ int arizona_irq_init(struct arizona *arizona) goto err_map_main_irq; } =20 -#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) !=3D 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 =3D gpio_to_irq(arizona->pdata.irq_gpio); - } - - ret =3D devm_gpio_request_one(arizona->dev, - arizona->pdata.irq_gpio, - GPIOF_IN, "arizona IRQ"); - if (ret !=3D 0) { - dev_err(arizona->dev, - "Failed to request IRQ GPIO %d:: %d\n", - arizona->pdata.irq_gpio, ret); - arizona->pdata.irq_gpio =3D 0; + /* + * Used to emulate edge trigger and to work around broken pinmux + * define "irq-gpios" in device tree or software node. + */ + arizona->irq_gpiod =3D devm_gpiod_get_optional(arizona->dev, "irq", + GPIOD_IN); + if (IS_ERR(arizona->irq_gpiod)) { + ret =3D dev_err_probe(arizona->dev, + PTR_ERR(arizona->irq_gpiod), + "error getting IRQ GPIO\n"); + goto err_irq_gpiod; + } + if (arizona->irq_gpiod) { + if (gpiod_to_irq(arizona->irq_gpiod) !=3D arizona->irq) { + dev_warn(arizona->dev, "IRQ %d does not match GPIO's IRQ %d\n", + arizona->irq, gpiod_to_irq(arizona->irq_gpiod)); + arizona->irq =3D gpiod_to_irq(arizona->irq_gpiod); } + gpiod_set_consumer_name(arizona->irq_gpiod, "arizona IRQ"); } -#endif =20 ret =3D request_threaded_irq(arizona->irq, NULL, arizona_irq_thread, flags, "arizona", arizona); @@ -409,6 +406,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/c= ore.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 =20 #include +#include #include #include #include @@ -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; =20 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; =20 -#ifdef CONFIG_GPIOLIB_LEGACY - /** GPIO for primary IRQ (used for edge triggered emulation) */ - int irq_gpio; -#endif - /** General purpose switch control */ unsigned int gpsw; }; --=20 2.53.0