diff mbox series

[resend,25/47] ASoC: samsung: snow: don't select unnecessary Platform

Message ID 874l4mv0h8.wl-kuninori.morimoto.gx@renesas.com (mailing list archive)
State New, archived
Headers show
Series ASoC: no Platform support | expand

Commit Message

Kuninori Morimoto June 19, 2019, 1:18 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ALSA SoC is now supporting "no Platform". Sound card doesn't need to
select "CPU component" as "Platform" anymore if it doesn't need
special Platform.
This patch removes such settings.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/samsung/snow.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

Comments

Marek Szyprowski June 24, 2019, 1:19 p.m. UTC | #1
Hi

On 2019-06-19 03:18, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>
> ALSA SoC is now supporting "no Platform". Sound card doesn't need to
> select "CPU component" as "Platform" anymore if it doesn't need
> special Platform.
> This patch removes such settings.
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch causes regression on Samsung Exynos-based boards: Snow, 
Peach-Pi and Peach-Pit (all that use snow machine driver) since linux 
next-20190620. ASoC device is properly registered, but it is not usable:

[    3.203006] samsung-i2s 3830000.i2s-sec: DMA channels sourced from 
device 3830000.i2s
[    3.213440] snow-audio sound: Failed parsing codec node
[    3.423241] snow-audio sound: multicodec <-> samsung-i2s mapping ok
[    3.429776] max98095 7-0011: ASoC: mux External MIC has no paths
[    3.434513] max98095 7-0011: ASoC: mux Linein Mux has no paths
[    4.043488] ALSA device list:
[    4.047171]   #0: Snow-I2S-MAX98095

# speaker-test -l1

speaker-test 1.1.3

Playback device is default
Stream parameters are 48000Hz, S16_LE, 1 channels
Using 16 octaves of pink noise
Playback open error: -22,Invalid argument

#

The kernel logs are exactly the same whem it worked fine (i.e. 
next-20190619, so the message about codec node can be ignored).

Similar issue appears also on Hardkernel's OdroidXU board 
(Exynos5410-based, uses sound-card-simple ASoC driver) and Samsung TM2 
board (Exynos5433, uses tm2_wm5110 driver). I'm open to test any patch 
or provide more logs if needed.

> ---
>   sound/soc/samsung/snow.c | 10 +++-------
>   1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/sound/soc/samsung/snow.c b/sound/soc/samsung/snow.c
> index 8ea7799..7d669c4 100644
> --- a/sound/soc/samsung/snow.c
> +++ b/sound/soc/samsung/snow.c
> @@ -14,9 +14,9 @@
>   
>   #define FIN_PLL_RATE		24000000
>   
> -SND_SOC_DAILINK_DEFS(links,
> -	DAILINK_COMP_ARRAY(COMP_EMPTY()),
> -	DAILINK_COMP_ARRAY(COMP_EMPTY()),
> +SND_SOC_DAILINK_DEF(links_cpus,
> +	DAILINK_COMP_ARRAY(COMP_EMPTY()));
> +SND_SOC_DAILINK_DEF(links_codecs,
>   	DAILINK_COMP_ARRAY(COMP_EMPTY()));
>   
>   struct snow_priv {
> @@ -150,8 +150,6 @@ static int snow_probe(struct platform_device *pdev)
>   	link->num_cpus = ARRAY_SIZE(links_cpus);
>   	link->codecs = links_codecs;
>   	link->num_codecs = ARRAY_SIZE(links_codecs);
> -	link->platforms = links_platforms;
> -	link->num_platforms = ARRAY_SIZE(links_platforms);
>   
>   	card->dai_link = link;
>   	card->num_links = 1;
> @@ -207,8 +205,6 @@ static int snow_probe(struct platform_device *pdev)
>   		}
>   	}
>   
> -	link->platforms->of_node = link->cpus->of_node;
> -
>   	/* Update card-name if provided through DT, else use default name */
>   	snd_soc_of_parse_card_name(card, "samsung,model");
>   

Best regards
Kuninori Morimoto June 25, 2019, 12:51 a.m. UTC | #2
Hi Marek

Thank you for your report.

> > ALSA SoC is now supporting "no Platform". Sound card doesn't need to
> > select "CPU component" as "Platform" anymore if it doesn't need
> > special Platform.
> > This patch removes such settings.
> >
> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> This patch causes regression on Samsung Exynos-based boards: Snow, 
> Peach-Pi and Peach-Pit (all that use snow machine driver) since linux 
> next-20190620. ASoC device is properly registered, but it is not usable:
> 
> [    3.203006] samsung-i2s 3830000.i2s-sec: DMA channels sourced from 
> device 3830000.i2s
> [    3.213440] snow-audio sound: Failed parsing codec node
> [    3.423241] snow-audio sound: multicodec <-> samsung-i2s mapping ok
> [    3.429776] max98095 7-0011: ASoC: mux External MIC has no paths
> [    3.434513] max98095 7-0011: ASoC: mux Linein Mux has no paths
> [    4.043488] ALSA device list:
> [    4.047171]   #0: Snow-I2S-MAX98095
> 
> # speaker-test -l1
> 
> speaker-test 1.1.3
> 
> Playback device is default
> Stream parameters are 48000Hz, S16_LE, 1 channels
> Using 16 octaves of pink noise
> Playback open error: -22,Invalid argument

Hmm.. strange...
Can you test normal aplay here ? I'm not familiar with speaker-test.

I have no idea so far, but one capability is that if your system
used / based dummy platform, and if your CPU driver didn't use/have
snd_soc_set_runtime_hwparams() / snd_pcm_lib_ioctl,
it might be happen, but this patch seems not related to it...


Thank you for your help !!
Best regards
---
Kuninori Morimoto
Marek Szyprowski June 25, 2019, 5:36 a.m. UTC | #3
Hi Kuninor

On 2019-06-25 02:51, Kuninori Morimoto wrote:
> Hi Marek
>
> Thank you for your report.
>
>>> ALSA SoC is now supporting "no Platform". Sound card doesn't need to
>>> select "CPU component" as "Platform" anymore if it doesn't need
>>> special Platform.
>>> This patch removes such settings.
>>>
>>> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>> This patch causes regression on Samsung Exynos-based boards: Snow,
>> Peach-Pi and Peach-Pit (all that use snow machine driver) since linux
>> next-20190620. ASoC device is properly registered, but it is not usable:
>>
>> [    3.203006] samsung-i2s 3830000.i2s-sec: DMA channels sourced from
>> device 3830000.i2s
>> [    3.213440] snow-audio sound: Failed parsing codec node
>> [    3.423241] snow-audio sound: multicodec <-> samsung-i2s mapping ok
>> [    3.429776] max98095 7-0011: ASoC: mux External MIC has no paths
>> [    3.434513] max98095 7-0011: ASoC: mux Linein Mux has no paths
>> [    4.043488] ALSA device list:
>> [    4.047171]   #0: Snow-I2S-MAX98095
>>
>> # speaker-test -l1
>>
>> speaker-test 1.1.3
>>
>> Playback device is default
>> Stream parameters are 48000Hz, S16_LE, 1 channels
>> Using 16 octaves of pink noise
>> Playback open error: -22,Invalid argument
> Hmm.. strange...
> Can you test normal aplay here ? I'm not familiar with speaker-test.

The same issue:

# aplay /usr/share/sounds/alsa/Front_Center.wav
aplay: main:788: audio open error: Invalid argument
#


> I have no idea so far, but one capability is that if your system
> used / based dummy platform, and if your CPU driver didn't use/have
> snd_soc_set_runtime_hwparams() / snd_pcm_lib_ioctl,
> it might be happen, but this patch seems not related to it...

Reverting this patch fixes the issue, so it is definitely related somehow.


Best regards
Kuninori Morimoto June 25, 2019, 8:25 a.m. UTC | #4
Hi Marek

> > I have no idea so far, but one capability is that if your system
> > used / based dummy platform, and if your CPU driver didn't use/have
> > snd_soc_set_runtime_hwparams() / snd_pcm_lib_ioctl,
> > it might be happen, but this patch seems not related to it...
> 
> Reverting this patch fixes the issue, so it is definitely related somehow.

Ahh... OK now I think I could understand your issue.
Your CPU is using devm_snd_dmaengine_pcm_register() with same *dev.
In such case, indeed this patch breaks sound card.

Can I confirm it ?
In local email, I asked printing component name list.
Can you please replace it to below ?
I think disappear component is "snd_dmaengine_pcm".
If so, above my patch is the bug.

---------------------------
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 4cd77cd..4b1f8ae 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -313,6 +313,7 @@ static int snd_soc_rtdcom_add(struct snd_soc_pcm_runtime *rtd,
 	new_rtdcom->component = component;
 	INIT_LIST_HEAD(&new_rtdcom->list);
 
+	printk("-----%s : %s\n", component->name, component->driver->name);
 	list_add_tail(&new_rtdcom->list, &rtd->component_list);
 
 	return 0;
---------------------------

Thank you for your help !!
Best regards
---
Kuninori Morimoto
Marek Szyprowski June 25, 2019, 8:37 a.m. UTC | #5
Hi Kuninori,

On 2019-06-25 10:25, Kuninori Morimoto wrote:
>>> I have no idea so far, but one capability is that if your system
>>> used / based dummy platform, and if your CPU driver didn't use/have
>>> snd_soc_set_runtime_hwparams() / snd_pcm_lib_ioctl,
>>> it might be happen, but this patch seems not related to it...
>> Reverting this patch fixes the issue, so it is definitely related somehow.
> Ahh... OK now I think I could understand your issue.
> Your CPU is using devm_snd_dmaengine_pcm_register() with same *dev.
> In such case, indeed this patch breaks sound card.
>
> Can I confirm it ?
> In local email, I asked printing component name list.
> Can you please replace it to below ?
> I think disappear component is "snd_dmaengine_pcm".
> If so, above my patch is the bug.
>
> ---------------------------
> diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
> index 4cd77cd..4b1f8ae 100644
> --- a/sound/soc/soc-core.c
> +++ b/sound/soc/soc-core.c
> @@ -313,6 +313,7 @@ static int snd_soc_rtdcom_add(struct snd_soc_pcm_runtime *rtd,
>   	new_rtdcom->component = component;
>   	INIT_LIST_HEAD(&new_rtdcom->list);
>   
> +	printk("-----%s : %s\n", component->name, component->driver->name);
>   	list_add_tail(&new_rtdcom->list, &rtd->component_list);
>   
>   	return 0;
> ---------------------------
>
> Thank you for your help !!

pure next-20190624:

[    3.549712] -----3830000.i2s : samsung-i2s
[    3.767732] -----max98095.7-0011 : (null)
[    3.986370] -----hdmi-audio-codec.3.auto : (null)

next-20190624 + Revert "ASoC: samsung: snow: don't select unnecessary 
Platform":

[    3.508391] -----3830000.i2s : samsung-i2s
[    3.726332] -----max98095.7-0011 : (null)
[    3.944906] -----hdmi-audio-codec.3.auto : (null)
[    4.376639] -----3830000.i2s : snd_dmaengine_pcm


Best regards
Kuninori Morimoto June 25, 2019, 11:44 p.m. UTC | #6
Hi Marek

Thank you for your test.
And so sorry to bother you.
I will fixup this issue.

> >>> I have no idea so far, but one capability is that if your system
> >>> used / based dummy platform, and if your CPU driver didn't use/have
> >>> snd_soc_set_runtime_hwparams() / snd_pcm_lib_ioctl,
> >>> it might be happen, but this patch seems not related to it...
> >> Reverting this patch fixes the issue, so it is definitely related somehow.
> > Ahh... OK now I think I could understand your issue.
> > Your CPU is using devm_snd_dmaengine_pcm_register() with same *dev.
> > In such case, indeed this patch breaks sound card.
> >
> > Can I confirm it ?
> > In local email, I asked printing component name list.
> > Can you please replace it to below ?
> > I think disappear component is "snd_dmaengine_pcm".
> > If so, above my patch is the bug.
> >
> > ---------------------------
> > diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
> > index 4cd77cd..4b1f8ae 100644
> > --- a/sound/soc/soc-core.c
> > +++ b/sound/soc/soc-core.c
> > @@ -313,6 +313,7 @@ static int snd_soc_rtdcom_add(struct snd_soc_pcm_runtime *rtd,
> >   	new_rtdcom->component = component;
> >   	INIT_LIST_HEAD(&new_rtdcom->list);
> >   
> > +	printk("-----%s : %s\n", component->name, component->driver->name);
> >   	list_add_tail(&new_rtdcom->list, &rtd->component_list);
> >   
> >   	return 0;
> > ---------------------------
> >
> > Thank you for your help !!
> 
> pure next-20190624:
> 
> [    3.549712] -----3830000.i2s : samsung-i2s
> [    3.767732] -----max98095.7-0011 : (null)
> [    3.986370] -----hdmi-audio-codec.3.auto : (null)
> 
> next-20190624 + Revert "ASoC: samsung: snow: don't select unnecessary 
> Platform":
> 
> [    3.508391] -----3830000.i2s : samsung-i2s
> [    3.726332] -----max98095.7-0011 : (null)
> [    3.944906] -----hdmi-audio-codec.3.auto : (null)
> [    4.376639] -----3830000.i2s : snd_dmaengine_pcm
> 
> 
> Best regards
> -- 
> Marek Szyprowski, PhD
> Samsung R&D Institute Poland
>
Kuninori Morimoto June 26, 2019, 1:15 a.m. UTC | #7
Hi Marek, again

> Thank you for your test.
> And so sorry to bother you.
> I will fixup this issue.
> 
> > >>> I have no idea so far, but one capability is that if your system
> > >>> used / based dummy platform, and if your CPU driver didn't use/have
> > >>> snd_soc_set_runtime_hwparams() / snd_pcm_lib_ioctl,
> > >>> it might be happen, but this patch seems not related to it...
> > >> Reverting this patch fixes the issue, so it is definitely related somehow.
> > > Ahh... OK now I think I could understand your issue.
> > > Your CPU is using devm_snd_dmaengine_pcm_register() with same *dev.
> > > In such case, indeed this patch breaks sound card.

I'm now negotiating to Mark to reverting issue patches.
But, as alternative idea, I think below patch can solve this issue.
Can you please test it ?

----------------------
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 358f1fb..79b9cc4 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -931,9 +931,11 @@ static int soc_bind_dai_link(struct snd_soc_card *card,
 	rtd->codec_dai = rtd->codec_dais[0];
 
 	/* Find PLATFORM from registered PLATFORMs */
+	/* CPU driver might has both DAI and PLATFORM */
 	for_each_component(component) {
 		if (!snd_soc_is_matching_component(dai_link->platforms,
-						   component))
+						   component) &&
+		    !snd_soc_is_matching_component(dai_link->cpus, component))
 			continue;
 
 		snd_soc_rtdcom_add(rtd, component);
----------------------


Thank you for your help !!
Best regards
---
Kuninori Morimoto
Marek Szyprowski June 26, 2019, 6:41 a.m. UTC | #8
Hi Kuninori,

On 2019-06-26 03:15, Kuninori Morimoto wrote:
> Hi Marek, again
>
>> Thank you for your test.
>> And so sorry to bother you.
>> I will fixup this issue.
>>
>>>>>> I have no idea so far, but one capability is that if your system
>>>>>> used / based dummy platform, and if your CPU driver didn't use/have
>>>>>> snd_soc_set_runtime_hwparams() / snd_pcm_lib_ioctl,
>>>>>> it might be happen, but this patch seems not related to it...
>>>>> Reverting this patch fixes the issue, so it is definitely related somehow.
>>>> Ahh... OK now I think I could understand your issue.
>>>> Your CPU is using devm_snd_dmaengine_pcm_register() with same *dev.
>>>> In such case, indeed this patch breaks sound card.
> I'm now negotiating to Mark to reverting issue patches.
> But, as alternative idea, I think below patch can solve this issue.
> Can you please test it ?
>
> ----------------------
> diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
> index 358f1fb..79b9cc4 100644
> --- a/sound/soc/soc-core.c
> +++ b/sound/soc/soc-core.c
> @@ -931,9 +931,11 @@ static int soc_bind_dai_link(struct snd_soc_card *card,
>   	rtd->codec_dai = rtd->codec_dais[0];
>   
>   	/* Find PLATFORM from registered PLATFORMs */
> +	/* CPU driver might has both DAI and PLATFORM */
>   	for_each_component(component) {
>   		if (!snd_soc_is_matching_component(dai_link->platforms,
> -						   component))
> +						   component) &&
> +		    !snd_soc_is_matching_component(dai_link->cpus, component))
>   			continue;
>   
>   		snd_soc_rtdcom_add(rtd, component);
> ----------------------

Yes, the above change fixes the issue on Samsung Snow, Peach-Pit and 
Peach-Pi Chromebooks, but causes regression on the other boards, for 
example here is the log from Odroid U3:

max98090 1-0010: MAX98090 REVID=0x43
max98090 1-0010: use default 2.8v micbias
odroid-audio sound: snd-soc-dummy-dai <-> samsung-i2s mapping ok
odroid-audio sound: multicodec <-> snd-soc-dummy-dai mapping ok
------------[ cut here ]------------
WARNING: CPU: 3 PID: 88 at fs/proc/generic.c:361 proc_register+0xf8/0x12c
proc_dir_entry 'sub0/prealloc' already registered
Modules linked in:
CPU: 3 PID: 88 Comm: kworker/3:1 Not tainted 
5.2.0-rc6-next-20190624-00004-g5611edb05c36-dirty #6233
Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
Workqueue: events deferred_probe_work_func
[<c0112548>] (unwind_backtrace) from [<c010e004>] (show_stack+0x10/0x14)
usb 1-3: new high-speed USB device number 3 using exynos-ehci
[<c010e004>] (show_stack) from [<c0aa63bc>] (dump_stack+0x98/0xc4)
[<c0aa63bc>] (dump_stack) from [<c01274d8>] (__warn+0x10c/0x124)
[<c01274d8>] (__warn) from [<c0127534>] (warn_slowpath_fmt+0x44/0x68)
[<c0127534>] (warn_slowpath_fmt) from [<c031f8b8>] 
(proc_register+0xf8/0x12c)
[<c031f8b8>] (proc_register) from [<c031fb88>] (proc_create_data+0x38/0x44)
[<c031fb88>] (proc_create_data) from [<c07a88a4>] 
(snd_info_register+0xe4/0x13c)
[<c07a88a4>] (snd_info_register) from [<c07a8804>] 
(snd_info_register+0x44/0x13c)
irq event stamp: 12923
hardirqs last  enabled at (12941): [<c01976a8>] console_unlock+0x4b8/0x6a8
hardirqs last disabled at (12958): [<c01972bc>] console_unlock+0xcc/0x6a8
softirqs last  enabled at (12956): [<c01026d8>] __do_softirq+0x4f0/0x5e0
softirqs last disabled at (12977): [<c012f6f8>] irq_exit+0x160/0x16c
---[ end trace 9e0864d90e2e08ab ]---
odroid-audio sound: ASoC: failed to register soundcard -12
odroid-audio sound: snd_soc_register_card() failed: -12
odroid-audio: probe of sound failed with error -12

here is the component list reported by your previous patch for that board:

[    3.012781] -----3830000.i2s : samsung-i2s
[    3.015736] -----snd-soc-dummy : (null)
[    3.019588] -----3830000.i2s : snd_dmaengine_pcm
[    3.024122] -----snd-soc-dummy : (null)
[    3.027991] -----hdmi-audio-codec.0.auto : (null)
[    3.032620] -----max98090.1-0010 : (null)
[    3.078865] max98090 1-0010: MAX98090 REVID=0x43
[    3.085038] max98090 1-0010: use default 2.8v micbias
[    3.113438] odroid-audio sound: snd-soc-dummy-dai <-> samsung-i2s 
mapping ok
[    3.123849] odroid-audio sound: multicodec <-> snd-soc-dummy-dai 
mapping ok
[    3.263208] ALSA device list:
[    3.264234]   #0: Odroid-U3

Best regards
Marek Szyprowski June 26, 2019, 6:48 a.m. UTC | #9
Hi again,

On 2019-06-26 08:41, Marek Szyprowski wrote:
> Hi Kuninori,
>
> On 2019-06-26 03:15, Kuninori Morimoto wrote:
>> Hi Marek, again
>>
>>> Thank you for your test.
>>> And so sorry to bother you.
>>> I will fixup this issue.
>>>
>>>>>>> I have no idea so far, but one capability is that if your system
>>>>>>> used / based dummy platform, and if your CPU driver didn't use/have
>>>>>>> snd_soc_set_runtime_hwparams() / snd_pcm_lib_ioctl,
>>>>>>> it might be happen, but this patch seems not related to it...
>>>>>> Reverting this patch fixes the issue, so it is definitely related 
>>>>>> somehow.
>>>>> Ahh... OK now I think I could understand your issue.
>>>>> Your CPU is using devm_snd_dmaengine_pcm_register() with same *dev.
>>>>> In such case, indeed this patch breaks sound card.
>> I'm now negotiating to Mark to reverting issue patches.
>> But, as alternative idea, I think below patch can solve this issue.
>> Can you please test it ?
>>
>> ----------------------
>> diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
>> index 358f1fb..79b9cc4 100644
>> --- a/sound/soc/soc-core.c
>> +++ b/sound/soc/soc-core.c
>> @@ -931,9 +931,11 @@ static int soc_bind_dai_link(struct snd_soc_card 
>> *card,
>>       rtd->codec_dai = rtd->codec_dais[0];
>>         /* Find PLATFORM from registered PLATFORMs */
>> +    /* CPU driver might has both DAI and PLATFORM */
>>       for_each_component(component) {
>>           if (!snd_soc_is_matching_component(dai_link->platforms,
>> -                           component))
>> +                           component) &&
>> +            !snd_soc_is_matching_component(dai_link->cpus, component))
>>               continue;
>>             snd_soc_rtdcom_add(rtd, component);
>> ----------------------
>
> Yes, the above change fixes the issue on Samsung Snow, Peach-Pit and 
> Peach-Pi Chromebooks, but causes regression on the other boards, for 
> example here is the log from Odroid U3:
>
> max98090 1-0010: MAX98090 REVID=0x43
> max98090 1-0010: use default 2.8v micbias
> odroid-audio sound: snd-soc-dummy-dai <-> samsung-i2s mapping ok
> odroid-audio sound: multicodec <-> snd-soc-dummy-dai mapping ok
> ------------[ cut here ]------------
> WARNING: CPU: 3 PID: 88 at fs/proc/generic.c:361 proc_register+0xf8/0x12c
> proc_dir_entry 'sub0/prealloc' already registered
> Modules linked in:
> CPU: 3 PID: 88 Comm: kworker/3:1 Not tainted 
> 5.2.0-rc6-next-20190624-00004-g5611edb05c36-dirty #6233
> Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
> Workqueue: events deferred_probe_work_func
> [<c0112548>] (unwind_backtrace) from [<c010e004>] (show_stack+0x10/0x14)
> usb 1-3: new high-speed USB device number 3 using exynos-ehci
> [<c010e004>] (show_stack) from [<c0aa63bc>] (dump_stack+0x98/0xc4)
> [<c0aa63bc>] (dump_stack) from [<c01274d8>] (__warn+0x10c/0x124)
> [<c01274d8>] (__warn) from [<c0127534>] (warn_slowpath_fmt+0x44/0x68)
> [<c0127534>] (warn_slowpath_fmt) from [<c031f8b8>] 
> (proc_register+0xf8/0x12c)
> [<c031f8b8>] (proc_register) from [<c031fb88>] 
> (proc_create_data+0x38/0x44)
> [<c031fb88>] (proc_create_data) from [<c07a88a4>] 
> (snd_info_register+0xe4/0x13c)
> [<c07a88a4>] (snd_info_register) from [<c07a8804>] 
> (snd_info_register+0x44/0x13c)
> irq event stamp: 12923
> hardirqs last  enabled at (12941): [<c01976a8>] 
> console_unlock+0x4b8/0x6a8
> hardirqs last disabled at (12958): [<c01972bc>] console_unlock+0xcc/0x6a8
> softirqs last  enabled at (12956): [<c01026d8>] __do_softirq+0x4f0/0x5e0
> softirqs last disabled at (12977): [<c012f6f8>] irq_exit+0x160/0x16c
> ---[ end trace 9e0864d90e2e08ab ]---
> odroid-audio sound: ASoC: failed to register soundcard -12
> odroid-audio sound: snd_soc_register_card() failed: -12
> odroid-audio: probe of sound failed with error -12
>
> here is the component list reported by your previous patch for that 
> board:
>
> [    3.012781] -----3830000.i2s : samsung-i2s
> [    3.015736] -----snd-soc-dummy : (null)
> [    3.019588] -----3830000.i2s : snd_dmaengine_pcm
> [    3.024122] -----snd-soc-dummy : (null)
> [    3.027991] -----hdmi-audio-codec.0.auto : (null)
> [    3.032620] -----max98090.1-0010 : (null)
> [    3.078865] max98090 1-0010: MAX98090 REVID=0x43
> [    3.085038] max98090 1-0010: use default 2.8v micbias
> [    3.113438] odroid-audio sound: snd-soc-dummy-dai <-> samsung-i2s 
> mapping ok
> [    3.123849] odroid-audio sound: multicodec <-> snd-soc-dummy-dai 
> mapping ok
> [    3.263208] ALSA device list:
> [    3.264234]   #0: Odroid-U3


Just one more thing. Here is the component list with the above patch 
applied:

[    2.970127] -----3830000.i2s : samsung-i2s
[    2.973029] -----snd-soc-dummy : (null)
[    2.976851] -----hdmi-audio-codec.0.auto : (null)
[    2.981476] -----3830000.i2s-sec : snd_dmaengine_pcm
[    2.986459] -----3830000.i2s : snd_dmaengine_pcm
[    2.991022] -----max98090.1-0010 : (null)
[    2.995065] -----snd-soc-dummy : (null)
[    2.998866] -----hdmi-audio-codec.0.auto : (null)
[    3.003523] -----max98090.1-0010 : (null)
[    3.047448] max98090 1-0010: MAX98090 REVID=0x43
[    3.052177] max98090 1-0010: use default 2.8v micbias
[    3.085090] odroid-audio sound: snd-soc-dummy-dai <-> samsung-i2s 
mapping ok
[    3.089691] odroid-audio sound: multicodec <-> snd-soc-dummy-dai 
mapping ok
[    3.099545] ------------[ cut here ]------------
[    3.099799] WARNING: CPU: 2 PID: 33 at fs/proc/generic.c:361 
proc_register+0xe4/0x118
[    3.106497] proc_dir_entry 'sub0/prealloc' already registered
[    3.112118] Modules linked in:
[    3.115162] CPU: 2 PID: 33 Comm: kworker/2:1 Not tainted 
5.2.0-rc6-next-20190624-00004-g5611edb05c36-dirty #6238
[    3.125310] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[    3.131399] Workqueue: events deferred_probe_work_func
[    3.136533] [<c0112530>] (unwind_backtrace) from [<c010e070>] 
(show_stack+0x10/0x14)
[    3.144249] [<c010e070>] (show_stack) from [<c0aa2a2c>] 
(dump_stack+0xa8/0xd4)
[    3.151447] [<c0aa2a2c>] (dump_stack) from [<c01271f4>] 
(__warn+0x10c/0x124)
[    3.158472] [<c01271f4>] (__warn) from [<c0127250>] 
(warn_slowpath_fmt+0x44/0x68)
[    3.165937] [<c0127250>] (warn_slowpath_fmt) from [<c031cf5c>] 
(proc_register+0xe4/0x118)
[    3.174094] [<c031cf5c>] (proc_register) from [<c031d23c>] 
(proc_create_data+0x38/0x4c)
[    3.182095] [<c031d23c>] (proc_create_data) from [<c07a3bb0>] 
(snd_info_register+0xe4/0x13c)
[    3.190500] [<c07a3bb0>] (snd_info_register) from [<c07a3b10>] 
(snd_info_register+0x44/0x13c)
[    3.199072] irq event stamp: 12863
[    3.202401] hardirqs last  enabled at (12871): [<c0196d60>] 
console_unlock+0x464/0x6d0
[    3.210328] hardirqs last disabled at (12888): [<c01969a4>] 
console_unlock+0xa8/0x6d0
[    3.218140] softirqs last  enabled at (12904): [<c01026fc>] 
__do_softirq+0x4fc/0x5f8
[    3.225834] softirqs last disabled at (12897): [<c012f52c>] 
irq_exit+0x160/0x16c
[    3.233242] ---[ end trace 09e9050a97457376 ]---
[    3.237863] odroid-audio sound: ASoC: failed to register soundcard -12
[    3.253458] odroid-audio sound: snd_soc_register_card() failed: -12
[    3.254216] odroid-audio: probe of sound failed with error -12

Best regards
Kuninori Morimoto June 26, 2019, 7:20 a.m. UTC | #10
Hi Marek

Thank you for your report

> [    2.970127] -----3830000.i2s : samsung-i2s
> [    2.973029] -----snd-soc-dummy : (null)
> [    2.976851] -----hdmi-audio-codec.0.auto : (null)
> [    2.981476] -----3830000.i2s-sec : snd_dmaengine_pcm
> [    2.986459] -----3830000.i2s : snd_dmaengine_pcm
> [    2.991022] -----max98090.1-0010 : (null)
> [    2.995065] -----snd-soc-dummy : (null)
> [    2.998866] -----hdmi-audio-codec.0.auto : (null)
> [    3.003523] -----max98090.1-0010 : (null)

Ahh, OK...
Unfortunately, alternative idea will add extra component to
rtd in your case.
This means, my patches were totally buggy.
I need to negotiate Mark revert/remove all buggy patches.

Thank you for your help !!
Best regards
---
Kuninori Morimoto
Marek Szyprowski June 27, 2019, 12:44 p.m. UTC | #11
Hi Kuninori,

On 2019-06-26 08:48, Marek Szyprowski wrote:
> Hi again,
>
> On 2019-06-26 08:41, Marek Szyprowski wrote:
>> Hi Kuninori,
>>
>> On 2019-06-26 03:15, Kuninori Morimoto wrote:
>>> Hi Marek, again
>>>
>>>> Thank you for your test.
>>>> And so sorry to bother you.
>>>> I will fixup this issue.
>>>>
>>>>>>>> I have no idea so far, but one capability is that if your system
>>>>>>>> used / based dummy platform, and if your CPU driver didn't 
>>>>>>>> use/have
>>>>>>>> snd_soc_set_runtime_hwparams() / snd_pcm_lib_ioctl,
>>>>>>>> it might be happen, but this patch seems not related to it...
>>>>>>> Reverting this patch fixes the issue, so it is definitely 
>>>>>>> related somehow.
>>>>>> Ahh... OK now I think I could understand your issue.
>>>>>> Your CPU is using devm_snd_dmaengine_pcm_register() with same *dev.
>>>>>> In such case, indeed this patch breaks sound card.
>>> I'm now negotiating to Mark to reverting issue patches.
>>> But, as alternative idea, I think below patch can solve this issue.
>>> Can you please test it ?
>>>
>>> ----------------------
>>> diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
>>> index 358f1fb..79b9cc4 100644
>>> --- a/sound/soc/soc-core.c
>>> +++ b/sound/soc/soc-core.c
>>> @@ -931,9 +931,11 @@ static int soc_bind_dai_link(struct 
>>> snd_soc_card *card,
>>>       rtd->codec_dai = rtd->codec_dais[0];
>>>         /* Find PLATFORM from registered PLATFORMs */
>>> +    /* CPU driver might has both DAI and PLATFORM */
>>>       for_each_component(component) {
>>>           if (!snd_soc_is_matching_component(dai_link->platforms,
>>> -                           component))
>>> +                           component) &&
>>> +            !snd_soc_is_matching_component(dai_link->cpus, component))
>>>               continue;
>>>             snd_soc_rtdcom_add(rtd, component);
>>> ----------------------
>>
>> Yes, the above change fixes the issue on Samsung Snow, Peach-Pit and 
>> Peach-Pi Chromebooks, but causes regression on the other boards, for 
>> example here is the log from Odroid U3:
>>
>> max98090 1-0010: MAX98090 REVID=0x43
>> max98090 1-0010: use default 2.8v micbias
>> odroid-audio sound: snd-soc-dummy-dai <-> samsung-i2s mapping ok
>> odroid-audio sound: multicodec <-> snd-soc-dummy-dai mapping ok
>> ------------[ cut here ]------------
>> WARNING: CPU: 3 PID: 88 at fs/proc/generic.c:361 
>> proc_register+0xf8/0x12c
>> proc_dir_entry 'sub0/prealloc' already registered
>> Modules linked in:
>> CPU: 3 PID: 88 Comm: kworker/3:1 Not tainted 
>> 5.2.0-rc6-next-20190624-00004-g5611edb05c36-dirty #6233
>> Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
>> Workqueue: events deferred_probe_work_func
>> [<c0112548>] (unwind_backtrace) from [<c010e004>] (show_stack+0x10/0x14)
>> usb 1-3: new high-speed USB device number 3 using exynos-ehci
>> [<c010e004>] (show_stack) from [<c0aa63bc>] (dump_stack+0x98/0xc4)
>> [<c0aa63bc>] (dump_stack) from [<c01274d8>] (__warn+0x10c/0x124)
>> [<c01274d8>] (__warn) from [<c0127534>] (warn_slowpath_fmt+0x44/0x68)
>> [<c0127534>] (warn_slowpath_fmt) from [<c031f8b8>] 
>> (proc_register+0xf8/0x12c)
>> [<c031f8b8>] (proc_register) from [<c031fb88>] 
>> (proc_create_data+0x38/0x44)
>> [<c031fb88>] (proc_create_data) from [<c07a88a4>] 
>> (snd_info_register+0xe4/0x13c)
>> [<c07a88a4>] (snd_info_register) from [<c07a8804>] 
>> (snd_info_register+0x44/0x13c)
>> irq event stamp: 12923
>> hardirqs last  enabled at (12941): [<c01976a8>] 
>> console_unlock+0x4b8/0x6a8
>> hardirqs last disabled at (12958): [<c01972bc>] 
>> console_unlock+0xcc/0x6a8
>> softirqs last  enabled at (12956): [<c01026d8>] __do_softirq+0x4f0/0x5e0
>> softirqs last disabled at (12977): [<c012f6f8>] irq_exit+0x160/0x16c
>> ---[ end trace 9e0864d90e2e08ab ]---
>> odroid-audio sound: ASoC: failed to register soundcard -12
>> odroid-audio sound: snd_soc_register_card() failed: -12
>> odroid-audio: probe of sound failed with error -12
>>
>> here is the component list reported by your previous patch for that 
>> board:
>>
>> [    3.012781] -----3830000.i2s : samsung-i2s
>> [    3.015736] -----snd-soc-dummy : (null)
>> [    3.019588] -----3830000.i2s : snd_dmaengine_pcm
>> [    3.024122] -----snd-soc-dummy : (null)
>> [    3.027991] -----hdmi-audio-codec.0.auto : (null)
>> [    3.032620] -----max98090.1-0010 : (null)
>> [    3.078865] max98090 1-0010: MAX98090 REVID=0x43
>> [    3.085038] max98090 1-0010: use default 2.8v micbias
>> [    3.113438] odroid-audio sound: snd-soc-dummy-dai <-> samsung-i2s 
>> mapping ok
>> [    3.123849] odroid-audio sound: multicodec <-> snd-soc-dummy-dai 
>> mapping ok
>> [    3.263208] ALSA device list:
>> [    3.264234]   #0: Odroid-U3
>
>
> Just one more thing. Here is the component list with the above patch 
> applied:
>
> [    2.970127] -----3830000.i2s : samsung-i2s
> [    2.973029] -----snd-soc-dummy : (null)
> [    2.976851] -----hdmi-audio-codec.0.auto : (null)
> [    2.981476] -----3830000.i2s-sec : snd_dmaengine_pcm
> [    2.986459] -----3830000.i2s : snd_dmaengine_pcm
> [    2.991022] -----max98090.1-0010 : (null)
> [    2.995065] -----snd-soc-dummy : (null)
> [    2.998866] -----hdmi-audio-codec.0.auto : (null)
> [    3.003523] -----max98090.1-0010 : (null)
> [    3.047448] max98090 1-0010: MAX98090 REVID=0x43
> [    3.052177] max98090 1-0010: use default 2.8v micbias
> [    3.085090] odroid-audio sound: snd-soc-dummy-dai <-> samsung-i2s 
> mapping ok
> [    3.089691] odroid-audio sound: multicodec <-> snd-soc-dummy-dai 
> mapping ok
> [    3.099545] ------------[ cut here ]------------
> [    3.099799] WARNING: CPU: 2 PID: 33 at fs/proc/generic.c:361 
> proc_register+0xe4/0x118
> [    3.106497] proc_dir_entry 'sub0/prealloc' already registered
> [    3.112118] Modules linked in:
> [    3.115162] CPU: 2 PID: 33 Comm: kworker/2:1 Not tainted 
> 5.2.0-rc6-next-20190624-00004-g5611edb05c36-dirty #6238
> [    3.125310] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
> [    3.131399] Workqueue: events deferred_probe_work_func
> [    3.136533] [<c0112530>] (unwind_backtrace) from [<c010e070>] 
> (show_stack+0x10/0x14)
> [    3.144249] [<c010e070>] (show_stack) from [<c0aa2a2c>] 
> (dump_stack+0xa8/0xd4)
> [    3.151447] [<c0aa2a2c>] (dump_stack) from [<c01271f4>] 
> (__warn+0x10c/0x124)
> [    3.158472] [<c01271f4>] (__warn) from [<c0127250>] 
> (warn_slowpath_fmt+0x44/0x68)
> [    3.165937] [<c0127250>] (warn_slowpath_fmt) from [<c031cf5c>] 
> (proc_register+0xe4/0x118)
> [    3.174094] [<c031cf5c>] (proc_register) from [<c031d23c>] 
> (proc_create_data+0x38/0x4c)
> [    3.182095] [<c031d23c>] (proc_create_data) from [<c07a3bb0>] 
> (snd_info_register+0xe4/0x13c)
> [    3.190500] [<c07a3bb0>] (snd_info_register) from [<c07a3b10>] 
> (snd_info_register+0x44/0x13c)
> [    3.199072] irq event stamp: 12863
> [    3.202401] hardirqs last  enabled at (12871): [<c0196d60>] 
> console_unlock+0x464/0x6d0
> [    3.210328] hardirqs last disabled at (12888): [<c01969a4>] 
> console_unlock+0xa8/0x6d0
> [    3.218140] softirqs last  enabled at (12904): [<c01026fc>] 
> __do_softirq+0x4fc/0x5f8
> [    3.225834] softirqs last disabled at (12897): [<c012f52c>] 
> irq_exit+0x160/0x16c
> [    3.233242] ---[ end trace 09e9050a97457376 ]---
> [    3.237863] odroid-audio sound: ASoC: failed to register soundcard -12
> [    3.253458] odroid-audio sound: snd_soc_register_card() failed: -12
> [    3.254216] odroid-audio: probe of sound failed with error -12
>
I've noticed your "ASoC: soc-core: don't use soc_find_component() at 
snd_soc_find_dai()" patch, but sadly it doesn't fix any issue with the 
Samsung I2S and Snow ASoC driver. Do you want me to send revert to all 
the needed commits to restore audio on Samsung Chromebooks: Snow, Pit 
and Pi, Odroid XU and Samsung TM2 boards?

Best regards
Kuninori Morimoto June 27, 2019, 11:53 p.m. UTC | #12
Hi Marek

sorry for bother you

> I've noticed your "ASoC: soc-core: don't use soc_find_component() at 
> snd_soc_find_dai()" patch, but sadly it doesn't fix any issue with the 
> Samsung I2S and Snow ASoC driver. Do you want me to send revert to all 
> the needed commits to restore audio on Samsung Chromebooks: Snow, Pit 
> and Pi, Odroid XU and Samsung TM2 boards?

It and your issue are both from my miss-understanding
(= some CPU is using generic DMAEngine), but needs different patch.

I'm now negotiating to Mark about it,
and I will post revert/fixup patch, soon.

Again, I'm so sorry to bother you.


Thank you for your help !!
Best regards
---
Kuninori Morimoto
diff mbox series

Patch

diff --git a/sound/soc/samsung/snow.c b/sound/soc/samsung/snow.c
index 8ea7799..7d669c4 100644
--- a/sound/soc/samsung/snow.c
+++ b/sound/soc/samsung/snow.c
@@ -14,9 +14,9 @@ 
 
 #define FIN_PLL_RATE		24000000
 
-SND_SOC_DAILINK_DEFS(links,
-	DAILINK_COMP_ARRAY(COMP_EMPTY()),
-	DAILINK_COMP_ARRAY(COMP_EMPTY()),
+SND_SOC_DAILINK_DEF(links_cpus,
+	DAILINK_COMP_ARRAY(COMP_EMPTY()));
+SND_SOC_DAILINK_DEF(links_codecs,
 	DAILINK_COMP_ARRAY(COMP_EMPTY()));
 
 struct snow_priv {
@@ -150,8 +150,6 @@  static int snow_probe(struct platform_device *pdev)
 	link->num_cpus = ARRAY_SIZE(links_cpus);
 	link->codecs = links_codecs;
 	link->num_codecs = ARRAY_SIZE(links_codecs);
-	link->platforms = links_platforms;
-	link->num_platforms = ARRAY_SIZE(links_platforms);
 
 	card->dai_link = link;
 	card->num_links = 1;
@@ -207,8 +205,6 @@  static int snow_probe(struct platform_device *pdev)
 		}
 	}
 
-	link->platforms->of_node = link->cpus->of_node;
-
 	/* Update card-name if provided through DT, else use default name */
 	snd_soc_of_parse_card_name(card, "samsung,model");