From patchwork Mon May 20 14:19:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 797980 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 F37B8C04FFE for ; Mon, 20 May 2024 14:23:08 +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 325FD82B; Mon, 20 May 2024 16:22:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 325FD82B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1716214987; bh=BQrXQQTyaxGZ3PSkUrwn5zNtXxGEe2/vXi521zgodPM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=rlaCXpBl392S1IAr1dhrNrEbKo9JsIZl1K5G8RtvjBvAtGr9olysdX4XzTfs7w9qO c4X2Y81+UvBQQP0kuirlLm28S2/mTy0kA2HpDmncLMoqdZiRJI8g9eVOsKt89tt0iC QPx8uF/vO4TChe0o5mt/vbew8GVDy/vtE5I/LUcc= Received: by alsa1.perex.cz (Postfix, from userid 50401) id D7702F80611; Mon, 20 May 2024 16:21:46 +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 4ABF5F8061A; Mon, 20 May 2024 16:21:46 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 012FBF8026A; Mon, 20 May 2024 16:20:43 +0200 (CEST) Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) (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 72F5EF8028B for ; Mon, 20 May 2024 16:20:10 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 72F5EF8028B 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=IS6t0u8Q Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-4202c1d19d5so18927245e9.2 for ; Mon, 20 May 2024 07:20:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716214809; x=1716819609; darn=alsa-project.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=zCmZJRRayag6o4GxgnAbuVjFLecTARmQ0KdgUsO8Ydw=; b=IS6t0u8QdTLAD1M5+FjaGsjZumaT+druhDQBsneI5zbzrsFGL8P0o1JOqj/VWV0eIs +EZgchcr79lPf5niBRetH9bL00Z4AO50pO7eFEpgsy+9K0/8+GYd7gfO5/NJj8ZNlTD+ YnvbTRJwbyiirehFhq3Ad3BpiJ0jMFUQSarDEHXqNlBM756WL6Okja7QmPi2VeRDlNze GB2z4MgnqYK5l2HEZ+v2pZHemLJnPJiyZxlAQV9QDYZlP8rlqizphU1DNgJ1LBBndY2X ws8GU0s49nMEkVpWmwSnEUSHGeNy62n8UemEnk/OTQs2KIkUFTSKqh9l4VhiQfIFuL3+ b0VA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716214809; x=1716819609; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zCmZJRRayag6o4GxgnAbuVjFLecTARmQ0KdgUsO8Ydw=; b=MUChN1GdLt2o0AwEGKGnMTl75C22lgY27b9SkeJQxhPlmoieFWX4hqyoZoNDMTtuib XoW1E71sbVVIeRx9VJ2L0j5kx4C9fhpTLKzD35Uopfs+TVNOc2f4/jcEJziyfMT3XMRn AK99Pp4CBiZT6utu8pHCl5IRjIUWpdQVh0GC8/gv2mouTh9i6/9d5G3om6zqT4uwfiqD IS4Cy13BrGd5ef7Y9w74FLDJoV0zqtTsLgFUS/X00lu1449wMI2Mun2JV3JU8CNqHXl7 0NTSgZhQvunz2eHp56M+un3MtSwLZ0q2M5+jJpPICVzfrKyi8yIsKt/Hvzv9ZVDWswyV IzOw== X-Gm-Message-State: AOJu0Yx6Uzvq8BRfxcGdb4Z6C88bIoHKMHqWbVATeXRaUG+C1uBTewmR Rhda9hzzdVTMrFrJUCktQ6DWSVe69sMsvZo6TPG7Fo436yzCRVIo0ooXwm6kVaA= X-Google-Smtp-Source: AGHT+IHGA1qZi8BCksF79z/Rm+AMK4VQrjozLRrZ73UZBqcf5Z4LbCoplPZXhDUNk+WzYge2lwZU4A== X-Received: by 2002:a05:600c:3582:b0:41b:143b:5c2d with SMTP id 5b1f17b1804b1-41feac55195mr226931615e9.28.1716214809472; Mon, 20 May 2024 07:20:09 -0700 (PDT) Received: from [127.0.1.1] ([178.197.206.169]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee962esm421612625e9.31.2024.05.20.07.20.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 07:20:08 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 20 May 2024 16:19:56 +0200 Subject: [PATCH v4 1/4] ASoC: Constify channel mapping array arguments in set_channel_map() MIME-Version: 1.0 Message-Id: <20240520-asoc-x1e80100-4-channel-mapping-v4-1-f657159b4aad@linaro.org> References: <20240520-asoc-x1e80100-4-channel-mapping-v4-0-f657159b4aad@linaro.org> In-Reply-To: <20240520-asoc-x1e80100-4-channel-mapping-v4-0-f657159b4aad@linaro.org> To: James Schulman , David Rhodes , Richard Fitzgerald , Jaroslav Kysela , Takashi Iwai , Liam Girdwood , Mark Brown , Lars-Peter Clausen , =?utf-8?q?Nuno_S=C3=A1?= , Srinivas Kandagatla , Banajit Goswami Cc: alsa-devel@alsa-project.org, patches@opensource.cirrus.com, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, Charles Keepax , Krzysztof Kozlowski X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=10100; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=BQrXQQTyaxGZ3PSkUrwn5zNtXxGEe2/vXi521zgodPM=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmS1wS3bHQiGQB0LU8H76joCn0St7UMGjM6zTjc 0f7nQet2lSJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZktcEgAKCRDBN2bmhouD 1xkyD/wP6Dh59WJdt2bKucHbUMasaDij2viWAX1HjjXES524H9QrpyS/533Q3QQUH6XogNvg805 PdNWfEVKMW03V+/P4/VFgIJS2bVt/5H+YCN0RPenzQFjg4sJdLvrYxaR50UEdjkovLOk/zZAoOX s45IgMjt4PyBZvy1lvxG60+WNt/b1ys0inEV7BT+6lE1gl7OMK0x+ffJflOKQRjf1AKtoyEc0sE K6LTIVusTEfmXe14LS0AIG6sdpFX8zLQflpEFWH1dUZlKX14cY+44XPWrhkjygq3RfdR9Qrl2Ul JLygF23AoyuYYLRGgfzb5WlLbF1toki9aOS4cFX5gwi16ZRHig101rmigIVG9Cc+Tr00kXEhKaD I8z8lOcPDsXJ+L8df7NHq94emZfzjtQiUZp95qv8vdMA7eAc0IpJlRp3H7rkLOYQidsMGabP6al m/jM9YuGZADshCfjkkK6QPbQXd5RyYGKMmnn68HUzp3mNcqQTytBW5/hYRH7FsQ6OsszKZPKHkn p8WzLViFKkg/HvvErFz8Yj2qUG8biVwdrYE9TKYQ2YA2oYKxHYPc4zf2rdHcVM+5g79+rNPeKQg k7HKkHajRfF/VyAAHU5fqv78Jrlicy+WZGrhvbGzb4q6nIAzu3wlnMZOfOK1G8OQFX8MYHMEwRh SauJhdb0mR2gGJQ== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Message-ID-Hash: SIU5XQVRM5HS3KPKFMQRZU53XQ2DT2NQ X-Message-ID-Hash: SIU5XQVRM5HS3KPKFMQRZU53XQ2DT2NQ 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.9 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: There is no need for implementations of DAI set_channel_map() to modify contents of passed arrays with actual channel mapping. Additionally, the caller keeps full ownership of the array. Constify these pointer arguments so the code will be safer and easier to read (documenting the caller's ownership). Acked-by: Charles Keepax Signed-off-by: Krzysztof Kozlowski --- Changes in v2/v3/v4: 1. None --- include/sound/cs35l41.h | 4 ++-- include/sound/soc-dai.h | 8 ++++---- sound/soc/codecs/adau7118.c | 6 ++++-- sound/soc/codecs/cs35l41-lib.c | 4 ++-- sound/soc/codecs/cs35l41.c | 3 ++- sound/soc/codecs/max98504.c | 6 ++++-- sound/soc/codecs/wcd9335.c | 6 ++++-- sound/soc/codecs/wcd934x.c | 6 ++++-- sound/soc/qcom/qdsp6/q6afe-dai.c | 16 ++++++++++------ sound/soc/qcom/qdsp6/q6apm-lpass-dais.c | 6 ++++-- sound/soc/soc-dai.c | 4 ++-- 11 files changed, 42 insertions(+), 27 deletions(-) diff --git a/include/sound/cs35l41.h b/include/sound/cs35l41.h index bb70782d15d0..43c6a9ef8d9f 100644 --- a/include/sound/cs35l41.h +++ b/include/sound/cs35l41.h @@ -896,8 +896,8 @@ int cs35l41_test_key_lock(struct device *dev, struct regmap *regmap); int cs35l41_otp_unpack(struct device *dev, struct regmap *regmap); int cs35l41_register_errata_patch(struct device *dev, struct regmap *reg, unsigned int reg_revid); int cs35l41_set_channels(struct device *dev, struct regmap *reg, - unsigned int tx_num, unsigned int *tx_slot, - unsigned int rx_num, unsigned int *rx_slot); + unsigned int tx_num, const unsigned int *tx_slot, + unsigned int rx_num, const unsigned int *rx_slot); int cs35l41_gpio_config(struct regmap *regmap, struct cs35l41_hw_cfg *hw_cfg); void cs35l41_configure_cs_dsp(struct device *dev, struct regmap *reg, struct cs_dsp *dsp); int cs35l41_set_cspl_mbox_cmd(struct device *dev, struct regmap *regmap, diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index adcd8719d343..15ef268c9845 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h @@ -188,8 +188,8 @@ int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width); int snd_soc_dai_set_channel_map(struct snd_soc_dai *dai, - unsigned int tx_num, unsigned int *tx_slot, - unsigned int rx_num, unsigned int *rx_slot); + unsigned int tx_num, const unsigned int *tx_slot, + unsigned int rx_num, const unsigned int *rx_slot); int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate); @@ -305,8 +305,8 @@ struct snd_soc_dai_ops { unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width); int (*set_channel_map)(struct snd_soc_dai *dai, - unsigned int tx_num, unsigned int *tx_slot, - unsigned int rx_num, unsigned int *rx_slot); + unsigned int tx_num, const unsigned int *tx_slot, + unsigned int rx_num, const unsigned int *rx_slot); int (*get_channel_map)(struct snd_soc_dai *dai, unsigned int *tx_num, unsigned int *tx_slot, unsigned int *rx_num, unsigned int *rx_slot); diff --git a/sound/soc/codecs/adau7118.c b/sound/soc/codecs/adau7118.c index a663d37e5776..abc4764697a5 100644 --- a/sound/soc/codecs/adau7118.c +++ b/sound/soc/codecs/adau7118.c @@ -121,8 +121,10 @@ static const struct snd_soc_dapm_widget adau7118_widgets[] = { }; static int adau7118_set_channel_map(struct snd_soc_dai *dai, - unsigned int tx_num, unsigned int *tx_slot, - unsigned int rx_num, unsigned int *rx_slot) + unsigned int tx_num, + const unsigned int *tx_slot, + unsigned int rx_num, + const unsigned int *rx_slot) { struct adau7118_data *st = snd_soc_component_get_drvdata(dai->component); diff --git a/sound/soc/codecs/cs35l41-lib.c b/sound/soc/codecs/cs35l41-lib.c index e9993a39f7d0..1702f26049d3 100644 --- a/sound/soc/codecs/cs35l41-lib.c +++ b/sound/soc/codecs/cs35l41-lib.c @@ -936,8 +936,8 @@ int cs35l41_register_errata_patch(struct device *dev, struct regmap *reg, unsign EXPORT_SYMBOL_GPL(cs35l41_register_errata_patch); int cs35l41_set_channels(struct device *dev, struct regmap *reg, - unsigned int tx_num, unsigned int *tx_slot, - unsigned int rx_num, unsigned int *rx_slot) + unsigned int tx_num, const unsigned int *tx_slot, + unsigned int rx_num, const unsigned int *rx_slot) { unsigned int val, mask; int i; diff --git a/sound/soc/codecs/cs35l41.c b/sound/soc/codecs/cs35l41.c index cb25c33cc9b9..1688c2c688f0 100644 --- a/sound/soc/codecs/cs35l41.c +++ b/sound/soc/codecs/cs35l41.c @@ -673,7 +673,8 @@ static const struct snd_soc_dapm_route cs35l41_audio_map[] = { }; static int cs35l41_set_channel_map(struct snd_soc_dai *dai, unsigned int tx_n, - unsigned int *tx_slot, unsigned int rx_n, unsigned int *rx_slot) + const unsigned int *tx_slot, + unsigned int rx_n, const unsigned int *rx_slot) { struct cs35l41_private *cs35l41 = snd_soc_component_get_drvdata(dai->component); diff --git a/sound/soc/codecs/max98504.c b/sound/soc/codecs/max98504.c index 93412b966b33..6b6a7ece4cec 100644 --- a/sound/soc/codecs/max98504.c +++ b/sound/soc/codecs/max98504.c @@ -220,8 +220,10 @@ static int max98504_set_tdm_slot(struct snd_soc_dai *dai, return 0; } static int max98504_set_channel_map(struct snd_soc_dai *dai, - unsigned int tx_num, unsigned int *tx_slot, - unsigned int rx_num, unsigned int *rx_slot) + unsigned int tx_num, + const unsigned int *tx_slot, + unsigned int rx_num, + const unsigned int *rx_slot) { struct max98504_priv *max98504 = snd_soc_dai_get_drvdata(dai); struct regmap *map = max98504->regmap; diff --git a/sound/soc/codecs/wcd9335.c b/sound/soc/codecs/wcd9335.c index deb15b95992d..42a99978fe5a 100644 --- a/sound/soc/codecs/wcd9335.c +++ b/sound/soc/codecs/wcd9335.c @@ -1983,8 +1983,10 @@ static int wcd9335_trigger(struct snd_pcm_substream *substream, int cmd, } static int wcd9335_set_channel_map(struct snd_soc_dai *dai, - unsigned int tx_num, unsigned int *tx_slot, - unsigned int rx_num, unsigned int *rx_slot) + unsigned int tx_num, + const unsigned int *tx_slot, + unsigned int rx_num, + const unsigned int *rx_slot) { struct wcd9335_codec *wcd; int i; diff --git a/sound/soc/codecs/wcd934x.c b/sound/soc/codecs/wcd934x.c index de870c7819ca..fcad2c9fba55 100644 --- a/sound/soc/codecs/wcd934x.c +++ b/sound/soc/codecs/wcd934x.c @@ -1923,8 +1923,10 @@ static int wcd934x_trigger(struct snd_pcm_substream *substream, int cmd, } static int wcd934x_set_channel_map(struct snd_soc_dai *dai, - unsigned int tx_num, unsigned int *tx_slot, - unsigned int rx_num, unsigned int *rx_slot) + unsigned int tx_num, + const unsigned int *tx_slot, + unsigned int rx_num, + const unsigned int *rx_slot) { struct wcd934x_codec *wcd; int i; diff --git a/sound/soc/qcom/qdsp6/q6afe-dai.c b/sound/soc/qcom/qdsp6/q6afe-dai.c index a9c4f896a7df..7d9628cda875 100644 --- a/sound/soc/qcom/qdsp6/q6afe-dai.c +++ b/sound/soc/qcom/qdsp6/q6afe-dai.c @@ -172,8 +172,8 @@ static int q6tdm_set_tdm_slot(struct snd_soc_dai *dai, } static int q6tdm_set_channel_map(struct snd_soc_dai *dai, - unsigned int tx_num, unsigned int *tx_slot, - unsigned int rx_num, unsigned int *rx_slot) + unsigned int tx_num, const unsigned int *tx_slot, + unsigned int rx_num, const unsigned int *rx_slot) { struct q6afe_dai_data *dai_data = dev_get_drvdata(dai->dev); @@ -250,8 +250,10 @@ static int q6tdm_hw_params(struct snd_pcm_substream *substream, } static int q6dma_set_channel_map(struct snd_soc_dai *dai, - unsigned int tx_num, unsigned int *tx_ch_mask, - unsigned int rx_num, unsigned int *rx_ch_mask) + unsigned int tx_num, + const unsigned int *tx_ch_mask, + unsigned int rx_num, + const unsigned int *rx_ch_mask) { struct q6afe_dai_data *dai_data = dev_get_drvdata(dai->dev); @@ -407,8 +409,10 @@ static int q6afe_dai_prepare(struct snd_pcm_substream *substream, } static int q6slim_set_channel_map(struct snd_soc_dai *dai, - unsigned int tx_num, unsigned int *tx_slot, - unsigned int rx_num, unsigned int *rx_slot) + unsigned int tx_num, + const unsigned int *tx_slot, + unsigned int rx_num, + const unsigned int *rx_slot) { struct q6afe_dai_data *dai_data = dev_get_drvdata(dai->dev); struct q6afe_port_config *pcfg = &dai_data->port_config[dai->id]; diff --git a/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c b/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c index 68a38f63a2db..6bfbb52345e1 100644 --- a/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c +++ b/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c @@ -25,8 +25,10 @@ struct q6apm_lpass_dai_data { }; static int q6dma_set_channel_map(struct snd_soc_dai *dai, - unsigned int tx_num, unsigned int *tx_ch_mask, - unsigned int rx_num, unsigned int *rx_ch_mask) + unsigned int tx_num, + const unsigned int *tx_ch_mask, + unsigned int rx_num, + const unsigned int *rx_ch_mask) { struct q6apm_lpass_dai_data *dai_data = dev_get_drvdata(dai->dev); diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c index fefe394dce72..03afd5efb24c 100644 --- a/sound/soc/soc-dai.c +++ b/sound/soc/soc-dai.c @@ -304,8 +304,8 @@ EXPORT_SYMBOL_GPL(snd_soc_dai_set_tdm_slot); * configure the relationship between channel number and TDM slot number. */ int snd_soc_dai_set_channel_map(struct snd_soc_dai *dai, - unsigned int tx_num, unsigned int *tx_slot, - unsigned int rx_num, unsigned int *rx_slot) + unsigned int tx_num, const unsigned int *tx_slot, + unsigned int rx_num, const unsigned int *rx_slot) { int ret = -ENOTSUPP; From patchwork Mon May 20 14:19:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 797981 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 C7234C04FFE for ; Mon, 20 May 2024 14:22:31 +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 EDD16200; Mon, 20 May 2024 16:22:19 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz EDD16200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1716214950; bh=KcXmjnJ0AY0poUqIW4e8b27TbRb3h9g0TWVdcoOZzQc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=jTQzYJQgwQt9JlDcpn9NzHUWZnVAz1Vr4zjVzLKXWt0Vgla/t8hF562QZ3pIchZ9J rnjqlT0EMGS2yJwyanwmeP5n7ak/rBuGLYpzIbs4MEVQBS43CeWMVMhcDZpTPJTjsF ITj0PbjmAmJh4vXsQEVSXLGjhOWQTzxdYhxU6Iu4= Received: by alsa1.perex.cz (Postfix, from userid 50401) id D13B2F805C9; Mon, 20 May 2024 16:21:41 +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 A8A4DF805D6; Mon, 20 May 2024 16:21:40 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9AC97F804B2; Mon, 20 May 2024 16:20:26 +0200 (CEST) Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) (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 819FFF8016B for ; Mon, 20 May 2024 16:20:11 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 819FFF8016B 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=h+8oPCAy Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-4200ee78f35so15426635e9.1 for ; Mon, 20 May 2024 07:20:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716214811; x=1716819611; darn=alsa-project.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=xHRQQE65RAI65GXyR0YkZ7EC6+UVgVpJwZAhrM/DH1g=; b=h+8oPCAyskU6dF9m59y40LY5z6hbhXa4L0sfZ1TPEYaUCMymKJHfQshgelnmMr5vMn x0YzNmNzqKQ7Oor3gcxhkYGvkymfFuZ6w92XSALWB0l2BsF8+m0VOGb0t9jdYxWYUVOa oEHicFW4zB6M199QWsv5vblRt40HL2SgVjRAkyUPDkaaoAHpwZ8aVFngS6AiA+RmY7v1 YKe5o4SfB4sPl7bPEA+mACaKFb3Y1meRghV1m9L56+DewKnpJreXQKt3OArjYkVRK2lu 9GmsWL2r10+vQYl0ruHOH6fRjcZ3x7DAq0tW8Puc5+iSOJiXdFFFZu5YYy8PoD2KMfoa 7Lzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716214811; x=1716819611; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xHRQQE65RAI65GXyR0YkZ7EC6+UVgVpJwZAhrM/DH1g=; b=YB7WeTjpNPfqLPjj4iONxXV/MPJk6knY6lfUvmjEi5TqtvQPXYZve6GQzHoKksStK8 4DQSftRKR197k+IfkjL9ZaeNh82L/sypvpxWzCY4Jn32yteWheZ1loOoK5t6ACfDBh9R iwb1hIl+RKgD/ZjwsC2I54w2fYlvsPKmMubnThsm4gQTI2w1w4p6K+4dRXmdlW8xnpTE XqzRCEXTKi+CG35XXEXNABDOzAprfvwPmIbTCaz44JUVCdc459kNGR9Ywm/yZDcHLXGq qrEIfIxacGbHZt8zP7mjhKWURfEl6KUbmI8aop5idDYc/47NoE/yk1wKXdSCGNBeFULs 6R0A== X-Gm-Message-State: AOJu0YzdkTdHcPEg+ST5it+LF3uCjsvqjCSGv535dcJwOZ9nPHHxb4D0 bYMYUqtwGoDDsECVgb7RPa9eCpVv/PN8mxUtol0JUeuRyjJ+xaB+VzDy/+u68j0= X-Google-Smtp-Source: AGHT+IGdwFfpSiCb5k+nHbLrV2SfE/QSc4k9N6wA3+1dezFaLcQXWKVJz2Cr8xwIDD5iaWnMb+BlQQ== X-Received: by 2002:a05:600c:41d6:b0:41a:8b39:8040 with SMTP id 5b1f17b1804b1-41feaa43677mr303456185e9.20.1716214810883; Mon, 20 May 2024 07:20:10 -0700 (PDT) Received: from [127.0.1.1] ([178.197.206.169]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee962esm421612625e9.31.2024.05.20.07.20.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 07:20:10 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 20 May 2024 16:19:57 +0200 Subject: [PATCH v4 2/4] ASoC: qcom: q6apm-lpass-dais: Implement proper channel mapping MIME-Version: 1.0 Message-Id: <20240520-asoc-x1e80100-4-channel-mapping-v4-2-f657159b4aad@linaro.org> References: <20240520-asoc-x1e80100-4-channel-mapping-v4-0-f657159b4aad@linaro.org> In-Reply-To: <20240520-asoc-x1e80100-4-channel-mapping-v4-0-f657159b4aad@linaro.org> To: James Schulman , David Rhodes , Richard Fitzgerald , Jaroslav Kysela , Takashi Iwai , Liam Girdwood , Mark Brown , Lars-Peter Clausen , =?utf-8?q?Nuno_S=C3=A1?= , Srinivas Kandagatla , Banajit Goswami Cc: alsa-devel@alsa-project.org, patches@opensource.cirrus.com, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2524; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=KcXmjnJ0AY0poUqIW4e8b27TbRb3h9g0TWVdcoOZzQc=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmS1wT1xFhZckPx+G4fVsbfms73t1WEZI+lxA2g 2s4CcjTjF+JAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZktcEwAKCRDBN2bmhouD 17sjEACYXZI6kpL+uEMc+XDJnuwm5R3L7XoKQW/5PuLWOHqNvbY429ietCvF66+DiASSwd5QFh+ TihhfNJCgkmsQGork59va9S5uv7MaGANL2mxK5sbYXu0z5WZQMZTyWHNs2IrayK1IkqhRAAuHDQ SX0uud1vJugwESiBNoHIK9QoVzmBZszNHOZYARYeQOZ/i2hNamF2kGh90vrSRsoC5H2PKJUlCaV MUr4/uZu9SXxg3gh9zcW6TMP0lBRzLzZILjf/dz7jTYhQ4o+abNOzoBiLbOnhJ2gDrJonXQdV9l D6v4WGu4z2EyjC/vzbJJSt45O6mOUstD2Kfl6GPQo2i+vXC0DdVYiM2JnPb5oqvuKxv84zGaR+b dXLNqaZZkDMqaD+nCEkB481NFqMJ9RI+PpvA+UBiIZjglDy8R9cE0gI4eoLTvizjfxcq/Ov1ZBX AxmgcgVrmMRhNk5aXy9DcnEKJLFuuHpIyeImO/kDbTrfSVLCpb3nkYcFWODAzxQxddNBpZfV7py 8xEwDQp/OA12QSlYcMZL08Hhr5av386oCGS4Hk7xStUhgiZTYdA4T1IzAxWaUxf9XGSDPhbR3E6 stiIIG5jtYb9R5AYnlAMmA+I0yCSkRquiIq4lXt5UpG4WZyAi/0kIYVCk+a9tIC5L4mF7XjUMFa h8DT/vVC7GVF8kA== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Message-ID-Hash: 225O2ZW7VF7XNU3X5NG64N7THKGNRFJJ X-Message-ID-Hash: 225O2ZW7VF7XNU3X5NG64N7THKGNRFJJ 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.9 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: The set_channel_map() implementation in q6apm-lpass-dais driver was copying older pre-Audioreach code from q6afe-dai driver, but not really using it. The code sets active channel mask based on passed channel mapping, but Audioreach code does not use that mask ever. Audioreach module configuration does have on the other hand proper channel mapping field, which should supersed that active channel mask. Drop the unused active channel mask and implement proper mapping of channels in q6apm-lpass-dais driver. Signed-off-by: Krzysztof Kozlowski --- Changes in v3/v4: 1. None Changes in v2: 1. Entirely replaced - now channel mapping is implemented in q6apm-lpass-dais. --- sound/soc/qcom/qdsp6/audioreach.h | 1 - sound/soc/qcom/qdsp6/q6apm-lpass-dais.c | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/sound/soc/qcom/qdsp6/audioreach.h b/sound/soc/qcom/qdsp6/audioreach.h index 2c82917b7162..eb9306280988 100644 --- a/sound/soc/qcom/qdsp6/audioreach.h +++ b/sound/soc/qcom/qdsp6/audioreach.h @@ -755,7 +755,6 @@ struct audioreach_module_config { u16 data_format; u16 num_channels; - u16 active_channels_mask; u16 dp_idx; u32 channel_allocation; u32 sd_line_mask; diff --git a/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c b/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c index 6bfbb52345e1..a4ad1d0e6abd 100644 --- a/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c +++ b/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c @@ -33,7 +33,7 @@ static int q6dma_set_channel_map(struct snd_soc_dai *dai, struct q6apm_lpass_dai_data *dai_data = dev_get_drvdata(dai->dev); struct audioreach_module_config *cfg = &dai_data->module_config[dai->id]; - int ch_mask; + int i; switch (dai->id) { case WSA_CODEC_DMA_TX_0: @@ -58,7 +58,8 @@ static int q6dma_set_channel_map(struct snd_soc_dai *dai, tx_num); return -EINVAL; } - ch_mask = *tx_ch_mask; + for (i = 0; i < tx_num; i++) + cfg->channel_map[i] = tx_ch_mask[i]; break; case WSA_CODEC_DMA_RX_0: @@ -81,7 +82,8 @@ static int q6dma_set_channel_map(struct snd_soc_dai *dai, rx_num); return -EINVAL; } - ch_mask = *rx_ch_mask; + for (i = 0; i < rx_num; i++) + cfg->channel_map[i] = rx_ch_mask[i]; break; default: @@ -90,8 +92,6 @@ static int q6dma_set_channel_map(struct snd_soc_dai *dai, return -EINVAL; } - cfg->active_channels_mask = ch_mask; - return 0; } From patchwork Mon May 20 14:19:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 797880 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 84277C04FFE for ; Mon, 20 May 2024 14:22:54 +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 8A1CF822; Mon, 20 May 2024 16:22:42 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8A1CF822 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1716214972; bh=Ch9FJ4z3MUpybsvY/Xbh0HnZsJCcfkozAQNezxUTkUI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=kePJbR44vMlxR01mkP0r5jooLxYB1klgAxixScFUKQyjcNTRTjXa/1A4l/6QFXdCD ZqZGXVQaQDfgy42Bog55AmFnMUoErIBzOIqA6GxWxcuQStnDjCveWyIhCH+rB0mH1K kvL5lXT2//2lt3YdWW++opuRb01yHAmp7ncaLU/s= Received: by alsa1.perex.cz (Postfix, from userid 50401) id B1680F805FA; Mon, 20 May 2024 16:21:44 +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 CD18CF805FA; Mon, 20 May 2024 16:21:43 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 093B7F8042F; Mon, 20 May 2024 16:20:34 +0200 (CEST) Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) (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 1DA3AF8026A for ; Mon, 20 May 2024 16:20:13 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 1DA3AF8026A 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=dqmzC10j Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-4202c0d316cso12995705e9.1 for ; Mon, 20 May 2024 07:20:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716214812; x=1716819612; darn=alsa-project.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=wEUon1YHmseguu1+S9mQf/195zEF4D9sn4frgRTloEU=; b=dqmzC10j5EqHlFijZbu1/P/trvfvQPWbKNAP2zg0R27V/ZsJenTGO+RJYvFQRxF7Ti +MWnXxgOM5mWMbPJUHuJBMEE7nWM/nBXFNkl8zxzyutP8j381+J5PpFYUg92h43gPkON Z0Alyg4uXvTqXjfA7Ni18t0G9eT1UE+vI/kLicEFX+mw+LtB85QQ3jOKT6DE7utLj41l N8F4Tj4HdQ8OtS/n2ClBzvrPdEQJ2RSn8L5/a8RJGpjwT4jnNjAEpxAcc+4iFJLLybfQ UOECOEPqwroGDg5izdD2ZG6WHggxExjA480sYiQe4lU2XnDIdaGTut0YzbY6frLkqAR8 ZUgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716214812; x=1716819612; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wEUon1YHmseguu1+S9mQf/195zEF4D9sn4frgRTloEU=; b=f8d2za1+CtudPtSO5Tg91vjLRPImQtqfifCc7HggaT/Xp1J7/0lK9yFJAVBDgEjXoZ EQHRYJX4Lig/QbH/9f8MF9zXbUEniSPILgZ2F1mGdg+CoUmkYx2MdAFrlW2adbJx6dfN gFYcZBj2uzz12hXe1bliTv+hAJa45dvSsA+4/sdORBODTZvtHGPLUznxvpHKllym+VaJ LFQDNx33xNb5/MwV1LzXYeMo16DkFd8GtEvTLZsiP7DPpGKwPMSUafGnl7SdcGLPRV9z O+cVwjhN8j3aoa21asXDBW2bXQDeRjtOyfxPofM1aIZ/x3mKvghYU6hCmLmOd56kdaYm EcEA== X-Gm-Message-State: AOJu0Yx/xdOTFIP5OWKlSDxwWoKRGCejbgg6VlBjZdJq71JVKhbObRbe gvdGxD1R6v902lVXaZjqtcCMDoxBiSGt4viD0ZpsSPdDmnQah8sENse3mRn0/g4= X-Google-Smtp-Source: AGHT+IHUzosNwd66I4RPORx0mY0lfWq2SbcRlTyOnRdHejfyAQSpGq3RH0YaVFVvxZm+LAFlfuAFTw== X-Received: by 2002:a7b:c4ca:0:b0:41a:56b7:eb37 with SMTP id 5b1f17b1804b1-420e1a03c81mr44876145e9.20.1716214812422; Mon, 20 May 2024 07:20:12 -0700 (PDT) Received: from [127.0.1.1] ([178.197.206.169]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee962esm421612625e9.31.2024.05.20.07.20.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 07:20:11 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 20 May 2024 16:19:58 +0200 Subject: [PATCH v4 3/4] ASoC: qcom: qdsp6: Set channel mapping instead of fixed defaults MIME-Version: 1.0 Message-Id: <20240520-asoc-x1e80100-4-channel-mapping-v4-3-f657159b4aad@linaro.org> References: <20240520-asoc-x1e80100-4-channel-mapping-v4-0-f657159b4aad@linaro.org> In-Reply-To: <20240520-asoc-x1e80100-4-channel-mapping-v4-0-f657159b4aad@linaro.org> To: James Schulman , David Rhodes , Richard Fitzgerald , Jaroslav Kysela , Takashi Iwai , Liam Girdwood , Mark Brown , Lars-Peter Clausen , =?utf-8?q?Nuno_S=C3=A1?= , Srinivas Kandagatla , Banajit Goswami Cc: alsa-devel@alsa-project.org, patches@opensource.cirrus.com, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=7882; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=Ch9FJ4z3MUpybsvY/Xbh0HnZsJCcfkozAQNezxUTkUI=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmS1wUf2oripGEvBkcrPo42DDTF9UP8Q8weHDwp Qvz0LOFaRGJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZktcFAAKCRDBN2bmhouD 1xpSD/9Zuq3qb30zicly4zWVmFpAI+VDd0ETscZGKmFhV0HeX0jtMeFcxGIb/m1GE1xyxZIx5LI 4ZBUjh1qixISNeFZdy1Dhur6dGwzICYyGZU3YnGAmkk9LvyWmfD3AzrqQ/lyEKHgfGkJi/sSDsh GzmhToq6z947LBa8dHC04Lm9VmLsz15T98wo+2RjcR5MTYaaxpa+y4hLnh6WqVvfJ+7G3Aism7E zOgCQDMyGkuS+Ts1BRaJOFO832gsd+S94x0VAHUteF3winIJuBCmCMvS72bOKPawL/mvzEiKEyV xXhsg7RPeXFtmozFCUl38k3GW9pCIs6t5e19gVEahG5EHnvCX224DhCd/WEwbIQjRXubrZz9+Xb ocPnWcVS5ApSJ4uXklZMuejjuZPmg/g1FAVo2536hUh9s67qUt+v9KsVHf5CtAQqo6KT81prbta wRvnNyPkswVT0PZDkxn+7KhQdybvUzoR3QpqlAa7Eo3sBNz0z3SEt86bsuJ7BQz6UYYUbIvympA xwejd+pgF+7YHGsGETtSHY+fjQFDCRwW+LTb/OQs9uGWvlVj7szBFA4+8/C6sXIRmiTupZpqWSt VPfMxUmjmycigLciRFhsI4L3pPB38JgiDarlsehkr9scRAGGQ8qxLd5kom3OkRigtTMiDDuCOXs vb0RbI4wn844gLw== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Message-ID-Hash: Z7PSXFIFVC56QFESZG26WEXK5YSBANIN X-Message-ID-Hash: Z7PSXFIFVC56QFESZG26WEXK5YSBANIN 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.9 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 constructing packets to DSP, the Audioreach code uses 'struct audioreach_module_config' to configure parameters like number of channels, bitrate, sample rate etc, but uses defaults for the channel mapping. Rework this code to copy the channel mapping from 'struct audioreach_module_config', instead of using the default. This requires all callers to fill that structure: add missing initialization of channel mapping. Entire patch makes code more logical and easier to follow: 1. q6apm-dai and q6apm-lpass-dais code which allocates 'struct audioreach_module_config' initializes it fully, so fills both the number of channels and the channel mapping. 2. Audioreach code, which uses 'struct audioreach_module_config' when constructing packets, copies entire contents of passed config, not only pieces of it. Signed-off-by: Krzysztof Kozlowski --- Changes in v4: 1. Rename audioreach_set_channel_mapping -> audioreach_set_default_channel_mapping Changes in v2: 1. Extend commit msg, rationale. 2. Rework to new approach, but most of the code stays. 3. Export audioreach_set_channel_mapping() (needed by Q6APM DAIS and LPASS DAIS) 4. Correct channel mapping also in audioreach_mfc_set_media_format(), because MFC DAI is now part of backend. 5. Do not adjust dynamic DAIs (drop audioreach_dai_load()). --- sound/soc/qcom/qdsp6/audioreach.c | 30 +++++++----------------------- sound/soc/qcom/qdsp6/audioreach.h | 1 + sound/soc/qcom/qdsp6/q6apm-dai.c | 3 +++ sound/soc/qcom/qdsp6/q6apm-lpass-dais.c | 5 ++++- 4 files changed, 15 insertions(+), 24 deletions(-) diff --git a/sound/soc/qcom/qdsp6/audioreach.c b/sound/soc/qcom/qdsp6/audioreach.c index 5291deac0a0b..4ebaaf736fb9 100644 --- a/sound/soc/qcom/qdsp6/audioreach.c +++ b/sound/soc/qcom/qdsp6/audioreach.c @@ -267,7 +267,7 @@ void *audioreach_alloc_apm_cmd_pkt(int pkt_size, uint32_t opcode, uint32_t token } EXPORT_SYMBOL_GPL(audioreach_alloc_apm_cmd_pkt); -static void audioreach_set_channel_mapping(u8 *ch_map, int num_channels) +void audioreach_set_default_channel_mapping(u8 *ch_map, int num_channels) { if (num_channels == 1) { ch_map[0] = PCM_CHANNEL_FL; @@ -281,6 +281,7 @@ static void audioreach_set_channel_mapping(u8 *ch_map, int num_channels) ch_map[3] = PCM_CHANNEL_RS; } } +EXPORT_SYMBOL_GPL(audioreach_set_default_channel_mapping); static void apm_populate_container_config(struct apm_container_obj *cfg, struct audioreach_container *cont) @@ -819,7 +820,7 @@ static int audioreach_mfc_set_media_format(struct q6apm_graph *graph, uint32_t num_channels = cfg->num_channels; int payload_size; struct gpr_pkt *pkt; - int rc; + int rc, i; void *p; payload_size = APM_MFC_CFG_PSIZE(media_format, num_channels) + @@ -842,18 +843,8 @@ static int audioreach_mfc_set_media_format(struct q6apm_graph *graph, media_format->sample_rate = cfg->sample_rate; media_format->bit_width = cfg->bit_width; media_format->num_channels = cfg->num_channels; - - if (num_channels == 1) { - media_format->channel_mapping[0] = PCM_CHANNEL_FL; - } else if (num_channels == 2) { - media_format->channel_mapping[0] = PCM_CHANNEL_FL; - media_format->channel_mapping[1] = PCM_CHANNEL_FR; - } else if (num_channels == 4) { - media_format->channel_mapping[0] = PCM_CHANNEL_FL; - media_format->channel_mapping[1] = PCM_CHANNEL_FR; - media_format->channel_mapping[2] = PCM_CHANNEL_LS; - media_format->channel_mapping[3] = PCM_CHANNEL_RS; - } + for (i = 0; i < num_channels; i++) + media_format->channel_mapping[i] = cfg->channel_map[i]; rc = q6apm_send_cmd_sync(graph->apm, pkt, 0); @@ -883,9 +874,6 @@ static int audioreach_set_compr_media_format(struct media_format *media_fmt_hdr, mp3_cfg->q_factor = mcfg->bit_width - 1; mp3_cfg->endianness = PCM_LITTLE_ENDIAN; mp3_cfg->num_channels = mcfg->num_channels; - - audioreach_set_channel_mapping(mp3_cfg->channel_mapping, - mcfg->num_channels); break; case SND_AUDIOCODEC_AAC: media_fmt_hdr->data_format = DATA_FORMAT_RAW_COMPRESSED; @@ -1104,9 +1092,7 @@ static int audioreach_pcm_set_media_format(struct q6apm_graph *graph, media_cfg->num_channels = mcfg->num_channels; media_cfg->q_factor = mcfg->bit_width - 1; media_cfg->bits_per_sample = mcfg->bit_width; - - audioreach_set_channel_mapping(media_cfg->channel_mapping, - num_channels); + memcpy(media_cfg->channel_mapping, mcfg->channel_map, mcfg->num_channels); rc = q6apm_send_cmd_sync(graph->apm, pkt, 0); @@ -1163,9 +1149,7 @@ static int audioreach_shmem_set_media_format(struct q6apm_graph *graph, cfg->q_factor = mcfg->bit_width - 1; cfg->endianness = PCM_LITTLE_ENDIAN; cfg->num_channels = mcfg->num_channels; - - audioreach_set_channel_mapping(cfg->channel_mapping, - num_channels); + memcpy(cfg->channel_mapping, mcfg->channel_map, mcfg->num_channels); } else { rc = audioreach_set_compr_media_format(header, p, mcfg); if (rc) { diff --git a/sound/soc/qcom/qdsp6/audioreach.h b/sound/soc/qcom/qdsp6/audioreach.h index eb9306280988..61a69df4f50f 100644 --- a/sound/soc/qcom/qdsp6/audioreach.h +++ b/sound/soc/qcom/qdsp6/audioreach.h @@ -766,6 +766,7 @@ struct audioreach_module_config { /* Packet Allocation routines */ void *audioreach_alloc_apm_cmd_pkt(int pkt_size, uint32_t opcode, uint32_t token); +void audioreach_set_default_channel_mapping(u8 *ch_map, int num_channels); void *audioreach_alloc_cmd_pkt(int payload_size, uint32_t opcode, uint32_t token, uint32_t src_port, uint32_t dest_port); diff --git a/sound/soc/qcom/qdsp6/q6apm-dai.c b/sound/soc/qcom/qdsp6/q6apm-dai.c index 00bbd291be5c..3361c10d69a4 100644 --- a/sound/soc/qcom/qdsp6/q6apm-dai.c +++ b/sound/soc/qcom/qdsp6/q6apm-dai.c @@ -243,6 +243,7 @@ static int q6apm_dai_prepare(struct snd_soc_component *component, cfg.num_channels = runtime->channels; cfg.bit_width = prtd->bits_per_sample; cfg.fmt = SND_AUDIOCODEC_PCM; + audioreach_set_default_channel_mapping(cfg.channel_map, runtime->channels); if (prtd->state) { /* clear the previous setup if any */ @@ -669,6 +670,8 @@ static int q6apm_dai_compr_set_params(struct snd_soc_component *component, cfg.num_channels = 2; cfg.bit_width = prtd->bits_per_sample; cfg.fmt = codec->id; + audioreach_set_default_channel_mapping(cfg.channel_map, + cfg.num_channels); memcpy(&cfg.codec, codec, sizeof(*codec)); ret = q6apm_graph_media_format_shmem(prtd->graph, &cfg); diff --git a/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c b/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c index a4ad1d0e6abd..ba28ec9dff86 100644 --- a/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c +++ b/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c @@ -106,6 +106,7 @@ static int q6hdmi_hw_params(struct snd_pcm_substream *substream, cfg->bit_width = params_width(params); cfg->sample_rate = params_rate(params); cfg->num_channels = channels; + audioreach_set_default_channel_mapping(cfg->channel_map, channels); switch (dai->id) { case DISPLAY_PORT_RX_0: @@ -130,10 +131,12 @@ static int q6dma_hw_params(struct snd_pcm_substream *substream, { struct q6apm_lpass_dai_data *dai_data = dev_get_drvdata(dai->dev); struct audioreach_module_config *cfg = &dai_data->module_config[dai->id]; + int channels = hw_param_interval_c(params, SNDRV_PCM_HW_PARAM_CHANNELS)->max; cfg->bit_width = params_width(params); cfg->sample_rate = params_rate(params); - cfg->num_channels = hw_param_interval_c(params, SNDRV_PCM_HW_PARAM_CHANNELS)->max; + cfg->num_channels = channels; + audioreach_set_default_channel_mapping(cfg->channel_map, channels); return 0; } From patchwork Mon May 20 14:19:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 797879 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 3E711C25B79 for ; Mon, 20 May 2024 14:23:27 +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 23FB893A; Mon, 20 May 2024 16:23:16 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 23FB893A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1716215006; bh=RVNDo+PUPNeV1sa0OC/s/rwZqNAdhw3yPx+40/ruZ0I=; h=From:Date:Subject:References:In-Reply-To:To:Cc:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=l7EGoiMWd8CaTfQEODfi3jX1XfWzOp7B7rp4dEFobmO8FG94mBFtYjuGEHC+C9BEF AB6OX3Eh6k34t2MBNj/ezXC2tD3zXqHJpY23+6tLjdW1TYjc1aODnUXeZoqEso1J6Y zlEpPPGTbouoXRv3XK7v4vGUZp46rBv/OyjHrpYY= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 72FD5F80588; Mon, 20 May 2024 16:22:45 +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 695B2F805AC; Mon, 20 May 2024 16:22:45 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B8988F8026A; Mon, 20 May 2024 16:22:40 +0200 (CEST) Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) (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 4D90EF8020D for ; Mon, 20 May 2024 16:20:14 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 4D90EF8020D 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=Jw1z3n37 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-4202ca70318so18968925e9.1 for ; Mon, 20 May 2024 07:20:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716214814; x=1716819614; darn=alsa-project.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=sm/iyvA/oRf8IDDwCG6199y51shfGYvzaBKbXuvmT5Q=; b=Jw1z3n370u8keFLLn6gZBEht6lXlPux/UJKjIi6OYAJQbVPKR0SMsycnyEoM1RUeyd Z+iKwxbIzwE71vbwy9Zgd5db5yW7TNp3NvnB3l1HCbCmERguQ8mH6+zvO0+UhNHtBgpP LdoigoVURvoEMpa2FcsJFLkmClZ+zM02aOGXMRB79S/AdZIRNi1LCNZ4VXdrNidx1uX5 4lC/QZhX4Q0vIycJ28Rgaaa4kT3+afRa1Md59xGCxHvUtuUo4oZelGeqgOgjUd39nf2W +pBgF/oZRb+mEQ70J5o3d535mXvnjVjtEAqFlhxnHD+Uwxxcpz33997/1Km2nleBwnfb qBGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716214814; x=1716819614; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sm/iyvA/oRf8IDDwCG6199y51shfGYvzaBKbXuvmT5Q=; b=YTpvJPfY9JsPmZwPOOI5fUlO3JEZIk57+0SjmVNAcMGmxIYd8KCWiOS6lTnV6q7PI6 RwWOApWtacujganR1Ef0OLWAPyrtnthoqfvPtM7T13hZqeAhOnyf//KGpJzHaUm11zz4 XUlhTNqIafGdKurWx9tjXzyku2WcFzOL6VKq2noCxd77iDwfDiRctEZ5okcTn61ESmBi wlPHmlkC9kg3FN/qetSAZ0ViNz9Tf2mvjgWFxHvqKDNpToOg8R9gry9ZWeR4MR8RBP00 NauwUb6QIpZ1e5jx7X8qCZETuEaHSyCGXFHjhVVbfNOJiEbrC3+sf9HygZ8/o3HxjtZ0 yHbQ== X-Gm-Message-State: AOJu0YyaOq+hDP3UFQr3iCp25u+E7ixQW5IO+Frxx0FFFZKW9pK8doJO MQVMLVXTkRVQL1d+UL3HHSd8Mr9iMrNipWLL7ZUenlT5a7j3S92x9+fG6saa2rM= X-Google-Smtp-Source: AGHT+IGVRyJJ7aHIZMec1RRFI1lujPx2Dl5vOFi8D3htETVzjOwcHTweLhfI2iYBMlx8IuAnYEGitQ== X-Received: by 2002:a05:600c:ac1:b0:416:3f85:d49 with SMTP id 5b1f17b1804b1-41feaa42cd6mr250592485e9.18.1716214813838; Mon, 20 May 2024 07:20:13 -0700 (PDT) Received: from [127.0.1.1] ([178.197.206.169]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee962esm421612625e9.31.2024.05.20.07.20.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 07:20:13 -0700 (PDT) From: Krzysztof Kozlowski Date: Mon, 20 May 2024 16:19:59 +0200 Subject: [PATCH v4 4/4] ASoC: qcom: x1e80100: Correct channel mapping MIME-Version: 1.0 Message-Id: <20240520-asoc-x1e80100-4-channel-mapping-v4-4-f657159b4aad@linaro.org> References: <20240520-asoc-x1e80100-4-channel-mapping-v4-0-f657159b4aad@linaro.org> In-Reply-To: <20240520-asoc-x1e80100-4-channel-mapping-v4-0-f657159b4aad@linaro.org> To: James Schulman , David Rhodes , Richard Fitzgerald , Jaroslav Kysela , Takashi Iwai , Liam Girdwood , Mark Brown , Lars-Peter Clausen , =?utf-8?q?Nuno_S=C3=A1?= , Srinivas Kandagatla , Banajit Goswami Cc: alsa-devel@alsa-project.org, patches@opensource.cirrus.com, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1580; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=RVNDo+PUPNeV1sa0OC/s/rwZqNAdhw3yPx+40/ruZ0I=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmS1wVxsw/p+VXN2eP9N2OLCdsAbVUC+7yjp30j BFHMQJTguOJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZktcFQAKCRDBN2bmhouD 11RZD/9MxHl6NYGke5RtglSMF7GhedR5atNcAnGjmHO7nesbXV3GMuToOk7k49VmQaxlg5ly6IH Oy/wFsxxZrSJzd4ce+sjQXd32sRXnGipksKiB0wvIhFvY3973MiUP7xxLaMu4WxouANJiRp5FFD YxkuzSLXrekOrO5foULPEM1L38vcjOqveybopaNm5+vJWgKFqD/EF7WfXWgEJpErXbmP2oCTO5d 2rxWiiHdabrrpD4yuMIjmm2P/HivHBx2LUra4m4HkRB0Wp/TAL7vKvtmgCJcY5pTgwm5IRyOoEV qz3kkoAKC90nAnRYvPdMRrDyRmorQvy5dK25BbUCnU+HO3fZT6VvNXMnwqu6+cHOs9h9tqXwrpl Qj72RqmdHOTEeoSCMbkqrhL/5z2C70E1wT31yLDDF3w2GfcGeVcQIDrPs2B1DdEvobRYezY0LGX 46Mtxhuz/FJZHQC/uNQcJezBniMAa6HS29M9eJRqtbyVetJhH3qFhRyCuS+GR1jDXXJbA+uXm92 PLAJwp0uW43HJKhO1gu1gobTm1ciyxwb8KawtkuolAxewb2CZFFz3PqGie23cgyAsLLPZmPLRl/ iyCSH587Do9m4PT0jtp1RoT3AI9Kni5RNKgPAOY1Rp12Kt0gi2gWleqA5NYxMC7B9fiUhaiun9T Lgf6MaPNLe76WRQ== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Message-ID-Hash: Z5342LYCQYYZQP3QIA7JX6UULMHNA24K X-Message-ID-Hash: Z5342LYCQYYZQP3QIA7JX6UULMHNA24K 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.9 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: X1E80100 CRD board comes with four speakers arranged as left front+back and then right front+back. Using default channel mapping causes front right speaker to play left back stream. Signed-off-by: Krzysztof Kozlowski --- Changes in v2: 1. Rework significantly, because only backend DAIs is now affected. --- sound/soc/qcom/x1e80100.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sound/soc/qcom/x1e80100.c b/sound/soc/qcom/x1e80100.c index c3c8bf7ffb5b..27f34c0873ab 100644 --- a/sound/soc/qcom/x1e80100.c +++ b/sound/soc/qcom/x1e80100.c @@ -12,6 +12,7 @@ #include "common.h" #include "qdsp6/q6afe.h" +#include "qdsp6/q6dsp-common.h" #include "sdw.h" struct x1e80100_snd_data { @@ -80,6 +81,23 @@ static int x1e80100_snd_prepare(struct snd_pcm_substream *substream) struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); struct x1e80100_snd_data *data = snd_soc_card_get_drvdata(rtd->card); struct sdw_stream_runtime *sruntime = data->sruntime[cpu_dai->id]; + const unsigned int rx_slot[4] = { PCM_CHANNEL_FL, + PCM_CHANNEL_LB, + PCM_CHANNEL_FR, + PCM_CHANNEL_RB }; + int ret; + + switch (cpu_dai->id) { + case WSA_CODEC_DMA_RX_0: + case WSA_CODEC_DMA_RX_1: + ret = snd_soc_dai_set_channel_map(cpu_dai, 0, NULL, + ARRAY_SIZE(rx_slot), rx_slot); + if (ret) + return ret; + break; + default: + break; + } return qcom_snd_sdw_prepare(substream, sruntime, &data->stream_prepared[cpu_dai->id]);