From mboxrd@z Thu Jan 1 00:00:00 1970 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=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no 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 21F5DC433DB for ; Mon, 8 Feb 2021 16:34:04 +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 BCAC564E8F for ; Mon, 8 Feb 2021 16:34:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BCAC564E8F 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 480171676; Mon, 8 Feb 2021 17:33:10 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 480171676 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1612802040; bh=Uzev0ALhE4ZFJmh/d8jaQEzlm2VEaJRB7FhxMA3TBCY=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=nCSi0eY2Q+5aYMImN3Dx11cvNT+dd2hjcawGu1aCtoxAptkDKkulRI/t4aoI4WHXG 0SpJXRZuxXSo3vjnEuPlmdgmDNrUy7ilY3dZY3TmprRjLOALDufoAWifaMwafeBvVn fAO1GMnP25hEKL+BO8Ak9cOV/jdGs886NDFreZr4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id AF609F80169; Mon, 8 Feb 2021 17:33:09 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A68D4F8022B; Mon, 8 Feb 2021 17:33:07 +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 A5A5BF80165 for ; Mon, 8 Feb 2021 17:33:03 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A5A5BF80165 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 CF2D6AB98; Mon, 8 Feb 2021 16:33:02 +0000 (UTC) Date: Mon, 08 Feb 2021 17:33:02 +0100 Message-ID: From: Takashi Iwai To: Jaroslav Kysela Subject: Re: [PATCH] [RFC] ALSA: control - add generic LED API to sound core routines In-Reply-To: <3bc1b151-68ce-8408-aff1-aeba2e6fe4c3@perex.cz> References: <20210207201157.869972-1-perex@perex.cz> <3bc1b151-68ce-8408-aff1-aeba2e6fe4c3@perex.cz> 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 Cc: Hans de Goede , ALSA development , Perry Yuan 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 Mon, 08 Feb 2021 17:17:29 +0100, Jaroslav Kysela wrote: > > Dne 08. 02. 21 v 16:11 Takashi Iwai napsal(a): > > On Sun, 07 Feb 2021 21:11:57 +0100, > > Jaroslav Kysela wrote: > >> > >> [DO NOT MERGE!] > >> [This is just an early proposal for comments] > >> [The code is not tested / debugged] > >> > >> The recent laptops have usually two LEDs assigned to reflect > >> the speaker and microphone mute state. This implementation > >> adds a tiny layer on top of the control API which calculates > >> the state for those LEDs using the driver callbacks. > >> > >> Two new access flags are introduced to describe the controls > >> which affects the audio path settings (an easy path for drivers). > >> > >> The LED resource can be shared with multiple sound cards with > >> this code. The user space controls may be added to the state > >> chain, too. > >> > >> This code should replace the LED code in the HDA driver and > >> add a possibility to easy extend the other drivers (ASoC > >> codecs etc.). > > > > Having a common helper in the ALSA core sounds like a good way to go. > > > > My slight concern is that this will end up having the dependency on > > LEDS stuff unconditionally when CONFIG_SND_LED=y. > > You probably mean that the LEDs subsystem is activated even if we don't have > audio LED class driver connected, right? Yes. > I think that the HDA way (select conditionally the LED code) in the low-level > driver Kconfig is good, but I'm open for any other suggestions. Well, in the case of HD-audio, it's only for HD-audio. But with this change, LEDS class will be always loaded on distro kernels no matter which sound driver is actually used. I guess we can split the LED-support code to another module? The problem would be the registration from the control core. The other parts look already isolated enough. > > Also, are those new access flags exposed to user-space intentionally, > > so that user-space gets some information? > > Yes, it's one benefit, the second benefit is that we can create user space > controls for hardware which does not have any switch / volume controls for the > given path. > > An example is the AMD ACP bridge with the simple digital microphones. We can > use alsa-lib's softvol plugin to control the volume for this and it would be > nice to mark this user space control with the mic mute LED flag. OK, makes sense. > > Last but not least: I'm not sure whether we should limit to only two > > LEDs (mic and spk). I'm afraid that there will be more LEDs in > > future; people love decorations :) > > We have some more free bits in the access field. If the LED count will > increase in future for the standard hardware, we should reconsider the > implementation (info callback or so). > > Perhaps, it may be clever to reserve three bits from the access flags now (to > create a three bit value not a mask). In this case, we can carry information > for 7 LED types (assuming that one control element can be assigned only to one > LED type). Sounds like a good idea. I guess 4 types would suffice for now. thanks, Takashi