ASoC: OMAP: mcbsp, mcpdm, dmic, hdmi: Set dma_data at startup time
authorPeter Ujfalusi <peter.ujfalusi@ti.com>
Fri, 14 Sep 2012 12:05:57 +0000 (15:05 +0300)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Sat, 22 Sep 2012 15:13:02 +0000 (11:13 -0400)
Set the dma_data for the stream (snd_soc_dai_set_dma_data) at dai_startup
time so omap-pcm will have access to the needed information regarding to
the DMA channel earlier.
This is needed for the clean dmaengine support.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Tested-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/omap/omap-dmic.c
sound/soc/omap/omap-hdmi.c
sound/soc/omap/omap-mcbsp.c
sound/soc/omap/omap-mcpdm.c

index df0ff247f4964ce58c664aadede6c3998a261d01..68f2cd1a92061504bd332c683d286c8ffe8414eb 100644 (file)
@@ -118,6 +118,7 @@ static int omap_dmic_dai_startup(struct snd_pcm_substream *substream,
 
        mutex_unlock(&dmic->mutex);
 
+       snd_soc_dai_set_dma_data(dai, substream, &omap_dmic_dai_dma_params);
        return ret;
 }
 
@@ -202,6 +203,7 @@ static int omap_dmic_dai_hw_params(struct snd_pcm_substream *substream,
                                    struct snd_soc_dai *dai)
 {
        struct omap_dmic *dmic = snd_soc_dai_get_drvdata(dai);
+       struct omap_pcm_dma_data *dma_data;
        int channels;
 
        dmic->clk_div = omap_dmic_select_divider(dmic, params_rate(params));
@@ -227,8 +229,8 @@ static int omap_dmic_dai_hw_params(struct snd_pcm_substream *substream,
        }
 
        /* packet size is threshold * channels */
-       omap_dmic_dai_dma_params.packet_size = dmic->threshold * channels;
-       snd_soc_dai_set_dma_data(dai, substream, &omap_dmic_dai_dma_params);
+       dma_data = snd_soc_dai_get_dma_data(dai, substream);
+       dma_data->packet_size = dmic->threshold * channels;
 
        return 0;
 }
index 095176738fd633711c97f9bc9029eb4c5a206283..f59c69fb400ee60861bf334067aa1ee29df00d12 100644 (file)
@@ -67,6 +67,9 @@ static int omap_hdmi_dai_startup(struct snd_pcm_substream *substream,
                dev_err(dai->dev, "audio not supported\n");
                return -ENODEV;
        }
+
+       snd_soc_dai_set_dma_data(dai, substream, &priv->dma_params);
+
        return 0;
 }
 
@@ -85,24 +88,24 @@ static int omap_hdmi_dai_hw_params(struct snd_pcm_substream *substream,
        struct hdmi_priv *priv = snd_soc_dai_get_drvdata(dai);
        struct snd_aes_iec958 *iec = &priv->iec;
        struct snd_cea_861_aud_if *cea = &priv->cea;
+       struct omap_pcm_dma_data *dma_data;
        int err = 0;
 
+       dma_data = snd_soc_dai_get_dma_data(dai, substream);
+
        switch (params_format(params)) {
        case SNDRV_PCM_FORMAT_S16_LE:
-               priv->dma_params.packet_size = 16;
+               dma_data->packet_size = 16;
                break;
        case SNDRV_PCM_FORMAT_S24_LE:
-               priv->dma_params.packet_size = 32;
+               dma_data->packet_size = 32;
                break;
        default:
                dev_err(dai->dev, "format not supported!\n");
                return -EINVAL;
        }
 
-       priv->dma_params.data_type = 32;
-
-       snd_soc_dai_set_dma_data(dai, substream,
-                                &priv->dma_params);
+       dma_data->data_type = 32;
 
        /*
         * fill the IEC-60958 channel status word
index a23064644e58ac8b3a66731d9780859cf044ed6f..fef2f5933bb262f65f9c268da9c30d64daef3ee0 100644 (file)
@@ -151,6 +151,9 @@ static int omap_mcbsp_dai_startup(struct snd_pcm_substream *substream,
                                           SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 2);
        }
 
+       snd_soc_dai_set_dma_data(cpu_dai, substream,
+                                &mcbsp->dma_data[substream->stream]);
+
        return err;
 }
 
@@ -228,7 +231,7 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
        int pkt_size = 0;
        unsigned int format, div, framesize, master;
 
-       dma_data = &mcbsp->dma_data[substream->stream];
+       dma_data = snd_soc_dai_get_dma_data(cpu_dai, substream);
        channels = params_channels(params);
 
        switch (params_format(params)) {
@@ -277,8 +280,6 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
 
        dma_data->packet_size = pkt_size;
 
-       snd_soc_dai_set_dma_data(cpu_dai, substream, dma_data);
-
        if (mcbsp->configured) {
                /* McBSP already configured by another stream */
                return 0;
index 84743d47e687437de4971bcd7a1b7b1ce35c875d..775565032ce3f73b0bef43e22977a51d94adbee5 100644 (file)
@@ -267,9 +267,11 @@ static int omap_mcpdm_dai_startup(struct snd_pcm_substream *substream,
                }
                omap_mcpdm_open_streams(mcpdm);
        }
-
        mutex_unlock(&mcpdm->mutex);
 
+       snd_soc_dai_set_dma_data(dai, substream,
+                                &omap_mcpdm_dai_dma_params[substream->stream]);
+
        return 0;
 }
 
@@ -324,7 +326,7 @@ static int omap_mcpdm_dai_hw_params(struct snd_pcm_substream *substream,
                return -EINVAL;
        }
 
-       dma_data = &omap_mcpdm_dai_dma_params[stream];
+       dma_data = snd_soc_dai_get_dma_data(dai, substream);
 
        /* Configure McPDM channels, and DMA packet size */
        if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
@@ -336,8 +338,6 @@ static int omap_mcpdm_dai_hw_params(struct snd_pcm_substream *substream,
                dma_data->packet_size = mcpdm->up_threshold * channels;
        }
 
-       snd_soc_dai_set_dma_data(dai, substream, dma_data);
-
        return 0;
 }