ASoC: cs42l43: Add shared IRQ flag for shutters

The microphone and speaker shutters on cs42l43 can be configured to
trigger from the same GPIO, in this case the current code returns an
error as we attempt to request two IRQ handlers for the same IRQ. Fix
this by always requesting the shutter IRQs with the IRQF_SHARED flag.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230915144300.120100-1-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Charles Keepax 2023-09-15 15:43:00 +01:00 committed by Mark Brown
parent b19a5733de
commit c923e7759a
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -2077,7 +2077,8 @@ static const struct cs42l43_irq cs42l43_irqs[] = {
static int cs42l43_request_irq(struct cs42l43_codec *priv, static int cs42l43_request_irq(struct cs42l43_codec *priv,
struct irq_domain *dom, const char * const name, struct irq_domain *dom, const char * const name,
unsigned int irq, irq_handler_t handler) unsigned int irq, irq_handler_t handler,
unsigned long flags)
{ {
int ret; int ret;
@ -2087,8 +2088,8 @@ static int cs42l43_request_irq(struct cs42l43_codec *priv,
dev_dbg(priv->dev, "Request IRQ %d for %s\n", ret, name); dev_dbg(priv->dev, "Request IRQ %d for %s\n", ret, name);
ret = devm_request_threaded_irq(priv->dev, ret, NULL, handler, IRQF_ONESHOT, ret = devm_request_threaded_irq(priv->dev, ret, NULL, handler,
name, priv); IRQF_ONESHOT | flags, name, priv);
if (ret) if (ret)
return dev_err_probe(priv->dev, ret, "Failed to request IRQ %s\n", name); return dev_err_probe(priv->dev, ret, "Failed to request IRQ %s\n", name);
@ -2124,11 +2125,11 @@ static int cs42l43_shutter_irq(struct cs42l43_codec *priv,
return 0; return 0;
} }
ret = cs42l43_request_irq(priv, dom, close_name, close_irq, handler); ret = cs42l43_request_irq(priv, dom, close_name, close_irq, handler, IRQF_SHARED);
if (ret) if (ret)
return ret; return ret;
return cs42l43_request_irq(priv, dom, open_name, open_irq, handler); return cs42l43_request_irq(priv, dom, open_name, open_irq, handler, IRQF_SHARED);
} }
static int cs42l43_codec_probe(struct platform_device *pdev) static int cs42l43_codec_probe(struct platform_device *pdev)
@ -2178,7 +2179,8 @@ static int cs42l43_codec_probe(struct platform_device *pdev)
for (i = 0; i < ARRAY_SIZE(cs42l43_irqs); i++) { for (i = 0; i < ARRAY_SIZE(cs42l43_irqs); i++) {
ret = cs42l43_request_irq(priv, dom, cs42l43_irqs[i].name, ret = cs42l43_request_irq(priv, dom, cs42l43_irqs[i].name,
cs42l43_irqs[i].irq, cs42l43_irqs[i].handler); cs42l43_irqs[i].irq,
cs42l43_irqs[i].handler, 0);
if (ret) if (ret)
goto err_pm; goto err_pm;
} }