ASoC: mmp-pcm: config pcm slave via generic dmaengine
Subsystems (3)
PATCH 1/1 ASoC: mmp-pcm: config pcm slave via generic dmaengine
use snd_dmaengine_pcm_prepare_slave_config to set slave config, and remove the max_burst_size = 4 hard code.
select SND_SOC_GENERIC_DMAENGINE_PCM for mmp-pcm.
--- sound/soc/pxa/Kconfig | 2 +- sound/soc/pxa/mmp-pcm.c | 18 +++--------------- 2 files changed, 4 insertions(+), 16 deletions(-)
sound/soc/pxa/Kconfig +1 -1
@@ -11,7 +11,7 @@ config SND_PXA2XX_SOC config SND_MMP_SOC bool "Soc Audio for Marvell MMP chips" depends on ARCH_MMP - select SND_DMAENGINE_PCM + select SND_SOC_GENERIC_DMAENGINE_PCM select SND_ARM help Say Y if you want to add support for codecs attached to
sound/soc/pxa/mmp-pcm.c +3 -15
@@ -67,27 +67,15 @@ static int mmp_pcm_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) {struct dma_chan *chan =snd_dmaengine_pcm_get_chan (substream); -struct snd_soc_pcm_runtime *rtd = substream->private_data; -struct snd_dmaengine_dai_dma_data *dma_params;struct dma_slave_config slave_config;int ret; - dma_params =snd_soc_dai_get_dma_data (rtd->cpu_dai, substream); -if (!dma_params) -return 0 ; - - ret =snd_hwparams_to_dma_slave_config (substream, params, &slave_config); + ret = +snd_dmaengine_pcm_prepare_slave_config (substream, params, + &slave_config);if (ret)return ret; -if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) { - slave_config.dst_addr = dma_params->addr; - slave_config.dst_maxburst =4 ; - }else { - slave_config.src_addr = dma_params->addr; - slave_config.src_maxburst =4 ; - } - ret =dmaengine_slave_config (chan, &slave_config);if (ret)return ret;
Signature · 1 line
1.7.0.4
Quoted 4 lines · Qiao Zhou
use
snd_dmaengine_pcm_prepare_slave_configto set slave config, and remove themax_burst_size= 4 hard code.select
SND_SOC_GENERIC_DMAENGINE_PCMfor mmp-pcm.
Applied, thanks. Can you also convert to use snd_dmaengine_pcm_register() and remove this file completely?
Quoted 9 lines · Mark Brown
Quoted 4 lines · Qiao Zhou
use
snd_dmaengine_pcm_prepare_slave_configto set slave config, and remove themax_burst_size= 4 hard code.select
SND_SOC_GENERIC_DMAENGINE_PCMfor mmp-pcm.Applied, thanks. Can you also convert to use
snd_dmaengine_pcm_register()and remove this file completely?
The problem here is that the driver uses sram for its audio memory and the platform has a custom function for looking up the sram pool. What we really need is a generic version of that which we can use in memalloc.c in the core.
- Lars
Mark Brown
maintainerQuoted 8 lines · Lars-Peter Clausen
Quoted 2 lines · Mark Brown
Applied, thanks. Can you also convert to use
snd_dmaengine_pcm_register()and remove this file completely?The problem here is that the driver uses sram for its audio memory and the platform has a custom function for looking up the sram pool. What we really need is a generic version of that which we can use in
memalloc.cin the core.
Ah, yes - now I remember.
Quoted 11 lines · Lars-Peter Clausen
Quoted 9 lines · Mark Brown
Quoted 4 lines · Qiao Zhou
use
snd_dmaengine_pcm_prepare_slave_configto set slave config, and remove themax_burst_size= 4 hard code.select
SND_SOC_GENERIC_DMAENGINE_PCMfor mmp-pcm.Applied, thanks. Can you also convert to use
snd_dmaengine_pcm_register()and remove this file completely?
Quoted 6 lines
The problem here is that the driver uses sram for its audio memory and the platform has a custom function for looking up the sram pool. What we really need is a generic version of that which we can use in
memalloc.cin the core.- Lars
I'll check the general memalloc implementation. Thanks.
Signature · 2 lines
Best Regards Qiao
Quoted 12 lines · Qiao Zhou
Quoted 11 lines · Lars-Peter Clausen
Quoted 9 lines · Mark Brown
Quoted 4 lines · Qiao Zhou
use
snd_dmaengine_pcm_prepare_slave_configto set slave config, and remove themax_burst_size= 4 hard code.select
SND_SOC_GENERIC_DMAENGINE_PCMfor mmp-pcm.Applied, thanks. Can you also convert to use
snd_dmaengine_pcm_register()and remove this file completely?
Quoted 8 lines
Quoted 6 lines
The problem here is that the driver uses sram for its audio memory and the platform has a custom function for looking up the sram pool. What we really need is a generic version of that which we can use in
memalloc.cin the core.- Lars
I'll check the general memalloc implementation. Thanks.
It's a bit dirty but if nobody has any strong objections we could add the following temporary hack until there is a generic method for looking up genpools. This would allow us to cut down mmp-pcm.c quite a bit by switching it over to the generic dmaengine PCM driver.
sound/core/memalloc.c +0 -0
@@ -178,6 +178,15 @@ static void snd_malloc_dev_iram(struct snd_dma_buffer
*dmab, size_t size)
if (dev->of_node)
pool = of_get_named_gen_pool(dev->of_node, "iram", 0);
+#ifdef CONFIG_CPU_MMP2
+ /*
+ * Temporary hack until we have a generic gen_pool lookup
+ * infrastructure.
+ */
+ if (!pool)
+ pool = sram_get_gpool("asram");
+#endif
+
if (!pool)
return;
At Wed, 18 Dec 2013 10:16:36 +0100,
Quoted 20 lines · Lars-Peter Clausen
Quoted 18 lines · Qiao Zhou
Quoted 17 lines · Lars-Peter Clausen
Quoted 9 lines · Mark Brown
Quoted 4 lines · Qiao Zhou
use
snd_dmaengine_pcm_prepare_slave_configto set slave config, and remove themax_burst_size= 4 hard code.select
SND_SOC_GENERIC_DMAENGINE_PCMfor mmp-pcm.Applied, thanks. Can you also convert to use
snd_dmaengine_pcm_register()and remove this file completely?The problem here is that the driver uses sram for its audio memory and the platform has a custom function for looking up the sram pool. What we really need is a generic version of that which we can use in
memalloc.cin the core.- Lars
Quoted 7 lines
Quoted 2 lines
I'll check the general memalloc implementation. Thanks.
It's a bit dirty but if nobody has any strong objections we could add the following temporary hack until there is a generic method for looking up genpools. This would allow us to cut down
mmp-pcm.cquite a bit by switching it over to the generic dmaengine PCM driver.
SNDRV_DMA_TYPE_DEV_IRAM is specific to such machines, so I have no big objection (as long as we can remember for the later revisit :)
thanks,
Takashi
Quoted 20 lines
sound/core/memalloc.c +9
-0@@ -178,6 +178,15 @@ static void snd_malloc_dev_iram(struct snd_dma_buffer *dmab, size_t size)if (dev->of_node) pool =of_get_named_gen_pool (dev->of_node,"iram" ,0 ); +#ifdef CONFIG_CPU_MMP2 +/* +* Temporary hack until we have a generic gen_pool lookup +* infrastructure. +*/ +if (!pool) + pool =sram_get_gpool ("asram" ); +#endif +if (!pool)return ;
Mark Brown
maintainerReview
Quoted 8 lines · Lars-Peter Clausen
(quoted diff) +8
-0+#ifdef CONFIG_CPU_MMP2 + /* + * Temporary hack until we have a generic gen_pool lookup + * infrastructure. + */ + if (!pool) + pool = sram_get_gpool("asram"); +#endif
I worry about what this'd do on a multiplatform kernel - it seems unlikely that someone has a pool with the same name but that sounds like famous last words. Nothing in mainline does though so...
Quoted 14 lines · Mark Brown
Review
Quoted 8 lines · Lars-Peter Clausen
(quoted diff) +8
-0+#ifdef CONFIG_CPU_MMP2 + /* + * Temporary hack until we have a generic gen_pool lookup + * infrastructure. + */ + if (!pool) + pool = sram_get_gpool("asram"); +#endifI worry about what this'd do on a multiplatform kernel - it seems unlikely that someone has a pool with the same name but that sounds like famous last words. Nothing in mainline does though so...
The sram_get_gpool() function is mmp2 specific. It basically iterates a list of available pools. Those pools are registered by mmp2 platform code. So on a multiplatform kernel not booting mmp2 it will always return NULL since no pools have been registered.
- Lars
Mark Brown
maintainerQuoted 7 lines · Lars-Peter Clausen
Quoted 3 lines · Mark Brown
I worry about what this'd do on a multiplatform kernel - it seems unlikely that someone has a pool with the same name but that sounds like famous last words. Nothing in mainline does though so...
The
sram_get_gpool()function is mmp2 specific. It basically iterates a list
It is? That's an unfortunate name then.
Quoted 3 lines
of available pools. Those pools are registered by mmp2 platform code. So on a multiplatform kernel not booting mmp2 it will always return NULL since no pools have been registered.
Yes, and like I say there's no non-MMP references to the string asram either. It seems viable to do things this way, though we need to get the generic interface sorted before too many other platforms get the same idea.