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=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 9057FC433DB for ; Mon, 1 Feb 2021 08:43:47 +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 BAB4164E3C for ; Mon, 1 Feb 2021 08:43:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BAB4164E3C 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 6A80F1770; Mon, 1 Feb 2021 09:42:53 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 6A80F1770 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1612169023; bh=dM3LPmcOnce+YezUPPVAIDRNVU3nZfG0EcxgG3Rz+xY=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=mnu307Fvs5ZSZji/GU3UBrVycmt5YUe/H4W/hJwoiDYteV4A8xawV1udVHlj5ybdf GREv4FZfACCgTdg3lpmdYEerW37iBysavJRFX6LfpCw7dIR9SOPwMZeynZaFjmaHH5 rPSQ9/vjhGbX0Cg60Qev7/XHr2PeKB3b1d34f5q0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id EBBE8F8015A; Mon, 1 Feb 2021 09:42:52 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 0BA20F80224; Mon, 1 Feb 2021 09:42:52 +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 51336F8015A for ; Mon, 1 Feb 2021 09:42:46 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 51336F8015A X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 1A1DCAD0B; Mon, 1 Feb 2021 08:42:46 +0000 (UTC) Date: Mon, 01 Feb 2021 09:42:45 +0100 Message-ID: From: Takashi Iwai To: fassl Subject: Re: [PATCH] sound: pci/rme9652 - implement and expose controls for output In-Reply-To: <3cd2889a-e71a-aa3f-e79a-d11a4833c581@gmail.com> References: <3cd2889a-e71a-aa3f-e79a-d11a4833c581@gmail.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") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: alsa-devel@alsa-project.org, Allen Pais , Takashi Iwai , Colin Ian King , Romain Perier 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Sun, 31 Jan 2021 22:37:32 +0100, fassl wrote: > > >From 980aa253c17d233966e05a43f3611693e2e02040 Mon Sep 17 00:00:00 2001 > From: Jasmin Fazlic > Date: Sun, 31 Jan 2021 22:17:22 +0100 > Subject: [PATCH] sound: pci/rme9652 - implement and expose controls for output >  loopback > > - so far only tested and enabled for RME HDSP9632 > > Signed-off-by: Jasmin Fazlic Could you give a bit more description? What exactly the additions do? About the code change: > +static int snd_hdsp_loopback_info(struct snd_kcontrol *const kcontrol, > +                  struct snd_ctl_elem_info *const uinfo) > +{ > +    uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; > +    uinfo->count = 1; > +    uinfo->value.integer.min = 0; > +    uinfo->value.integer.max = 1; > +    return 0; > +} This is identical with snd_ctl_boolean_mono_info. > +static struct snd_kcontrol_new snd_hdsp_loopback_control = { > +    .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, > +    .name = "Output Loopback", > +    .index = 0, > +    .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, > +    .info = snd_hdsp_loopback_info, > +    .get = snd_hdsp_loopback_get, > +    .put = snd_hdsp_loopback_put > +}; IFACE_HWDEP is used in hdsp driver because it's a sort of special mixer setup. I don't know your mixer stuff need to follow that. >  static int snd_hdsp_create_controls(struct snd_card *card, struct hdsp *hdsp) >  { >      unsigned int idx; > @@ -3297,6 +3363,17 @@ static int snd_hdsp_create_controls(struct snd_card *card, struct hdsp *hdsp) >          } >      } >   > +    /* Output loopback controls for H9632 cards */ > +    if (hdsp->io_type == H9632) { > +        for (idx = 0; idx < hdsp->max_channels; idx++) { > +            snd_hdsp_loopback_control.index = idx; > +            kctl = snd_ctl_new1(&snd_hdsp_loopback_control, hdsp); > +            err = snd_ctl_add(card, kctl); > +            if (err < 0) > +                return err; > +        } > +    } snd_ctl_new() can be used for allocating the multiple instances in one kcontrol. If the kctl object is created in this way, you'd just need to change your code to retrieve the kctl index via snd_ctl_get_ioff() instead of referring to kctl->index directly. thanks, Takashi