diff mbox series

ASoC: atmel: atmel-classd: Re-add dai_link->platform to fix card init

Message ID 20240604101030.237792-1-andrei.simion@microchip.com (mailing list archive)
State Accepted
Commit 2ed22161b19b11239aa742804549f63edd7c91e3
Headers show
Series ASoC: atmel: atmel-classd: Re-add dai_link->platform to fix card init | expand

Commit Message

Andrei Simion June 4, 2024, 10:10 a.m. UTC
The removed dai_link->platform component cause a fail which
is exposed at runtime. (ex: when a sound tool is used)
This patch re-adds the dai_link->platform component to have
a full card registered.

Before this patch:
:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: CLASSD [CLASSD], device 0: CLASSD PCM snd-soc-dummy-dai-0 []
    Subdevices: 1/1
    Subdevice #0: subdevice #0

:~$ speaker-test -t sine
speaker-test 1.2.6
Playback device is default
Stream parameters are 48000Hz, S16_LE, 1 channels
Sine wave rate is 440.0000Hz
Playback open error: -22,Invalid argument

After this patch which restores the platform component:
:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: CLASSD [CLASSD], device 0: CLASSD PCM snd-soc-dummy-dai-0
						[CLASSD PCM snd-soc-dummy-dai-0]
    Subdevices: 1/1
    Subdevice #0: subdevice #0
-> Resolve the playback error.

Fixes: 2f650f87c03c ("ASoC: atmel: remove unnecessary dai_link->platform")
Signed-off-by: Andrei Simion <andrei.simion@microchip.com>
---
 sound/soc/atmel/atmel-classd.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Kuninori Morimoto June 4, 2024, 11:36 p.m. UTC | #1
Hi Andrei

> The removed dai_link->platform component cause a fail which
> is exposed at runtime. (ex: when a sound tool is used)
> This patch re-adds the dai_link->platform component to have
> a full card registered.

Thank you for the patch, and sorry to bother you by my patch.

Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>


I would like to ask for reference. What is this "sound tool" ?
(Is it on userland side ? or Kernel side ?)
And do you know what it will do to dai_link->platform ?

Thank you for your help !!
Best regards
---
Kuninori Morimoto
Andrei Simion June 5, 2024, 2:51 p.m. UTC | #2
Hi Kuninori,

On 05.06.2024 02:36, Kuninori Morimoto wrote:
> Hi Andrei
> 
>> The removed dai_link->platform component cause a fail which
>> is exposed at runtime. (ex: when a sound tool is used)
>> This patch re-adds the dai_link->platform component to have
>> a full card registered.
> 
> Thank you for the patch, and sorry to bother you by my patch.
> 
> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> 
> I would like to ask for reference. What is this "sound tool" ?
> (Is it on userland side ? or Kernel side ?)

It is on userland side like : arecord, aplay - command-line sound recorder and player for ALSA soundcard driver or speaker-test - command-line speaker test tone generator for ALSA

> And do you know what it will do to dai_link->platform ?
>

A platform driver is critical for interfacing between userland audio applications and the physical audio hardware. Proper implementation ensures successful audio playback and recording.

On the basic level of how it works when a userland application plays audio:
1. The ALSA subsystem processes the audio stream and sends it to the appropriate driver through the ASoC layer.
2. The dai_link->platform component is responsible for managing the data transfer, using DMA, to the codec (Class D amplifier).
3. The codec driver then converts the digital audio data into a PWM signal or other suitable digital representation that directly drives the loudspeaker.

> Thank you for your help !!
> Best regards
> ---
> Kuninori Morimoto


Best regards,
Andrei Simion
Mark Brown June 6, 2024, 2:49 p.m. UTC | #3
On Tue, 04 Jun 2024 13:10:30 +0300, Andrei Simion wrote:
> The removed dai_link->platform component cause a fail which
> is exposed at runtime. (ex: when a sound tool is used)
> This patch re-adds the dai_link->platform component to have
> a full card registered.
> 
> Before this patch:
> :~$ aplay -l
> **** List of PLAYBACK Hardware Devices ****
> card 0: CLASSD [CLASSD], device 0: CLASSD PCM snd-soc-dummy-dai-0 []
>     Subdevices: 1/1
>     Subdevice #0: subdevice #0
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: atmel: atmel-classd: Re-add dai_link->platform to fix card init
      commit: 2ed22161b19b11239aa742804549f63edd7c91e3

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
diff mbox series

Patch

diff --git a/sound/soc/atmel/atmel-classd.c b/sound/soc/atmel/atmel-classd.c
index 6aed1ee443b4..ba314b279919 100644
--- a/sound/soc/atmel/atmel-classd.c
+++ b/sound/soc/atmel/atmel-classd.c
@@ -473,19 +473,22 @@  static int atmel_classd_asoc_card_init(struct device *dev,
 	if (!dai_link)
 		return -ENOMEM;
 
-	comp = devm_kzalloc(dev, sizeof(*comp), GFP_KERNEL);
+	comp = devm_kzalloc(dev, 2 * sizeof(*comp), GFP_KERNEL);
 	if (!comp)
 		return -ENOMEM;
 
-	dai_link->cpus		= comp;
+	dai_link->cpus		= &comp[0];
 	dai_link->codecs	= &snd_soc_dummy_dlc;
+	dai_link->platforms	= &comp[1];
 
 	dai_link->num_cpus	= 1;
 	dai_link->num_codecs	= 1;
+	dai_link->num_platforms = 1;
 
 	dai_link->name			= "CLASSD";
 	dai_link->stream_name		= "CLASSD PCM";
 	dai_link->cpus->dai_name	= dev_name(dev);
+	dai_link->platforms->name	= dev_name(dev);
 
 	card->dai_link	= dai_link;
 	card->num_links	= 1;