Skip to contentSkip to conversation

ASoC: Intel: bxt: Refine the HW contraint of Ref capture.

PATCH In review Harry Pan 2 participants 2 messages Dec 5, 2017 – Dec 13, 2017

Subsystems (3)
lore
Share & tools
lore

Harry Pan

author
#0 lore raw

PATCH 1/1 ASoC: Intel: bxt: Refine the HW contraint of Ref capture.

The patch restricts the HW contraint of the refcap of WoV stream in single channel (mono) and 16k Hz based on platform implementation.

Such that, the userspace program can rely on correct HW parameters through the ALSA library call to manipulate the device.

---
 sound/soc/intel/boards/bxt_da7219_max98357a.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
sound/soc/intel/boards/bxt_da7219_max98357a.c +15 -0
index ce35ec7884d1..382f71228807 100644
@@ -338,8 +338,23 @@ static const struct snd_pcm_hw_constraint_list constraints_16000 = {
 	.list  = rates_16000,
 };
 
+static const unsigned int ch_mono[] = {
+	1,
+};
+
+static const struct snd_pcm_hw_constraint_list constraints_refcap = {
+	.count = ARRAY_SIZE(ch_mono),
+	.list  = ch_mono,
+};
+
 static int broxton_refcap_startup(struct snd_pcm_substream *substream)
 {
+	substream->runtime->hw.channels_max = 1;
+
+	snd_pcm_hw_constraint_list(substream->runtime, 0,
+					SNDRV_PCM_HW_PARAM_CHANNELS,
+					&constraints_refcap);
+
 	return snd_pcm_hw_constraint_list(substream->runtime, 0,
 			SNDRV_PCM_HW_PARAM_RATE,
 			&constraints_16000);
Signature · 1 line
2.13.5
#1 lore raw
Quoted 5 lines · Harry Pan

The patch restricts the HW contraint of the refcap of WoV stream in single channel (mono) and 16k Hz based on platform implementation.

Such that, the userspace program can rely on correct HW parameters through the ALSA library call to manipulate the device.

I think this has been discussed earlier in the context of kbl machine and we dont want kernel to have such restrictions. User space can request and open a mono stream..

Quoted 41 lines
---
 sound/soc/intel/boards/bxt_da7219_max98357a.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
sound/soc/intel/boards/bxt_da7219_max98357a.c +15 -0
index ce35ec7884d1..382f71228807 100644
@@ -338,8 +338,23 @@ static const struct snd_pcm_hw_constraint_list constraints_16000 = {
 	.list  = rates_16000,
 };
 
+static const unsigned int ch_mono[] = {
+	1,
+};
+
+static const struct snd_pcm_hw_constraint_list constraints_refcap = {
+	.count = ARRAY_SIZE(ch_mono),
+	.list  = ch_mono,
+};
+
 static int broxton_refcap_startup(struct snd_pcm_substream *substream)
 {
+	substream->runtime->hw.channels_max = 1;
+
+	snd_pcm_hw_constraint_list(substream->runtime, 0,
+					SNDRV_PCM_HW_PARAM_CHANNELS,
+					&constraints_refcap);
+
 	return snd_pcm_hw_constraint_list(substream->runtime, 0,
 			SNDRV_PCM_HW_PARAM_RATE,
 			&constraints_16000);
Signature · 6 lines
2.13.5

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Signature · 1 line
~Vinod