Re: [PATCH 1/3] ASoC: soc-generic-dmaengine-pcm: add option to start DMA after DAI

From: Lars-Peter Clausen
Date: Tue Feb 14 2023 - 13:14:38 EST


On 2/14/23 08:14, Claudiu Beznea wrote:
diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c
index 3b99f619e37e..264e87af6b58 100644
--- a/sound/soc/soc-generic-dmaengine-pcm.c
+++ b/sound/soc/soc-generic-dmaengine-pcm.c
@@ -318,7 +318,7 @@ static int dmaengine_copy_user(struct snd_soc_component *component,
return 0;
}
-static const struct snd_soc_component_driver dmaengine_pcm_component = {
+static struct snd_soc_component_driver dmaengine_pcm_component = {
.name = SND_DMAENGINE_PCM_DRV_NAME,
.probe_order = SND_SOC_COMP_ORDER_LATE,
.open = dmaengine_pcm_open,
@@ -329,7 +329,7 @@ static const struct snd_soc_component_driver dmaengine_pcm_component = {
.pcm_construct = dmaengine_pcm_new,
};
-static const struct snd_soc_component_driver dmaengine_pcm_component_process = {
+static struct snd_soc_component_driver dmaengine_pcm_component_process = {
.name = SND_DMAENGINE_PCM_DRV_NAME,
.probe_order = SND_SOC_COMP_ORDER_LATE,
.open = dmaengine_pcm_open,
@@ -425,7 +425,7 @@ static const struct snd_dmaengine_pcm_config snd_dmaengine_pcm_default_config =
int snd_dmaengine_pcm_register(struct device *dev,
const struct snd_dmaengine_pcm_config *config, unsigned int flags)
{
- const struct snd_soc_component_driver *driver;
+ struct snd_soc_component_driver *driver;
struct dmaengine_pcm *pcm;
int ret;
@@ -450,6 +450,8 @@ int snd_dmaengine_pcm_register(struct device *dev,
else
driver = &dmaengine_pcm_component;
+ driver->start_dma_last = config->start_dma_last;

This will break if you have multiple sound cards in the system. dmaengine_pcm_component must stay const.