ALSA: usb-audio: Filter out unsupported sample rates on Focusrite devices
authorAlexander Tsoy <alexander@tsoy.me>
Sat, 18 Apr 2020 17:58:15 +0000 (20:58 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 2 May 2020 15:24:23 +0000 (17:24 +0200)
commitb47d6d6f68a37e9e6f1fc1a1cd5d5e02e2171394
treedde0dc75fb41eaf0065b1daf2e6b423093489a00
parent83c4d03d001eb25b563e8cb4919ad6c9a0c4b0dd
ALSA: usb-audio: Filter out unsupported sample rates on Focusrite devices

commit 1c826792586f526a5a5cd21d55aad388f5bb0b23 upstream.

Many Focusrite devices supports a limited set of sample rates per
altsetting. These includes audio interfaces with ADAT ports:
 - Scarlett 18i6, 18i8 1st gen, 18i20 1st gen;
 - Scarlett 18i8 2nd gen, 18i20 2nd gen;
 - Scarlett 18i8 3rd gen, 18i20 3rd gen;
 - Clarett 2Pre USB, 4Pre USB, 8Pre USB.

Maximum rate is exposed in the last 4 bytes of Format Type descriptor
which has a non-standard bLength = 10.

Tested-by: Alexey Skobkin <skobkin-ru@ya.ru>
Signed-off-by: Alexander Tsoy <alexander@tsoy.me>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200418175815.12211-1-alexander@tsoy.me
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/usb/format.c