aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2012-02-14 08:41:29 -0500
committerLiam Girdwood <lrg@ti.com>2012-03-12 09:34:22 -0400
commitb8fb4907a74dbcbd0b21e02380d58e422bd4a1fe (patch)
tree0b3369b83f25835af04414bd2c992e65d3783092 /sound
parent256d9c251fe6800a494206b96d2572e5a98762d5 (diff)
ASoC: omap-mcbsp: Simplify DMA configuration
Configure the DMA request line, port address, and stream name at probe time instead of every time we start a stream. These settings are static in the system. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Tested-by: Grazvydas Ignotas <notasas@gmail.com> Tested-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Jarkko Nikula <jarkko.nikula@bitmer.com> Signed-off-by: Liam Girdwood <lrg@ti.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/omap/mcbsp.c29
-rw-r--r--sound/soc/omap/mcbsp.h7
-rw-r--r--sound/soc/omap/omap-mcbsp.c8
3 files changed, 10 insertions, 34 deletions
diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
index 9e39c58a4671..fe4734e0c18c 100644
--- a/sound/soc/omap/mcbsp.c
+++ b/sound/soc/omap/mcbsp.c
@@ -176,22 +176,6 @@ void omap_mcbsp_config(struct omap_mcbsp *mcbsp,
176} 176}
177 177
178/** 178/**
179 * omap_mcbsp_dma_params - returns the dma channel number
180 * @id - mcbsp id
181 * @stream - indicates the direction of data flow (rx or tx)
182 *
183 * Returns the dma channel number for the rx channel or tx channel
184 * based on the value of @stream for the requested mcbsp given by @id
185 */
186int omap_mcbsp_dma_ch_params(struct omap_mcbsp *mcbsp, unsigned int stream)
187{
188 if (stream)
189 return mcbsp->dma_rx_sync;
190 else
191 return mcbsp->dma_tx_sync;
192}
193
194/**
195 * omap_mcbsp_dma_reg_params - returns the address of mcbsp data register 179 * omap_mcbsp_dma_reg_params - returns the address of mcbsp data register
196 * @id - mcbsp id 180 * @id - mcbsp id
197 * @stream - indicates the direction of data flow (rx or tx) 181 * @stream - indicates the direction of data flow (rx or tx)
@@ -200,7 +184,8 @@ int omap_mcbsp_dma_ch_params(struct omap_mcbsp *mcbsp, unsigned int stream)
200 * to be used by DMA for transferring/receiving data based on the value of 184 * to be used by DMA for transferring/receiving data based on the value of
201 * @stream for the requested mcbsp given by @id 185 * @stream for the requested mcbsp given by @id
202 */ 186 */
203int omap_mcbsp_dma_reg_params(struct omap_mcbsp *mcbsp, unsigned int stream) 187static int omap_mcbsp_dma_reg_params(struct omap_mcbsp *mcbsp,
188 unsigned int stream)
204{ 189{
205 int data_reg; 190 int data_reg;
206 191
@@ -983,14 +968,20 @@ int __devinit omap_mcbsp_init(struct platform_device *pdev)
983 dev_err(&pdev->dev, "invalid rx DMA channel\n"); 968 dev_err(&pdev->dev, "invalid rx DMA channel\n");
984 return -ENODEV; 969 return -ENODEV;
985 } 970 }
986 mcbsp->dma_rx_sync = res->start; 971 /* RX DMA request number, and port address configuration */
972 mcbsp->dma_data[1].name = "Audio Capture";
973 mcbsp->dma_data[1].dma_req = res->start;
974 mcbsp->dma_data[1].port_addr = omap_mcbsp_dma_reg_params(mcbsp, 1);
987 975
988 res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx"); 976 res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx");
989 if (!res) { 977 if (!res) {
990 dev_err(&pdev->dev, "invalid tx DMA channel\n"); 978 dev_err(&pdev->dev, "invalid tx DMA channel\n");
991 return -ENODEV; 979 return -ENODEV;
992 } 980 }
993 mcbsp->dma_tx_sync = res->start; 981 /* TX DMA request number, and port address configuration */
982 mcbsp->dma_data[0].name = "Audio Playback";
983 mcbsp->dma_data[0].dma_req = res->start;
984 mcbsp->dma_data[0].port_addr = omap_mcbsp_dma_reg_params(mcbsp, 0);
994 985
995 mcbsp->fclk = clk_get(&pdev->dev, "fck"); 986 mcbsp->fclk = clk_get(&pdev->dev, "fck");
996 if (IS_ERR(mcbsp->fclk)) { 987 if (IS_ERR(mcbsp->fclk)) {
diff --git a/sound/soc/omap/mcbsp.h b/sound/soc/omap/mcbsp.h
index d250bcc952d2..a5518d71913f 100644
--- a/sound/soc/omap/mcbsp.h
+++ b/sound/soc/omap/mcbsp.h
@@ -288,10 +288,6 @@ struct omap_mcbsp {
288 int rx_irq; 288 int rx_irq;
289 int tx_irq; 289 int tx_irq;
290 290
291 /* DMA stuff */
292 u8 dma_rx_sync;
293 u8 dma_tx_sync;
294
295 /* Protect the field .free, while checking if the mcbsp is in use */ 291 /* Protect the field .free, while checking if the mcbsp is in use */
296 struct omap_mcbsp_platform_data *pdata; 292 struct omap_mcbsp_platform_data *pdata;
297 struct omap_mcbsp_st_data *st_data; 293 struct omap_mcbsp_st_data *st_data;
@@ -328,9 +324,6 @@ int omap2_mcbsp_set_clks_src(struct omap_mcbsp *mcbsp, u8 fck_src_id);
328void omap2_mcbsp1_mux_clkr_src(struct omap_mcbsp *mcbsp, u8 mux); 324void omap2_mcbsp1_mux_clkr_src(struct omap_mcbsp *mcbsp, u8 mux);
329void omap2_mcbsp1_mux_fsr_src(struct omap_mcbsp *mcbsp, u8 mux); 325void omap2_mcbsp1_mux_fsr_src(struct omap_mcbsp *mcbsp, u8 mux);
330 326
331int omap_mcbsp_dma_ch_params(struct omap_mcbsp *mcbsp, unsigned int stream);
332int omap_mcbsp_dma_reg_params(struct omap_mcbsp *mcbsp, unsigned int stream);
333
334/* Sidetone specific API */ 327/* Sidetone specific API */
335int omap_st_set_chgain(struct omap_mcbsp *mcbsp, int channel, s16 chgain); 328int omap_st_set_chgain(struct omap_mcbsp *mcbsp, int channel, s16 chgain);
336int omap_st_get_chgain(struct omap_mcbsp *mcbsp, int channel, s16 *chgain); 329int omap_st_get_chgain(struct omap_mcbsp *mcbsp, int channel, s16 *chgain);
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index 4cd7af883de9..10eb645ceeef 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -225,17 +225,12 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
225 struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai); 225 struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai);
226 struct omap_mcbsp_reg_cfg *regs = &mcbsp->cfg_regs; 226 struct omap_mcbsp_reg_cfg *regs = &mcbsp->cfg_regs;
227 struct omap_pcm_dma_data *dma_data; 227 struct omap_pcm_dma_data *dma_data;
228 int dma;
229 int wlen, channels, wpf, sync_mode = OMAP_DMA_SYNC_ELEMENT; 228 int wlen, channels, wpf, sync_mode = OMAP_DMA_SYNC_ELEMENT;
230 int pkt_size = 0; 229 int pkt_size = 0;
231 unsigned long port;
232 unsigned int format, div, framesize, master; 230 unsigned int format, div, framesize, master;
233 231
234 dma_data = &mcbsp->dma_data[substream->stream]; 232 dma_data = &mcbsp->dma_data[substream->stream];
235 233
236 dma = omap_mcbsp_dma_ch_params(mcbsp, substream->stream);
237 port = omap_mcbsp_dma_reg_params(mcbsp, substream->stream);
238
239 switch (params_format(params)) { 234 switch (params_format(params)) {
240 case SNDRV_PCM_FORMAT_S16_LE: 235 case SNDRV_PCM_FORMAT_S16_LE:
241 dma_data->data_type = OMAP_DMA_DATA_TYPE_S16; 236 dma_data->data_type = OMAP_DMA_DATA_TYPE_S16;
@@ -291,9 +286,6 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
291 } 286 }
292 } 287 }
293 288
294 dma_data->name = substream->stream ? "Audio Capture" : "Audio Playback";
295 dma_data->dma_req = dma;
296 dma_data->port_addr = port;
297 dma_data->sync_mode = sync_mode; 289 dma_data->sync_mode = sync_mode;
298 dma_data->packet_size = pkt_size; 290 dma_data->packet_size = pkt_size;
299 291