ASoC: Intel: Make Baytrail PCM data per stream rather than per DAI device
authorLiam Girdwood <liam.r.girdwood@linux.intel.com>
Wed, 14 May 2014 14:20:53 +0000 (17:20 +0300)
committerMark Brown <broonie@linaro.org>
Wed, 14 May 2014 15:57:26 +0000 (16:57 +0100)
Prepare for single Baytrail DAI playback/capture link by accessing PCM data
using stream ID instead of rtd->dev. Now rtd->dev is unique for playback
and capture since they are exported as separate DAIs but not once converted
to single DAI.

[Jarkko: Separated from another commit with updated commit log]

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
sound/soc/intel/sst-baytrail-pcm.c

index 0afb3491f5f0c8cbdeacd97d921408067a1cfe83..73bb68119b9e25fcfd431867568640e1c4dc24da 100644 (file)
@@ -68,7 +68,7 @@ static int sst_byt_pcm_hw_params(struct snd_pcm_substream *substream,
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct sst_byt_priv_data *pdata =
                snd_soc_platform_get_drvdata(rtd->platform);
-       struct sst_byt_pcm_data *pcm_data = snd_soc_pcm_get_drvdata(rtd);
+       struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream];
        struct sst_byt *byt = pdata->byt;
        u32 rate, bits;
        u8 channels;
@@ -140,7 +140,7 @@ static int sst_byt_pcm_restore_stream_context(struct snd_pcm_substream *substrea
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct sst_byt_priv_data *pdata =
                snd_soc_platform_get_drvdata(rtd->platform);
-       struct sst_byt_pcm_data *pcm_data = snd_soc_pcm_get_drvdata(rtd);
+       struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream];
        struct sst_byt *byt = pdata->byt;
        int ret;
 
@@ -172,7 +172,7 @@ static int sst_byt_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct sst_byt_priv_data *pdata =
                snd_soc_platform_get_drvdata(rtd->platform);
-       struct sst_byt_pcm_data *pcm_data = snd_soc_pcm_get_drvdata(rtd);
+       struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream];
        struct sst_byt *byt = pdata->byt;
 
        dev_dbg(rtd->dev, "PCM: trigger %d\n", cmd);
@@ -229,7 +229,9 @@ static snd_pcm_uframes_t sst_byt_pcm_pointer(struct snd_pcm_substream *substream
 {
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_pcm_runtime *runtime = substream->runtime;
-       struct sst_byt_pcm_data *pcm_data = snd_soc_pcm_get_drvdata(rtd);
+       struct sst_byt_priv_data *pdata =
+               snd_soc_platform_get_drvdata(rtd->platform);
+       struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream];
 
        dev_dbg(rtd->dev, "PCM: DMA pointer %u bytes\n", pcm_data->hw_ptr);
 
@@ -241,15 +243,13 @@ static int sst_byt_pcm_open(struct snd_pcm_substream *substream)
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct sst_byt_priv_data *pdata =
                snd_soc_platform_get_drvdata(rtd->platform);
-       struct sst_byt_pcm_data *pcm_data = snd_soc_pcm_get_drvdata(rtd);
+       struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream];
        struct sst_byt *byt = pdata->byt;
 
        dev_dbg(rtd->dev, "PCM: open\n");
 
-       pcm_data = &pdata->pcm[rtd->cpu_dai->id];
        mutex_lock(&pcm_data->mutex);
 
-       snd_soc_pcm_set_drvdata(rtd, pcm_data);
        pcm_data->substream = substream;
 
        snd_soc_set_runtime_hwparams(substream, &sst_byt_pcm_hardware);
@@ -271,7 +271,7 @@ static int sst_byt_pcm_close(struct snd_pcm_substream *substream)
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct sst_byt_priv_data *pdata =
                snd_soc_platform_get_drvdata(rtd->platform);
-       struct sst_byt_pcm_data *pcm_data = snd_soc_pcm_get_drvdata(rtd);
+       struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream];
        struct sst_byt *byt = pdata->byt;
        int ret;