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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2C57FCCF2C9 for ; Sun, 18 Oct 2026 05:55:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=TkL5krI5HcwcF2aMm7pBYk9h5C6V+6rm4QZatT5Wuo4=; b=o5xcf4fjMEiL+YRSaXCIrdcAqH 7DWC9nR4gQbFZoT1nbvjEoOv24Xeqpp30Pgo6t0PpKnPgXKfuKyHl+xPnSuPgaMoEzNqvkTClGWfW nOh+SDbBd0hZgthoaDBTIqB4gFcVl2kH9z5h2OulEGtcnysDBi6ztYhxlSpLHydRVbJweqkA2ZipF KO/oicW+1ZzCLQl94a1c9r5ntoNraHkr9iOokyb8ESJumGFI7o3eL0O2Ed/0rS5b/SfDQPmyf+nqI uyL/tQ2/UHydq10gIlSl9ULl1XpJGEasbScZepHvEVkOfsUGVPM8CI5v9V6qN5b2THSAUG8a6Gw+/ ZfRciAkg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1xIJrY-00000005Zjd-0XBk; Sun, 18 Oct 2026 05:55:16 +0000 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1xIJrS-00000005ZgN-2bLe for linux-mediatek@lists.infradead.org; Sun, 18 Oct 2026 05:55:13 +0000 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-2e987b4a710so9629605ad.1 for ; Sat, 17 Oct 2026 22:55:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1792302910; x=1792907710; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=TkL5krI5HcwcF2aMm7pBYk9h5C6V+6rm4QZatT5Wuo4=; b=V3seBbI5of/mGuYKlPlHt1hYLhUULvsIofYfJv6aQpgI8UPviV0R095uu97X0x1u05 HjIxwzcsXO+PcsFyNoPvLDoS87sZaYNFgfTWc8Ium4PSFRsEwgFV+wLqUz4iP9hjhQQF QE2Zgtguxf/hRaM+riFKYKuBcElzpWMxJtz+5LyuOC1afUqB3+smd/2yLSfxlGaZsHp8 YTbE6LnmjbNZgzHpX0UOqVAj/XAU5XUoStCO5qR5cJxBSsmLOaLKim04MLlYs8DjaVzv Nss+0YzMxWSFY1gsBv+videz8S0mZZ30OJglqo+yjfkwhZqxM+1PYJiz5GAXfqFDOz/g UpFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792302910; x=1792907710; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=TkL5krI5HcwcF2aMm7pBYk9h5C6V+6rm4QZatT5Wuo4=; b=ZbAcnCY8aQkWQDl/jkVa9LWKQrIciBJZmIAKILEr90t3Rrozq+AHb6aENlf1n2LmZy uzPR3LCy64v3vhVtfNj/y2kCHwBscqTz7orNebuKM1lq3QWFSnmbHXjYBJa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nm9VA/BHq/bhfbHwr9iS2P8d/Vl7rIxyHK4fs= X-Received: by 2002:a17:90b:580c:b0:3a8:337d:228a with SMTP id 98e67ed59e1d1-3acee2768cfmr2702377a91.6.1792302909929; Sat, 17 Oct 2026 22:55:09 -0700 (PDT) Received: from [10.0.70.21] ([2403:581e:d87e:0:fc2d:ed31:e80e:412d]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3acd0cde4fdsm5511292a91.4.2026.10.17.22.55.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Oct 2026 22:55:09 -0700 (PDT) From: James Calligeros Date: Sun, 18 Oct 2026 15:53:58 +1000 Subject: [PATCH v3 04/21] ASoC: ops: Introduce 'snd_soc_ctl_activate' MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20261018-macaudio-v3-4-abdff7741dea@gmail.com> References: <20261018-macaudio-v3-0-abdff7741dea@gmail.com> In-Reply-To: <20261018-macaudio-v3-0-abdff7741dea@gmail.com> To: David Rhodes , Richard Fitzgerald , =?utf-8?q?Martin_Povi=C5=A1er?= , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , James Calligeros , Jaroslav Kysela , Takashi Iwai , Matthias Brugger , AngeloGioacchino Del Regno , Shenghao Ding , Kevin Lu , Baojun Xu , Sen Wang , Sven Peter , Janne Grunau , Neal Gompa Cc: asahi@lists.linux.dev, linux-sound@vger.kernel.org, patches@opensource.cirrus.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2214; i=jcalligeros99@gmail.com; h=from:subject:message-id; bh=eogWKeAPSgLXuvFuxBpm0mCMpQlIZe0f6Gyo195bzv4=; b=owGbwMvMwCV2xczoYuD3ygTG02pJDFlX4nlMut3rN7jGTw++yar56Nujo3kPXr314b2V6G32L sVitc3hjoksDGJcDJZiiiwbmoQ8Zhux3ewXqdwLM4eVCWSItEgDAxCwMPDlJuaVGukY6ZlqG+oZ GukY6xgxcHEKwFRzMTMyHGOoaN6st3+KE4v2kjMP89/dODOtQUhfq3/H9G9JAnm/7jEyfGvpbTO UNf+wb7uxRIrgSp3Pjs/Nzff/XjRR/I1lsJ4LEwA= X-Developer-Key: i=jcalligeros99@gmail.com; a=openpgp; fpr=B08212489B3206D98F1479BDD43632D151F77960 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261017_225510_784663_0CA79EA2 X-CRM114-Status: GOOD ( 12.07 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Martin Povišer This function mirrors wraps the sound/core 'snd_ctl_activate_id' for ASoC. Machine drivers may call it to lock down kcontrols during fixup_controls. Signed-off-by: Martin Povišer Signed-off-by: James Calligeros --- include/sound/soc.h | 2 ++ sound/soc/soc-ops.c | 32 +++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/include/sound/soc.h b/include/sound/soc.h index 553bb7e2be98..7509824a6b2e 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -578,6 +578,8 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol); int snd_soc_limit_volume(struct snd_soc_card *card, const char *name, int max); +int snd_soc_ctl_activate(struct snd_soc_card *card, + const char *name, int active); int snd_soc_bytes_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo); int snd_soc_bytes_get(struct snd_kcontrol *kcontrol, diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c index 142f407e3939..295056bcc081 100644 --- a/sound/soc/soc-ops.c +++ b/sound/soc/soc-ops.c @@ -471,6 +471,38 @@ int snd_soc_limit_volume(struct snd_soc_card *card, const char *name, int max) } EXPORT_SYMBOL_GPL(snd_soc_limit_volume); +/** + * snd_soc_ctl_activate - Activate/deactivate a control matching a name + * + * @card: where to look for the control + * @name: name + * @active: zero to deactivate, nonzero to activate + * + * Return: 0 if unchanged, 1 if changed, or a negative error code on failure. + */ +int snd_soc_ctl_activate(struct snd_soc_card *card, + const char *name, int active) +{ + struct snd_kcontrol *kctl; + int ret = -EINVAL; + + if (!name) + return ret; + + kctl = snd_soc_card_get_kcontrol(card, name); + + if (kctl) { + ret = snd_ctl_activate_id(card->snd_card, &kctl->id, active); + if (ret < 0) + return ret; + } else { + dev_dbg(card->dev, "Tried to de/activate unknown control '%s'\n", name); + } + + return ret; +} +EXPORT_SYMBOL_GPL(snd_soc_ctl_activate); + int snd_soc_bytes_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { -- 2.56.0