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
421 priv->spkvdd_en_gpio = gpiod_get(codec_dev, "wlf,spkvdd-ena", GPIOD_OUT_LOW);421 priv->spkvdd_en_gpio = gpiod_get(codec_dev, "wlf,spkvdd-ena", GPIOD_OUT_LOW);
422 put_device(codec_dev);422 put_device(codec_dev);
423 423
424 if (IS_ERR(priv->spkvdd_en_gpio))424 if (IS_ERR(priv->spkvdd_en_gpio)) {
425 return dev_err_probe(dev, PTR_ERR(priv->spkvdd_en_gpio), "getting spkvdd-GPIO\n");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 }
426 435
427 /* override platform name, if required */436 /* override platform name, if required */
428 byt_wm5102_card.dev = dev;437 byt_wm5102_card.dev = dev;