summaryrefslogtreecommitdiffstats
path: root/sound/usb
diff options
context:
space:
mode:
authorAndrej Krutak <dev@andree.sk>2017-02-06 20:34:58 +0100
committerTakashi Iwai <tiwai@suse.de>2017-02-07 09:40:49 +0100
commit5d81296b5e7849ba3bcc5bf430ffd37bf67ff7dc (patch)
treec28d997b973ed53112d8d2fe717b4e88dfffeba2 /sound/usb
parentMerge branch 'for-linus' into for-next (diff)
downloadlinux-5d81296b5e7849ba3bcc5bf430ffd37bf67ff7dc.tar.xz
linux-5d81296b5e7849ba3bcc5bf430ffd37bf67ff7dc.zip
ALSA: line6: Always setup isochronous transfer properties
While not all line6 devices currently support PCM, it causes no harm to 'have it prepared'. This also fixes toneport, which only has PCM - in which case we previously skipped the USB transfer properties detection completely. Signed-off-by: Andrej Krutak <dev@andree.sk> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/line6/driver.c48
1 files changed, 26 insertions, 22 deletions
diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c
index ab3c280a23d1..0ff5a7d2e19f 100644
--- a/sound/usb/line6/driver.c
+++ b/sound/usb/line6/driver.c
@@ -492,42 +492,46 @@ static void line6_destruct(struct snd_card *card)
usb_put_dev(usbdev);
}
-/* get data from endpoint descriptor (see usb_maxpacket): */
-static void line6_get_interval(struct usb_line6 *line6)
+static void line6_get_usb_properties(struct usb_line6 *line6)
{
struct usb_device *usbdev = line6->usbdev;
const struct line6_properties *properties = line6->properties;
int pipe;
- struct usb_host_endpoint *ep;
+ struct usb_host_endpoint *ep = NULL;
- if (properties->capabilities & LINE6_CAP_CONTROL_MIDI) {
- pipe =
- usb_rcvintpipe(line6->usbdev, line6->properties->ep_ctrl_r);
- } else {
- pipe =
- usb_rcvbulkpipe(line6->usbdev, line6->properties->ep_ctrl_r);
+ if (properties->capabilities & LINE6_CAP_CONTROL) {
+ if (properties->capabilities & LINE6_CAP_CONTROL_MIDI) {
+ pipe = usb_rcvintpipe(line6->usbdev,
+ line6->properties->ep_ctrl_r);
+ } else {
+ pipe = usb_rcvbulkpipe(line6->usbdev,
+ line6->properties->ep_ctrl_r);
+ }
+ ep = usbdev->ep_in[usb_pipeendpoint(pipe)];
}
- ep = usbdev->ep_in[usb_pipeendpoint(pipe)];
+ /* Control data transfer properties */
if (ep) {
line6->interval = ep->desc.bInterval;
- if (usbdev->speed == USB_SPEED_LOW) {
- line6->intervals_per_second = USB_LOW_INTERVALS_PER_SECOND;
- line6->iso_buffers = USB_LOW_ISO_BUFFERS;
- } else {
- line6->intervals_per_second = USB_HIGH_INTERVALS_PER_SECOND;
- line6->iso_buffers = USB_HIGH_ISO_BUFFERS;
- }
-
line6->max_packet_size = le16_to_cpu(ep->desc.wMaxPacketSize);
} else {
- dev_err(line6->ifcdev,
- "endpoint not available, using fallback values");
+ if (properties->capabilities & LINE6_CAP_CONTROL) {
+ dev_err(line6->ifcdev,
+ "endpoint not available, using fallback values");
+ }
line6->interval = LINE6_FALLBACK_INTERVAL;
line6->max_packet_size = LINE6_FALLBACK_MAXPACKETSIZE;
}
-}
+ /* Isochronous transfer properties */
+ if (usbdev->speed == USB_SPEED_LOW) {
+ line6->intervals_per_second = USB_LOW_INTERVALS_PER_SECOND;
+ line6->iso_buffers = USB_LOW_ISO_BUFFERS;
+ } else {
+ line6->intervals_per_second = USB_HIGH_INTERVALS_PER_SECOND;
+ line6->iso_buffers = USB_HIGH_ISO_BUFFERS;
+ }
+}
/* Enable buffering of incoming messages, flush the buffer */
static int line6_hwdep_open(struct snd_hwdep *hw, struct file *file)
@@ -754,7 +758,7 @@ int line6_probe(struct usb_interface *interface,
goto error;
}
- line6_get_interval(line6);
+ line6_get_usb_properties(line6);
if (properties->capabilities & LINE6_CAP_CONTROL) {
ret = line6_init_cap_control(line6);