diff options
Diffstat (limited to 'sound/soc/cirrus')
-rw-r--r-- | sound/soc/cirrus/edb93xx.c | 2 | ||||
-rw-r--r-- | sound/soc/cirrus/ep93xx-ac97.c | 20 | ||||
-rw-r--r-- | sound/soc/cirrus/ep93xx-i2s.c | 22 | ||||
-rw-r--r-- | sound/soc/cirrus/ep93xx-pcm.c | 48 | ||||
-rw-r--r-- | sound/soc/cirrus/ep93xx-pcm.h | 22 | ||||
-rw-r--r-- | sound/soc/cirrus/simone.c | 2 | ||||
-rw-r--r-- | sound/soc/cirrus/snappercl15.c | 2 |
7 files changed, 68 insertions, 50 deletions
diff --git a/sound/soc/cirrus/edb93xx.c b/sound/soc/cirrus/edb93xx.c index c43fb214558a..4f900efc437c 100644 --- a/sound/soc/cirrus/edb93xx.c +++ b/sound/soc/cirrus/edb93xx.c | |||
@@ -63,7 +63,7 @@ static struct snd_soc_ops edb93xx_ops = { | |||
63 | static struct snd_soc_dai_link edb93xx_dai = { | 63 | static struct snd_soc_dai_link edb93xx_dai = { |
64 | .name = "CS4271", | 64 | .name = "CS4271", |
65 | .stream_name = "CS4271 HiFi", | 65 | .stream_name = "CS4271 HiFi", |
66 | .platform_name = "ep93xx-pcm-audio", | 66 | .platform_name = "ep93xx-i2s", |
67 | .cpu_dai_name = "ep93xx-i2s", | 67 | .cpu_dai_name = "ep93xx-i2s", |
68 | .codec_name = "spi0.0", | 68 | .codec_name = "spi0.0", |
69 | .codec_dai_name = "cs4271-hifi", | 69 | .codec_dai_name = "cs4271-hifi", |
diff --git a/sound/soc/cirrus/ep93xx-ac97.c b/sound/soc/cirrus/ep93xx-ac97.c index efa75b5086a4..f30dadf85b99 100644 --- a/sound/soc/cirrus/ep93xx-ac97.c +++ b/sound/soc/cirrus/ep93xx-ac97.c | |||
@@ -19,11 +19,14 @@ | |||
19 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
20 | 20 | ||
21 | #include <sound/core.h> | 21 | #include <sound/core.h> |
22 | #include <sound/dmaengine_pcm.h> | ||
22 | #include <sound/ac97_codec.h> | 23 | #include <sound/ac97_codec.h> |
23 | #include <sound/soc.h> | 24 | #include <sound/soc.h> |
24 | 25 | ||
25 | #include <linux/platform_data/dma-ep93xx.h> | 26 | #include <linux/platform_data/dma-ep93xx.h> |
26 | 27 | ||
28 | #include "ep93xx-pcm.h" | ||
29 | |||
27 | /* | 30 | /* |
28 | * Per channel (1-4) registers. | 31 | * Per channel (1-4) registers. |
29 | */ | 32 | */ |
@@ -95,6 +98,8 @@ struct ep93xx_ac97_info { | |||
95 | struct device *dev; | 98 | struct device *dev; |
96 | void __iomem *regs; | 99 | void __iomem *regs; |
97 | struct completion done; | 100 | struct completion done; |
101 | struct snd_dmaengine_dai_dma_data dma_params_rx; | ||
102 | struct snd_dmaengine_dai_dma_data dma_params_tx; | ||
98 | }; | 103 | }; |
99 | 104 | ||
100 | /* currently ALSA only supports a single AC97 device */ | 105 | /* currently ALSA only supports a single AC97 device */ |
@@ -315,8 +320,13 @@ static int ep93xx_ac97_trigger(struct snd_pcm_substream *substream, | |||
315 | 320 | ||
316 | static int ep93xx_ac97_dai_probe(struct snd_soc_dai *dai) | 321 | static int ep93xx_ac97_dai_probe(struct snd_soc_dai *dai) |
317 | { | 322 | { |
318 | dai->playback_dma_data = &ep93xx_ac97_pcm_out; | 323 | struct ep93xx_ac97_info *info = snd_soc_dai_get_drvdata(dai); |
319 | dai->capture_dma_data = &ep93xx_ac97_pcm_in; | 324 | |
325 | info->dma_params_tx.filter_data = &ep93xx_ac97_pcm_out; | ||
326 | info->dma_params_rx.filter_data = &ep93xx_ac97_pcm_in; | ||
327 | |||
328 | dai->playback_dma_data = &info->dma_params_tx; | ||
329 | dai->capture_dma_data = &info->dma_params_rx; | ||
320 | 330 | ||
321 | return 0; | 331 | return 0; |
322 | } | 332 | } |
@@ -394,8 +404,14 @@ static int ep93xx_ac97_probe(struct platform_device *pdev) | |||
394 | if (ret) | 404 | if (ret) |
395 | goto fail; | 405 | goto fail; |
396 | 406 | ||
407 | ret = devm_ep93xx_pcm_platform_register(&pdev->dev); | ||
408 | if (ret) | ||
409 | goto fail_unregister; | ||
410 | |||
397 | return 0; | 411 | return 0; |
398 | 412 | ||
413 | fail_unregister: | ||
414 | snd_soc_unregister_component(&pdev->dev); | ||
399 | fail: | 415 | fail: |
400 | ep93xx_ac97_info = NULL; | 416 | ep93xx_ac97_info = NULL; |
401 | snd_soc_set_ac97_ops(NULL); | 417 | snd_soc_set_ac97_ops(NULL); |
diff --git a/sound/soc/cirrus/ep93xx-i2s.c b/sound/soc/cirrus/ep93xx-i2s.c index a57643d6402f..943145f9d1b6 100644 --- a/sound/soc/cirrus/ep93xx-i2s.c +++ b/sound/soc/cirrus/ep93xx-i2s.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/io.h> | 21 | #include <linux/io.h> |
22 | 22 | ||
23 | #include <sound/core.h> | 23 | #include <sound/core.h> |
24 | #include <sound/dmaengine_pcm.h> | ||
24 | #include <sound/pcm.h> | 25 | #include <sound/pcm.h> |
25 | #include <sound/pcm_params.h> | 26 | #include <sound/pcm_params.h> |
26 | #include <sound/initval.h> | 27 | #include <sound/initval.h> |
@@ -30,6 +31,8 @@ | |||
30 | #include <mach/ep93xx-regs.h> | 31 | #include <mach/ep93xx-regs.h> |
31 | #include <linux/platform_data/dma-ep93xx.h> | 32 | #include <linux/platform_data/dma-ep93xx.h> |
32 | 33 | ||
34 | #include "ep93xx-pcm.h" | ||
35 | |||
33 | #define EP93XX_I2S_TXCLKCFG 0x00 | 36 | #define EP93XX_I2S_TXCLKCFG 0x00 |
34 | #define EP93XX_I2S_RXCLKCFG 0x04 | 37 | #define EP93XX_I2S_RXCLKCFG 0x04 |
35 | #define EP93XX_I2S_GLCTRL 0x0C | 38 | #define EP93XX_I2S_GLCTRL 0x0C |
@@ -61,6 +64,8 @@ struct ep93xx_i2s_info { | |||
61 | struct clk *sclk; | 64 | struct clk *sclk; |
62 | struct clk *lrclk; | 65 | struct clk *lrclk; |
63 | void __iomem *regs; | 66 | void __iomem *regs; |
67 | struct snd_dmaengine_dai_dma_data dma_params_rx; | ||
68 | struct snd_dmaengine_dai_dma_data dma_params_tx; | ||
64 | }; | 69 | }; |
65 | 70 | ||
66 | static struct ep93xx_dma_data ep93xx_i2s_dma_data[] = { | 71 | static struct ep93xx_dma_data ep93xx_i2s_dma_data[] = { |
@@ -140,8 +145,15 @@ static void ep93xx_i2s_disable(struct ep93xx_i2s_info *info, int stream) | |||
140 | 145 | ||
141 | static int ep93xx_i2s_dai_probe(struct snd_soc_dai *dai) | 146 | static int ep93xx_i2s_dai_probe(struct snd_soc_dai *dai) |
142 | { | 147 | { |
143 | dai->playback_dma_data = &ep93xx_i2s_dma_data[SNDRV_PCM_STREAM_PLAYBACK]; | 148 | struct ep93xx_i2s_info *info = snd_soc_dai_get_drvdata(dai); |
144 | dai->capture_dma_data = &ep93xx_i2s_dma_data[SNDRV_PCM_STREAM_CAPTURE]; | 149 | |
150 | info->dma_params_tx.filter_data = | ||
151 | &ep93xx_i2s_dma_data[SNDRV_PCM_STREAM_PLAYBACK]; | ||
152 | info->dma_params_rx.filter_data = | ||
153 | &ep93xx_i2s_dma_data[SNDRV_PCM_STREAM_CAPTURE]; | ||
154 | |||
155 | dai->playback_dma_data = &info->dma_params_tx; | ||
156 | dai->capture_dma_data = &info->dma_params_rx; | ||
145 | 157 | ||
146 | return 0; | 158 | return 0; |
147 | } | 159 | } |
@@ -405,8 +417,14 @@ static int ep93xx_i2s_probe(struct platform_device *pdev) | |||
405 | if (err) | 417 | if (err) |
406 | goto fail_put_lrclk; | 418 | goto fail_put_lrclk; |
407 | 419 | ||
420 | err = devm_ep93xx_pcm_platform_register(&pdev->dev); | ||
421 | if (err) | ||
422 | goto fail_unregister; | ||
423 | |||
408 | return 0; | 424 | return 0; |
409 | 425 | ||
426 | fail_unregister: | ||
427 | snd_soc_unregister_component(&pdev->dev); | ||
410 | fail_put_lrclk: | 428 | fail_put_lrclk: |
411 | clk_put(info->lrclk); | 429 | clk_put(info->lrclk); |
412 | fail_put_sclk: | 430 | fail_put_sclk: |
diff --git a/sound/soc/cirrus/ep93xx-pcm.c b/sound/soc/cirrus/ep93xx-pcm.c index cfe517e68009..5f664471d99e 100644 --- a/sound/soc/cirrus/ep93xx-pcm.c +++ b/sound/soc/cirrus/ep93xx-pcm.c | |||
@@ -23,20 +23,13 @@ | |||
23 | 23 | ||
24 | #include <linux/platform_data/dma-ep93xx.h> | 24 | #include <linux/platform_data/dma-ep93xx.h> |
25 | 25 | ||
26 | #include "ep93xx-pcm.h" | ||
27 | |||
26 | static const struct snd_pcm_hardware ep93xx_pcm_hardware = { | 28 | static const struct snd_pcm_hardware ep93xx_pcm_hardware = { |
27 | .info = (SNDRV_PCM_INFO_MMAP | | 29 | .info = (SNDRV_PCM_INFO_MMAP | |
28 | SNDRV_PCM_INFO_MMAP_VALID | | 30 | SNDRV_PCM_INFO_MMAP_VALID | |
29 | SNDRV_PCM_INFO_INTERLEAVED | | 31 | SNDRV_PCM_INFO_INTERLEAVED | |
30 | SNDRV_PCM_INFO_BLOCK_TRANSFER), | 32 | SNDRV_PCM_INFO_BLOCK_TRANSFER), |
31 | |||
32 | .rates = SNDRV_PCM_RATE_8000_192000, | ||
33 | .rate_min = SNDRV_PCM_RATE_8000, | ||
34 | .rate_max = SNDRV_PCM_RATE_192000, | ||
35 | |||
36 | .formats = (SNDRV_PCM_FMTBIT_S16_LE | | ||
37 | SNDRV_PCM_FMTBIT_S24_LE | | ||
38 | SNDRV_PCM_FMTBIT_S32_LE), | ||
39 | |||
40 | .buffer_bytes_max = 131072, | 33 | .buffer_bytes_max = 131072, |
41 | .period_bytes_min = 32, | 34 | .period_bytes_min = 32, |
42 | .period_bytes_max = 32768, | 35 | .period_bytes_max = 32768, |
@@ -57,53 +50,22 @@ static bool ep93xx_pcm_dma_filter(struct dma_chan *chan, void *filter_param) | |||
57 | return false; | 50 | return false; |
58 | } | 51 | } |
59 | 52 | ||
60 | static struct dma_chan *ep93xx_compat_request_channel( | ||
61 | struct snd_soc_pcm_runtime *rtd, | ||
62 | struct snd_pcm_substream *substream) | ||
63 | { | ||
64 | struct snd_dmaengine_dai_dma_data *dma_data; | ||
65 | |||
66 | dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); | ||
67 | |||
68 | return snd_dmaengine_pcm_request_channel(ep93xx_pcm_dma_filter, | ||
69 | dma_data); | ||
70 | } | ||
71 | |||
72 | static const struct snd_dmaengine_pcm_config ep93xx_dmaengine_pcm_config = { | 53 | static const struct snd_dmaengine_pcm_config ep93xx_dmaengine_pcm_config = { |
73 | .pcm_hardware = &ep93xx_pcm_hardware, | 54 | .pcm_hardware = &ep93xx_pcm_hardware, |
74 | .compat_filter_fn = ep93xx_pcm_dma_filter, | 55 | .compat_filter_fn = ep93xx_pcm_dma_filter, |
75 | .compat_request_channel = ep93xx_compat_request_channel, | ||
76 | .prealloc_buffer_size = 131072, | 56 | .prealloc_buffer_size = 131072, |
77 | }; | 57 | }; |
78 | 58 | ||
79 | static int ep93xx_soc_platform_probe(struct platform_device *pdev) | 59 | int devm_ep93xx_pcm_platform_register(struct device *dev) |
80 | { | 60 | { |
81 | return snd_dmaengine_pcm_register(&pdev->dev, | 61 | return devm_snd_dmaengine_pcm_register(dev, |
82 | &ep93xx_dmaengine_pcm_config, | 62 | &ep93xx_dmaengine_pcm_config, |
83 | SND_DMAENGINE_PCM_FLAG_NO_RESIDUE | | 63 | SND_DMAENGINE_PCM_FLAG_NO_RESIDUE | |
84 | SND_DMAENGINE_PCM_FLAG_NO_DT | | 64 | SND_DMAENGINE_PCM_FLAG_NO_DT | |
85 | SND_DMAENGINE_PCM_FLAG_COMPAT); | 65 | SND_DMAENGINE_PCM_FLAG_COMPAT); |
86 | } | 66 | } |
87 | 67 | EXPORT_SYMBOL_GPL(devm_ep93xx_pcm_platform_register); | |
88 | static int ep93xx_soc_platform_remove(struct platform_device *pdev) | ||
89 | { | ||
90 | snd_dmaengine_pcm_unregister(&pdev->dev); | ||
91 | return 0; | ||
92 | } | ||
93 | |||
94 | static struct platform_driver ep93xx_pcm_driver = { | ||
95 | .driver = { | ||
96 | .name = "ep93xx-pcm-audio", | ||
97 | .owner = THIS_MODULE, | ||
98 | }, | ||
99 | |||
100 | .probe = ep93xx_soc_platform_probe, | ||
101 | .remove = ep93xx_soc_platform_remove, | ||
102 | }; | ||
103 | |||
104 | module_platform_driver(ep93xx_pcm_driver); | ||
105 | 68 | ||
106 | MODULE_AUTHOR("Ryan Mallon"); | 69 | MODULE_AUTHOR("Ryan Mallon"); |
107 | MODULE_DESCRIPTION("EP93xx ALSA PCM interface"); | 70 | MODULE_DESCRIPTION("EP93xx ALSA PCM interface"); |
108 | MODULE_LICENSE("GPL"); | 71 | MODULE_LICENSE("GPL"); |
109 | MODULE_ALIAS("platform:ep93xx-pcm-audio"); | ||
diff --git a/sound/soc/cirrus/ep93xx-pcm.h b/sound/soc/cirrus/ep93xx-pcm.h new file mode 100644 index 000000000000..b7a12a2fae9c --- /dev/null +++ b/sound/soc/cirrus/ep93xx-pcm.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | |||
17 | #ifndef __EP93XX_PCM_H__ | ||
18 | #define __EP93XX_PCM_H__ | ||
19 | |||
20 | int devm_ep93xx_pcm_platform_register(struct device *dev); | ||
21 | |||
22 | #endif | ||
diff --git a/sound/soc/cirrus/simone.c b/sound/soc/cirrus/simone.c index 4d094d00c34a..822a19a89e74 100644 --- a/sound/soc/cirrus/simone.c +++ b/sound/soc/cirrus/simone.c | |||
@@ -27,7 +27,7 @@ static struct snd_soc_dai_link simone_dai = { | |||
27 | .cpu_dai_name = "ep93xx-ac97", | 27 | .cpu_dai_name = "ep93xx-ac97", |
28 | .codec_dai_name = "ac97-hifi", | 28 | .codec_dai_name = "ac97-hifi", |
29 | .codec_name = "ac97-codec", | 29 | .codec_name = "ac97-codec", |
30 | .platform_name = "ep93xx-pcm-audio", | 30 | .platform_name = "ep93xx-ac97", |
31 | }; | 31 | }; |
32 | 32 | ||
33 | static struct snd_soc_card snd_soc_simone = { | 33 | static struct snd_soc_card snd_soc_simone = { |
diff --git a/sound/soc/cirrus/snappercl15.c b/sound/soc/cirrus/snappercl15.c index 69041074f2c1..29238a7476dd 100644 --- a/sound/soc/cirrus/snappercl15.c +++ b/sound/soc/cirrus/snappercl15.c | |||
@@ -83,7 +83,7 @@ static struct snd_soc_dai_link snappercl15_dai = { | |||
83 | .cpu_dai_name = "ep93xx-i2s", | 83 | .cpu_dai_name = "ep93xx-i2s", |
84 | .codec_dai_name = "tlv320aic23-hifi", | 84 | .codec_dai_name = "tlv320aic23-hifi", |
85 | .codec_name = "tlv320aic23-codec.0-001a", | 85 | .codec_name = "tlv320aic23-codec.0-001a", |
86 | .platform_name = "ep93xx-pcm-audio", | 86 | .platform_name = "ep93xx-i2s", |
87 | .init = snappercl15_tlv320aic23_init, | 87 | .init = snappercl15_tlv320aic23_init, |
88 | .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_IF | | 88 | .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_IF | |
89 | SND_SOC_DAIFMT_CBS_CFS, | 89 | SND_SOC_DAIFMT_CBS_CFS, |