ASoC: Intel: update bxt_da7219_max98357a to support quad ch dmic capture
authorSathyanarayana Nujella <sathyanarayana.nujella@intel.com>
Tue, 6 Dec 2016 15:08:36 +0000 (07:08 -0800)
committerMark Brown <broonie@kernel.org>
Tue, 6 Dec 2016 15:13:11 +0000 (15:13 +0000)
This patch updates FE channel constraints & BE fixup to support
quad channel DMIC capture.
DMIC pin's BE fixup is configured based on channel input, i.e.
either stereo or quad.

Signed-off-by: Sathyanarayana Nujella <sathyanarayana.nujella@intel.com>
Signed-off-by: Harsha Priya <harshapriya.n@intel.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/boards/bxt_da7219_max98357a.c

index bff80b4672627712ef92e7d4a88a26a78305d121..3a8c24a590205e152c2af78bffe1aae2e3b00f46 100644 (file)
@@ -30,6 +30,7 @@
 #define BXT_DIALOG_CODEC_DAI   "da7219-hifi"
 #define BXT_MAXIM_CODEC_DAI    "HiFi"
 #define DUAL_CHANNEL           2
+#define QUAD_CHANNEL           4
 
 static struct snd_soc_jack broxton_headset;
 
@@ -182,6 +183,16 @@ static struct snd_pcm_hw_constraint_list constraints_channels = {
        .mask = 0,
 };
 
+static unsigned int channels_quad[] = {
+       QUAD_CHANNEL,
+};
+
+static struct snd_pcm_hw_constraint_list constraints_channels_quad = {
+       .count = ARRAY_SIZE(channels_quad),
+       .list = channels_quad,
+       .mask = 0,
+};
+
 static int bxt_fe_startup(struct snd_pcm_substream *substream)
 {
        struct snd_pcm_runtime *runtime = substream->runtime;
@@ -258,7 +269,10 @@ static int broxton_dmic_fixup(struct snd_soc_pcm_runtime *rtd,
 {
        struct snd_interval *channels = hw_param_interval(params,
                                                SNDRV_PCM_HW_PARAM_CHANNELS);
-       channels->min = channels->max = DUAL_CHANNEL;
+       if (params_channels(params) == 2)
+               channels->min = channels->max = 2;
+       else
+               channels->min = channels->max = 4;
 
        return 0;
 }
@@ -267,9 +281,9 @@ static int broxton_dmic_startup(struct snd_pcm_substream *substream)
 {
        struct snd_pcm_runtime *runtime = substream->runtime;
 
-       runtime->hw.channels_max = DUAL_CHANNEL;
+       runtime->hw.channels_min = runtime->hw.channels_max = QUAD_CHANNEL;
        snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
-                       &constraints_channels);
+                       &constraints_channels_quad);
 
        return snd_pcm_hw_constraint_list(substream->runtime, 0,
                        SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);