diff options
author | Andrej Krutak <dev@andree.sk> | 2017-02-06 14:34:58 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2017-02-07 03:40:49 -0500 |
commit | 5d81296b5e7849ba3bcc5bf430ffd37bf67ff7dc (patch) | |
tree | c28d997b973ed53112d8d2fe717b4e88dfffeba2 /sound/usb/line6 | |
parent | 1e94320ffee29424ef70cdbb7f5601216382b7e6 (diff) |
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/line6')
-rw-r--r-- | sound/usb/line6/driver.c | 48 |
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) | |||
492 | usb_put_dev(usbdev); | 492 | usb_put_dev(usbdev); |
493 | } | 493 | } |
494 | 494 | ||
495 | /* get data from endpoint descriptor (see usb_maxpacket): */ | 495 | static void line6_get_usb_properties(struct usb_line6 *line6) |
496 | static void line6_get_interval(struct usb_line6 *line6) | ||
497 | { | 496 | { |
498 | struct usb_device *usbdev = line6->usbdev; | 497 | struct usb_device *usbdev = line6->usbdev; |
499 | const struct line6_properties *properties = line6->properties; | 498 | const struct line6_properties *properties = line6->properties; |
500 | int pipe; | 499 | int pipe; |
501 | struct usb_host_endpoint *ep; | 500 | struct usb_host_endpoint *ep = NULL; |
502 | 501 | ||
503 | if (properties->capabilities & LINE6_CAP_CONTROL_MIDI) { | 502 | if (properties->capabilities & LINE6_CAP_CONTROL) { |
504 | pipe = | 503 | if (properties->capabilities & LINE6_CAP_CONTROL_MIDI) { |
505 | usb_rcvintpipe(line6->usbdev, line6->properties->ep_ctrl_r); | 504 | pipe = usb_rcvintpipe(line6->usbdev, |
506 | } else { | 505 | line6->properties->ep_ctrl_r); |
507 | pipe = | 506 | } else { |
508 | usb_rcvbulkpipe(line6->usbdev, line6->properties->ep_ctrl_r); | 507 | pipe = usb_rcvbulkpipe(line6->usbdev, |
508 | line6->properties->ep_ctrl_r); | ||
509 | } | ||
510 | ep = usbdev->ep_in[usb_pipeendpoint(pipe)]; | ||
509 | } | 511 | } |
510 | ep = usbdev->ep_in[usb_pipeendpoint(pipe)]; | ||
511 | 512 | ||
513 | /* Control data transfer properties */ | ||
512 | if (ep) { | 514 | if (ep) { |
513 | line6->interval = ep->desc.bInterval; | 515 | line6->interval = ep->desc.bInterval; |
514 | if (usbdev->speed == USB_SPEED_LOW) { | ||
515 | line6->intervals_per_second = USB_LOW_INTERVALS_PER_SECOND; | ||
516 | line6->iso_buffers = USB_LOW_ISO_BUFFERS; | ||
517 | } else { | ||
518 | line6->intervals_per_second = USB_HIGH_INTERVALS_PER_SECOND; | ||
519 | line6->iso_buffers = USB_HIGH_ISO_BUFFERS; | ||
520 | } | ||
521 | |||
522 | line6->max_packet_size = le16_to_cpu(ep->desc.wMaxPacketSize); | 516 | line6->max_packet_size = le16_to_cpu(ep->desc.wMaxPacketSize); |
523 | } else { | 517 | } else { |
524 | dev_err(line6->ifcdev, | 518 | if (properties->capabilities & LINE6_CAP_CONTROL) { |
525 | "endpoint not available, using fallback values"); | 519 | dev_err(line6->ifcdev, |
520 | "endpoint not available, using fallback values"); | ||
521 | } | ||
526 | line6->interval = LINE6_FALLBACK_INTERVAL; | 522 | line6->interval = LINE6_FALLBACK_INTERVAL; |
527 | line6->max_packet_size = LINE6_FALLBACK_MAXPACKETSIZE; | 523 | line6->max_packet_size = LINE6_FALLBACK_MAXPACKETSIZE; |
528 | } | 524 | } |
529 | } | ||
530 | 525 | ||
526 | /* Isochronous transfer properties */ | ||
527 | if (usbdev->speed == USB_SPEED_LOW) { | ||
528 | line6->intervals_per_second = USB_LOW_INTERVALS_PER_SECOND; | ||
529 | line6->iso_buffers = USB_LOW_ISO_BUFFERS; | ||
530 | } else { | ||
531 | line6->intervals_per_second = USB_HIGH_INTERVALS_PER_SECOND; | ||
532 | line6->iso_buffers = USB_HIGH_ISO_BUFFERS; | ||
533 | } | ||
534 | } | ||
531 | 535 | ||
532 | /* Enable buffering of incoming messages, flush the buffer */ | 536 | /* Enable buffering of incoming messages, flush the buffer */ |
533 | static int line6_hwdep_open(struct snd_hwdep *hw, struct file *file) | 537 | static int line6_hwdep_open(struct snd_hwdep *hw, struct file *file) |
@@ -754,7 +758,7 @@ int line6_probe(struct usb_interface *interface, | |||
754 | goto error; | 758 | goto error; |
755 | } | 759 | } |
756 | 760 | ||
757 | line6_get_interval(line6); | 761 | line6_get_usb_properties(line6); |
758 | 762 | ||
759 | if (properties->capabilities & LINE6_CAP_CONTROL) { | 763 | if (properties->capabilities & LINE6_CAP_CONTROL) { |
760 | ret = line6_init_cap_control(line6); | 764 | ret = line6_init_cap_control(line6); |