Merge tag 'sound-6.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai...
[sfrench/cifs-2.6.git] / sound / soc / intel / boards / sof_rt5682.c
index 4a90a0a5d8315b8c68cfcc9103102ea2d8ccab61..045965312245b4bb5ace04ab3ef2e940b3703f79 100644 (file)
@@ -247,6 +247,17 @@ static int sof_hdmi_init(struct snd_soc_pcm_runtime *rtd)
        return 0;
 }
 
+static struct snd_soc_jack_pin jack_pins[] = {
+       {
+               .pin    = "Headphone Jack",
+               .mask   = SND_JACK_HEADPHONE,
+       },
+       {
+               .pin    = "Headset Mic",
+               .mask   = SND_JACK_MICROPHONE,
+       },
+};
+
 static int sof_rt5682_codec_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct sof_card_private *ctx = snd_soc_card_get_drvdata(rtd->card);
@@ -294,11 +305,13 @@ static int sof_rt5682_codec_init(struct snd_soc_pcm_runtime *rtd)
         * Headset buttons map to the google Reference headset.
         * These can be configured by userspace.
         */
-       ret = snd_soc_card_jack_new(rtd->card, "Headset Jack",
-                                   SND_JACK_HEADSET | SND_JACK_BTN_0 |
-                                   SND_JACK_BTN_1 | SND_JACK_BTN_2 |
-                                   SND_JACK_BTN_3,
-                                   &ctx->sof_headset);
+       ret = snd_soc_card_jack_new_pins(rtd->card, "Headset Jack",
+                                        SND_JACK_HEADSET | SND_JACK_BTN_0 |
+                                        SND_JACK_BTN_1 | SND_JACK_BTN_2 |
+                                        SND_JACK_BTN_3,
+                                        &ctx->sof_headset,
+                                        jack_pins,
+                                        ARRAY_SIZE(jack_pins));
        if (ret) {
                dev_err(rtd->dev, "Headset Jack creation failed: %d\n", ret);
                return ret;
@@ -434,6 +447,15 @@ static int sof_card_late_probe(struct snd_soc_card *card)
        struct sof_hdmi_pcm *pcm;
        int err;
 
+       if (sof_rt5682_quirk & SOF_MAX98373_SPEAKER_AMP_PRESENT) {
+               /* Disable Left and Right Spk pin after boot */
+               snd_soc_dapm_disable_pin(dapm, "Left Spk");
+               snd_soc_dapm_disable_pin(dapm, "Right Spk");
+               err = snd_soc_dapm_sync(dapm);
+               if (err < 0)
+                       return err;
+       }
+
        /* HDMI is not supported by SOF on Baytrail/CherryTrail */
        if (is_legacy_cpu || !ctx->idisp_codec)
                return 0;
@@ -464,15 +486,6 @@ static int sof_card_late_probe(struct snd_soc_card *card)
                        return err;
        }
 
-       if (sof_rt5682_quirk & SOF_MAX98373_SPEAKER_AMP_PRESENT) {
-               /* Disable Left and Right Spk pin after boot */
-               snd_soc_dapm_disable_pin(dapm, "Left Spk");
-               snd_soc_dapm_disable_pin(dapm, "Right Spk");
-               err = snd_soc_dapm_sync(dapm);
-               if (err < 0)
-                       return err;
-       }
-
        return hdac_hdmi_jack_port_init(component, &card->dapm);
 }
 
@@ -731,7 +744,7 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
                } else if (sof_rt5682_quirk & SOF_RT1015P_SPEAKER_AMP_PRESENT) {
                        sof_rt1015p_dai_link(&links[id]);
                } else if (sof_rt5682_quirk & SOF_RT1019_SPEAKER_AMP_PRESENT) {
-                       sof_rt1019_dai_link(&links[id]);
+                       sof_rt1019p_dai_link(&links[id]);
                } else if (sof_rt5682_quirk &
                                SOF_MAX98373_SPEAKER_AMP_PRESENT) {
                        links[id].codecs = max_98373_components;
@@ -1079,6 +1092,14 @@ static const struct platform_device_id board_ids[] = {
                                        SOF_RT5682_SSP_AMP(1) |
                                        SOF_RT5682_NUM_HDMIDEV(4)),
        },
+       {
+               .name = "mtl_mx98357_rt5682",
+               .driver_data = (kernel_ulong_t)(SOF_RT5682_MCLK_EN |
+                                       SOF_RT5682_SSP_CODEC(0) |
+                                       SOF_SPEAKER_AMP_PRESENT |
+                                       SOF_RT5682_SSP_AMP(1) |
+                                       SOF_RT5682_NUM_HDMIDEV(4)),
+       },
        { }
 };
 MODULE_DEVICE_TABLE(platform, board_ids);