From: "Troy Mitchell" <troy.mitchell@linux.spacemit.com>
To: "Bui Duc Phuc" <phucduc.bui@gmail.com>,
"Yixun Lan" <dlan@kernel.org>, "Takashi Iwai" <tiwai@suse.com>,
"Mark Brown" <broonie@kernel.org>,
"Jaroslav Kysela" <perex@perex.cz>,
"Liam Girdwood" <lgirdwood@gmail.com>
Cc: "Troy Mitchell" <troy.mitchell@linux.spacemit.com>,
"Goko Mell" <goku.sonxin626@gmail.com>,
"Jinmei Wei" <weijinmei@linux.spacemit.com>,
"Kuninori Morimoto" <kuninori.morimoto.gx@renesas.com>,
<linux-riscv@lists.infradead.org>, <spacemit@lists.linux.dev>,
<linux-sound@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ASoC: spacemit: Remove redundant DAI field initialization
Date: Mon, 03 Aug 2026 23:39:39 -0700 [thread overview]
Message-ID: <DKFYC1MGUCF0.1AQF42KLZZ0XL@linux.spacemit.com> (raw)
In-Reply-To: <20260804043036.22065-1-phucduc.bui@gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 3162 bytes --]
> spacemit_i2s_init_dai() already initializes the playback and capture
> fields after duplicating the static DAI template with devm_kmemdup().
> Remove the duplicated initializers from the static template and keep
> all field initialization in spacemit_i2s_init_dai().
The code change is functionally correct, but the commit message currently
describes it only as removing redundant initialization. It also changes
which stream directions ASoC considers valid.
> @@ -354,22 +354,6 @@ static const struct snd_soc_dai_ops spacemit_i2s_dai_ops = {
>
> static struct snd_soc_dai_driver spacemit_i2s_dai = {
> .ops = &spacemit_i2s_dai_ops,
> - .playback = {
> - .channels_min = 1,
> - .channels_max = 2,
> - .rates = SPACEMIT_PCM_RATES,
> - .rate_min = SNDRV_PCM_RATE_8000,
> - .rate_max = SNDRV_PCM_RATE_48000,
> - .formats = SPACEMIT_PCM_FORMATS,
> - },
> - .capture = {
> - .channels_min = 1,
> - .channels_max = 2,
> - .rates = SPACEMIT_PCM_RATES,
> - .rate_min = SNDRV_PCM_RATE_8000,
> - .rate_max = SNDRV_PCM_RATE_48000,
> - .formats = SPACEMIT_PCM_FORMATS,
> - },
> .symmetric_rate = 1,
> };
With the current static initialization, channels_min is nonzero for both
directions before dma-names is examined. snd_soc_dai_stream_valid()
therefore considers capture valid even when the device only provides a
"tx" DMA channel, which is permitted by the binding. The DMAengine PCM
code may then create a capture substream without an RX DMA channel and
fail during PCM creation.
> [...]
>
> @@ -399,6 +383,8 @@ static int spacemit_i2s_init_dai(struct spacemit_i2s_dev *i2s,
> dai->playback.channels_min = 1;
> dai->playback.channels_max = 2;
> dai->playback.rates = SPACEMIT_PCM_RATES;
> + dai->playback.rate_min = SNDRV_PCM_RATE_8000;
> + dai->playback.rate_max = SNDRV_PCM_RATE_48000;
> dai->playback.formats = SPACEMIT_PCM_FORMATS;
>
> i2s->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
>
> [...]
>
> @@ -411,6 +397,8 @@ static int spacemit_i2s_init_dai(struct spacemit_i2s_dev *i2s,
> dai->capture.channels_min = 1;
> dai->capture.channels_max = 2;
> dai->capture.rates = SPACEMIT_PCM_RATES;
> + dai->capture.rate_min = SNDRV_PCM_RATE_8000;
> + dai->capture.rate_max = SNDRV_PCM_RATE_48000;
> dai->capture.formats = SPACEMIT_PCM_FORMATS;
>
> i2s->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
Initializing these fields conditionally preserves the existing
capabilities for devices with both "tx" and "rx" DMA channels, while
correctly disabling directions without a corresponding DMA channel. The
added rate_min and rate_max assignments also preserve the existing rate
constraints.
Please update the subject and commit message to describe this functional
fix rather than only the removal of redundant initialization. A possible
subject is:
ASoC: spacemit: advertise only DMA-backed DAI streams
Since the issue was introduced with the original driver, please also add:
Fixes: fce217449075 ("ASoC: spacemit: add i2s support for K1 SoC")
- Troy
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 248 bytes --]
[-- Attachment #2: Type: text/plain, Size: 161 bytes --]
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2026-08-04 6:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 4:30 [PATCH] ASoC: spacemit: Remove redundant DAI field initialization phucduc.bui
2026-08-04 6:39 ` Troy Mitchell [this message]
2026-08-04 9:45 ` Bui Duc Phuc
2026-08-04 9:58 ` Troy Mitchell
2026-08-04 9:59 ` Troy Mitchell
2026-08-04 14:19 ` Bui Duc Phuc
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=DKFYC1MGUCF0.1AQF42KLZZ0XL@linux.spacemit.com \
--to=troy.mitchell@linux.spacemit.com \
--cc=broonie@kernel.org \
--cc=dlan@kernel.org \
--cc=goku.sonxin626@gmail.com \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=phucduc.bui@gmail.com \
--cc=spacemit@lists.linux.dev \
--cc=tiwai@suse.com \
--cc=weijinmei@linux.spacemit.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox