* [PATCH] ASoC: pxa: remove duplicated snd_soc_component_driver ops
@ 2018-09-03 20:25 petrcvekcz
2018-09-10 18:55 ` Robert Jarzmik
0 siblings, 1 reply; 3+ messages in thread
From: petrcvekcz @ 2018-09-03 20:25 UTC (permalink / raw)
To: daniel, haojian.zhuang, lgirdwood, broonie, marek.vasut
Cc: alsa-devel, dbaryshkov, Petr Cvek, dirk, zhouqiao, philipp.zabel,
lost.distance, robert.jarzmik
From: Petr Cvek <petrcvekcz@gmail.com>
The sound soc drivers which are using a platform driver pxa-pcm-audio and
cpu dai drivers from the pxa tree have defined pxa2xx_soc_pcm_new() twice.
The function will get called in soc_new_pcm() for two components (platform
and cpu dai) which causes a double allocation of DMA resources and later
during a close of the playback/capture a kernel warning:
WARNING: CPU: 0 PID: 892 at drivers/dma/dmaengine.c:788 dma_release_channel+0x44/0xa0
chan reference count 0 != 1
Modules linked in: snd_soc_magician snd_soc_pxa2xx snd_pxa2xx_lib ...
CPU: 0 PID: 892 Comm: aplay Tainted: G C 4.18.0-rc6-next-20180726-magician+ #16
Hardware name: HTC Magician
[<c0107d90>] (unwind_backtrace) from [<c010594c>] (show_stack+0x10/0x14)
[<c010594c>] (show_stack) from [<c0111680>] (__warn+0xd4/0xec)
[<c0111680>] (__warn) from [<c01112d0>] (warn_slowpath_fmt+0x44/0x6c)
[<c01112d0>] (warn_slowpath_fmt) from [<c034908c>] (dma_release_channel+0x44/0xa0)
[<c034908c>] (dma_release_channel) from [<bf330528>] (snd_dmaengine_pcm_close_release_chan+0x44/0xb1c [snd_pcm_dmaengine])
[<bf330528>] (snd_dmaengine_pcm_close_release_chan [snd_pcm_dmaengine]) from [<bf26c29c>] (soc_pcm_components_close+0x8c/0xac [snd_soc_core])
[<bf26c29c>] (soc_pcm_components_close [snd_soc_core]) from [<bf26c3a0>] (soc_pcm_close+0xe4/0xd44 [snd_soc_core])
[<bf26c3a0>] (soc_pcm_close [snd_soc_core]) from [<bf167254>] (snd_pcm_release_substream+0x88/0x108 [snd_pcm])
[<bf167254>] (snd_pcm_release_substream [snd_pcm]) from [<bf167330>] (snd_pcm_release+0x5c/0xd2c [snd_pcm])
[<bf167330>] (snd_pcm_release [snd_pcm]) from [<c01c39e4>] (__fput+0xdc/0x1e8)
[<c01c39e4>] (__fput) from [<c0129e7c>] (task_work_run+0xc4/0xd4)
[<c0129e7c>] (task_work_run) from [<c01053ac>] (do_work_pending+0xc0/0xc8)
[<c01053ac>] (do_work_pending) from [<c0101068>] (slow_work_pending+0xc/0x20)
Exception stack(0xc2fdffb0 to 0xc2fdfff8)
ffa0: 00000000 0154d1a0 01542a3c 00000000
ffc0: 0154d150 00000000 0009283c 00000006 000003f0 0154d4c8 00000000 0154d4c8
ffe0: b6ee7d70 bef13960 b6e547b8 b6cfe018 60000010 00000004
The problem was found for cpu dai drivers: pxa-i2s and pxa-ssp and by
a calltrace sent from Robert Jarzmik on pxa-ac97 (although there was no
observed kernel warning). The git grep shows these 3 cpu dai drivers are
the only one which assign the .pcm_new to pxa2xx_soc_pcm_new() and almost
every machine which is using one of these cpu dai drivers is using the
platform driver pxa-pcm-audio too. The only exception is TTC_DKB board
which is using a platform driver mmp-pcm-audio. A quick look in the code
of mmp-pcm-audio shows it allocates the DMA in the similar way as PXA.
The solution is to remove one of pxa2xx_soc_pcm_new() assignments and the
patch does it for 3 cpu dai drivers (SSP/I2S/AC97).
The result was tested on HTC Magician board (SSP for playback, I2S for
capture) and the DMA buffers are correctly allocated.
Signed-off-by: Petr Cvek <petrcvekcz@gmail.com>
---
sound/soc/pxa/pxa-ssp.c | 3 ---
sound/soc/pxa/pxa2xx-ac97.c | 3 ---
sound/soc/pxa/pxa2xx-i2s.c | 3 ---
3 files changed, 9 deletions(-)
diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c
index 69033e1a84e6..9689a1552d53 100644
--- a/sound/soc/pxa/pxa-ssp.c
+++ b/sound/soc/pxa/pxa-ssp.c
@@ -867,9 +867,6 @@ static struct snd_soc_dai_driver pxa_ssp_dai = {
static const struct snd_soc_component_driver pxa_ssp_component = {
.name = "pxa-ssp",
- .ops = &pxa2xx_pcm_ops,
- .pcm_new = pxa2xx_soc_pcm_new,
- .pcm_free = pxa2xx_pcm_free_dma_buffers,
};
#ifdef CONFIG_OF
diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c
index 9f779657bc86..c52b33802bf2 100644
--- a/sound/soc/pxa/pxa2xx-ac97.c
+++ b/sound/soc/pxa/pxa2xx-ac97.c
@@ -214,9 +214,6 @@ static struct snd_soc_dai_driver pxa_ac97_dai_driver[] = {
static const struct snd_soc_component_driver pxa_ac97_component = {
.name = "pxa-ac97",
- .ops = &pxa2xx_pcm_ops,
- .pcm_new = pxa2xx_soc_pcm_new,
- .pcm_free = pxa2xx_pcm_free_dma_buffers,
};
#ifdef CONFIG_OF
diff --git a/sound/soc/pxa/pxa2xx-i2s.c b/sound/soc/pxa/pxa2xx-i2s.c
index 42820121e5b9..e7184de0de04 100644
--- a/sound/soc/pxa/pxa2xx-i2s.c
+++ b/sound/soc/pxa/pxa2xx-i2s.c
@@ -364,9 +364,6 @@ static struct snd_soc_dai_driver pxa_i2s_dai = {
static const struct snd_soc_component_driver pxa_i2s_component = {
.name = "pxa-i2s",
- .ops = &pxa2xx_pcm_ops,
- .pcm_new = pxa2xx_soc_pcm_new,
- .pcm_free = pxa2xx_pcm_free_dma_buffers,
};
static int pxa2xx_i2s_drv_probe(struct platform_device *pdev)
--
2.18.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ASoC: pxa: remove duplicated snd_soc_component_driver ops
2018-09-03 20:25 [PATCH] ASoC: pxa: remove duplicated snd_soc_component_driver ops petrcvekcz
@ 2018-09-10 18:55 ` Robert Jarzmik
2018-09-11 20:57 ` Robert Jarzmik
0 siblings, 1 reply; 3+ messages in thread
From: Robert Jarzmik @ 2018-09-10 18:55 UTC (permalink / raw)
To: petrcvekcz
Cc: alsa-devel, dbaryshkov, lgirdwood, haojian.zhuang, dirk,
marek.vasut, zhouqiao, broonie, philipp.zabel, lost.distance,
daniel
petrcvekcz@gmail.com writes:
> From: Petr Cvek <petrcvekcz@gmail.com>
>
> The sound soc drivers which are using a platform driver pxa-pcm-audio and
> cpu dai drivers from the pxa tree have defined pxa2xx_soc_pcm_new() twice.
> The function will get called in soc_new_pcm() for two components (platform
> and cpu dai) which causes a double allocation of DMA resources and later
> during a close of the playback/capture a kernel warning:
>
> WARNING: CPU: 0 PID: 892 at drivers/dma/dmaengine.c:788 dma_release_channel+0x44/0xa0
> chan reference count 0 != 1
> Modules linked in: snd_soc_magician snd_soc_pxa2xx snd_pxa2xx_lib ...
> CPU: 0 PID: 892 Comm: aplay Tainted: G C 4.18.0-rc6-next-20180726-magician+ #16
> Hardware name: HTC Magician
> [<c0107d90>] (unwind_backtrace) from [<c010594c>] (show_stack+0x10/0x14)
> [<c010594c>] (show_stack) from [<c0111680>] (__warn+0xd4/0xec)
> [<c0111680>] (__warn) from [<c01112d0>] (warn_slowpath_fmt+0x44/0x6c)
> [<c01112d0>] (warn_slowpath_fmt) from [<c034908c>] (dma_release_channel+0x44/0xa0)
> [<c034908c>] (dma_release_channel) from [<bf330528>] (snd_dmaengine_pcm_close_release_chan+0x44/0xb1c [snd_pcm_dmaengine])
> [<bf330528>] (snd_dmaengine_pcm_close_release_chan [snd_pcm_dmaengine]) from [<bf26c29c>] (soc_pcm_components_close+0x8c/0xac [snd_soc_core])
> [<bf26c29c>] (soc_pcm_components_close [snd_soc_core]) from [<bf26c3a0>] (soc_pcm_close+0xe4/0xd44 [snd_soc_core])
> [<bf26c3a0>] (soc_pcm_close [snd_soc_core]) from [<bf167254>] (snd_pcm_release_substream+0x88/0x108 [snd_pcm])
> [<bf167254>] (snd_pcm_release_substream [snd_pcm]) from [<bf167330>] (snd_pcm_release+0x5c/0xd2c [snd_pcm])
> [<bf167330>] (snd_pcm_release [snd_pcm]) from [<c01c39e4>] (__fput+0xdc/0x1e8)
> [<c01c39e4>] (__fput) from [<c0129e7c>] (task_work_run+0xc4/0xd4)
> [<c0129e7c>] (task_work_run) from [<c01053ac>] (do_work_pending+0xc0/0xc8)
> [<c01053ac>] (do_work_pending) from [<c0101068>] (slow_work_pending+0xc/0x20)
> Exception stack(0xc2fdffb0 to 0xc2fdfff8)
> ffa0: 00000000 0154d1a0 01542a3c 00000000
> ffc0: 0154d150 00000000 0009283c 00000006 000003f0 0154d4c8 00000000 0154d4c8
> ffe0: b6ee7d70 bef13960 b6e547b8 b6cfe018 60000010 00000004
>
> The problem was found for cpu dai drivers: pxa-i2s and pxa-ssp and by
> a calltrace sent from Robert Jarzmik on pxa-ac97 (although there was no
> observed kernel warning). The git grep shows these 3 cpu dai drivers are
> the only one which assign the .pcm_new to pxa2xx_soc_pcm_new() and almost
> every machine which is using one of these cpu dai drivers is using the
> platform driver pxa-pcm-audio too. The only exception is TTC_DKB board
> which is using a platform driver mmp-pcm-audio. A quick look in the code
> of mmp-pcm-audio shows it allocates the DMA in the similar way as PXA.
>
> The solution is to remove one of pxa2xx_soc_pcm_new() assignments and the
> patch does it for 3 cpu dai drivers (SSP/I2S/AC97).
>
> The result was tested on HTC Magician board (SSP for playback, I2S for
> capture) and the DMA buffers are correctly allocated.
>
> Signed-off-by: Petr Cvek <petrcvekcz@gmail.com>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Tested-by: Robert Jarzmik <robert.jarzmik@free.fr>
Cheers.
--
Robert
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ASoC: pxa: remove duplicated snd_soc_component_driver ops
2018-09-10 18:55 ` Robert Jarzmik
@ 2018-09-11 20:57 ` Robert Jarzmik
0 siblings, 0 replies; 3+ messages in thread
From: Robert Jarzmik @ 2018-09-11 20:57 UTC (permalink / raw)
To: petrcvekcz
Cc: alsa-devel, dbaryshkov, lgirdwood, haojian.zhuang, dirk,
marek.vasut, zhouqiao, broonie, philipp.zabel, lost.distance,
daniel
Robert Jarzmik <robert.jarzmik@free.fr> writes:
> Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
> Tested-by: Robert Jarzmik <robert.jarzmik@free.fr>
Mmh actually no, there is still a potential issue :
- the ac97 aplay works in my platform_data mioa701 board
- but it doesn't work anymore with the devicetree version ... until I revert
this patch where it works again.
The error I get is :
root@mioa701:~# aplay mp3/Avril\ Lavigne\ Joie.wav
aplay: main:722: audio open error: Invalid argument
The relevant devicetree extract is :
sound {
compatible = "simple-audio-card";
simple-audio-card,name = "MioA701";
simple-audio-card,widgets =
"Speaker", "Front Speaker",
"Speaker", "Rear Speaker",
"Microphone", "Headset",
"Microphone", "GSM Line Out",
"Line", "GSM Line In",
"Microphone", "Headset Mic",
"Microphone", "Front Mic";
simple-audio-card,routing =
/* Call Mic */
"Mic Bias", "Front Mic",
"MIC1", "Mic Bias",
/* Headset Mic */
"LINEL", "Headset Mic",
"LINER", "Headset Mic",
/* GSM Module */
"MONOIN", "GSM Line Out",
"PCBEEP", "GSM Line Out",
"GSM Line In", "MONO",
/* headphone connected to HPL, HPR */
"Headset", "HPL",
"Headset", "HPR",
/* front speaker connected to HPL, OUT3 */
"Front Speaker", "HPL",
"Front Speaker", "OUT3",
/* rear speaker connected to SPKL, SPKR */
"Rear Speaker", "SPKL",
"Rear Speaker", "SPKR";
simple-audio-card,cpu {
sound-dai = <&ac97>;
};
simple-audio-card,codec {
sound-dai = <&wm9713>;
};
simple-audio-card,plat {
sound-dai = <&pxa_pcm_audio>;
};
};
Cheers.
--
Robert
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-09-11 20:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-03 20:25 [PATCH] ASoC: pxa: remove duplicated snd_soc_component_driver ops petrcvekcz
2018-09-10 18:55 ` Robert Jarzmik
2018-09-11 20:57 ` Robert Jarzmik
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.