Received: by 10.192.165.148 with SMTP id m20csp3358789imm; Mon, 23 Apr 2018 05:21:03 -0700 (PDT) X-Google-Smtp-Source: AIpwx49u9CueXm/uvD9/YL1qDyXU6YYjFr/LJFTvAs4C/dqS/sKh5XyLZls/aCVn0N7tvkFI0YJa X-Received: by 2002:a17:902:b28:: with SMTP id 37-v6mr20538927plq.207.1524486063898; Mon, 23 Apr 2018 05:21:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524486063; cv=none; d=google.com; s=arc-20160816; b=aam3t4RZXB5WSJF3x7rxW2+hzDJZ3qnUAmnbJnYNu75uZJ2F/ouWe4TZgUhHaqoyT/ hqBdHS2a+IpufeUlmkXEdIPYmxoUQ6KI2ZVhh9QbFaMupC1SEeHWLLZ4rLzzA7Tb3ofL 1JxpySg3RZS2MTMxQFx36Szed3krqWb5s625ARhpX20I4b15or22ez+k6L/tdfMUUGaq ZWY/73LKNh3bQPMTkrrLjp3wB+tUGGBMJl/zJ9uPe076nhPKvMMpi0g14Qbgbt4RGcEe iMVAStObG4FjLXgrBYNa56HIMh8KCIwnx5eCiVN6pdUH3y1AShxerZtJrkkcN6eriuh0 YflQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:subject:cc:to:from:message-id:date :arc-authentication-results; bh=GktRFESay/nmbN9m4LuYkamPWeI3kMK0yBIU3qiFn5w=; b=XpDdwcCt3YcZ5UzeWjBxNQTcMK3WkdWoI/3wErvg5/lOORXp/OBVCuqWCe6fV4ccf8 LXju4eGK4pzZcG/9Y+CNN6P8vOpVN8cTSWA6ujQdxoNE7y9oVo1tOBRJ9bpyMUF4YC8w ZwZFH+XSSKgA9lZtOerTCTCk3hhhqkk+ykVaLeLvn/3pZIC4WnWLPZg/Bo/z5TbfNUmB VfNKgAxK2W7Ii5mckd887iY4i9cMTidHaXHhEGBq64P9Qdq9/vOfo9XohpEx5MJawbZV PUAv4JkLE97JGXyKvNNUsmASFKspEFFdvUG5/W5jYvoe6Tz9k7q6QuqCWC2Fzro2n6PN 2DvA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r1si11039659pfb.247.2018.04.23.05.20.48; Mon, 23 Apr 2018 05:21:03 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754811AbeDWMTl (ORCPT + 99 others); Mon, 23 Apr 2018 08:19:41 -0400 Received: from mx2.suse.de ([195.135.220.15]:52141 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754614AbeDWMTk (ORCPT ); Mon, 23 Apr 2018 08:19:40 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id CB59BAC99; Mon, 23 Apr 2018 12:19:38 +0000 (UTC) Date: Mon, 23 Apr 2018 14:19:38 +0200 Message-ID: From: Takashi Iwai To: "Jorge Sanjuan" Cc: , , Subject: Re: [PATCH 4/4] ALSA: usb-audio: UAC3 Add support for connector insertion. In-Reply-To: <20180420170327.31569-5-jorge.sanjuan@codethink.co.uk> References: <20180420170327.31569-1-jorge.sanjuan@codethink.co.uk> <20180420170327.31569-5-jorge.sanjuan@codethink.co.uk> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 20 Apr 2018 19:03:27 +0200, Jorge Sanjuan wrote: > > diff --git a/include/linux/usb/audio-v3.h b/include/linux/usb/audio-v3.h > index a8959aaba0ae..6cedb6d499ba 100644 > --- a/include/linux/usb/audio-v3.h > +++ b/include/linux/usb/audio-v3.h > @@ -221,6 +221,12 @@ struct uac3_iso_endpoint_descriptor { > __le16 wLockDelay; > } __attribute__((packed)); > > +/* 5.2.1.6.1 INSERTION CONTROL PARAMETER BLOCK */ > +struct uac3_insertion_ctl_blk { > + __u8 bSize; > + __u8 bmConInserted[1]; Do we need to declare this as an array? > static struct snd_kcontrol_new usb_feature_unit_ctl = { > .iface = SNDRV_CTL_ELEM_IFACE_MIXER, > .name = "", /* will be filled later manually */ > @@ -1322,6 +1367,15 @@ static struct snd_kcontrol_new usb_bool_master_control_ctl_ro = { > .put = NULL, > }; > > +static struct snd_kcontrol_new usb_connector_ctl_ro = { Put const. > @@ -1904,16 +1966,29 @@ static int parse_audio_input_terminal(struct mixer_build *state, int unitid, > void *raw_desc) > { > struct usb_audio_term iterm; > - struct uac2_input_terminal_descriptor *d = raw_desc; > + unsigned int control, bmctls, term_id; > > - check_input_term(state, d->bTerminalID, &iterm); > if (state->mixer->protocol == UAC_VERSION_2) { > - /* Check for jack detection. */ > - if (uac_v2v3_control_is_readable(d->bmControls, > - UAC2_TE_CONNECTOR)) { > - build_connector_control(state, &iterm, true); > - } > - } > + struct uac2_input_terminal_descriptor *d_v2 = raw_desc; > + control = UAC2_TE_CONNECTOR; > + term_id = d_v2->bTerminalID; > + bmctls = d_v2->bmControls; > + } > + else if (state->mixer->protocol == UAC_VERSION_3) { Put "else if" and the closing brace in the same line. > + struct uac3_input_terminal_descriptor *d_v3 = raw_desc; > + control = UAC3_TE_INSERTION; > + term_id = d_v3->bTerminalID; > + bmctls = d_v3->bmControls; Doesn't it need le32_to_cpu()? > + } > + else /* UAC1. No Insertion control */ Ditto, put "else" and the closing brace in the same line. Also, use braces for the rest block, otherwise it'll look inconsistent. Or rewrite with switch(). > @@ -2645,6 +2720,12 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) > err = parse_audio_unit(&state, desc->bCSourceID); > if (err < 0 && err != -EINVAL) > return err; > + > + if (uac_v2v3_control_is_readable(desc->bmControls, Missing le32_to_cpu()? thanks, Takashi