Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ALSA: usb-audio: Trust fields given in the quirk

The maxpacksize field is given in some quirks, but it gets ignored (in
favour of wMaxPacketSize from the first endpoint.) This patch favours
the one in the quirk.

Digidesign Mbox and Mbox 2 are the only affected quirks and the devices
are assumed to be working without this patch. So for safety against the
values in the quirk being incorrect, remove them.

The datainterval is also ignored but there are not currently any quirks
which choose to override this.

Cc: Damien Zammit <damien@zamaudio.com>
Cc: Chris J Arges <christopherarges@gmail.com>
Signed-off-by: Mark Hills <mark@xwax.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>

authored by

Mark Hills and committed by
Takashi Iwai
59ea586f 5e212332

+4 -5
-3
sound/usb/quirks-table.h
··· 3036 3036 .attributes = UAC_EP_CS_ATTR_SAMPLE_RATE, 3037 3037 .endpoint = 0x02, 3038 3038 .ep_attr = 0x01, 3039 - .maxpacksize = 0x130, 3040 3039 .rates = SNDRV_PCM_RATE_44100 | 3041 3040 SNDRV_PCM_RATE_48000, 3042 3041 .rate_min = 44100, ··· 3083 3084 .attributes = 0x00, 3084 3085 .endpoint = 0x03, 3085 3086 .ep_attr = USB_ENDPOINT_SYNC_ASYNC, 3086 - .maxpacksize = 0x128, 3087 3087 .rates = SNDRV_PCM_RATE_48000, 3088 3088 .rate_min = 48000, 3089 3089 .rate_max = 48000, ··· 3108 3110 .attributes = UAC_EP_CS_ATTR_SAMPLE_RATE, 3109 3111 .endpoint = 0x85, 3110 3112 .ep_attr = USB_ENDPOINT_SYNC_SYNC, 3111 - .maxpacksize = 0x128, 3112 3113 .rates = SNDRV_PCM_RATE_48000, 3113 3114 .rate_min = 48000, 3114 3115 .rate_max = 48000,
+4 -2
sound/usb/quirks.c
··· 165 165 return -EINVAL; 166 166 } 167 167 alts = &iface->altsetting[fp->altset_idx]; 168 - fp->datainterval = snd_usb_parse_datainterval(chip, alts); 169 - fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize); 168 + if (fp->datainterval == 0) 169 + fp->datainterval = snd_usb_parse_datainterval(chip, alts); 170 + if (fp->maxpacksize == 0) 171 + fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize); 170 172 usb_set_interface(chip->dev, fp->iface, 0); 171 173 snd_usb_init_pitch(chip, fp->iface, alts, fp); 172 174 snd_usb_init_sample_rate(chip, fp->iface, alts, fp, fp->rate_max);