MLK-19854-1: ASoC: imx-wm8960: fix error when m4 image is not loaded

With rpmsg sound, when the m4 image is not loaded. There is error log

[ 46.275223] imx-wm8960 sound-rpmsg-wm8960: ASoC: CODEC DAI rpmsg-wm8960-hifi not registered
[ 46.284543] imx-wm8960 sound-rpmsg-wm8960: snd_soc_register_card failed (-517)

The issue is caused by that codec is not registered, the sound
card registration will fail

So add check in probe function for codec dai is ready or not.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
This commit is contained in:
Shengjiu Wang
2018-10-11 18:00:08 +08:00
committed by Jason Liu
parent 2bf5f97047
commit a52c88bc39

View File

@ -448,6 +448,8 @@ static int imx_wm8960_probe(struct platform_device *pdev)
struct imx_wm8960_data *data;
struct platform_device *asrc_pdev = NULL;
struct device_node *asrc_np;
struct snd_soc_dai_link_component dlc = { 0 };
struct snd_soc_dai *codec_dai;
u32 width;
int ret;
@ -537,6 +539,12 @@ static int imx_wm8960_probe(struct platform_device *pdev)
if (data->is_codec_rpmsg) {
imx_wm8960_dai[0].codec_name = "rpmsg-audio-codec-wm8960";
imx_wm8960_dai[0].codec_dai_name = "rpmsg-wm8960-hifi";
dlc.name = "rpmsg-audio-codec-wm8960";
dlc.dai_name = "rpmsg-wm8960-hifi";
codec_dai = snd_soc_find_dai(&dlc);
if (!codec_dai)
return -ENODEV;
} else
imx_wm8960_dai[0].codec_of_node = codec_np;