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: Hans de Goede <hdegoede@redhat.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220612155652.107310-1-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Hans de Goede 2022-06-12 17:56:52 +02:00 committed by Mark Brown
parent a7d9391dc3
commit 4e07479eab
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
1 changed files with 11 additions and 2 deletions

View File

@ -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;