aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/omap/omap-dmic.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2013-04-12 08:57:04 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-04-12 08:57:04 -0400
commit38e8c895d33b0642dc341f83cce0adde4cffbc82 (patch)
tree3657c043986d5c944f971c9685ae4a68f5a5b035 /sound/soc/omap/omap-dmic.c
parentd66e065c5b8b64b03a9d9b8a7c5d674c7dfa2e3d (diff)
parent69b6f19622ce0aef41df884b75e3f789c64b89c0 (diff)
Merge remote-tracking branch 'asoc/topic/dma' into asoc-next
Diffstat (limited to 'sound/soc/omap/omap-dmic.c')
-rw-r--r--sound/soc/omap/omap-dmic.c38
1 files changed, 13 insertions, 25 deletions
diff --git a/sound/soc/omap/omap-dmic.c b/sound/soc/omap/omap-dmic.c
index 4c54542895b0..2ad0370146fd 100644
--- a/sound/soc/omap/omap-dmic.c
+++ b/sound/soc/omap/omap-dmic.c
@@ -39,8 +39,8 @@
39#include <sound/pcm_params.h> 39#include <sound/pcm_params.h>
40#include <sound/initval.h> 40#include <sound/initval.h>
41#include <sound/soc.h> 41#include <sound/soc.h>
42#include <sound/dmaengine_pcm.h>
42 43
43#include "omap-pcm.h"
44#include "omap-dmic.h" 44#include "omap-dmic.h"
45 45
46struct omap_dmic { 46struct omap_dmic {
@@ -55,13 +55,9 @@ struct omap_dmic {
55 u32 ch_enabled; 55 u32 ch_enabled;
56 bool active; 56 bool active;
57 struct mutex mutex; 57 struct mutex mutex;
58};
59 58
60/* 59 struct snd_dmaengine_dai_dma_data dma_data;
61 * Stream DMA parameters 60 unsigned int dma_req;
62 */
63static struct omap_pcm_dma_data omap_dmic_dai_dma_params = {
64 .name = "DMIC capture",
65}; 61};
66 62
67static inline void omap_dmic_write(struct omap_dmic *dmic, u16 reg, u32 val) 63static inline void omap_dmic_write(struct omap_dmic *dmic, u16 reg, u32 val)
@@ -118,7 +114,7 @@ static int omap_dmic_dai_startup(struct snd_pcm_substream *substream,
118 114
119 mutex_unlock(&dmic->mutex); 115 mutex_unlock(&dmic->mutex);
120 116
121 snd_soc_dai_set_dma_data(dai, substream, &omap_dmic_dai_dma_params); 117 snd_soc_dai_set_dma_data(dai, substream, &dmic->dma_data);
122 return ret; 118 return ret;
123} 119}
124 120
@@ -203,7 +199,7 @@ static int omap_dmic_dai_hw_params(struct snd_pcm_substream *substream,
203 struct snd_soc_dai *dai) 199 struct snd_soc_dai *dai)
204{ 200{
205 struct omap_dmic *dmic = snd_soc_dai_get_drvdata(dai); 201 struct omap_dmic *dmic = snd_soc_dai_get_drvdata(dai);
206 struct omap_pcm_dma_data *dma_data; 202 struct snd_dmaengine_dai_dma_data *dma_data;
207 int channels; 203 int channels;
208 204
209 dmic->clk_div = omap_dmic_select_divider(dmic, params_rate(params)); 205 dmic->clk_div = omap_dmic_select_divider(dmic, params_rate(params));
@@ -230,7 +226,7 @@ static int omap_dmic_dai_hw_params(struct snd_pcm_substream *substream,
230 226
231 /* packet size is threshold * channels */ 227 /* packet size is threshold * channels */
232 dma_data = snd_soc_dai_get_dma_data(dai, substream); 228 dma_data = snd_soc_dai_get_dma_data(dai, substream);
233 dma_data->packet_size = dmic->threshold * channels; 229 dma_data->maxburst = dmic->threshold * channels;
234 230
235 return 0; 231 return 0;
236} 232}
@@ -480,7 +476,7 @@ static int asoc_dmic_probe(struct platform_device *pdev)
480 ret = -ENODEV; 476 ret = -ENODEV;
481 goto err_put_clk; 477 goto err_put_clk;
482 } 478 }
483 omap_dmic_dai_dma_params.port_addr = res->start + OMAP_DMIC_DATA_REG; 479 dmic->dma_data.addr = res->start + OMAP_DMIC_DATA_REG;
484 480
485 res = platform_get_resource(pdev, IORESOURCE_DMA, 0); 481 res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
486 if (!res) { 482 if (!res) {
@@ -488,7 +484,9 @@ static int asoc_dmic_probe(struct platform_device *pdev)
488 ret = -ENODEV; 484 ret = -ENODEV;
489 goto err_put_clk; 485 goto err_put_clk;
490 } 486 }
491 omap_dmic_dai_dma_params.dma_req = res->start; 487
488 dmic->dma_req = res->start;
489 dmic->dma_data.filter_data = &dmic->dma_req;
492 490
493 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mpu"); 491 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mpu");
494 if (!res) { 492 if (!res) {
@@ -497,19 +495,9 @@ static int asoc_dmic_probe(struct platform_device *pdev)
497 goto err_put_clk; 495 goto err_put_clk;
498 } 496 }
499 497
500 if (!devm_request_mem_region(&pdev->dev, res->start, 498 dmic->io_base = devm_ioremap_resource(&pdev->dev, res);
501 resource_size(res), pdev->name)) { 499 if (IS_ERR(dmic->io_base))
502 dev_err(dmic->dev, "memory region already claimed\n"); 500 return PTR_ERR(dmic->io_base);
503 ret = -ENODEV;
504 goto err_put_clk;
505 }
506
507 dmic->io_base = devm_ioremap(&pdev->dev, res->start,
508 resource_size(res));
509 if (!dmic->io_base) {
510 ret = -ENOMEM;
511 goto err_put_clk;
512 }
513 501
514 ret = snd_soc_register_component(&pdev->dev, &omap_dmic_component, 502 ret = snd_soc_register_component(&pdev->dev, &omap_dmic_component,
515 &omap_dmic_dai, 1); 503 &omap_dmic_dai, 1);