History

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.

Hans de Goede committed 4 years ago

Commit 4e074791 parent a7d93911 file · +11 −2Browse files

Unified · Split

sound/soc/intel/boards/bytcr_wm5102.c+11−2
@@ -421,8 +421,17 @@ static int snd_byt_wm5102_mc_probe(struct platform_device *pdev) · 420 unmodified lines
421421 priv->spkvdd_en_gpio = gpiod_get(codec_dev, "wlf,spkvdd-ena", GPIOD_OUT_LOW);
422422 put_device(codec_dev);
423423
424− if (IS_ERR(priv->spkvdd_en_gpio))
425− return dev_err_probe(dev, PTR_ERR(priv->spkvdd_en_gpio), "getting spkvdd-GPIO\n");
424+ if (IS_ERR(priv->spkvdd_en_gpio)) {
425+ ret = PTR_ERR(priv->spkvdd_en_gpio);
426+ /*
427+ * The spkvdd gpio-lookup is registered by: drivers/mfd/arizona-spi.c,
428+ * so -ENOENT means that arizona-spi hasn't probed yet.
429+ */
430+ if (ret == -ENOENT)
431+ ret = -EPROBE_DEFER;
432+
433+ return dev_err_probe(dev, ret, "getting spkvdd-GPIO\n");
434+ }
426435
427436 /* override platform name, if required */
428437 byt_wm5102_card.dev = dev;