From patchwork Tue Oct 3 15:57:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 728835 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 5C08DE7AD75 for ; Tue, 3 Oct 2023 16:03:53 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id A1477E74; Tue, 3 Oct 2023 18:03:01 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A1477E74 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1696349031; bh=9Ubr+IhBnNwpdPuPk/XbfbKlx5zEKvtiPdy0NEO9LPc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=JjXqNlYoe8sEW5D1kgenLOWuORdWmF8kCA5e1/IsAMhRPLBQ1RRQgofnGFfIvEmyN ZWz5YQ52mPDBC26xsO1vx4pEEb6ApBZ2GpWdWvlcakliTkrnctq6vr58TIyM/mtpUg 5i9CyiZ4wkYec6wkJioO7lSH2KEgpSGcJOroonvU= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 66453F80568; Tue, 3 Oct 2023 18:02:33 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id D53BBF8056F; Tue, 3 Oct 2023 18:02:32 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1FB8DF80564; Tue, 3 Oct 2023 17:59:29 +0200 (CEST) Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 2FAC4F8047D for ; Tue, 3 Oct 2023 17:57:18 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2FAC4F8047D Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=su6m8QvP Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-9a9f139cd94so184201366b.2 for ; Tue, 03 Oct 2023 08:57:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696348636; x=1696953436; darn=alsa-project.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=168VbodA38Hdi5eAfuNgKvUwcfZckCEtb5Hwk95lQ/Q=; b=su6m8QvPbKnKqj2v2VlEkNJEEwJ2oWhY7z2yQUsLuCZezBV4u79+ptWaCENyqLj42W J1pPiA90WXNKZHiUkI2H8ulM2JdDAwppZOIUYjSf3u2zd2oM7oI3kUPszXO78zsggnqN oBU4hxsLfuhyFPRs3r3WlIRrHfoCOhV5WpDxfZoJYc6m2mN0vna535AcyQrbqkNeRAEd Alos3ldIxZTt1HlRcKMk86C0Cc/VunAVRogbpv4SA8d0uob9uTfSYfCaNlUxCRwjdwCW Ffi/9rrhDKnDbn696wzEFhjHzB2svO6adwv7L8SdCCGRrs82ZoDhrAvEJZcNWATdWREL f8zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696348636; x=1696953436; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=168VbodA38Hdi5eAfuNgKvUwcfZckCEtb5Hwk95lQ/Q=; b=ryKy5XgXUS9lvW0zsUM5a/3FwG2UfXqSmw7f+WSkoMVjcKwCabFSNoeRUoMZP4caDE BsxTjAiOG6wDL1KQ39bUCsUXm7OlpKJQpCn0hxkrGMCiloUjLGA+bGxDPlQ4+hATmedn XhcxXP9q4Ty0qlUFhxlLwv7MEp9UsIAn4ntd7SwXEOUHRywcUDoZnIjE/0uSZSDUIi6T KbeM7y/ZD5wVfNZwA4Pcr50MzVs1yOshprFxQd4H4cvDhqJcnAQ7wOYqxK1123V4p/73 siSLVYrBg9wtSa8bBYdRSxyA0Ga5bb5CN8z7FA22flI3hnyUr3OjSUHVTpFWNcBN+YVb AFNQ== X-Gm-Message-State: AOJu0YwI4bNu9pxPlWXMy7HSykt5QWgTZBx8UbKGgVik1xi2FifbEYPv /0z0iD/3QeMXU7NnJYXKJu4GpQ== X-Google-Smtp-Source: AGHT+IFxb7p6HyTQDTwuHqjaxVz5+dsTwm+VvkHaxagLHnQgS8VYvxoMpoZBnybgXCeiPC4gYQTmqQ== X-Received: by 2002:a17:906:51db:b0:9b2:abda:2543 with SMTP id v27-20020a17090651db00b009b2abda2543mr14616486ejk.65.1696348636295; Tue, 03 Oct 2023 08:57:16 -0700 (PDT) Received: from krzk-bin.. (5-157-101-10.dyn.eolo.it. [5.157.101.10]) by smtp.gmail.com with ESMTPSA id w25-20020a170906481900b0099bc2d1429csm1288088ejq.72.2023.10.03.08.57.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 08:57:15 -0700 (PDT) From: Krzysztof Kozlowski To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Srinivas Kandagatla , Banajit Goswami , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [PATCH 1/2] ASoC: soc-dapm: Add helper for comparing widget name Date: Tue, 3 Oct 2023 17:57:09 +0200 Message-Id: <20231003155710.821315-2-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231003155710.821315-1-krzysztof.kozlowski@linaro.org> References: <20231003155710.821315-1-krzysztof.kozlowski@linaro.org> MIME-Version: 1.0 Message-ID-Hash: YQFU3PYGQYRZVYFYEXDAITTQ25AEVVQS X-Message-ID-Hash: YQFU3PYGQYRZVYFYEXDAITTQ25AEVVQS X-MailFrom: krzysztof.kozlowski@linaro.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Some drivers use one event callback for multiple widgets but still need to perform a bit different actions based on actual widget. This is done by comparing widget name, however drivers tend to miss possible name prefix. Add a helper to solve common mistakes. Signed-off-by: Krzysztof Kozlowski --- include/sound/soc-dapm.h | 1 + sound/soc/soc-component.c | 1 + sound/soc/soc-dapm.c | 12 ++++++++++++ 3 files changed, 14 insertions(+) diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index d2faec9a323e..433543eb82b9 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h @@ -469,6 +469,7 @@ void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card); int snd_soc_dapm_update_dai(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai); +int snd_soc_dapm_widget_name_cmp(struct snd_soc_dapm_widget *widget, const char *s); /* dapm path setup */ int snd_soc_dapm_new_widgets(struct snd_soc_card *card); diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c index 69198de39e79..4d7c2e3c929a 100644 --- a/sound/soc/soc-component.c +++ b/sound/soc/soc-component.c @@ -242,6 +242,7 @@ int snd_soc_component_notify_control(struct snd_soc_component *component, char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; struct snd_kcontrol *kctl; + /* When updating, change also snd_soc_dapm_widget_name_cmp() */ if (component->name_prefix) snprintf(name, ARRAY_SIZE(name), "%s %s", component->name_prefix, ctl); else diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 2512aadf95f7..8f22ce857f4a 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -2728,6 +2728,18 @@ int snd_soc_dapm_update_dai(struct snd_pcm_substream *substream, } EXPORT_SYMBOL_GPL(snd_soc_dapm_update_dai); +int snd_soc_dapm_widget_name_cmp(struct snd_soc_dapm_widget *widget, const char *s) +{ + struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm); + const char *wname = widget->name; + + if (component->name_prefix) + wname += strlen(component->name_prefix) + 1; /* plus space */ + + return strcmp(wname, s); +} +EXPORT_SYMBOL_GPL(snd_soc_dapm_widget_name_cmp); + /* * dapm_update_widget_flags() - Re-compute widget sink and source flags * @w: The widget for which to update the flags From patchwork Tue Oct 3 15:57:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 729337 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 08D54E7AD74 for ; Tue, 3 Oct 2023 15:59:14 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 6C233A4A; Tue, 3 Oct 2023 17:58:22 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 6C233A4A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1696348752; bh=WlhpXA3KDD0/FgpskiX15zwM8aTAJe0rZMpdmLJeseI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=rdQCinMMSXWwHdidztXHeUa/nJHXj7AUAXhhFTxx1y9uJ/kOBSbXMRZ+eoGHbQmh2 SXoqxxAyjX+8ndjBFQlHzY9SDTQl+HYMrfQD0ydU9jD50OBwav8rZtaqngxt08BRWg ZNsDe43wm4RL8NMgiQqnyuM05uFnAFXnrm6PjHAg= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 58183F8056F; Tue, 3 Oct 2023 17:57:34 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id E2E97F80563; Tue, 3 Oct 2023 17:57:33 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id C71DCF80549; Tue, 3 Oct 2023 17:57:29 +0200 (CEST) Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id BB8EDF80166 for ; Tue, 3 Oct 2023 17:57:18 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz BB8EDF80166 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=QgxgE4Mv Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-9ad8a822508so201169366b.0 for ; Tue, 03 Oct 2023 08:57:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696348637; x=1696953437; darn=alsa-project.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GTMTkkvOrFaQjz0yOJaB7Q7/cPC8x6m+P9hBCS11kOw=; b=QgxgE4Mvk6FKB3tVPs/jZifWhZNiP/M7jXmMqPzkS2n3cg2SBblFtzhPmudZTRnibm oP2CzCzcx74OQVFKAUu9dXLXFLT5ywHRikRS4PqDw7bex1If76UeBqhWvi24r+rjfYTM 3iDOC1cZAYYJN/fKXx+Bo8WphpCMxNT6lRb6S6ziqZALgAsMJqKnrhX3WAwPazGwA4EK rg+rM4lBzyQPd7EL9HgYkvRZVQkW2KteDmKE0z994ukB7XU7SFVeQZfRpGha19u8Ly7V MWgBxBJTWSA2jtSBOEa9PJcGZXBXOjAesQeljM6C7UlBXKA4fKLS0kIdADdDJAai7w6I +64w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696348637; x=1696953437; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GTMTkkvOrFaQjz0yOJaB7Q7/cPC8x6m+P9hBCS11kOw=; b=gvhyPJu76TIJnLuLAKD4gl9J9mXqSVtUgize2d2gz0GScLBm0FfG6smfmZwbZcyphy wTArEPjMKaPKk0eglUHm75lxBPzRs1wyWYJ/qq5xVJHVtGk8ILSDA3vGJa3Cd86XxmpL haB8hJoOu4gRY8Ak6B9iYCyw1ySYGJeqy159FApesNVzMUC2wixs55pMqvvDFL4GoZbD E8FI3EhlTnEWnhfEZcDhcf/F+OLN4qinCbGCI1jqQobp8UcG8AtXwMBz2bVFyieNz+RU pSSC5qr8ZGV46sv7fvi0FYpjxheJ93423xJLEr6zQjGwiTBn7w54LYNmLZDtGNXn8kwM kYoQ== X-Gm-Message-State: AOJu0YzTtgTLnVfP1kOHZfJurK2Ls3mPtcQMxmG6/qCfXgwlKNrxHwBK gwT9dwOBsMK7UvjUAOXoxHuZVw== X-Google-Smtp-Source: AGHT+IH6Iv8pRe5kVjLJr/VnS5qxhiKaTIKJ7fgCvAijxKTfbrDX6qtvCp9N5M3hF1FzRbOXyUwQig== X-Received: by 2002:a17:906:7383:b0:9ae:5aa5:ee6c with SMTP id f3-20020a170906738300b009ae5aa5ee6cmr14822922ejl.12.1696348637599; Tue, 03 Oct 2023 08:57:17 -0700 (PDT) Received: from krzk-bin.. (5-157-101-10.dyn.eolo.it. [5.157.101.10]) by smtp.gmail.com with ESMTPSA id w25-20020a170906481900b0099bc2d1429csm1288088ejq.72.2023.10.03.08.57.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 08:57:17 -0700 (PDT) From: Krzysztof Kozlowski To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Srinivas Kandagatla , Banajit Goswami , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [PATCH 2/2] ASoC: codecs: wsa-macro: handle component name prefix Date: Tue, 3 Oct 2023 17:57:10 +0200 Message-Id: <20231003155710.821315-3-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231003155710.821315-1-krzysztof.kozlowski@linaro.org> References: <20231003155710.821315-1-krzysztof.kozlowski@linaro.org> MIME-Version: 1.0 Message-ID-Hash: SQKWCQTRC22EKWL4MXVUA5XF66F5ZHXF X-Message-ID-Hash: SQKWCQTRC22EKWL4MXVUA5XF66F5ZHXF X-MailFrom: krzysztof.kozlowski@linaro.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: When comparing widget names in wsa_macro_spk_boost_event(), consider also the component's name prefix. Otherwise the WSA codec won't have proper mixer setup resulting in no sound playback through speakers. Signed-off-by: Krzysztof Kozlowski --- sound/soc/codecs/lpass-wsa-macro.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/lpass-wsa-macro.c b/sound/soc/codecs/lpass-wsa-macro.c index ea6e3fa7e9e1..7e21cec3c2fb 100644 --- a/sound/soc/codecs/lpass-wsa-macro.c +++ b/sound/soc/codecs/lpass-wsa-macro.c @@ -1675,12 +1675,12 @@ static int wsa_macro_spk_boost_event(struct snd_soc_dapm_widget *w, u16 boost_path_ctl, boost_path_cfg1; u16 reg, reg_mix; - if (!strcmp(w->name, "WSA_RX INT0 CHAIN")) { + if (!snd_soc_dapm_widget_name_cmp(w, "WSA_RX INT0 CHAIN")) { boost_path_ctl = CDC_WSA_BOOST0_BOOST_PATH_CTL; boost_path_cfg1 = CDC_WSA_RX0_RX_PATH_CFG1; reg = CDC_WSA_RX0_RX_PATH_CTL; reg_mix = CDC_WSA_RX0_RX_PATH_MIX_CTL; - } else if (!strcmp(w->name, "WSA_RX INT1 CHAIN")) { + } else if (!snd_soc_dapm_widget_name_cmp(w, "WSA_RX INT1 CHAIN")) { boost_path_ctl = CDC_WSA_BOOST1_BOOST_PATH_CTL; boost_path_cfg1 = CDC_WSA_RX1_RX_PATH_CFG1; reg = CDC_WSA_RX1_RX_PATH_CTL;