]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - sound/soc/intel/boards/bxt_da7219_max98357a.c
Merge remote-tracking branch 'asoc/fix/intel' into asoc-linus
[mirror_ubuntu-artful-kernel.git] / sound / soc / intel / boards / bxt_da7219_max98357a.c
index 2c93fa26e13b8f5b594453d7e0b9a4a7fd34540e..865a21e557cce330508ceee677c16f82359087ee 100644 (file)
@@ -37,6 +37,7 @@ enum {
        BXT_DPCM_AUDIO_PB = 0,
        BXT_DPCM_AUDIO_CP,
        BXT_DPCM_AUDIO_REF_CP,
+       BXT_DPCM_AUDIO_DMIC_CP,
        BXT_DPCM_AUDIO_HDMI1_PB,
        BXT_DPCM_AUDIO_HDMI2_PB,
        BXT_DPCM_AUDIO_HDMI3_PB,
@@ -252,10 +253,56 @@ static struct snd_soc_ops broxton_da7219_ops = {
        .hw_free = broxton_da7219_hw_free,
 };
 
+static int broxton_dmic_fixup(struct snd_soc_pcm_runtime *rtd,
+                       struct snd_pcm_hw_params *params)
+{
+       struct snd_interval *channels = hw_param_interval(params,
+                                               SNDRV_PCM_HW_PARAM_CHANNELS);
+       channels->min = channels->max = DUAL_CHANNEL;
+
+       return 0;
+}
+
+static int broxton_dmic_startup(struct snd_pcm_substream *substream)
+{
+       struct snd_pcm_runtime *runtime = substream->runtime;
+
+       runtime->hw.channels_max = DUAL_CHANNEL;
+       snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
+                       &constraints_channels);
+
+       return snd_pcm_hw_constraint_list(substream->runtime, 0,
+                       SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);
+}
+
+static const struct snd_soc_ops broxton_dmic_ops = {
+       .startup = broxton_dmic_startup,
+};
+
+static const unsigned int rates_16000[] = {
+       16000,
+};
+
+static const struct snd_pcm_hw_constraint_list constraints_16000 = {
+       .count = ARRAY_SIZE(rates_16000),
+       .list  = rates_16000,
+};
+
+static int broxton_refcap_startup(struct snd_pcm_substream *substream)
+{
+       return snd_pcm_hw_constraint_list(substream->runtime, 0,
+                       SNDRV_PCM_HW_PARAM_RATE,
+                       &constraints_16000);
+};
+
+static struct snd_soc_ops broxton_refcap_ops = {
+       .startup = broxton_refcap_startup,
+};
+
 /* broxton digital audio interface glue - connects codec <--> CPU */
 static struct snd_soc_dai_link broxton_dais[] = {
        /* Front End DAI links */
-       [BXT_DPCM_AUDIO_PB]
+       [BXT_DPCM_AUDIO_PB] =
        {
                .name = "Bxt Audio Port",
                .stream_name = "Audio",
@@ -271,7 +318,7 @@ static struct snd_soc_dai_link broxton_dais[] = {
                .dpcm_playback = 1,
                .ops = &broxton_da7219_fe_ops,
        },
-       [BXT_DPCM_AUDIO_CP]
+       [BXT_DPCM_AUDIO_CP] =
        {
                .name = "Bxt Audio Capture Port",
                .stream_name = "Audio Record",
@@ -286,7 +333,7 @@ static struct snd_soc_dai_link broxton_dais[] = {
                .dpcm_capture = 1,
                .ops = &broxton_da7219_fe_ops,
        },
-       [BXT_DPCM_AUDIO_REF_CP]
+       [BXT_DPCM_AUDIO_REF_CP] =
        {
                .name = "Bxt Audio Reference cap",
                .stream_name = "Refcap",
@@ -299,8 +346,23 @@ static struct snd_soc_dai_link broxton_dais[] = {
                .ignore_suspend = 1,
                .nonatomic = 1,
                .dynamic = 1,
+               .ops = &broxton_refcap_ops,
+       },
+       [BXT_DPCM_AUDIO_DMIC_CP]
+       {
+               .name = "Bxt Audio DMIC cap",
+               .stream_name = "dmiccap",
+               .cpu_dai_name = "DMIC Pin",
+               .codec_name = "snd-soc-dummy",
+               .codec_dai_name = "snd-soc-dummy-dai",
+               .platform_name = "0000:00:0e.0",
+               .init = NULL,
+               .dpcm_capture = 1,
+               .nonatomic = 1,
+               .dynamic = 1,
+               .ops = &broxton_dmic_ops,
        },
-       [BXT_DPCM_AUDIO_HDMI1_PB]
+       [BXT_DPCM_AUDIO_HDMI1_PB] =
        {
                .name = "Bxt HDMI Port1",
                .stream_name = "Hdmi1",
@@ -313,7 +375,7 @@ static struct snd_soc_dai_link broxton_dais[] = {
                .nonatomic = 1,
                .dynamic = 1,
        },
-       [BXT_DPCM_AUDIO_HDMI2_PB]
+       [BXT_DPCM_AUDIO_HDMI2_PB] =
        {
                .name = "Bxt HDMI Port2",
                .stream_name = "Hdmi2",
@@ -326,7 +388,7 @@ static struct snd_soc_dai_link broxton_dais[] = {
                .nonatomic = 1,
                .dynamic = 1,
        },
-       [BXT_DPCM_AUDIO_HDMI3_PB]
+       [BXT_DPCM_AUDIO_HDMI3_PB] =
        {
                .name = "Bxt HDMI Port3",
                .stream_name = "Hdmi3",
@@ -382,6 +444,7 @@ static struct snd_soc_dai_link broxton_dais[] = {
                .codec_dai_name = "dmic-hifi",
                .platform_name = "0000:00:0e.0",
                .ignore_suspend = 1,
+               .be_hw_params_fixup = broxton_dmic_fixup,
                .dpcm_capture = 1,
                .no_pcm = 1,
        },