aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/intel/boards
diff options
context:
space:
mode:
authorYong Zhi <yong.zhi@intel.com>2016-09-26 16:02:29 -0400
committerMark Brown <broonie@kernel.org>2016-09-26 17:05:29 -0400
commit43c02ede76a60de38504f4f4fd6042f677be093a (patch)
tree75ca54d38b52ec77fb2d55df033fd01fd822707d /sound/soc/intel/boards
parent88b456b0f4a2a4c10c141a7d83113a8ce2164463 (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.c63
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
256static 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
266static 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
278static const struct snd_soc_ops broxton_dmic_ops = {
279 .startup = broxton_dmic_startup,
280};
281
282static const unsigned int rates_16000[] = {
283 16000,
284};
285
286static const struct snd_pcm_hw_constraint_list constraints_16000 = {
287 .count = ARRAY_SIZE(rates_16000),
288 .list = rates_16000,
289};
290
291static 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
298static 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 */
256static struct snd_soc_dai_link broxton_dais[] = { 303static 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 },