Commit 4e07479e authored by Hans de Goede's avatar Hans de Goede Committed by Mark Brown

ASoC: Intel: bytcr_wm5102: Fix GPIO related probe-ordering problem

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: default avatarHans de Goede <hdegoede@redhat.com>
Acked-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220612155652.107310-1-hdegoede@redhat.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent a7d9391d
...@@ -421,8 +421,17 @@ static int snd_byt_wm5102_mc_probe(struct platform_device *pdev) ...@@ -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); priv->spkvdd_en_gpio = gpiod_get(codec_dev, "wlf,spkvdd-ena", GPIOD_OUT_LOW);
put_device(codec_dev); put_device(codec_dev);
if (IS_ERR(priv->spkvdd_en_gpio)) if (IS_ERR(priv->spkvdd_en_gpio)) {
return dev_err_probe(dev, PTR_ERR(priv->spkvdd_en_gpio), "getting spkvdd-GPIO\n"); 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 */ /* override platform name, if required */
byt_wm5102_card.dev = dev; byt_wm5102_card.dev = dev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment