aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/intel/boards
diff options
context:
space:
mode:
authorSenthilnathan Veppur <senthilnathanx.veppur@intel.com>2016-06-13 08:28:58 -0400
committerMark Brown <broonie@kernel.org>2016-06-14 09:59:33 -0400
commitbfcdc6d19008c0f11cba30c2cff1b63ec4e7a744 (patch)
tree53d596affe8f4c0fcc6b48c99150a9814d52c344 /sound/soc/intel/boards
parent7b96144df1b143750921605d8b29494d3e93c150 (diff)
ASoC: Intel: Add DMIC 4 channel support for bxt machine
Like Skylake, we can support 4 channel for DMIC, so add hw_params and constraints in the bxt-rt298 machine While at it, also add codec1 pipe for speaker playback. Signed-off-by: Senthilnathan Veppur <senthilnathanx.veppur@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/intel/boards')
-rw-r--r--sound/soc/intel/boards/bxt_rt298.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/sound/soc/intel/boards/bxt_rt298.c b/sound/soc/intel/boards/bxt_rt298.c
index f4787515c0ed..9b649b6cc757 100644
--- a/sound/soc/intel/boards/bxt_rt298.c
+++ b/sound/soc/intel/boards/bxt_rt298.c
@@ -33,6 +33,7 @@ enum {
33 BXT_DPCM_AUDIO_PB = 0, 33 BXT_DPCM_AUDIO_PB = 0,
34 BXT_DPCM_AUDIO_CP, 34 BXT_DPCM_AUDIO_CP,
35 BXT_DPCM_AUDIO_REF_CP, 35 BXT_DPCM_AUDIO_REF_CP,
36 BXT_DPCM_AUDIO_DMIC_CP,
36 BXT_DPCM_AUDIO_HDMI1_PB, 37 BXT_DPCM_AUDIO_HDMI1_PB,
37 BXT_DPCM_AUDIO_HDMI2_PB, 38 BXT_DPCM_AUDIO_HDMI2_PB,
38 BXT_DPCM_AUDIO_HDMI3_PB, 39 BXT_DPCM_AUDIO_HDMI3_PB,
@@ -88,6 +89,7 @@ static const struct snd_soc_dapm_route broxton_rt298_map[] = {
88 /* CODEC BE connections */ 89 /* CODEC BE connections */
89 { "AIF1 Playback", NULL, "ssp5 Tx"}, 90 { "AIF1 Playback", NULL, "ssp5 Tx"},
90 { "ssp5 Tx", NULL, "codec0_out"}, 91 { "ssp5 Tx", NULL, "codec0_out"},
92 { "ssp5 Tx", NULL, "codec1_out"},
91 93
92 { "codec0_in", NULL, "ssp5 Rx" }, 94 { "codec0_in", NULL, "ssp5 Rx" },
93 { "ssp5 Rx", NULL, "AIF1 Capture" }, 95 { "ssp5 Rx", NULL, "AIF1 Capture" },
@@ -169,6 +171,55 @@ static struct snd_soc_ops broxton_rt298_ops = {
169 .hw_params = broxton_rt298_hw_params, 171 .hw_params = broxton_rt298_hw_params,
170}; 172};
171 173
174static unsigned int rates[] = {
175 48000,
176};
177
178static struct snd_pcm_hw_constraint_list constraints_rates = {
179 .count = ARRAY_SIZE(rates),
180 .list = rates,
181 .mask = 0,
182};
183
184static int broxton_dmic_fixup(struct snd_soc_pcm_runtime *rtd,
185 struct snd_pcm_hw_params *params)
186{
187 struct snd_interval *channels = hw_param_interval(params,
188 SNDRV_PCM_HW_PARAM_CHANNELS);
189 if (params_channels(params) == 2)
190 channels->min = channels->max = 2;
191 else
192 channels->min = channels->max = 4;
193
194 return 0;
195}
196
197static unsigned int channels_dmic[] = {
198 2, 4,
199};
200
201static struct snd_pcm_hw_constraint_list constraints_dmic_channels = {
202 .count = ARRAY_SIZE(channels_dmic),
203 .list = channels_dmic,
204 .mask = 0,
205};
206
207static int broxton_dmic_startup(struct snd_pcm_substream *substream)
208{
209 struct snd_pcm_runtime *runtime = substream->runtime;
210
211 runtime->hw.channels_max = 4;
212 snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
213 &constraints_dmic_channels);
214
215 return snd_pcm_hw_constraint_list(substream->runtime, 0,
216 SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);
217}
218
219static struct snd_soc_ops broxton_dmic_ops = {
220 .startup = broxton_dmic_startup,
221};
222
172/* broxton digital audio interface glue - connects codec <--> CPU */ 223/* broxton digital audio interface glue - connects codec <--> CPU */
173static struct snd_soc_dai_link broxton_rt298_dais[] = { 224static struct snd_soc_dai_link broxton_rt298_dais[] = {
174 /* Front End DAI links */ 225 /* Front End DAI links */
@@ -211,6 +262,20 @@ static struct snd_soc_dai_link broxton_rt298_dais[] = {
211 .nonatomic = 1, 262 .nonatomic = 1,
212 .dynamic = 1, 263 .dynamic = 1,
213 }, 264 },
265 [BXT_DPCM_AUDIO_DMIC_CP]
266 {
267 .name = "Bxt Audio DMIC cap",
268 .stream_name = "dmiccap",
269 .cpu_dai_name = "DMIC Pin",
270 .codec_name = "snd-soc-dummy",
271 .codec_dai_name = "snd-soc-dummy-dai",
272 .platform_name = "0000:00:0e.0",
273 .init = NULL,
274 .dpcm_capture = 1,
275 .nonatomic = 1,
276 .dynamic = 1,
277 .ops = &broxton_dmic_ops,
278 },
214 [BXT_DPCM_AUDIO_HDMI1_PB] 279 [BXT_DPCM_AUDIO_HDMI1_PB]
215 { 280 {
216 .name = "Bxt HDMI Port1", 281 .name = "Bxt HDMI Port1",
@@ -276,6 +341,7 @@ static struct snd_soc_dai_link broxton_rt298_dais[] = {
276 .codec_name = "dmic-codec", 341 .codec_name = "dmic-codec",
277 .codec_dai_name = "dmic-hifi", 342 .codec_dai_name = "dmic-hifi",
278 .platform_name = "0000:00:0e.0", 343 .platform_name = "0000:00:0e.0",
344 .be_hw_params_fixup = broxton_dmic_fixup,
279 .ignore_suspend = 1, 345 .ignore_suspend = 1,
280 .dpcm_capture = 1, 346 .dpcm_capture = 1,
281 .no_pcm = 1, 347 .no_pcm = 1,