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 8D30AC433DB for ; Tue, 30 Mar 2021 15:50: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 11BE8619C5 for ; Tue, 30 Mar 2021 15:50:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 11BE8619C5 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 0C76A167A; Tue, 30 Mar 2021 17:49:11 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0C76A167A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1617119401; bh=6xyxyP5SsV17NYP0kBERZ3hxlx3TfNVDek0Scn8frHA=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=LXWcbDMyUklmFzCdc4v6uNdFw+1PXO6AuOjJzXU2SNHa9XfHP8M1pU+itpPBwdZYd cMs5fdCJuByxt2kjFolOmAKgM3PMfhUzrF9/ziNM7kf6E6HYlmYwsWwZALyMDhN4ra H+deQLM02/YAOAhdlyB7Pb4YFAfQeY/xZ2S3kV2M= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 782FDF80141; Tue, 30 Mar 2021 17:49:10 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6C9ADF80240; Tue, 30 Mar 2021 17:49:08 +0200 (CEST) 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 951B0F80141 for ; Tue, 30 Mar 2021 17:49:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 951B0F80141 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 B34C9AE15; Tue, 30 Mar 2021 15:49:04 +0000 (UTC) Date: Tue, 30 Mar 2021 17:49:04 +0200 Message-ID: From: Takashi Iwai To: Jaroslav Kysela Subject: Re: [PATCH v4 0/6] ALSA: control - add generic LED API In-Reply-To: <20210317172945.842280-1-perex@perex.cz> References: <20210317172945.842280-1-perex@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: Curtis Malainey , Hans de Goede , ALSA development , Mark Brown , Dylan Reid 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 Wed, 17 Mar 2021 18:29:39 +0100, Jaroslav Kysela wrote: > > This patchset tries to resolve the diversity in the audio LED > control among the ALSA drivers. A new control layer registration > is introduced which allows to run additional operations on > top of the elementary ALSA sound controls. > > A new control access group (three bits in the access flags) > was introduced to carry the LED group information for > the sound controls. The low-level sound drivers can just > mark those controls using this access group. This information > is not exported to the user space, but user space can > manage the LED sound control associations through sysfs > (last patch) per Mark's request. It makes things fully > configurable in the kernel and user space (UCM). > > The actual state ('route') evaluation is really easy > (the minimal value check for all channels / controls / cards). > If there's more complicated logic for a given hardware, > the card driver may eventually export a new read-only > sound control for the LED group and do the logic itself. > > The new LED trigger control code is completely separated > and possibly optional (there's no symbol dependency). > The full code separation allows eventually to move this > LED trigger control to the user space in future. > Actually it replaces the already present functionality > in the kernel space (HDA drivers) and allows a quick adoption > for the recent hardware (ASoC codecs including SoundWire). > > # lsmod | grep snd_ctl_led > snd_ctl_led 24576 0 > > The sound driver implementation is really easy: > > 1) call snd_ctl_led_request() when control LED layer should be > automatically activated > / it calls module_request("snd-ctl-led") on demand / > 2) mark all related kcontrols with > SNDRV_CTL_ELEM_ACCESS_SPK_LED or > SNDRV_CTL_ELEM_ACCESS_MIC_LED > > v4 changes: > - the LED access flags are private to kernel now (no user space > API change) > - fixes (kctl management, sysfs cleanup) > - add the sysfs LED marking kcontrol management > - https://lore.kernel.org/alsa-devel/28fffebd-1ce9-7480-0f2f-ed8369abddf1@perex.cz/ > v3 changes: > - reorder the controls_rwsem use to fix the remaining mutex issue > card->controls_rwsem <-> snd_ctl_layer_rwsem > v2 changes: > - fix the locking - remove the controls_rwsem read lock > in the element get (the consistency is already protected > with the global snd_ctl_led_mutex and possible partial > value writes are catched with the next value change > notification callback) > - rename state to brightness and show the brightness > unsigned integer value instead the text on/off string > (sync with the LED core routines) > - remove snd_ctl_led_hello() function (CI warning) > - make snd_ctl_led_get_by_access() function static (CI warning) > - move snd_ctl_layer_rwsem lock before the registraction > callback call in snd_ctl_register_layer() - optimization > v1: > - https://lore.kernel.org/alsa-devel/20210211111400.1131020-1-perex@perex.cz/ > Original RFC: > - https://lore.kernel.org/alsa-devel/20210207201157.869972-1-perex@perex.cz/ > > Cc: Hans de Goede > > Jaroslav Kysela (6): > ALSA: control - introduce snd_ctl_notify_one() helper > ALSA: control - add layer registration routines > ALSA: control - add generic LED trigger module as the new control > layer > ALSA: HDA - remove the custom implementation for the audio LED trigger > ALSA: control - add sysfs support to the LED trigger module > ALSA: led control - add sysfs kcontrol LED marking layer As we seem agreeing with this approach, I merged this patch set as is now for 5.13. For the further development, let's put changes over there. An immutable branch was created on top of the clean 5.12-rc5, and tagged as mute-led-rework, too. Mark, please pull from there if you need to patch further ASoC changes that are relevant with the feature. Thanks! Takashi