ASoC: Allocate PCM operations dynamically to support multiple DAIs
PATCH 1/1 ASoC: Allocate PCM operations dynamically to support multiple DAIs
From: Sangsu Park <[email protected]>
The original code does not cover the case that two DAIs(CPU) have different ASoC core PCM operations(like mmap, pointer...). Currently we have only one global soc_pcm_ops for ASoC core PCM operation. When two DAIs have different pointer functions, second DAI's pointer function is set for both first DAI and second DAI in case of original code.
This patch allocates ASoC core PCM operations dynamically for each DAIs. So each DAIs can have different ASoC core PCM operations. This is needed to support multiple DAIs.
--- sound/core/pcm.c | 1 + sound/soc/soc-pcm.c | 44 ++++++++++++++++++++++++-------------------- 2 files changed, 25 insertions(+), 20 deletions(-)
sound/core/pcm.c +1 -0
@@ -769,6 +769,7 @@ static void snd_pcm_free_stream(struct snd_pcm_str * pstr) substream_next = substream->next;snd_pcm_timer_done (substream);snd_pcm_substream_proc_done (substream); +kfree (substream->ops);kfree (substream); substream = substream_next; }
sound/soc/soc-pcm.c +24 -20
71 lines not on this page · raw message
Signature · 1 line
1.7.1
Quoted 24 lines · Sangbeom Kim
From: Sangsu Park <[email protected]>
The original code does not cover the case that two DAIs(CPU) have different ASoC core PCM
operations(like mmap, pointer...). Currently we have only one globalsoc_pcm_opsfor ASoC core PCM operation. When two DAIs have different pointer functions, second DAI's pointer function is set for both first DAI and second DAI in case of original code.This patch allocates ASoC core PCM operations dynamically for each DAIs. So each DAIs can have different ASoC core PCM operations. This is needed to support multiple DAIs.
Signed-off-by Sangsu Park <[email protected]>Signed-off-by Sangbeom Kim <[email protected]>--- sound/core/pcm.c | 1 + sound/soc/soc-pcm.c | 44 ++++++++++++++++++++++++-------------------- 2 files changed, 25 insertions(+), 20 deletions(-)sound/core/pcm.c +0
-0
sound/core/pcm.c static void snd_pcm_free_stream(struct snd_pcm_str * pstr) · line 772
Quoted 4 lines
sound/core/pcm.c +1
-0@@ -769,6 +769,7 @@ static void snd_pcm_free_stream(struct snd_pcm_str * pstr) substream_next = substream->next;snd_pcm_timer_done (substream);snd_pcm_substream_proc_done (substream); +kfree (substream->ops);
This looks wrong. It will probably cause regression for all non ASoC sound card drivers.
The issue this patch addresses came up before and I think the conclusion was that it is best to embed the snd_pcm_ops struct into the snd_soc_pcm_runtime struct.