From: "Alvin Šipraga" <alvin.sipraga@analog.com>
To: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Mark Brown <broonie@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
linux-sound@vger.kernel.org
Subject: Re: [PATCH 05/10] ASoC: soc-dai: add snd_soc_dai_symmetric_get_params()
Date: Tue, 15 Sep 2026 03:51:54 +0200 [thread overview]
Message-ID: <aqiahbyrYADuK4_Z@analog.com> (raw)
In-Reply-To: <87jyooli6u.wl-kuninori.morimoto.gx@renesas.com>
Hi Kuninori,
A few more naming ideas below.
On Mon, Sep 14, 2026 at 01:45:14AM +0000, Kuninori Morimoto wrote:
> DAI parameter will be capsuled soon, will be not enable to access from
> each drivers. DAI symmetric_xxx has been mainly referred from Mediatek
> drivers. Let's add snd_soc_dai_symmetric_get_params() for it.
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
> include/sound/soc-dai.h | 4 ++++
> sound/soc/mediatek/mt8188/mt8188-dai-pcm.c | 5 ++++-
> sound/soc/mediatek/mt8195/mt8195-dai-pcm.c | 5 ++++-
> sound/soc/mediatek/mt8365/mt8365-dai-dmic.c | 10 +++++++---
> sound/soc/mediatek/mt8365/mt8365-dai-pcm.c | 4 +++-
> sound/soc/soc-dai.c | 14 ++++++++++++++
> sound/soc/soc-pcm.c | 5 ++++-
> 7 files changed, 40 insertions(+), 7 deletions(-)
>
> diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
> index bd714c3bbf3df..c5544f1789425 100644
> --- a/include/sound/soc-dai.h
> +++ b/include/sound/soc-dai.h
> @@ -563,6 +563,10 @@ struct snd_soc_dai *snd_soc_dai_register(struct snd_soc_component *component,
> void snd_soc_dai_unregister(struct snd_soc_dai *dai);
> struct snd_soc_dai *snd_soc_dai_from_list(struct list_head *list);
> struct list_head *snd_soc_dai_to_list(struct snd_soc_dai *dai);
> +void snd_soc_dai_symmetric_get_params(struct snd_soc_dai *dai,
> + unsigned int *symmetric_rate,
> + unsigned int *symmetric_channels,
> + unsigned int *symmetric_sample_bits);
Why not split into 3 functions:
snd_soc_dai_get_symmetric_rate()
snd_soc_dai_get_symmetric_channels()
snd_soc_dai_get_symmetric_sample_bits()
Or if not, similar to my comment in your other patch, consider
snd_soc_dai_get_symmetric_params() instead. I think it'd be more
consistent with the rest of the API.
>
> /* REMOVE ME */
> #define snd_soc_dai_get_pcm_stream snd_soc_dai_pcm_stream_get
> diff --git a/sound/soc/mediatek/mt8188/mt8188-dai-pcm.c b/sound/soc/mediatek/mt8188/mt8188-dai-pcm.c
> index 8ca7cc75e21dc..766893ca56d45 100644
> --- a/sound/soc/mediatek/mt8188/mt8188-dai-pcm.c
> +++ b/sound/soc/mediatek/mt8188/mt8188-dai-pcm.c
> @@ -128,7 +128,7 @@ static int mtk_dai_pcm_configure(struct snd_pcm_substream *substream,
> unsigned int lrck_inv;
> unsigned int bck_inv;
> unsigned int fmt;
> - unsigned int bit_width = dai->symmetric_sample_bits;
> + unsigned int bit_width;
Alternative:
unsigned int bit_width = snd_soc_dai_get_symmetric_sample_bits(dai);
> unsigned int val = 0;
> unsigned int mask = 0;
> int fs = 0;
> @@ -137,7 +137,10 @@ static int mtk_dai_pcm_configure(struct snd_pcm_substream *substream,
> if (dai->id < 0)
> return -EINVAL;
>
> + snd_soc_dai_symmetric_get_params(dai, NULL, NULL, &bit_width);
> +
> pcmif_priv = afe_priv->dai_priv[dai->id];
> +
> slave_mode = pcmif_priv->slave_mode;
> lrck_inv = pcmif_priv->lrck_inv;
> bck_inv = pcmif_priv->bck_inv;
> diff --git a/sound/soc/mediatek/mt8195/mt8195-dai-pcm.c b/sound/soc/mediatek/mt8195/mt8195-dai-pcm.c
> index cdc16057d50e2..a090995ac9a7f 100644
> --- a/sound/soc/mediatek/mt8195/mt8195-dai-pcm.c
> +++ b/sound/soc/mediatek/mt8195/mt8195-dai-pcm.c
> @@ -127,7 +127,7 @@ static int mtk_dai_pcm_configure(struct snd_pcm_substream *substream,
> unsigned int lrck_inv;
> unsigned int bck_inv;
> unsigned int fmt;
> - unsigned int bit_width = dai->symmetric_sample_bits;
> + unsigned int bit_width;
Ditto:
unsigned int bit_width = snd_soc_dai_get_symmetric_sample_bits(dai);
> unsigned int val = 0;
> unsigned int mask = 0;
> int fs = 0;
> @@ -136,7 +136,10 @@ static int mtk_dai_pcm_configure(struct snd_pcm_substream *substream,
> if (dai->id != MT8195_AFE_IO_PCM)
> return -EINVAL;
>
> + snd_soc_dai_symmetric_get_params(dai, NULL, NULL, &bit_width);
> +
> pcmif_priv = afe_priv->dai_priv[dai->id];
> +
> slave_mode = pcmif_priv->slave_mode;
> lrck_inv = pcmif_priv->lrck_inv;
> bck_inv = pcmif_priv->bck_inv;
> diff --git a/sound/soc/mediatek/mt8365/mt8365-dai-dmic.c b/sound/soc/mediatek/mt8365/mt8365-dai-dmic.c
> index 0bac143b48bfb..6e1d48f757d22 100644
> --- a/sound/soc/mediatek/mt8365/mt8365-dai-dmic.c
> +++ b/sound/soc/mediatek/mt8365/mt8365-dai-dmic.c
> @@ -118,13 +118,17 @@ static int mt8365_dai_configure_dmic(struct mtk_base_afe *afe,
> unsigned int clk_phase_sel_ch1 = dmic_data->clk_phase_sel_ch1;
> unsigned int clk_phase_sel_ch2 = dmic_data->clk_phase_sel_ch2;
> unsigned int val = 0;
> - unsigned int rate = dai->symmetric_rate;
> - int reg = get_chan_reg(dai->symmetric_channels);
> + unsigned int rate;
> + unsigned int channel;
Alternative:
unsigned int rate = snd_soc_dai_get_symmetric_rate(dai);
unsigned int channels = snd_soc_dai_get_symmetric_channels(dai);
int reg = get_chan_reg(channels);
you get the idea.
[...]
> diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
> index a446e9c1c9887..aaba9ca724e61 100644
> --- a/sound/soc/soc-pcm.c
> +++ b/sound/soc/soc-pcm.c
> @@ -453,6 +453,8 @@ static int soc_pcm_shared_bclk_rule_rate(struct snd_pcm_hw_params *params,
> /* Scan all DAIs on the card for an active peer sharing the same BCLK */
> for_each_card_rtds(card, rtd) {
> for_each_rtd_cpu_dais(rtd, i, other_dai) {
> + unsigned int symmetric_rate;
> +
> if (other_dai == dai)
> continue;
> if (!other_dai->bclk)
> @@ -465,7 +467,8 @@ static int soc_pcm_shared_bclk_rule_rate(struct snd_pcm_hw_params *params,
> * after snd_soc_dai_hw_params(), so non-zero means
> * the DAI's clk_set_rate() has already executed.
> */
> - if (!other_dai->symmetric_rate)
> + snd_soc_dai_symmetric_get_params(other_dai, &symmetric_rate, NULL, NULL);
> + if (!symmetric_rate)
> continue;
for_each_rtd_cpu_dais(rtd, i, other_dai) {
...
if (!snd_soc_dai_get_symmetric_rate(other_dai))
continue;
}
It's a bit more explicit, and avoids the NULL, NULL stuff.
Kind regards,
Alvin
next prev parent reply other threads:[~2026-09-15 1:52 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-14 1:43 [PATCH 00/10] ASoC: add new DAI functions Kuninori Morimoto
2026-09-14 1:43 ` [PATCH 01/10] ASoC: soc-dai: add snd_soc_dai_id() Kuninori Morimoto
2026-09-15 13:43 ` Alvin Šipraga
2026-09-15 13:43 ` Alvin Šipraga
2026-09-15 13:43 ` Alvin Šipraga
2026-09-14 1:43 ` [PATCH 02/10] ASoC: soc-dai: add snd_soc_dai_to_component() Kuninori Morimoto
2026-09-15 13:44 ` Alvin Šipraga
2026-09-14 1:43 ` [PATCH 03/10] ASoC: soc-dai: add snd_soc_dai_to_driver() Kuninori Morimoto
2026-09-15 13:44 ` Alvin Šipraga
2026-09-14 1:43 ` [PATCH 04/10] ASoC: soc-dai: add snd_soc_dai_{to/from}_list() Kuninori Morimoto
2026-09-15 15:03 ` Alvin Šipraga
2026-09-15 23:37 ` Kuninori Morimoto
2026-09-14 1:45 ` [PATCH 05/10] ASoC: soc-dai: add snd_soc_dai_symmetric_get_params() Kuninori Morimoto
2026-09-15 1:51 ` Alvin Šipraga [this message]
2026-09-15 4:30 ` Kuninori Morimoto
2026-09-14 1:46 ` [PATCH 06/10] ASoC: soc-dai: add snd_soc_dai_{set/to}_priv() Kuninori Morimoto
2026-09-14 8:38 ` Charles Keepax
2026-09-15 15:05 ` Alvin Šipraga
2026-09-14 1:46 ` [PATCH 07/10] ASoC: soc-dai: rename snd_soc_dai_stream_active() Kuninori Morimoto
2026-09-15 1:00 ` Alvin Šipraga
2026-09-15 5:20 ` Kuninori Morimoto
2026-09-15 13:42 ` Alvin Šipraga
2026-09-16 0:48 ` Kuninori Morimoto
2026-09-16 1:13 ` Alvin Šipraga
2026-09-16 1:45 ` Kuninori Morimoto
2026-09-14 1:46 ` [PATCH 08/10] ASoC: soc-dai: rename snd_soc_dai_action() Kuninori Morimoto
2026-09-14 1:46 ` [PATCH 09/10] ASoC: soc-dai: move snd_soc_dai_active_action() to soc-internal.h Kuninori Morimoto
2026-09-14 1:47 ` [PATCH 10/10] ASoC: soc-dai: add snd_soc_dai_get_bclk() Kuninori Morimoto
2026-09-14 13:55 ` Mark Brown
2026-09-14 23:56 ` Kuninori Morimoto
2026-09-15 15:19 ` Alvin Šipraga
2026-09-15 23:38 ` Kuninori Morimoto
2026-09-14 13:37 ` [PATCH 00/10] ASoC: add new DAI functions Mark Brown
2026-09-15 0:05 ` Kuninori Morimoto
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aqiahbyrYADuK4_Z@analog.com \
--to=alvin.sipraga@analog.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=broonie@kernel.org \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=linux-sound@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.