aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/blackfin
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/blackfin')
-rw-r--r--sound/soc/blackfin/Kconfig27
-rw-r--r--sound/soc/blackfin/Makefile4
-rw-r--r--sound/soc/blackfin/bf5xx-ac97-pcm.c6
-rw-r--r--sound/soc/blackfin/bf5xx-i2s-pcm.c12
-rw-r--r--sound/soc/blackfin/bf5xx-tdm-pcm.c6
-rw-r--r--sound/soc/blackfin/bfin-eval-adau1701.c139
-rw-r--r--sound/soc/blackfin/bfin-eval-adav80x.c173
7 files changed, 356 insertions, 11 deletions
diff --git a/sound/soc/blackfin/Kconfig b/sound/soc/blackfin/Kconfig
index ae403597fd31..fe9d548a6837 100644
--- a/sound/soc/blackfin/Kconfig
+++ b/sound/soc/blackfin/Kconfig
@@ -10,13 +10,36 @@ config SND_BF5XX_I2S
10 10
11config SND_BF5XX_SOC_SSM2602 11config SND_BF5XX_SOC_SSM2602
12 tristate "SoC SSM2602 Audio support for BF52x ezkit" 12 tristate "SoC SSM2602 Audio support for BF52x ezkit"
13 depends on SND_BF5XX_I2S 13 depends on SND_BF5XX_I2S && (SPI_MASTER || I2C)
14 select SND_BF5XX_SOC_I2S 14 select SND_BF5XX_SOC_I2S
15 select SND_SOC_SSM2602 15 select SND_SOC_SSM2602
16 select I2C
17 help 16 help
18 Say Y if you want to add support for SoC audio on BF527-EZKIT. 17 Say Y if you want to add support for SoC audio on BF527-EZKIT.
19 18
19config SND_SOC_BFIN_EVAL_ADAU1701
20 tristate "Support for the EVAL-ADAU1701MINIZ board on Blackfin eval boards"
21 depends on SND_BF5XX_I2S
22 select SND_BF5XX_SOC_I2S
23 select SND_SOC_ADAU1701
24 select I2C
25 help
26 Say Y if you want to add support for the Analog Devices EVAL-ADAU1701MINIZ
27 board connected to one of the Blackfin evaluation boards like the
28 BF5XX-STAMP or BF5XX-EZKIT.
29
30config SND_SOC_BFIN_EVAL_ADAV80X
31 tristate "Support for the EVAL-ADAV80X boards on Blackfin eval boards"
32 depends on SND_BF5XX_I2S && (SPI_MASTER || I2C)
33 select SND_BF5XX_SOC_I2S
34 select SND_SOC_ADAV80X
35 help
36 Say Y if you want to add support for the Analog Devices EVAL-ADAV801 or
37 EVAL-ADAV803 board connected to one of the Blackfin evaluation boards
38 like the BF5XX-STAMP or BF5XX-EZKIT.
39
40 Note: This driver assumes that the ADAV80X digital record and playback
41 interfaces are connected to the first SPORT port on the BF5XX board.
42
20config SND_BF5XX_SOC_AD73311 43config SND_BF5XX_SOC_AD73311
21 tristate "SoC AD73311 Audio support for Blackfin" 44 tristate "SoC AD73311 Audio support for Blackfin"
22 depends on SND_BF5XX_I2S 45 depends on SND_BF5XX_I2S
diff --git a/sound/soc/blackfin/Makefile b/sound/soc/blackfin/Makefile
index 49af3f32aec8..6018bf52a234 100644
--- a/sound/soc/blackfin/Makefile
+++ b/sound/soc/blackfin/Makefile
@@ -21,9 +21,13 @@ snd-ad1980-objs := bf5xx-ad1980.o
21snd-ssm2602-objs := bf5xx-ssm2602.o 21snd-ssm2602-objs := bf5xx-ssm2602.o
22snd-ad73311-objs := bf5xx-ad73311.o 22snd-ad73311-objs := bf5xx-ad73311.o
23snd-ad193x-objs := bf5xx-ad193x.o 23snd-ad193x-objs := bf5xx-ad193x.o
24snd-soc-bfin-eval-adau1701-objs := bfin-eval-adau1701.o
25snd-soc-bfin-eval-adav80x-objs := bfin-eval-adav80x.o
24 26
25obj-$(CONFIG_SND_BF5XX_SOC_AD1836) += snd-ad1836.o 27obj-$(CONFIG_SND_BF5XX_SOC_AD1836) += snd-ad1836.o
26obj-$(CONFIG_SND_BF5XX_SOC_AD1980) += snd-ad1980.o 28obj-$(CONFIG_SND_BF5XX_SOC_AD1980) += snd-ad1980.o
27obj-$(CONFIG_SND_BF5XX_SOC_SSM2602) += snd-ssm2602.o 29obj-$(CONFIG_SND_BF5XX_SOC_SSM2602) += snd-ssm2602.o
28obj-$(CONFIG_SND_BF5XX_SOC_AD73311) += snd-ad73311.o 30obj-$(CONFIG_SND_BF5XX_SOC_AD73311) += snd-ad73311.o
29obj-$(CONFIG_SND_BF5XX_SOC_AD193X) += snd-ad193x.o 31obj-$(CONFIG_SND_BF5XX_SOC_AD193X) += snd-ad193x.o
32obj-$(CONFIG_SND_SOC_BFIN_EVAL_ADAU1701) += snd-soc-bfin-eval-adau1701.o
33obj-$(CONFIG_SND_SOC_BFIN_EVAL_ADAV80X) += snd-soc-bfin-eval-adav80x.o
diff --git a/sound/soc/blackfin/bf5xx-ac97-pcm.c b/sound/soc/blackfin/bf5xx-ac97-pcm.c
index 98b44b316e78..9e59f680bc19 100644
--- a/sound/soc/blackfin/bf5xx-ac97-pcm.c
+++ b/sound/soc/blackfin/bf5xx-ac97-pcm.c
@@ -418,9 +418,11 @@ static void bf5xx_pcm_free_dma_buffers(struct snd_pcm *pcm)
418 418
419static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32); 419static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32);
420 420
421int bf5xx_pcm_ac97_new(struct snd_card *card, struct snd_soc_dai *dai, 421int bf5xx_pcm_ac97_new(struct snd_soc_pcm_runtime *rtd)
422 struct snd_pcm *pcm)
423{ 422{
423 struct snd_card *card = rtd->card->snd_card;
424 struct snd_soc_dai *dai = rtd->cpu_dai;
425 struct snd_pcm *pcm = rtd->pcm;
424 int ret = 0; 426 int ret = 0;
425 427
426 pr_debug("%s enter\n", __func__); 428 pr_debug("%s enter\n", __func__);
diff --git a/sound/soc/blackfin/bf5xx-i2s-pcm.c b/sound/soc/blackfin/bf5xx-i2s-pcm.c
index f1fd95bb6416..61ddf942fd4d 100644
--- a/sound/soc/blackfin/bf5xx-i2s-pcm.c
+++ b/sound/soc/blackfin/bf5xx-i2s-pcm.c
@@ -168,7 +168,7 @@ static int bf5xx_pcm_open(struct snd_pcm_substream *substream)
168 168
169 snd_soc_set_runtime_hwparams(substream, &bf5xx_pcm_hardware); 169 snd_soc_set_runtime_hwparams(substream, &bf5xx_pcm_hardware);
170 170
171 ret = snd_pcm_hw_constraint_integer(runtime, \ 171 ret = snd_pcm_hw_constraint_integer(runtime,
172 SNDRV_PCM_HW_PARAM_PERIODS); 172 SNDRV_PCM_HW_PARAM_PERIODS);
173 if (ret < 0) 173 if (ret < 0)
174 goto out; 174 goto out;
@@ -257,9 +257,11 @@ static void bf5xx_pcm_free_dma_buffers(struct snd_pcm *pcm)
257 257
258static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32); 258static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32);
259 259
260int bf5xx_pcm_i2s_new(struct snd_card *card, struct snd_soc_dai *dai, 260int bf5xx_pcm_i2s_new(struct snd_soc_pcm_runtime *rtd)
261 struct snd_pcm *pcm)
262{ 261{
262 struct snd_card *card = rtd->card->snd_card;
263 struct snd_soc_dai *dai = rtd->cpu_dai;
264 struct snd_pcm *pcm = rtd->pcm;
263 int ret = 0; 265 int ret = 0;
264 266
265 pr_debug("%s enter\n", __func__); 267 pr_debug("%s enter\n", __func__);
@@ -304,8 +306,8 @@ static int __devexit bfin_i2s_soc_platform_remove(struct platform_device *pdev)
304 306
305static struct platform_driver bfin_i2s_pcm_driver = { 307static struct platform_driver bfin_i2s_pcm_driver = {
306 .driver = { 308 .driver = {
307 .name = "bfin-i2s-pcm-audio", 309 .name = "bfin-i2s-pcm-audio",
308 .owner = THIS_MODULE, 310 .owner = THIS_MODULE,
309 }, 311 },
310 312
311 .probe = bfin_i2s_soc_platform_probe, 313 .probe = bfin_i2s_soc_platform_probe,
diff --git a/sound/soc/blackfin/bf5xx-tdm-pcm.c b/sound/soc/blackfin/bf5xx-tdm-pcm.c
index 07cfc7a9e49a..c95cc03d583d 100644
--- a/sound/soc/blackfin/bf5xx-tdm-pcm.c
+++ b/sound/soc/blackfin/bf5xx-tdm-pcm.c
@@ -283,9 +283,11 @@ static void bf5xx_pcm_free_dma_buffers(struct snd_pcm *pcm)
283 283
284static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32); 284static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32);
285 285
286static int bf5xx_pcm_tdm_new(struct snd_card *card, struct snd_soc_dai *dai, 286static int bf5xx_pcm_tdm_new(struct snd_soc_pcm_runtime *rtd)
287 struct snd_pcm *pcm)
288{ 287{
288 struct snd_card *card = rtd->card->snd_card;
289 struct snd_soc_dai *dai = rtd->cpu_dai;
290 struct snd_pcm *pcm = rtd->pcm;
289 int ret = 0; 291 int ret = 0;
290 292
291 if (!card->dev->dma_mask) 293 if (!card->dev->dma_mask)
diff --git a/sound/soc/blackfin/bfin-eval-adau1701.c b/sound/soc/blackfin/bfin-eval-adau1701.c
new file mode 100644
index 000000000000..e5550acba2c2
--- /dev/null
+++ b/sound/soc/blackfin/bfin-eval-adau1701.c
@@ -0,0 +1,139 @@
1/*
2 * Machine driver for EVAL-ADAU1701MINIZ on Analog Devices bfin
3 * evaluation boards.
4 *
5 * Copyright 2011 Analog Devices Inc.
6 * Author: Lars-Peter Clausen <lars@metafoo.de>
7 *
8 * Licensed under the GPL-2 or later.
9 */
10
11#include <linux/module.h>
12#include <linux/device.h>
13#include <sound/core.h>
14#include <sound/pcm.h>
15#include <sound/soc.h>
16#include <sound/pcm_params.h>
17
18#include "../codecs/adau1701.h"
19
20static const struct snd_soc_dapm_widget bfin_eval_adau1701_dapm_widgets[] = {
21 SND_SOC_DAPM_SPK("Speaker", NULL),
22 SND_SOC_DAPM_LINE("Line Out", NULL),
23 SND_SOC_DAPM_LINE("Line In", NULL),
24};
25
26static const struct snd_soc_dapm_route bfin_eval_adau1701_dapm_routes[] = {
27 { "Speaker", NULL, "OUT0" },
28 { "Speaker", NULL, "OUT1" },
29 { "Line Out", NULL, "OUT2" },
30 { "Line Out", NULL, "OUT3" },
31
32 { "IN0", NULL, "Line In" },
33 { "IN1", NULL, "Line In" },
34};
35
36static int bfin_eval_adau1701_hw_params(struct snd_pcm_substream *substream,
37 struct snd_pcm_hw_params *params)
38{
39 struct snd_soc_pcm_runtime *rtd = substream->private_data;
40 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
41 struct snd_soc_dai *codec_dai = rtd->codec_dai;
42 int ret;
43
44 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
45 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
46 if (ret)
47 return ret;
48
49 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
50 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
51 if (ret)
52 return ret;
53
54 ret = snd_soc_dai_set_sysclk(codec_dai, ADAU1701_CLK_SRC_OSC, 12288000,
55 SND_SOC_CLOCK_IN);
56
57 return ret;
58}
59
60static struct snd_soc_ops bfin_eval_adau1701_ops = {
61 .hw_params = bfin_eval_adau1701_hw_params,
62};
63
64static struct snd_soc_dai_link bfin_eval_adau1701_dai[] = {
65 {
66 .name = "adau1701",
67 .stream_name = "adau1701",
68 .cpu_dai_name = "bfin-i2s.0",
69 .codec_dai_name = "adau1701",
70 .platform_name = "bfin-i2s-pcm-audio",
71 .codec_name = "adau1701.0-0034",
72 .ops = &bfin_eval_adau1701_ops,
73 },
74 {
75 .name = "adau1701",
76 .stream_name = "adau1701",
77 .cpu_dai_name = "bfin-i2s.1",
78 .codec_dai_name = "adau1701",
79 .platform_name = "bfin-i2s-pcm-audio",
80 .codec_name = "adau1701.0-0034",
81 .ops = &bfin_eval_adau1701_ops,
82 },
83};
84
85static struct snd_soc_card bfin_eval_adau1701 = {
86 .name = "bfin-eval-adau1701",
87 .dai_link = &bfin_eval_adau1701_dai[CONFIG_SND_BF5XX_SPORT_NUM],
88 .num_links = 1,
89
90 .dapm_widgets = bfin_eval_adau1701_dapm_widgets,
91 .num_dapm_widgets = ARRAY_SIZE(bfin_eval_adau1701_dapm_widgets),
92 .dapm_routes = bfin_eval_adau1701_dapm_routes,
93 .num_dapm_routes = ARRAY_SIZE(bfin_eval_adau1701_dapm_routes),
94};
95
96static int bfin_eval_adau1701_probe(struct platform_device *pdev)
97{
98 struct snd_soc_card *card = &bfin_eval_adau1701;
99
100 card->dev = &pdev->dev;
101
102 return snd_soc_register_card(&bfin_eval_adau1701);
103}
104
105static int __devexit bfin_eval_adau1701_remove(struct platform_device *pdev)
106{
107 struct snd_soc_card *card = platform_get_drvdata(pdev);
108
109 snd_soc_unregister_card(card);
110
111 return 0;
112}
113
114static struct platform_driver bfin_eval_adau1701_driver = {
115 .driver = {
116 .name = "bfin-eval-adau1701",
117 .owner = THIS_MODULE,
118 .pm = &snd_soc_pm_ops,
119 },
120 .probe = bfin_eval_adau1701_probe,
121 .remove = __devexit_p(bfin_eval_adau1701_remove),
122};
123
124static int __init bfin_eval_adau1701_init(void)
125{
126 return platform_driver_register(&bfin_eval_adau1701_driver);
127}
128module_init(bfin_eval_adau1701_init);
129
130static void __exit bfin_eval_adau1701_exit(void)
131{
132 platform_driver_unregister(&bfin_eval_adau1701_driver);
133}
134module_exit(bfin_eval_adau1701_exit);
135
136MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
137MODULE_DESCRIPTION("ALSA SoC bfin ADAU1701 driver");
138MODULE_LICENSE("GPL");
139MODULE_ALIAS("platform:bfin-eval-adau1701");
diff --git a/sound/soc/blackfin/bfin-eval-adav80x.c b/sound/soc/blackfin/bfin-eval-adav80x.c
new file mode 100644
index 000000000000..8d014d01626e
--- /dev/null
+++ b/sound/soc/blackfin/bfin-eval-adav80x.c
@@ -0,0 +1,173 @@
1/*
2 * Machine driver for EVAL-ADAV801 and EVAL-ADAV803 on Analog Devices bfin
3 * evaluation boards.
4 *
5 * Copyright 2011 Analog Devices Inc.
6 * Author: Lars-Peter Clausen <lars@metafoo.de>
7 *
8 * Licensed under the GPL-2 or later.
9 */
10
11#include <linux/init.h>
12#include <linux/platform_device.h>
13#include <sound/core.h>
14#include <sound/pcm.h>
15#include <sound/soc.h>
16
17#include "../codecs/adav80x.h"
18
19static const struct snd_soc_dapm_widget bfin_eval_adav80x_dapm_widgets[] = {
20 SND_SOC_DAPM_LINE("Line Out", NULL),
21 SND_SOC_DAPM_LINE("Line In", NULL),
22};
23
24static const struct snd_soc_dapm_route bfin_eval_adav80x_dapm_routes[] = {
25 { "Line Out", NULL, "VOUTL" },
26 { "Line Out", NULL, "VOUTR" },
27
28 { "VINL", NULL, "Line In" },
29 { "VINR", NULL, "Line In" },
30};
31
32static int bfin_eval_adav80x_hw_params(struct snd_pcm_substream *substream,
33 struct snd_pcm_hw_params *params)
34{
35 struct snd_soc_pcm_runtime *rtd = substream->private_data;
36 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
37 struct snd_soc_dai *codec_dai = rtd->codec_dai;
38 int ret;
39
40 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
41 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
42 if (ret)
43 return ret;
44
45 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
46 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
47 if (ret)
48 return ret;
49
50 ret = snd_soc_dai_set_pll(codec_dai, ADAV80X_PLL1, ADAV80X_PLL_SRC_XTAL,
51 27000000, params_rate(params) * 256);
52 if (ret)
53 return ret;
54
55 ret = snd_soc_dai_set_sysclk(codec_dai, ADAV80X_CLK_PLL1,
56 params_rate(params) * 256, SND_SOC_CLOCK_IN);
57
58 return ret;
59}
60
61static int bfin_eval_adav80x_codec_init(struct snd_soc_pcm_runtime *rtd)
62{
63 struct snd_soc_dai *codec_dai = rtd->codec_dai;
64
65 snd_soc_dai_set_sysclk(codec_dai, ADAV80X_CLK_SYSCLK1, 0,
66 SND_SOC_CLOCK_OUT);
67 snd_soc_dai_set_sysclk(codec_dai, ADAV80X_CLK_SYSCLK2, 0,
68 SND_SOC_CLOCK_OUT);
69 snd_soc_dai_set_sysclk(codec_dai, ADAV80X_CLK_SYSCLK3, 0,
70 SND_SOC_CLOCK_OUT);
71
72 snd_soc_dai_set_sysclk(codec_dai, ADAV80X_CLK_XTAL, 2700000, 0);
73
74 return 0;
75}
76
77static struct snd_soc_ops bfin_eval_adav80x_ops = {
78 .hw_params = bfin_eval_adav80x_hw_params,
79};
80
81static struct snd_soc_dai_link bfin_eval_adav80x_dais[] = {
82 {
83 .name = "adav80x",
84 .stream_name = "ADAV80x HiFi",
85 .cpu_dai_name = "bfin-i2s.0",
86 .codec_dai_name = "adav80x-hifi",
87 .platform_name = "bfin-i2s-pcm-audio",
88 .init = bfin_eval_adav80x_codec_init,
89 .ops = &bfin_eval_adav80x_ops,
90 },
91};
92
93static struct snd_soc_card bfin_eval_adav80x = {
94 .name = "bfin-eval-adav80x",
95 .dai_link = bfin_eval_adav80x_dais,
96 .num_links = ARRAY_SIZE(bfin_eval_adav80x_dais),
97
98 .dapm_widgets = bfin_eval_adav80x_dapm_widgets,
99 .num_dapm_widgets = ARRAY_SIZE(bfin_eval_adav80x_dapm_widgets),
100 .dapm_routes = bfin_eval_adav80x_dapm_routes,
101 .num_dapm_routes = ARRAY_SIZE(bfin_eval_adav80x_dapm_routes),
102};
103
104enum bfin_eval_adav80x_type {
105 BFIN_EVAL_ADAV801,
106 BFIN_EVAL_ADAV803,
107};
108
109static int bfin_eval_adav80x_probe(struct platform_device *pdev)
110{
111 struct snd_soc_card *card = &bfin_eval_adav80x;
112 const char *codec_name;
113
114 switch (platform_get_device_id(pdev)->driver_data) {
115 case BFIN_EVAL_ADAV801:
116 codec_name = "spi0.1";
117 break;
118 case BFIN_EVAL_ADAV803:
119 codec_name = "adav803.0-0034";
120 break;
121 default:
122 return -EINVAL;
123 }
124
125 bfin_eval_adav80x_dais[0].codec_name = codec_name;
126
127 card->dev = &pdev->dev;
128
129 return snd_soc_register_card(&bfin_eval_adav80x);
130}
131
132static int __devexit bfin_eval_adav80x_remove(struct platform_device *pdev)
133{
134 struct snd_soc_card *card = platform_get_drvdata(pdev);
135
136 snd_soc_unregister_card(card);
137
138 return 0;
139}
140
141static const struct platform_device_id bfin_eval_adav80x_ids[] = {
142 { "bfin-eval-adav801", BFIN_EVAL_ADAV801 },
143 { "bfin-eval-adav803", BFIN_EVAL_ADAV803 },
144 { },
145};
146MODULE_DEVICE_TABLE(platform, bfin_eval_adav80x_ids);
147
148static struct platform_driver bfin_eval_adav80x_driver = {
149 .driver = {
150 .name = "bfin-eval-adav80x",
151 .owner = THIS_MODULE,
152 .pm = &snd_soc_pm_ops,
153 },
154 .probe = bfin_eval_adav80x_probe,
155 .remove = __devexit_p(bfin_eval_adav80x_remove),
156 .id_table = bfin_eval_adav80x_ids,
157};
158
159static int __init bfin_eval_adav80x_init(void)
160{
161 return platform_driver_register(&bfin_eval_adav80x_driver);
162}
163module_init(bfin_eval_adav80x_init);
164
165static void __exit bfin_eval_adav80x_exit(void)
166{
167 platform_driver_unregister(&bfin_eval_adav80x_driver);
168}
169module_exit(bfin_eval_adav80x_exit);
170
171MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
172MODULE_DESCRIPTION("ALSA SoC bfin adav80x driver");
173MODULE_LICENSE("GPL");