diff options
Diffstat (limited to 'sound/soc/omap/omap-dmic.c')
-rw-r--r-- | sound/soc/omap/omap-dmic.c | 47 |
1 files changed, 20 insertions, 27 deletions
diff --git a/sound/soc/omap/omap-dmic.c b/sound/soc/omap/omap-dmic.c index ba49ccd9eed9..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 | ||
46 | struct omap_dmic { | 46 | struct 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 | */ | ||
63 | static struct omap_pcm_dma_data omap_dmic_dai_dma_params = { | ||
64 | .name = "DMIC capture", | ||
65 | }; | 61 | }; |
66 | 62 | ||
67 | static inline void omap_dmic_write(struct omap_dmic *dmic, u16 reg, u32 val) | 63 | static 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 | } |
@@ -448,6 +444,10 @@ static struct snd_soc_dai_driver omap_dmic_dai = { | |||
448 | .ops = &omap_dmic_dai_ops, | 444 | .ops = &omap_dmic_dai_ops, |
449 | }; | 445 | }; |
450 | 446 | ||
447 | static const struct snd_soc_component_driver omap_dmic_component = { | ||
448 | .name = "omap-dmic", | ||
449 | }; | ||
450 | |||
451 | static int asoc_dmic_probe(struct platform_device *pdev) | 451 | static int asoc_dmic_probe(struct platform_device *pdev) |
452 | { | 452 | { |
453 | struct omap_dmic *dmic; | 453 | struct omap_dmic *dmic; |
@@ -476,7 +476,7 @@ static int asoc_dmic_probe(struct platform_device *pdev) | |||
476 | ret = -ENODEV; | 476 | ret = -ENODEV; |
477 | goto err_put_clk; | 477 | goto err_put_clk; |
478 | } | 478 | } |
479 | omap_dmic_dai_dma_params.port_addr = res->start + OMAP_DMIC_DATA_REG; | 479 | dmic->dma_data.addr = res->start + OMAP_DMIC_DATA_REG; |
480 | 480 | ||
481 | res = platform_get_resource(pdev, IORESOURCE_DMA, 0); | 481 | res = platform_get_resource(pdev, IORESOURCE_DMA, 0); |
482 | if (!res) { | 482 | if (!res) { |
@@ -484,7 +484,9 @@ static int asoc_dmic_probe(struct platform_device *pdev) | |||
484 | ret = -ENODEV; | 484 | ret = -ENODEV; |
485 | goto err_put_clk; | 485 | goto err_put_clk; |
486 | } | 486 | } |
487 | 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; | ||
488 | 490 | ||
489 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mpu"); | 491 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mpu"); |
490 | if (!res) { | 492 | if (!res) { |
@@ -493,21 +495,12 @@ static int asoc_dmic_probe(struct platform_device *pdev) | |||
493 | goto err_put_clk; | 495 | goto err_put_clk; |
494 | } | 496 | } |
495 | 497 | ||
496 | if (!devm_request_mem_region(&pdev->dev, res->start, | 498 | dmic->io_base = devm_ioremap_resource(&pdev->dev, res); |
497 | resource_size(res), pdev->name)) { | 499 | if (IS_ERR(dmic->io_base)) |
498 | dev_err(dmic->dev, "memory region already claimed\n"); | 500 | return PTR_ERR(dmic->io_base); |
499 | ret = -ENODEV; | ||
500 | goto err_put_clk; | ||
501 | } | ||
502 | |||
503 | dmic->io_base = devm_ioremap(&pdev->dev, res->start, | ||
504 | resource_size(res)); | ||
505 | if (!dmic->io_base) { | ||
506 | ret = -ENOMEM; | ||
507 | goto err_put_clk; | ||
508 | } | ||
509 | 501 | ||
510 | ret = snd_soc_register_dai(&pdev->dev, &omap_dmic_dai); | 502 | ret = snd_soc_register_component(&pdev->dev, &omap_dmic_component, |
503 | &omap_dmic_dai, 1); | ||
511 | if (ret) | 504 | if (ret) |
512 | goto err_put_clk; | 505 | goto err_put_clk; |
513 | 506 | ||
@@ -522,7 +515,7 @@ static int asoc_dmic_remove(struct platform_device *pdev) | |||
522 | { | 515 | { |
523 | struct omap_dmic *dmic = platform_get_drvdata(pdev); | 516 | struct omap_dmic *dmic = platform_get_drvdata(pdev); |
524 | 517 | ||
525 | snd_soc_unregister_dai(&pdev->dev); | 518 | snd_soc_unregister_component(&pdev->dev); |
526 | clk_put(dmic->fclk); | 519 | clk_put(dmic->fclk); |
527 | 520 | ||
528 | return 0; | 521 | return 0; |