MLK-20357-1: ASoC: imx-rpmsg: add audio routing for wm8960
authorShengjiu Wang <shengjiu.wang@nxp.com>
Wed, 14 Nov 2018 06:49:34 +0000 (14:49 +0800)
committerLeonard Crestez <leonard.crestez@nxp.com>
Wed, 17 Apr 2019 23:51:34 +0000 (02:51 +0300)
The rpmsg wm8960 codec driver is completed to support
full function, not only the volume control. which cause
an issue that there is no sound when recording, the reason
is that the MIC Bias not enabled, and it should be enabled
through audio routing.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
sound/soc/fsl/imx-rpmsg.c

index 2478462..13a9e7d 100644 (file)
@@ -29,6 +29,13 @@ struct imx_rpmsg_data {
        struct snd_soc_card card;
 };
 
+static const struct snd_soc_dapm_widget imx_wm8960_dapm_widgets[] = {
+       SND_SOC_DAPM_HP("Headphone Jack", NULL),
+       SND_SOC_DAPM_SPK("Ext Spk", NULL),
+       SND_SOC_DAPM_MIC("Mic Jack", NULL),
+       SND_SOC_DAPM_MIC("Main MIC", NULL),
+};
+
 static int imx_rpmsg_probe(struct platform_device *pdev)
 {
        struct device_node *cpu_np;
@@ -116,6 +123,17 @@ static int imx_rpmsg_probe(struct platform_device *pdev)
        if (ret)
                goto fail;
 
+       if (rpmsg_i2s->codec_wm8960) {
+               ret = snd_soc_of_parse_audio_routing(&data->card,
+                                               "audio-routing");
+               if (ret)
+                       goto fail;
+
+               data->card.dapm_widgets = imx_wm8960_dapm_widgets;
+               data->card.num_dapm_widgets =
+                               ARRAY_SIZE(imx_wm8960_dapm_widgets);
+       }
+
        platform_set_drvdata(pdev, &data->card);
        snd_soc_card_set_drvdata(&data->card, data);
        ret = devm_snd_soc_register_card(&pdev->dev, &data->card);