mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ASoC: es8316: Handle optional IRQ assignment
@ 2023-03-28  9:49 Cristian Ciocaltea
  2023-03-28 10:15 ` Hans de Goede
  2023-03-28 15:52 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Cristian Ciocaltea @ 2023-03-28  9:49 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai, Hans de Goede
  Cc: alsa-devel, linux-kernel, kernel

The driver is able to work fine without relying on a mandatory interrupt
being assigned to the I2C device. This is only needed when making use of
the jack-detect support.

However, the following warning message is always emitted when there is
no such interrupt available:

  es8316 0-0011: Failed to get IRQ 0: -22

Do not attempt to request an IRQ if it is not available/valid. This also
ensures the rather misleading message is not displayed anymore.

Also note the IRQ validation relies on commit dab472eb931bc291 ("i2c /
ACPI: Use 0 to indicate that device does not have interrupt assigned").

Fixes: 822257661031 ("ASoC: es8316: Add jack-detect support")
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
 sound/soc/codecs/es8316.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/sound/soc/codecs/es8316.c b/sound/soc/codecs/es8316.c
index 056c3082fe02..f7d7a9c91e04 100644
--- a/sound/soc/codecs/es8316.c
+++ b/sound/soc/codecs/es8316.c
@@ -842,12 +842,14 @@ static int es8316_i2c_probe(struct i2c_client *i2c_client)
 	es8316->irq = i2c_client->irq;
 	mutex_init(&es8316->lock);
 
-	ret = devm_request_threaded_irq(dev, es8316->irq, NULL, es8316_irq,
-					IRQF_TRIGGER_HIGH | IRQF_ONESHOT | IRQF_NO_AUTOEN,
-					"es8316", es8316);
-	if (ret) {
-		dev_warn(dev, "Failed to get IRQ %d: %d\n", es8316->irq, ret);
-		es8316->irq = -ENXIO;
+	if (es8316->irq > 0) {
+		ret = devm_request_threaded_irq(dev, es8316->irq, NULL, es8316_irq,
+						IRQF_TRIGGER_HIGH | IRQF_ONESHOT | IRQF_NO_AUTOEN,
+						"es8316", es8316);
+		if (ret) {
+			dev_warn(dev, "Failed to get IRQ %d: %d\n", es8316->irq, ret);
+			es8316->irq = -ENXIO;
+		}
 	}
 
 	return devm_snd_soc_register_component(&i2c_client->dev,
-- 
2.40.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: es8316: Handle optional IRQ assignment
  2023-03-28  9:49 [PATCH] ASoC: es8316: Handle optional IRQ assignment Cristian Ciocaltea
@ 2023-03-28 10:15 ` Hans de Goede
  2023-03-28 15:52 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Hans de Goede @ 2023-03-28 10:15 UTC (permalink / raw)
  To: Cristian Ciocaltea, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai
  Cc: alsa-devel, linux-kernel, kernel

Hi,

On 3/28/23 11:49, Cristian Ciocaltea wrote:
> The driver is able to work fine without relying on a mandatory interrupt
> being assigned to the I2C device. This is only needed when making use of
> the jack-detect support.
> 
> However, the following warning message is always emitted when there is
> no such interrupt available:
> 
>   es8316 0-0011: Failed to get IRQ 0: -22
> 
> Do not attempt to request an IRQ if it is not available/valid. This also
> ensures the rather misleading message is not displayed anymore.
> 
> Also note the IRQ validation relies on commit dab472eb931bc291 ("i2c /
> ACPI: Use 0 to indicate that device does not have interrupt assigned").
> 
> Fixes: 822257661031 ("ASoC: es8316: Add jack-detect support")
> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans



> ---
>  sound/soc/codecs/es8316.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/sound/soc/codecs/es8316.c b/sound/soc/codecs/es8316.c
> index 056c3082fe02..f7d7a9c91e04 100644
> --- a/sound/soc/codecs/es8316.c
> +++ b/sound/soc/codecs/es8316.c
> @@ -842,12 +842,14 @@ static int es8316_i2c_probe(struct i2c_client *i2c_client)
>  	es8316->irq = i2c_client->irq;
>  	mutex_init(&es8316->lock);
>  
> -	ret = devm_request_threaded_irq(dev, es8316->irq, NULL, es8316_irq,
> -					IRQF_TRIGGER_HIGH | IRQF_ONESHOT | IRQF_NO_AUTOEN,
> -					"es8316", es8316);
> -	if (ret) {
> -		dev_warn(dev, "Failed to get IRQ %d: %d\n", es8316->irq, ret);
> -		es8316->irq = -ENXIO;
> +	if (es8316->irq > 0) {
> +		ret = devm_request_threaded_irq(dev, es8316->irq, NULL, es8316_irq,
> +						IRQF_TRIGGER_HIGH | IRQF_ONESHOT | IRQF_NO_AUTOEN,
> +						"es8316", es8316);
> +		if (ret) {
> +			dev_warn(dev, "Failed to get IRQ %d: %d\n", es8316->irq, ret);
> +			es8316->irq = -ENXIO;
> +		}
>  	}
>  
>  	return devm_snd_soc_register_component(&i2c_client->dev,


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: es8316: Handle optional IRQ assignment
  2023-03-28  9:49 [PATCH] ASoC: es8316: Handle optional IRQ assignment Cristian Ciocaltea
  2023-03-28 10:15 ` Hans de Goede
@ 2023-03-28 15:52 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2023-03-28 15:52 UTC (permalink / raw)
  To: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Hans de Goede,
	Cristian Ciocaltea
  Cc: alsa-devel, linux-kernel, kernel

On Tue, 28 Mar 2023 12:49:01 +0300, Cristian Ciocaltea wrote:
> The driver is able to work fine without relying on a mandatory interrupt
> being assigned to the I2C device. This is only needed when making use of
> the jack-detect support.
> 
> However, the following warning message is always emitted when there is
> no such interrupt available:
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: es8316: Handle optional IRQ assignment
      commit: 39db65a0a17b54915b269d3685f253a4731f344c

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-03-28 15:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-28  9:49 [PATCH] ASoC: es8316: Handle optional IRQ assignment Cristian Ciocaltea
2023-03-28 10:15 ` Hans de Goede
2023-03-28 15:52 ` Mark Brown

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®