From patchwork Wed Feb 11 05:03:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Rorvick X-Patchwork-Id: 5810321 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1C5BDBF440 for ; Wed, 11 Feb 2015 05:06:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 50F0F2021F for ; Wed, 11 Feb 2015 05:06:25 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 2BAB52021A for ; Wed, 11 Feb 2015 05:06:24 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id CBDB2261B11; Wed, 11 Feb 2015 06:06:22 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 69241261736; Wed, 11 Feb 2015 06:03:56 +0100 (CET) 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 BF50C26061D; Wed, 11 Feb 2015 06:03:53 +0100 (CET) Received: from mail-ig0-f171.google.com (mail-ig0-f171.google.com [209.85.213.171]) by alsa0.perex.cz (Postfix) with ESMTP id D48EA2605F3 for ; Wed, 11 Feb 2015 06:03:41 +0100 (CET) Received: by mail-ig0-f171.google.com with SMTP id h15so28479974igd.4 for ; Tue, 10 Feb 2015 21:03:38 -0800 (PST) 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=T3lFA0Q6i/uPvwpXUIc4owCgJhdrwVgJlOK1qS8k55c=; b=LshDXShVlJMiVQCsTdH4jOJUJ6xNEDk2GXhLg/Ku/UwhlPEHVi+JBFWAgc67H9I+z2 FQwPCPdpon15+xbo1QGqtDssKJUKaWw5B9g7ldO9ZIDXXP9Lqd6KjfKzeDDImE+SSPnO FYHnDGVcGLX+biCt7YZUbwGNXDRH/fesBq/JLPJQzbXOA4LPzA15IlYyccavEldRmKkg Jng33Ira9cpVnPx0nRf6qMuzhN6DOrfUqYEfNYdZvnat7BH9LV5PDwCId00kCaINi5Os X3a8FYrgpRbHqhpaprtdNKz9J3uZpA+tqb90djbVFIXv5chPfaEOZ1Tj3nJI1AK7R+tr aqNA== X-Received: by 10.42.188.133 with SMTP id da5mr1074673icb.37.1423631018884; Tue, 10 Feb 2015 21:03:38 -0800 (PST) Received: from localhost.localdomain.com ([99.135.164.179]) by mx.google.com with ESMTPSA id qd2sm9291297igc.22.2015.02.10.21.03.37 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Feb 2015 21:03:38 -0800 (PST) From: Chris Rorvick To: Takashi Iwai Date: Tue, 10 Feb 2015 23:03:13 -0600 Message-Id: <1423630997-25464-3-git-send-email-chris@rorvick.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1423630997-25464-1-git-send-email-chris@rorvick.com> References: <1423630997-25464-1-git-send-email-chris@rorvick.com> Cc: Stefan Hajnoczi , alsa-devel@alsa-project.org, Chris Rorvick , linux-kernel@vger.kernel.org Subject: [alsa-devel] [PATCH 2/6] ALSA: line6: Add delay before reading status 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 The device indicates the result of a read/write operation by making the status available on a subsequent request from the driver. This is not ready immediately, though, so the driver is currently slamming the device with hundreds of pointless requests before getting the expected response. Add a two millisecond delay before each attempt. This is approximately the behavior observed with version 4.2.7.1 of the Windows driver. Signed-off-by: Chris Rorvick --- sound/usb/line6/driver.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c index aac1e35..222c14f 100644 --- a/sound/usb/line6/driver.c +++ b/sound/usb/line6/driver.c @@ -296,6 +296,8 @@ static void line6_data_received(struct urb *urb) line6_start_listen(line6); } +#define LINE6_READ_WRITE_STATUS_DELAY 2 /* milliseconds */ + /* Read data from device. */ @@ -319,6 +321,8 @@ int line6_read_data(struct usb_line6 *line6, u16 address, void *data, /* Wait for data length. We'll get 0xff until length arrives. */ do { + mdelay(LINE6_READ_WRITE_STATUS_DELAY); + ret = usb_control_msg(usbdev, usb_rcvctrlpipe(usbdev, 0), 0x67, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, @@ -376,6 +380,8 @@ int line6_write_data(struct usb_line6 *line6, u16 address, void *data, } do { + mdelay(LINE6_READ_WRITE_STATUS_DELAY); + ret = usb_control_msg(usbdev, usb_rcvctrlpipe(usbdev, 0), 0x67, USB_TYPE_VENDOR | USB_RECIP_DEVICE |