Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 917A6C32771 for ; Sun, 12 Jan 2020 08:43:53 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A5AEF20848 for ; Sun, 12 Jan 2020 08:43:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="a5Q8974n" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A5AEF20848 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 913841688; Sun, 12 Jan 2020 09:43:00 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 913841688 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1578818630; bh=9Ns6NfQZBhIada4Yp8+29exhsHJm9tcPXwkQ+Aecmqw=; h=Date:From:To:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=a5Q8974nRdEcnRrtV203Do7wjfeu0kdGWWnhPqmjCsOtm9Jtb8sJtRbSB7/Vu6LAH j0HqBiemJDDF30pM5qyNKVv1vYQ1suQMcEVwFxOYmGDiwMAmGnJ1/GpDk2FF2xav5i P3R7ik3h65aTc87Om6arNoh1K0RkWMUZ6UKTdieY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 088A0F80103; Sun, 12 Jan 2020 09:43:00 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id CF1AFF8014E; Sun, 12 Jan 2020 09:42:57 +0100 (CET) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 1F806F80103 for ; Sun, 12 Jan 2020 09:42:54 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 1F806F80103 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id AB697B28F; Sun, 12 Jan 2020 08:42:53 +0000 (UTC) Date: Sun, 12 Jan 2020 09:42:52 +0100 Message-ID: From: Takashi Iwai To: mickflemm@gmail.com In-Reply-To: <5e1a08b3.1c69fb81.ca5a.f66f@mx.google.com> References: <5e1a08b3.1c69fb81.ca5a.f66f@mx.google.com> 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") Cc: alsa-devel@alsa-project.org Subject: Re: [alsa-devel] [PATCH v2] ALSA: usb-audio: Add support for Presonus Studio 1810c X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Sat, 11 Jan 2020 18:40:56 +0100, mickflemm@gmail.com wrote: > > This patch adds support for Presonus Studio 1810c, a usb interface > that's UAC2 compliant with a few quirks and a few extra hw-specific > controls. I've tested all 3 altsettings and the added switch > controls and they work as expected. > > More infos on the card: > https://www.presonus.com/products/Studio-1810c > > Note that this work is based on packet inspection with > usbmon. I just wanted to get this card to work for using > it on our open-source radio station: > https://github.com/UoC-Radio > > v2 address issues reported by Takashi: > * Properly get/set enum type controls > * Prevent race condition on switch_get/set > * Various control naming changes > * Various coding style fixes > > Signed-off-by: Nick Kossifidis Thanks, the patch looks almost good for merge, just a couple of nitpicks: > --- a/sound/usb/format.c > +++ b/sound/usb/format.c > @@ -262,6 +262,23 @@ static int parse_uac2_sample_rate_range(struct snd_usb_audio *chip, > } > > for (rate = min; rate <= max; rate += res) { > + > + /* > + * Presonus Studio 1810c anounces invalid > + * sampling rates for its streams. > + */ > + if (chip->usb_id == USB_ID(0x0194f, 0x010c) && > + ((rate > 48000 && fp->altsetting == 1) || > + ((rate < 88200 || rate > 96000) > + && fp->altsetting == 2) || > + ((rate < 176400 || rate > 192000) > + && fp->altsetting == 3))) { I still find it too hard to read. Maybe better to factor out this check into a function. Also it's clearer in a form of something like: static bool sc1810c_valid_sample_rate() { switch (fp->altsetting) { case 1: return rate <= 48000; case 2: return rate >= 88200 && rate <= 96000; case 3: return rate >= 176400 && rate <= 192000; default: return true; } } > --- /dev/null > +++ b/sound/usb/mixer_s1810c.c > @@ -0,0 +1,595 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Presonus Studio 1810c driver for ALSA > + * Copyright (C) 2019 Nick Kossifidis > + * > + * Based on reverse engineering of the communication protocol > + * between the windows driver / Univeral Control (UC) program > + * and the device, through usbmon. > + * > + * For now this bypasses the mixer, with all channels split, > + * so that the software can mix with greater flexibility. > + * It also adds controls for the 4 buttons on the front of > + * the device. > + */ > + > +#include > +#include > +#include > +#include > +#include > + > +#include "usbaudio.h" > +#include "mixer.h" > +#include "mixer_quirks.h" > +#include "helper.h" Include mixer_s1810c.h here, too, for the function declaration. > +static const struct snd_kcontrol_new snd_s1810c_line_sw = { > + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, > + .name = "Line 1/2 Source Type Switch", This one is with an enum, so better to avoid "Switch" suffix. The user-space expects a "Switch" suffix is for a boolean blindly. Either omit the switch suffix, or use "Route" suffix, in any. Also, when I apply with git-am, the author is taken from From: line, which doesn't contain your full name . The best would to submit the patch with git-send-email, then it'll add a proper From: line if needed. thanks, Takashi _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel