Merge tag 'sound-5.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai...
[sfrench/cifs-2.6.git] / sound / soc / intel / boards / kbl_da7219_max98357a.c
index dc3d897ad2802d1ebc579213101b24f459f04a19..c0d8a73c6d21808da98aa71e79115b8ee597b122 100644 (file)
@@ -44,6 +44,7 @@ struct kbl_codec_private {
 enum {
        KBL_DPCM_AUDIO_PB = 0,
        KBL_DPCM_AUDIO_CP,
+       KBL_DPCM_AUDIO_REF_CP,
        KBL_DPCM_AUDIO_DMIC_CP,
        KBL_DPCM_AUDIO_HDMI1_PB,
        KBL_DPCM_AUDIO_HDMI2_PB,
@@ -90,8 +91,9 @@ static const struct snd_soc_dapm_widget kabylake_widgets[] = {
        SND_SOC_DAPM_MIC("Headset Mic", NULL),
        SND_SOC_DAPM_SPK("Spk", NULL),
        SND_SOC_DAPM_MIC("SoC DMIC", NULL),
-       SND_SOC_DAPM_SPK("DP", NULL),
-       SND_SOC_DAPM_SPK("HDMI", NULL),
+       SND_SOC_DAPM_SPK("HDMI1", NULL),
+       SND_SOC_DAPM_SPK("HDMI2", NULL),
+       SND_SOC_DAPM_SPK("HDMI3", NULL),
        SND_SOC_DAPM_SUPPLY("Platform Clock", SND_SOC_NOPM, 0, 0,
                        platform_clock_control, SND_SOC_DAPM_PRE_PMU |
                        SND_SOC_DAPM_POST_PMD),
@@ -108,8 +110,9 @@ static const struct snd_soc_dapm_route kabylake_map[] = {
        { "MIC", NULL, "Headset Mic" },
        { "DMic", NULL, "SoC DMIC" },
 
-       { "HDMI", NULL, "hif5 Output" },
-       { "DP", NULL, "hif6 Output" },
+       {"HDMI1", NULL, "hif5-0 Output"},
+       {"HDMI2", NULL, "hif6-0 Output"},
+       {"HDMI3", NULL, "hif7-0 Output"},
 
        /* CODEC BE connections */
        { "HiFi Playback", NULL, "ssp0 Tx" },
@@ -336,12 +339,49 @@ static struct snd_soc_ops kabylake_dmic_ops = {
        .startup = kabylake_dmic_startup,
 };
 
+static unsigned int rates_16000[] = {
+        16000,
+};
+
+static const struct snd_pcm_hw_constraint_list constraints_16000 = {
+        .count = ARRAY_SIZE(rates_16000),
+        .list  = rates_16000,
+};
+
+static const unsigned int ch_mono[] = {
+       1,
+};
+
+static const struct snd_pcm_hw_constraint_list constraints_refcap = {
+       .count = ARRAY_SIZE(ch_mono),
+       .list  = ch_mono,
+};
+
+static int kabylake_refcap_startup(struct snd_pcm_substream *substream)
+{
+       substream->runtime->hw.channels_max = 1;
+       snd_pcm_hw_constraint_list(substream->runtime, 0,
+                                       SNDRV_PCM_HW_PARAM_CHANNELS,
+                                       &constraints_refcap);
+
+       return snd_pcm_hw_constraint_list(substream->runtime, 0,
+                                       SNDRV_PCM_HW_PARAM_RATE,
+                                       &constraints_16000);
+}
+
+static struct snd_soc_ops skylake_refcap_ops = {
+       .startup = kabylake_refcap_startup,
+};
+
 SND_SOC_DAILINK_DEF(dummy,
        DAILINK_COMP_ARRAY(COMP_DUMMY()));
 
 SND_SOC_DAILINK_DEF(system,
        DAILINK_COMP_ARRAY(COMP_CPU("System Pin")));
 
+SND_SOC_DAILINK_DEF(reference,
+       DAILINK_COMP_ARRAY(COMP_CPU("Reference Pin")));
+
 SND_SOC_DAILINK_DEF(dmic,
        DAILINK_COMP_ARRAY(COMP_CPU("DMIC Pin")));
 
@@ -416,6 +456,16 @@ static struct snd_soc_dai_link kabylake_dais[] = {
                .ops = &kabylake_da7219_fe_ops,
                SND_SOC_DAILINK_REG(system, dummy, platform),
        },
+       [KBL_DPCM_AUDIO_REF_CP] = {
+               .name = "Kbl Audio Reference cap",
+               .stream_name = "Wake on Voice",
+               .init = NULL,
+               .dpcm_capture = 1,
+               .nonatomic = 1,
+               .dynamic = 1,
+               .ops = &skylake_refcap_ops,
+               SND_SOC_DAILINK_REG(reference, dummy, platform),
+       },
        [KBL_DPCM_AUDIO_DMIC_CP] = {
                .name = "Kbl Audio DMIC cap",
                .stream_name = "dmiccap",