diff options
author | Yong Zhi <yong.zhi@intel.com> | 2016-09-26 16:02:29 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-09-26 17:05:29 -0400 |
commit | 43c02ede76a60de38504f4f4fd6042f677be093a (patch) | |
tree | 75ca54d38b52ec77fb2d55df033fd01fd822707d /sound/soc/intel/boards | |
parent | 88b456b0f4a2a4c10c141a7d83113a8ce2164463 (diff) |
ASoC: Intel: Add DMIC channel constraint for bxt machine
Add channel and rate constraints for Refcap and dmiccap devices
respectively.
Signed-off-by: Yong Zhi <yong.zhi@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_da7219_max98357a.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/sound/soc/intel/boards/bxt_da7219_max98357a.c b/sound/soc/intel/boards/bxt_da7219_max98357a.c index 3774b117d365..bb4533c305c7 100644 --- a/sound/soc/intel/boards/bxt_da7219_max98357a.c +++ b/sound/soc/intel/boards/bxt_da7219_max98357a.c | |||
@@ -37,6 +37,7 @@ enum { | |||
37 | BXT_DPCM_AUDIO_PB = 0, | 37 | BXT_DPCM_AUDIO_PB = 0, |
38 | BXT_DPCM_AUDIO_CP, | 38 | BXT_DPCM_AUDIO_CP, |
39 | BXT_DPCM_AUDIO_REF_CP, | 39 | BXT_DPCM_AUDIO_REF_CP, |
40 | BXT_DPCM_AUDIO_DMIC_CP, | ||
40 | BXT_DPCM_AUDIO_HDMI1_PB, | 41 | BXT_DPCM_AUDIO_HDMI1_PB, |
41 | BXT_DPCM_AUDIO_HDMI2_PB, | 42 | BXT_DPCM_AUDIO_HDMI2_PB, |
42 | BXT_DPCM_AUDIO_HDMI3_PB, | 43 | BXT_DPCM_AUDIO_HDMI3_PB, |
@@ -252,6 +253,52 @@ static struct snd_soc_ops broxton_da7219_ops = { | |||
252 | .hw_free = broxton_da7219_hw_free, | 253 | .hw_free = broxton_da7219_hw_free, |
253 | }; | 254 | }; |
254 | 255 | ||
256 | static int broxton_dmic_fixup(struct snd_soc_pcm_runtime *rtd, | ||
257 | struct snd_pcm_hw_params *params) | ||
258 | { | ||
259 | struct snd_interval *channels = hw_param_interval(params, | ||
260 | SNDRV_PCM_HW_PARAM_CHANNELS); | ||
261 | channels->min = channels->max = DUAL_CHANNEL; | ||
262 | |||
263 | return 0; | ||
264 | } | ||
265 | |||
266 | static int broxton_dmic_startup(struct snd_pcm_substream *substream) | ||
267 | { | ||
268 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
269 | |||
270 | runtime->hw.channels_max = DUAL_CHANNEL; | ||
271 | snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, | ||
272 | &constraints_channels); | ||
273 | |||
274 | return snd_pcm_hw_constraint_list(substream->runtime, 0, | ||
275 | SNDRV_PCM_HW_PARAM_RATE, &constraints_rates); | ||
276 | } | ||
277 | |||
278 | static const struct snd_soc_ops broxton_dmic_ops = { | ||
279 | .startup = broxton_dmic_startup, | ||
280 | }; | ||
281 | |||
282 | static const unsigned int rates_16000[] = { | ||
283 | 16000, | ||
284 | }; | ||
285 | |||
286 | static const struct snd_pcm_hw_constraint_list constraints_16000 = { | ||
287 | .count = ARRAY_SIZE(rates_16000), | ||
288 | .list = rates_16000, | ||
289 | }; | ||
290 | |||
291 | static int broxton_refcap_startup(struct snd_pcm_substream *substream) | ||
292 | { | ||
293 | return snd_pcm_hw_constraint_list(substream->runtime, 0, | ||
294 | SNDRV_PCM_HW_PARAM_RATE, | ||
295 | &constraints_16000); | ||
296 | }; | ||
297 | |||
298 | static struct snd_soc_ops broxton_refcap_ops = { | ||
299 | .startup = broxton_refcap_startup, | ||
300 | }; | ||
301 | |||
255 | /* broxton digital audio interface glue - connects codec <--> CPU */ | 302 | /* broxton digital audio interface glue - connects codec <--> CPU */ |
256 | static struct snd_soc_dai_link broxton_dais[] = { | 303 | static struct snd_soc_dai_link broxton_dais[] = { |
257 | /* Front End DAI links */ | 304 | /* Front End DAI links */ |
@@ -299,6 +346,21 @@ static struct snd_soc_dai_link broxton_dais[] = { | |||
299 | .ignore_suspend = 1, | 346 | .ignore_suspend = 1, |
300 | .nonatomic = 1, | 347 | .nonatomic = 1, |
301 | .dynamic = 1, | 348 | .dynamic = 1, |
349 | .ops = &broxton_refcap_ops, | ||
350 | }, | ||
351 | [BXT_DPCM_AUDIO_DMIC_CP] | ||
352 | { | ||
353 | .name = "Bxt Audio DMIC cap", | ||
354 | .stream_name = "dmiccap", | ||
355 | .cpu_dai_name = "DMIC Pin", | ||
356 | .codec_name = "snd-soc-dummy", | ||
357 | .codec_dai_name = "snd-soc-dummy-dai", | ||
358 | .platform_name = "0000:00:0e.0", | ||
359 | .init = NULL, | ||
360 | .dpcm_capture = 1, | ||
361 | .nonatomic = 1, | ||
362 | .dynamic = 1, | ||
363 | .ops = &broxton_dmic_ops, | ||
302 | }, | 364 | }, |
303 | [BXT_DPCM_AUDIO_HDMI1_PB] | 365 | [BXT_DPCM_AUDIO_HDMI1_PB] |
304 | { | 366 | { |
@@ -382,6 +444,7 @@ static struct snd_soc_dai_link broxton_dais[] = { | |||
382 | .codec_dai_name = "dmic-hifi", | 444 | .codec_dai_name = "dmic-hifi", |
383 | .platform_name = "0000:00:0e.0", | 445 | .platform_name = "0000:00:0e.0", |
384 | .ignore_suspend = 1, | 446 | .ignore_suspend = 1, |
447 | .be_hw_params_fixup = broxton_dmic_fixup, | ||
385 | .dpcm_capture = 1, | 448 | .dpcm_capture = 1, |
386 | .no_pcm = 1, | 449 | .no_pcm = 1, |
387 | }, | 450 | }, |