diff mbox

[02/18] ASoC: omap-mcpdm: Assign the dai DMA data at earlier time

Message ID 1397640211-15447-3-git-send-email-peter.ujfalusi@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Peter Ujfalusi April 16, 2014, 9:23 a.m. UTC
Assign the dai dma data at dai driver probe time, not in startup.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 sound/soc/omap/omap-mcpdm.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Mark Brown April 16, 2014, 10:15 a.m. UTC | #1
On Wed, Apr 16, 2014 at 12:23:15PM +0300, Peter Ujfalusi wrote:

> -	snd_soc_dai_set_dma_data(dai, substream,
> -				 &mcpdm->dma_data[substream->stream]);
> -
>  	return 0;
>  }
>  
> @@ -406,6 +403,10 @@ static int omap_mcpdm_probe(struct snd_soc_dai *dai)
>  	mcpdm->config[SNDRV_PCM_STREAM_PLAYBACK].threshold = 2;
>  	mcpdm->config[SNDRV_PCM_STREAM_CAPTURE].threshold =
>  							MCPDM_UP_THRES_MAX - 3;
> +
> +	dai->playback_dma_data = &mcpdm->dma_data[SNDRV_PCM_STREAM_PLAYBACK];
> +	dai->capture_dma_data = &mcpdm->dma_data[SNDRV_PCM_STREAM_CAPTURE];
> +

Any reason to stop using _set_dma_data()?
Peter Ujfalusi April 16, 2014, 10:25 a.m. UTC | #2
On 04/16/2014 01:15 PM, Mark Brown wrote:
> On Wed, Apr 16, 2014 at 12:23:15PM +0300, Peter Ujfalusi wrote:
> 
>> -	snd_soc_dai_set_dma_data(dai, substream,
>> -				 &mcpdm->dma_data[substream->stream]);
>> -
>>  	return 0;
>>  }
>>  
>> @@ -406,6 +403,10 @@ static int omap_mcpdm_probe(struct snd_soc_dai *dai)
>>  	mcpdm->config[SNDRV_PCM_STREAM_PLAYBACK].threshold = 2;
>>  	mcpdm->config[SNDRV_PCM_STREAM_CAPTURE].threshold =
>>  							MCPDM_UP_THRES_MAX - 3;
>> +
>> +	dai->playback_dma_data = &mcpdm->dma_data[SNDRV_PCM_STREAM_PLAYBACK];
>> +	dai->capture_dma_data = &mcpdm->dma_data[SNDRV_PCM_STREAM_CAPTURE];
>> +
> 
> Any reason to stop using _set_dma_data()?

At dai driver probe we do not have substream and snd_soc_dai_set_dma_data()
relies on that (substream->stream) to figure out which dma_data to set.

This change is not a must for omap right now, but I have seen on davinci that
we need to have the playback/capture_dma_data set at this time if we are using
the ASoC generic dmaengine pcm for platform (I use edma-pcm on davinci right now).
Lars-Peter Clausen April 16, 2014, 12:23 p.m. UTC | #3
On 04/16/2014 12:25 PM, Peter Ujfalusi wrote:
> On 04/16/2014 01:15 PM, Mark Brown wrote:
>> On Wed, Apr 16, 2014 at 12:23:15PM +0300, Peter Ujfalusi wrote:
>>
>>> -	snd_soc_dai_set_dma_data(dai, substream,
>>> -				 &mcpdm->dma_data[substream->stream]);
>>> -
>>>   	return 0;
>>>   }
>>>
>>> @@ -406,6 +403,10 @@ static int omap_mcpdm_probe(struct snd_soc_dai *dai)
>>>   	mcpdm->config[SNDRV_PCM_STREAM_PLAYBACK].threshold = 2;
>>>   	mcpdm->config[SNDRV_PCM_STREAM_CAPTURE].threshold =
>>>   							MCPDM_UP_THRES_MAX - 3;
>>> +
>>> +	dai->playback_dma_data = &mcpdm->dma_data[SNDRV_PCM_STREAM_PLAYBACK];
>>> +	dai->capture_dma_data = &mcpdm->dma_data[SNDRV_PCM_STREAM_CAPTURE];
>>> +
>>
>> Any reason to stop using _set_dma_data()?
>
> At dai driver probe we do not have substream and snd_soc_dai_set_dma_data()
> relies on that (substream->stream) to figure out which dma_data to set.
>

You can use snd_soc_dai_init_dma_data(). Not that it saves much code, but it 
hides the implementation, which makes it easier to change things if we ever 
have to.

- Lars
diff mbox

Patch

diff --git a/sound/soc/omap/omap-mcpdm.c b/sound/soc/omap/omap-mcpdm.c
index 2f5b1536477e..489cb1f972a6 100644
--- a/sound/soc/omap/omap-mcpdm.c
+++ b/sound/soc/omap/omap-mcpdm.c
@@ -265,9 +265,6 @@  static int omap_mcpdm_dai_startup(struct snd_pcm_substream *substream,
 	}
 	mutex_unlock(&mcpdm->mutex);
 
-	snd_soc_dai_set_dma_data(dai, substream,
-				 &mcpdm->dma_data[substream->stream]);
-
 	return 0;
 }
 
@@ -406,6 +403,10 @@  static int omap_mcpdm_probe(struct snd_soc_dai *dai)
 	mcpdm->config[SNDRV_PCM_STREAM_PLAYBACK].threshold = 2;
 	mcpdm->config[SNDRV_PCM_STREAM_CAPTURE].threshold =
 							MCPDM_UP_THRES_MAX - 3;
+
+	dai->playback_dma_data = &mcpdm->dma_data[SNDRV_PCM_STREAM_PLAYBACK];
+	dai->capture_dma_data = &mcpdm->dma_data[SNDRV_PCM_STREAM_CAPTURE];
+
 	return ret;
 }