From patchwork Sun Jan 24 16:36:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Fougnies X-Patchwork-Id: 8100791 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C56D69F6DA for ; Sun, 24 Jan 2016 16:34:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D78022022A for ; Sun, 24 Jan 2016 16:34:56 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 8092B201EF for ; Sun, 24 Jan 2016 16:34:53 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 784952617B8; Sun, 24 Jan 2016 17:34:52 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_ADSP_ALL, DKIM_SIGNED, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id CFC0C260670; Sun, 24 Jan 2016 17:34:48 +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 5C98F2606C9; Sun, 24 Jan 2016 17:34:47 +0100 (CET) Received: from mail.eulerian.com (mail.eulerian.com [109.232.193.6]) by alsa0.perex.cz (Postfix) with ESMTP id 172F6260670 for ; Sun, 24 Jan 2016 17:34:42 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail.eulerian.com (Postfix) with ESMTP id C8F3E35A068A; Sun, 24 Jan 2016 17:34:41 +0100 (CET) Received: from mail.eulerian.com ([127.0.0.1]) by localhost (mail.eulerian.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id sNTOkHejKrhZ; Sun, 24 Jan 2016 17:34:40 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail.eulerian.com (Postfix) with ESMTP id C979B35A073E; Sun, 24 Jan 2016 17:34:40 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.9.2 mail.eulerian.com C979B35A073E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eulerian.com; s=smtp; t=1453653280; bh=ZNQZI/0a+E+bp1D8B9Yyko9w90jxokqdqqRPapp0YBU=; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type; b=numbC2/vEvb6BukU03TYZ2lQKs3gaCQ/9K9+hk80nGrUDIP1BEKE3uhFaskjc0qYG /8hzy/tqfT5HwYCgWgL/zEzldB5g3ypjNemmOK6ZzHqLqcPXWAWlZUJAVD1ClIyCDC 2dSWCXGuwMy552uYyfkVhRMa/LH5ZBFquWgzqrmI= X-Virus-Scanned: amavisd-new at eulerian.com Received: from mail.eulerian.com ([127.0.0.1]) by localhost (mail.eulerian.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 8Ap_I14WQrcq; Sun, 24 Jan 2016 17:34:40 +0100 (CET) Date: Sun, 24 Jan 2016 17:36:17 +0100 From: Guillaume Fougnies To: alsa-devel@alsa-project.org Message-ID: <20160124163617.GE4388@eulerian.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Cc: Takashi Iwai Subject: [alsa-devel] [PATCH] teac ud-501/ud-503 usb delay 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Hello, This is a small patch against sound/usb/quirks.c to correct "Teac Corp." products delay. Tested on Teac UD-501 and UD-503 products, could not harm other Teac products. It corrects the "clock source 41 is not valid, cannot use" error for both devices. And more critically on the new UD-503, a complete freeze of the teac usb interface when switching between different rate/format. (Freeze only solved by a power switch of the device...) The patch matches the problem of the "Playback Design" products. I just refactored a bit the code to include Teac products properly. Regards, Guillaume --- sound/usb/quirks.c | 58 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index 23ea6d8..f3faaef 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -1202,40 +1202,48 @@ void snd_usb_endpoint_start_quirk(struct snd_usb_endpoint *ep) void snd_usb_set_interface_quirk(struct usb_device *dev) { /* - * "Playback Design" products need a 50ms delay after setting the + * Products needing a 50ms delay after setting the * USB interface. */ - if (le16_to_cpu(dev->descriptor.idVendor) == 0x23ba) - mdelay(50); + switch (le16_to_cpu(dev->descriptor.idVendor)) { + case 0x23ba: /* Playback Design */ + case 0x0644: /* TEAC Corp. */ + mdelay(50); + } } void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe, __u8 request, __u8 requesttype, __u16 value, __u16 index, void *data, __u16 size) { - /* - * "Playback Design" products need a 20ms delay after each - * class compliant request - */ - if ((le16_to_cpu(dev->descriptor.idVendor) == 0x23ba) && - (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) - mdelay(20); - - /* Marantz/Denon devices with USB DAC functionality need a delay - * after each class compliant request - */ - if (is_marantz_denon_dac(USB_ID(le16_to_cpu(dev->descriptor.idVendor), - le16_to_cpu(dev->descriptor.idProduct))) - && (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) - mdelay(20); + if ((requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) { + switch (le16_to_cpu(dev->descriptor.idVendor)) { + /* + * "Playback Design"/"TEAC Corp." products need a 20ms delay after each + * class compliant request + */ + case 0x23ba: /* "Playback Design" */ + case 0x0644: /* TEAC Corp. */ + mdelay(20); + return; + + /* Zoom R16/24 needs a tiny delay here, otherwise requests like + * get/set frequency return as failed despite actually succeeding. + */ + case 0x1686: + /* restrict to 0x00dd */ + if (le16_to_cpu(dev->descriptor.idProduct) == 0x00dd) + mdelay(1); + return; + } - /* Zoom R16/24 needs a tiny delay here, otherwise requests like - * get/set frequency return as failed despite actually succeeding. - */ - if ((le16_to_cpu(dev->descriptor.idVendor) == 0x1686) && - (le16_to_cpu(dev->descriptor.idProduct) == 0x00dd) && - (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) - mdelay(1); + /* Marantz/Denon devices with USB DAC functionality need a delay + * after each class compliant request + */ + if (is_marantz_denon_dac(USB_ID(le16_to_cpu(dev->descriptor.idVendor), + le16_to_cpu(dev->descriptor.idProduct)))) + mdelay(20); + } } /*