Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d5902f69 authored by Peter Ujfalusi's avatar Peter Ujfalusi Committed by Mark Brown
Browse files

ASoC: davinci-mcasp: Assign the dma_data earlier in dai_probe callback



Set up the playback_dma_data/capture_dma_data for the dai at probe
time since the generic dmaengine PCM stack needs to have access to
this information early.

Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 1a95d8d0
Loading
Loading
Loading
Loading
+21 −15
Original line number Original line Diff line number Diff line
@@ -716,22 +716,7 @@ static int davinci_mcasp_trigger(struct snd_pcm_substream *substream,
	return ret;
	return ret;
}
}


static int davinci_mcasp_startup(struct snd_pcm_substream *substream,
				 struct snd_soc_dai *dai)
{
	struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(dai);

	if (mcasp->version == MCASP_VERSION_4)
		snd_soc_dai_set_dma_data(dai, substream,
					&mcasp->dma_data[substream->stream]);
	else
		snd_soc_dai_set_dma_data(dai, substream, mcasp->dma_params);

	return 0;
}

static const struct snd_soc_dai_ops davinci_mcasp_dai_ops = {
static const struct snd_soc_dai_ops davinci_mcasp_dai_ops = {
	.startup	= davinci_mcasp_startup,
	.trigger	= davinci_mcasp_trigger,
	.trigger	= davinci_mcasp_trigger,
	.hw_params	= davinci_mcasp_hw_params,
	.hw_params	= davinci_mcasp_hw_params,
	.set_fmt	= davinci_mcasp_set_dai_fmt,
	.set_fmt	= davinci_mcasp_set_dai_fmt,
@@ -739,6 +724,25 @@ static const struct snd_soc_dai_ops davinci_mcasp_dai_ops = {
	.set_sysclk	= davinci_mcasp_set_sysclk,
	.set_sysclk	= davinci_mcasp_set_sysclk,
};
};


static int davinci_mcasp_dai_probe(struct snd_soc_dai *dai)
{
	struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(dai);

	if (mcasp->version == MCASP_VERSION_4) {
		/* Using dmaengine PCM */
		dai->playback_dma_data =
				&mcasp->dma_data[SNDRV_PCM_STREAM_PLAYBACK];
		dai->capture_dma_data =
				&mcasp->dma_data[SNDRV_PCM_STREAM_CAPTURE];
	} else {
		/* Using davinci-pcm */
		dai->playback_dma_data = mcasp->dma_params;
		dai->capture_dma_data = mcasp->dma_params;
	}

	return 0;
}

#ifdef CONFIG_PM_SLEEP
#ifdef CONFIG_PM_SLEEP
static int davinci_mcasp_suspend(struct snd_soc_dai *dai)
static int davinci_mcasp_suspend(struct snd_soc_dai *dai)
{
{
@@ -792,6 +796,7 @@ static int davinci_mcasp_resume(struct snd_soc_dai *dai)
static struct snd_soc_dai_driver davinci_mcasp_dai[] = {
static struct snd_soc_dai_driver davinci_mcasp_dai[] = {
	{
	{
		.name		= "davinci-mcasp.0",
		.name		= "davinci-mcasp.0",
		.probe		= davinci_mcasp_dai_probe,
		.suspend	= davinci_mcasp_suspend,
		.suspend	= davinci_mcasp_suspend,
		.resume		= davinci_mcasp_resume,
		.resume		= davinci_mcasp_resume,
		.playback	= {
		.playback	= {
@@ -811,6 +816,7 @@ static struct snd_soc_dai_driver davinci_mcasp_dai[] = {
	},
	},
	{
	{
		.name		= "davinci-mcasp.1",
		.name		= "davinci-mcasp.1",
		.probe		= davinci_mcasp_dai_probe,
		.playback 	= {
		.playback 	= {
			.channels_min	= 1,
			.channels_min	= 1,
			.channels_max	= 384,
			.channels_max	= 384,