[2/6] ALSA: usb: ADC3. BADD specification: fixed 48KHz sample rate.
diff mbox

Message ID 20171129105532.15420-3-jorge.sanjuan@codethink.co.uk
State New
Headers show

Commit Message

Jorge Sanjuan Nov. 29, 2017, 10:55 a.m. UTC
Make the frame rate range fixed to just 48KHz as the BADD specification
stands for ADC3 devices.

For more details check section 4.2.4 of the Basic Audio Device version
3.

Signed-off-by: Jorge Sanjuan <jorge.sanjuan@codethink.co.uk>
---
 sound/usb/format.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Patch
diff mbox

diff --git a/sound/usb/format.c b/sound/usb/format.c
index 6f8589227e6a..e8669a1e996e 100644
--- a/sound/usb/format.c
+++ b/sound/usb/format.c
@@ -445,7 +445,12 @@  static int parse_audio_format_i(struct snd_usb_audio *chip,
 	case UAC_VERSION_2:
 	case UAC_VERSION_3: {
 		/* fp->channels is already set in this case */
-		ret = parse_audio_format_rates_v2v3(chip, fp);
+		if (chip->badd_profile > UAC3_FUNCTION_SUBCLASS_FULL_ADC_3_0) {
+			fp->rate_min = fp->rate_max = 48000;
+			fp->rates = SNDRV_PCM_RATE_CONTINUOUS;
+			return 0;
+		} else
+			ret = parse_audio_format_rates_v2v3(chip, fp);
 		break;
 	}
 	}