Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp927386imm; Fri, 11 May 2018 08:26:53 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo+3QS7LxcIwd+ryBdkVvmBIsW1v84PdmPSE79OmkZkAW5niAs8Pe9lVj/LzTM15qHPLu56 X-Received: by 2002:a62:679a:: with SMTP id t26-v6mr6043160pfj.24.1526052413903; Fri, 11 May 2018 08:26:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526052413; cv=none; d=google.com; s=arc-20160816; b=ETf73AULqRtWLG0fh48X7TOgf4p/2q0368HJHupb4ZqmsfA4txKZToCYOE2jIDd3yx EahPbHV3PPQuBn5HuPz5/RVzesqsT5kxpo0LBWmUuwxj+SIB32VhHmdegT66MMvWQYaj DJ4YV0FXLUrVoK2awNz7c2YRj1dYUypz9cKGzowX3PQgdRfdznI6Gur88x31D0E1gLne M8zGZLAtY4UiCh7b91/51f7x8Ju3GuVPaxivHv9nafd8xHdOnafJJZ/YHlPAZsWzAoKv LH/B1VEIYZZ+XogmrCbDih9ffexx7ySutw26QOKpQOTslp8++j4MYCCrCo4KjnQ1yL/t cRYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=UV09o4I1Pfl2MPUzeWYmlKy0qqTQq1s7b2GMoxWINrs=; b=sduB8fSv2bAHeg8RFR4Jw2jVnc3sv4ZgGaiReN93NO5JGWayAY4cq6YubDv56sBbeN plYXKLh+qRFYvQGxlWfBWqvAPDX+zQb8n9B7idHC5vG87+oSQIVkPicdbO9u9Ygqn9KL K57sGeFvFWAo/yMUFmZW033A2hHAuDd4sRw3LRJExVzfw3skPO2gQSfeI41vSP6CsQm2 qe6cXw98uz49V3NwFLi7dDsRp4kYHSZgEKkHNm50rE7+mUGhJHrJP10Ew9dlykXd82Xp C1Zx+YV4q2Gq3gdWBBVnYVvzaxJ+Ojcwj89yhYLXRMCgpB5c/0rsO5yG8Elk/FCs8ryv qLBQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=codethink.co.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w73-v6si3542428pfd.19.2018.05.11.08.26.39; Fri, 11 May 2018 08:26:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=codethink.co.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751764AbeEKPZw (ORCPT + 99 others); Fri, 11 May 2018 11:25:52 -0400 Received: from imap1.codethink.co.uk ([176.9.8.82]:51693 "EHLO imap1.codethink.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751219AbeEKPZt (ORCPT ); Fri, 11 May 2018 11:25:49 -0400 Received: from 167-98-27-229.cust-167.exponential-e.net ([167.98.27.229] helo=ct-lt-1121.codethink.co.uk) by imap1.codethink.co.uk with esmtpsa (Exim 4.84_2 #1 (Debian)) id 1fH9vW-0002XF-B7; Fri, 11 May 2018 16:25:46 +0100 From: Jorge Sanjuan To: tiwai@suse.com Cc: alsa-devel@alsa-project.org, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, ruslan.bilovol@gmail.com, Jorge Sanjuan Subject: [PATCH v4 2/4] ALSA: usb-audio: Use Class Specific EP for UAC3 devices. Date: Fri, 11 May 2018 16:25:35 +0100 Message-Id: <20180511152537.32267-3-jorge.sanjuan@codethink.co.uk> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180511152537.32267-1-jorge.sanjuan@codethink.co.uk> References: <20180420170327.31569-1-jorge.sanjuan@codethink.co.uk> <20180511152537.32267-1-jorge.sanjuan@codethink.co.uk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org bmAtributes offset doesn't exist in the UAC3 CS_EP descriptor. Hence, checking for pitch control as if it was UAC2 doesn't make any sense. Use the defined UAC3 offsets instead. Signed-off-by: Jorge Sanjuan --- sound/usb/stream.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sound/usb/stream.c b/sound/usb/stream.c index 764be07474a8..6b2924533d8d 100644 --- a/sound/usb/stream.c +++ b/sound/usb/stream.c @@ -576,7 +576,7 @@ static int parse_uac_endpoint_attributes(struct snd_usb_audio *chip, if (protocol == UAC_VERSION_1) { attributes = csep->bmAttributes; - } else { + } else if (protocol == UAC_VERSION_2) { struct uac2_iso_endpoint_descriptor *csep2 = (struct uac2_iso_endpoint_descriptor *) csep; @@ -585,6 +585,13 @@ static int parse_uac_endpoint_attributes(struct snd_usb_audio *chip, /* emulate the endpoint attributes of a v1 device */ if (csep2->bmControls & UAC2_CONTROL_PITCH) attributes |= UAC_EP_CS_ATTR_PITCH_CONTROL; + } else { /* UAC_VERSION_3 */ + struct uac3_iso_endpoint_descriptor *csep3 = + (struct uac3_iso_endpoint_descriptor *) csep; + + /* emulate the endpoint attributes of a v1 device */ + if (le32_to_cpu(csep3->bmControls) & UAC2_CONTROL_PITCH) + attributes |= UAC_EP_CS_ATTR_PITCH_CONTROL; } return attributes; -- 2.11.0