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.
Unified · Split
| @@ -421,8 +421,17 @@ static int snd_byt_wm5102_mc_probe(struct platform_device *pdev) · 420 unmodified lines | ||
| 421 | 421 | priv->spkvdd_en_gpio = gpiod_get(codec_dev, "wlf,spkvdd-ena", GPIOD_OUT_LOW); |
| 422 | 422 | put_device(codec_dev); |
| 423 | 423 | |
| 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 | + } | |
| 426 | 435 | |
| 427 | 436 | /* override platform name, if required */ |
| 428 | 437 | byt_wm5102_card.dev = dev; |