Re: [PATCH v7 15/34] pinctrl: airoha: fix IRQ mask/unmask code

Lorenzo Bianconi <[email protected]>
Newsgroups org.infradead.lists.linux-mediatek,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-gpio,org.kernel.vger.linux-kernel
Message-ID <amcYtIpIjyYclv4r@lore-desk>
> When using IRQCHIP_IMMUTABLE, airoha_irq_unmask() must manually call
> gpiochip_enable_irq() and airoha_irq_mask() must call
> gpiochip_disable_irq(). Without these calls, gpiolib never sets the
> GPIOD_FLAG_IRQ_IS_ENABLED bit. Because this bit is missing,
> gpiod_direction_output() will not realize the pin is actively used
> as an interrupt.

Acked-by: Lorenzo Bianconi <[email protected]>

> 
> Fixes: 1c8ace2d0725 ("pinctrl: airoha: Add support for EN7581 SoC")
> Signed-off-by: Mikhail Kshevetskiy <[email protected]>
> ---
>  drivers/pinctrl/airoha/pinctrl-airoha.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/pinctrl/airoha/pinctrl-airoha.c b/drivers/pinctrl/airoha/pinctrl-airoha.c
> index 6cf4ed5976fb0..f85941ccea560 100644
> --- a/drivers/pinctrl/airoha/pinctrl-airoha.c
> +++ b/drivers/pinctrl/airoha/pinctrl-airoha.c
> @@ -2580,6 +2580,7 @@ static void airoha_irq_unmask(struct irq_data *data)
>  	if (WARN_ON_ONCE(data->hwirq >= ARRAY_SIZE(gpiochip->irq_type)))
>  		return;
>  
> +	gpiochip_enable_irq(gc, irqd_to_hwirq(data));
>  	switch (gpiochip->irq_type[data->hwirq]) {
>  	case IRQ_TYPE_LEVEL_LOW:
>  		val = val << 1;
> @@ -2614,6 +2615,7 @@ static void airoha_irq_mask(struct irq_data *data)
>  
>  	regmap_clear_bits(pinctrl->regmap, gpiochip->level[index], mask);
>  	regmap_clear_bits(pinctrl->regmap, gpiochip->edge[index], mask);
> +	gpiochip_disable_irq(gc, irqd_to_hwirq(data));
>  }
>  
>  static int airoha_irq_type(struct irq_data *data, unsigned int type)
> -- 
> 2.53.0
>
signature.asc (application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE-----

iHUEABYKAB0WIQTquNwa3Txd3rGGn7Y6cBh0uS2trAUCamcYtAAKCRA6cBh0uS2t
rDh8AQDf2K0ZyIVFOfiaFcb2upEDJTym5mn75+5yfuBUwIbDwQEAy6+xBXdeFA9a
ODNHJGawn7QD/t8bsT580S0tfTCaUAE=
=Yt6b
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.