All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: Intel: bytcr_wm5102: Fix GPIO related probe-ordering problem
@ 2022-06-12 15:56 Hans de Goede
  2022-06-13 13:10 ` Pierre-Louis Bossart
  2022-06-13 19:22 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Hans de Goede @ 2022-06-12 15:56 UTC (permalink / raw)
  To: Cezary Rojewski, Pierre-Louis Bossart, Liam Girdwood, Jie Yang,
	Mark Brown
  Cc: Hans de Goede, alsa-devel

The "wlf,spkvdd-ena" GPIO needed by the bytcr_wm5102 driver
is made available through a gpio-lookup table.

This gpio-lookup table is registered by drivers/mfd/arizona-spi.c, which
may get probed after the bytcr_wm5102 driver.

If the gpio-lookup table has not registered yet then the gpiod_get()
will return -ENOENT. Treat -ENOENT as -EPROBE_DEFER to still keep
things working in this case.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 sound/soc/intel/boards/bytcr_wm5102.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/sound/soc/intel/boards/bytcr_wm5102.c b/sound/soc/intel/boards/bytcr_wm5102.c
index 00384c6fbcaa..330c0ace1638 100644
--- a/sound/soc/intel/boards/bytcr_wm5102.c
+++ b/sound/soc/intel/boards/bytcr_wm5102.c
@@ -421,8 +421,17 @@ static int snd_byt_wm5102_mc_probe(struct platform_device *pdev)
 	priv->spkvdd_en_gpio = gpiod_get(codec_dev, "wlf,spkvdd-ena", GPIOD_OUT_LOW);
 	put_device(codec_dev);
 
-	if (IS_ERR(priv->spkvdd_en_gpio))
-		return dev_err_probe(dev, PTR_ERR(priv->spkvdd_en_gpio), "getting spkvdd-GPIO\n");
+	if (IS_ERR(priv->spkvdd_en_gpio)) {
+		ret = PTR_ERR(priv->spkvdd_en_gpio);
+		/*
+		 * The spkvdd gpio-lookup is registered by: drivers/mfd/arizona-spi.c,
+		 * so -ENOENT means that arizona-spi hasn't probed yet.
+		 */
+		if (ret == -ENOENT)
+			ret = -EPROBE_DEFER;
+
+		return dev_err_probe(dev, ret, "getting spkvdd-GPIO\n");
+	}
 
 	/* override platform name, if required */
 	byt_wm5102_card.dev = dev;
-- 
2.36.0


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

* Re: [PATCH] ASoC: Intel: bytcr_wm5102: Fix GPIO related probe-ordering problem
  2022-06-12 15:56 [PATCH] ASoC: Intel: bytcr_wm5102: Fix GPIO related probe-ordering problem Hans de Goede
@ 2022-06-13 13:10 ` Pierre-Louis Bossart
  2022-06-13 19:22 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Pierre-Louis Bossart @ 2022-06-13 13:10 UTC (permalink / raw)
  To: Hans de Goede, Cezary Rojewski, Liam Girdwood, Jie Yang, Mark Brown
  Cc: alsa-devel



On 6/12/22 10:56, Hans de Goede wrote:
> The "wlf,spkvdd-ena" GPIO needed by the bytcr_wm5102 driver
> is made available through a gpio-lookup table.
> 
> This gpio-lookup table is registered by drivers/mfd/arizona-spi.c, which
> may get probed after the bytcr_wm5102 driver.
> 
> If the gpio-lookup table has not registered yet then the gpiod_get()
> will return -ENOENT. Treat -ENOENT as -EPROBE_DEFER to still keep
> things working in this case.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

> ---
>  sound/soc/intel/boards/bytcr_wm5102.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/soc/intel/boards/bytcr_wm5102.c b/sound/soc/intel/boards/bytcr_wm5102.c
> index 00384c6fbcaa..330c0ace1638 100644
> --- a/sound/soc/intel/boards/bytcr_wm5102.c
> +++ b/sound/soc/intel/boards/bytcr_wm5102.c
> @@ -421,8 +421,17 @@ static int snd_byt_wm5102_mc_probe(struct platform_device *pdev)
>  	priv->spkvdd_en_gpio = gpiod_get(codec_dev, "wlf,spkvdd-ena", GPIOD_OUT_LOW);
>  	put_device(codec_dev);
>  
> -	if (IS_ERR(priv->spkvdd_en_gpio))
> -		return dev_err_probe(dev, PTR_ERR(priv->spkvdd_en_gpio), "getting spkvdd-GPIO\n");
> +	if (IS_ERR(priv->spkvdd_en_gpio)) {
> +		ret = PTR_ERR(priv->spkvdd_en_gpio);
> +		/*
> +		 * The spkvdd gpio-lookup is registered by: drivers/mfd/arizona-spi.c,
> +		 * so -ENOENT means that arizona-spi hasn't probed yet.
> +		 */
> +		if (ret == -ENOENT)
> +			ret = -EPROBE_DEFER;
> +
> +		return dev_err_probe(dev, ret, "getting spkvdd-GPIO\n");
> +	}
>  
>  	/* override platform name, if required */
>  	byt_wm5102_card.dev = dev;

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

* Re: [PATCH] ASoC: Intel: bytcr_wm5102: Fix GPIO related probe-ordering problem
  2022-06-12 15:56 [PATCH] ASoC: Intel: bytcr_wm5102: Fix GPIO related probe-ordering problem Hans de Goede
  2022-06-13 13:10 ` Pierre-Louis Bossart
@ 2022-06-13 19:22 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2022-06-13 19:22 UTC (permalink / raw)
  To: cezary.rojewski, hdegoede, pierre-louis.bossart, yang.jie, lgirdwood
  Cc: alsa-devel

On Sun, 12 Jun 2022 17:56:52 +0200, Hans de Goede wrote:
> The "wlf,spkvdd-ena" GPIO needed by the bytcr_wm5102 driver
> is made available through a gpio-lookup table.
> 
> This gpio-lookup table is registered by drivers/mfd/arizona-spi.c, which
> may get probed after the bytcr_wm5102 driver.
> 
> If the gpio-lookup table has not registered yet then the gpiod_get()
> will return -ENOENT. Treat -ENOENT as -EPROBE_DEFER to still keep
> things working in this case.
> 
> [...]

Applied to

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

Thanks!

[1/1] ASoC: Intel: bytcr_wm5102: Fix GPIO related probe-ordering problem
      commit: da440af07fc3dd2b5a5138671eba51991dd1fac8

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:[~2022-06-13 19:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-12 15:56 [PATCH] ASoC: Intel: bytcr_wm5102: Fix GPIO related probe-ordering problem Hans de Goede
2022-06-13 13:10 ` Pierre-Louis Bossart
2022-06-13 19:22 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.