From patchwork Thu Aug 11 19:02:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrej Krutak X-Patchwork-Id: 9275855 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 66B8660780 for ; Thu, 11 Aug 2016 19:53:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 549D428715 for ; Thu, 11 Aug 2016 19:53:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 496D028786; Thu, 11 Aug 2016 19:53:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 655DD28715 for ; Thu, 11 Aug 2016 19:53:22 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 79040267A56; Thu, 11 Aug 2016 21:53:21 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id BCB71267A56; Thu, 11 Aug 2016 21:42:01 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 4437E2676C9; Thu, 11 Aug 2016 21:41:58 +0200 (CEST) Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by alsa0.perex.cz (Postfix) with ESMTP id 3172A26774F for ; Thu, 11 Aug 2016 21:04:01 +0200 (CEST) Received: by mail-wm0-f68.google.com with SMTP id o80so966229wme.0 for ; Thu, 11 Aug 2016 12:04:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=NKtsdTqyesxqujjZHNENHZyUzrgv9oGtvVcAR+0O7/4=; b=zj5dOAQlA9I4YQNdTQRziTy3SW54fe/Zu+kymcjSyZp7w1ahWjLA+g2YlbJGtrw08w ZbrPHcGCcq6AEazRyEvHOcwNwPK3+KJ+PO2FpxkV6NwyAk7Vb/932hkPRF9cyDToivUz x8p/qotmAIwPv72UVz3fkkuVyvsdYXOq87TjKBgQ6Vo3yIK7+1KPfQjzT06A0b95gEza Vqr4+alW8kY4U8DOyfN6YgdsvnCm7WDyUPJddodTxEC2P38GtOf1eudWeSMmRMNEbXwP FetCBPs2BZPssIJ/XsZFoObafc+xqLmcpVSNMOiwYGfGHECiSDlT7zzRVOqmNZH8O7YT F89w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=NKtsdTqyesxqujjZHNENHZyUzrgv9oGtvVcAR+0O7/4=; b=PCkkJnYbQ4mHXPcT1FOJ6Sl7FhQXoXJe+ftOOkr57iHQqtdJ8N5pcBZpLis1l67Fwf WTY68RUBsPNpxiHTNKkLE9Ppnua5MDD1P4uO0QlPeBt63mhcX9wzmX78yf6bFm5OojpB lHLyyibdo+ZaQeeYh9Bs4NlR8Q56XTd5cllRGzQ7cYIIrwOwfc6zHeLqL3A4XvPNm8+N fwb74e7UCrV++0PY6y0tzcjdXuqRr4hgneVdLOq3FBixZBkKZFexQFLFq00YqbDLld9a v2F4p9zhfbMH9D6B5bSX3ZaTh6AbNclHmHTCN/GBhGrzCRhqpvzZMRBLElHaPLwPdWjX 1xYQ== X-Gm-Message-State: AEkoouvzu4I7/b0ZQm4MHLZzVsSskI5pT5jvR/TJUDxJrrVmLo7Jjl4jQnCglpJexYMS8Q== X-Received: by 10.194.65.72 with SMTP id v8mr12933585wjs.103.1470942240867; Thu, 11 Aug 2016 12:04:00 -0700 (PDT) Received: from localhost.localdomain ([94.229.40.98]) by smtp.gmail.com with ESMTPSA id x6sm4001376wjk.26.2016.08.11.12.03.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 11 Aug 2016 12:03:59 -0700 (PDT) From: Andrej Krutak To: alsa-devel@alsa-project.org Date: Thu, 11 Aug 2016 21:02:18 +0200 Message-Id: <1470942147-19848-7-git-send-email-dev@andree.sk> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1470942147-19848-1-git-send-email-dev@andree.sk> References: <1470942147-19848-1-git-send-email-dev@andree.sk> Cc: Andrej Krutak Subject: [alsa-devel] [PATCH 06/15] ALSA: line6: Allow bulk endpoints instead of interrupt endpoints X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Some PODs (e.g. POD X3) have bulk instead of interrupt endpoints for data transfer. Signed-off-by: Andrej Krutak --- sound/usb/line6/driver.c | 63 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 15 deletions(-) diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c index 5fd6cad..9b16777 100644 --- a/sound/usb/line6/driver.c +++ b/sound/usb/line6/driver.c @@ -66,10 +66,17 @@ static int line6_start_listen(struct usb_line6 *line6) { int err; - usb_fill_int_urb(line6->urb_listen, line6->usbdev, - usb_rcvintpipe(line6->usbdev, line6->properties->ep_ctrl_r), - line6->buffer_listen, LINE6_BUFSIZE_LISTEN, - line6_data_received, line6, line6->interval); + if (line6->properties->capabilities & LINE6_CAP_CONTROL_MIDI) { + usb_fill_int_urb(line6->urb_listen, line6->usbdev, + usb_rcvintpipe(line6->usbdev, line6->properties->ep_ctrl_r), + line6->buffer_listen, LINE6_BUFSIZE_LISTEN, + line6_data_received, line6, line6->interval); + } else { + usb_fill_bulk_urb(line6->urb_listen, line6->usbdev, + usb_rcvbulkpipe(line6->usbdev, line6->properties->ep_ctrl_r), + line6->buffer_listen, LINE6_BUFSIZE_LISTEN, + line6_data_received, line6); + } line6->urb_listen->actual_length = 0; err = usb_submit_urb(line6->urb_listen, GFP_ATOMIC); return err; @@ -90,6 +97,7 @@ static int line6_send_raw_message(struct usb_line6 *line6, const char *buffer, int size) { int i, done = 0; + const struct line6_properties *properties = line6->properties; for (i = 0; i < size; i += line6->max_packet_size) { int partial; @@ -97,15 +105,21 @@ static int line6_send_raw_message(struct usb_line6 *line6, const char *buffer, int frag_size = min(line6->max_packet_size, size - i); int retval; - retval = usb_interrupt_msg(line6->usbdev, - usb_sndintpipe(line6->usbdev, - line6->properties->ep_ctrl_w), - (char *)frag_buf, frag_size, - &partial, LINE6_TIMEOUT * HZ); + if (properties->capabilities & LINE6_CAP_CONTROL_MIDI) { + retval = usb_interrupt_msg(line6->usbdev, + usb_sndintpipe(line6->usbdev, properties->ep_ctrl_w), + (char *)frag_buf, frag_size, + &partial, LINE6_TIMEOUT * HZ); + } else { + retval = usb_bulk_msg(line6->usbdev, + usb_sndbulkpipe(line6->usbdev, properties->ep_ctrl_w), + (char *)frag_buf, frag_size, + &partial, LINE6_TIMEOUT * HZ); + } if (retval) { dev_err(line6->ifcdev, - "usb_interrupt_msg failed (%d)\n", retval); + "usb_bulk_msg failed (%d)\n", retval); break; } @@ -140,10 +154,17 @@ static int line6_send_raw_message_async_part(struct message *msg, int done = msg->done; int bytes = min(msg->size - done, line6->max_packet_size); - usb_fill_int_urb(urb, line6->usbdev, - usb_sndintpipe(line6->usbdev, line6->properties->ep_ctrl_w), - (char *)msg->buffer + done, bytes, - line6_async_request_sent, msg, line6->interval); + if (line6->properties->capabilities & LINE6_CAP_CONTROL_MIDI) { + usb_fill_int_urb(urb, line6->usbdev, + usb_sndintpipe(line6->usbdev, line6->properties->ep_ctrl_w), + (char *)msg->buffer + done, bytes, + line6_async_request_sent, msg, line6->interval); + } else { + usb_fill_bulk_urb(urb, line6->usbdev, + usb_sndbulkpipe(line6->usbdev, line6->properties->ep_ctrl_w), + (char *)msg->buffer + done, bytes, + line6_async_request_sent, msg); + } msg->done += bytes; retval = usb_submit_urb(urb, GFP_ATOMIC); @@ -462,7 +483,19 @@ static void line6_destruct(struct snd_card *card) static void line6_get_interval(struct usb_line6 *line6) { struct usb_device *usbdev = line6->usbdev; - struct usb_host_endpoint *ep = usbdev->ep_in[line6->properties->ep_ctrl_r]; + const struct line6_properties *properties = line6->properties; + int pipe; + struct usb_host_endpoint *ep; + + 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)]; + if (ep) { line6->interval = ep->desc.bInterval; if (usbdev->speed == USB_SPEED_LOW) {