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=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,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 35B61C433E0 for ; Wed, 13 Jan 2021 15:02:29 +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 BA950235FA for ; Wed, 13 Jan 2021 15:02:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BA950235FA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com 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 EF00E16C3; Wed, 13 Jan 2021 16:01:34 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz EF00E16C3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1610550145; bh=T+vRA3FAhlPg1LKZ1Cr1vsqEsz6NP9iPsMFWfMUA1m0=; h=Date:From:To:Subject:References:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=pAB/T4RGX8EimZuU2AdIKS1dpquLCrHmOmclfEAQxT51AAv0ErJ12m6VBmPVdicI0 +C8kXK1tmBVtwl/65np/fZpOfFUOVwBuKVZeShDmhPjaYMYuve7rsHD6f1JPP8S4HU Lxv+kiEihpFw8c0TR9/HEmKvChRopzOEt2KcyvRI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 66DE1F8016D; Wed, 13 Jan 2021 16:01:33 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 591A4F801ED; Wed, 13 Jan 2021 16:01:31 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id E48D7F80085 for ; Wed, 13 Jan 2021 16:01:22 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E48D7F80085 IronPort-SDR: 0r98i2bEBv7rGLKRay3f0ASM6W145ZHiJAJV9XTfnQpiU9/xV9uvWvwZKE0jhD3Y1o/BVfvpVV RqYBeW0vnccQ== X-IronPort-AV: E=McAfee;i="6000,8403,9862"; a="165887975" X-IronPort-AV: E=Sophos;i="5.79,344,1602572400"; d="scan'208";a="165887975" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2021 07:01:09 -0800 IronPort-SDR: 6crpaSpDFenJkpsAJQgSbezS6LS9WgEXcNRUChxgfRstq7FQNM+WJHvDiRhFIVBX5PYadcrccu AYnoCebKq9MA== X-IronPort-AV: E=Sophos;i="5.79,344,1602572400"; d="scan'208";a="348846046" Received: from kekkonen.fi.intel.com ([10.237.72.68]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2021 07:01:08 -0800 Date: Wed, 13 Jan 2021 16:53:14 +0200 From: Jaska Uimonen To: Takashi Sakamoto Subject: Re: [RFC PATCH 1/3] ALSA: control: add kcontrol_type to control Message-ID: <20210113145314.GA2115387@kekkonen.fi.intel.com> References: <20210108112355.2053917-1-jaska.uimonen@linux.intel.com> <20210108112355.2053917-2-jaska.uimonen@linux.intel.com> <1272f71c-c736-d267-563e-c2bf43b740da@perex.cz> <20210108140659.GA44940@workstation> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210108140659.GA44940@workstation> Cc: alsa-devel@alsa-project.org 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 Fri, Jan 08, 2021 at 11:06:59PM +0900, Takashi Sakamoto wrote: > Hi, > > On Fri, Jan 08, 2021 at 12:40:28PM +0100, Jaroslav Kysela wrote: > > Dne 08. 01. 21 v 12:23 Jaska Uimonen napsal(a): > > > Current kcontrol structs don't have a member to describe the control > > > type. The type is present in the widget which contains the control. As > > > there can be many controls in one widget it is inherently presumed that > > > the control types are the same. > > > > > > Lately there has been use cases where different types of controls would > > > be needed for single widget. Thus enable this by adding the control type > > > to kcontrol and kcontrol_new structs. > > > > It looks like a SoC only extension. Use private_data to carry this > > information. It has no value for the toplevel code. > > > > Jaroslav > > In current design of ALSA control core, the type of control element is > firstly determined by driver in callback of snd_kcontrol.info(). The > callback is done when userspace applications call ioctl(2) with > SNDRV_CTL_IOCTL_ELEM_INFO request. > > The patch doesn't touch to the above processing. It means that the type > information is just for kernel-land implementation and is not exposed to > userspace application. > > Essentially, driver is dominant to determine the type of control element > in control element set which the driver adds. It's possible to achieve > your intension without changing ALSA control core itself, in my opinion. > > As Jaroslav said, it's better to change core of ALSA SoC part according > to your intention. If you'd like to change ALSA control core, I'd like > to request for the check of mismatch between the value of added member > in snd_kcontrol and the value of type of control element returned from > driver, like: > > ``` > diff --git a/sound/core/control.c b/sound/core/control.c > index 809b0a62e..c3ae70574 100644 > --- a/sound/core/control.c > +++ b/sound/core/control.c > @@ -973,6 +973,7 @@ static int __snd_ctl_elem_info(struct snd_card *card, > result = kctl->info(kctl, info); > if (result >= 0) { > snd_BUG_ON(info->access); > + snd_BUG_ON(info->type == kctl->kcontrol_type); > index_offset = snd_ctl_get_ioff(kctl, &info->id); > vd = &kctl->vd[index_offset]; > snd_ctl_build_ioff(&info->id, kctl, index_offset); > ``` > > > Regards > > Takashi Sakamoto Hi, Thanks for the comments, I tried to do the same thing now in asoc level, will send v2. br, Jaska