diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2011-06-13 09:26:21 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-06-16 06:24:25 -0400 |
commit | 53a93d58fbcfca5c40ff58f8ced421293bfcbc2a (patch) | |
tree | 9abc189f389f1da15e2a2a8f6627e9acf83adb22 | |
parent | 631ed8a2134dae17d9e17f3c35c7290720f85199 (diff) |
ASoC: Blackfin: Add bf5xx-adau1701 machine driver
Add a machine driver to support the ADAU1701 SigmaDSP processors on
Analog Devices BF5XX evaluation boards.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r-- | sound/soc/blackfin/Kconfig | 11 | ||||
-rw-r--r-- | sound/soc/blackfin/Makefile | 2 | ||||
-rw-r--r-- | sound/soc/blackfin/bfin-eval-adau1701.c | 139 |
3 files changed, 152 insertions, 0 deletions
diff --git a/sound/soc/blackfin/Kconfig b/sound/soc/blackfin/Kconfig index ae403597fd31..30706235ba04 100644 --- a/sound/soc/blackfin/Kconfig +++ b/sound/soc/blackfin/Kconfig | |||
@@ -17,6 +17,17 @@ config SND_BF5XX_SOC_SSM2602 | |||
17 | help | 17 | help |
18 | Say Y if you want to add support for SoC audio on BF527-EZKIT. | 18 | Say Y if you want to add support for SoC audio on BF527-EZKIT. |
19 | 19 | ||
20 | config SND_SOC_BFIN_EVAL_ADAU1701 | ||
21 | tristate "Support for the EVAL-ADAU1701MINIZ board on Blackfin eval boards" | ||
22 | depends on SND_BF5XX_I2S | ||
23 | select SND_BF5XX_SOC_I2S | ||
24 | select SND_SOC_ADAU1701 | ||
25 | select I2C | ||
26 | help | ||
27 | Say Y if you want to add support for the Analog Devices EVAL-ADAU1701MINIZ | ||
28 | board connected to one of the Blackfin evaluation boards like the | ||
29 | BF5XX-STAMP or BF5XX-EZKIT. | ||
30 | |||
20 | config SND_BF5XX_SOC_AD73311 | 31 | config SND_BF5XX_SOC_AD73311 |
21 | tristate "SoC AD73311 Audio support for Blackfin" | 32 | tristate "SoC AD73311 Audio support for Blackfin" |
22 | depends on SND_BF5XX_I2S | 33 | depends on SND_BF5XX_I2S |
diff --git a/sound/soc/blackfin/Makefile b/sound/soc/blackfin/Makefile index 49af3f32aec8..f01bff63177d 100644 --- a/sound/soc/blackfin/Makefile +++ b/sound/soc/blackfin/Makefile | |||
@@ -21,9 +21,11 @@ snd-ad1980-objs := bf5xx-ad1980.o | |||
21 | snd-ssm2602-objs := bf5xx-ssm2602.o | 21 | snd-ssm2602-objs := bf5xx-ssm2602.o |
22 | snd-ad73311-objs := bf5xx-ad73311.o | 22 | snd-ad73311-objs := bf5xx-ad73311.o |
23 | snd-ad193x-objs := bf5xx-ad193x.o | 23 | snd-ad193x-objs := bf5xx-ad193x.o |
24 | snd-soc-bfin-eval-adau1701-objs := bfin-eval-adau1701.o | ||
24 | 25 | ||
25 | obj-$(CONFIG_SND_BF5XX_SOC_AD1836) += snd-ad1836.o | 26 | obj-$(CONFIG_SND_BF5XX_SOC_AD1836) += snd-ad1836.o |
26 | obj-$(CONFIG_SND_BF5XX_SOC_AD1980) += snd-ad1980.o | 27 | obj-$(CONFIG_SND_BF5XX_SOC_AD1980) += snd-ad1980.o |
27 | obj-$(CONFIG_SND_BF5XX_SOC_SSM2602) += snd-ssm2602.o | 28 | obj-$(CONFIG_SND_BF5XX_SOC_SSM2602) += snd-ssm2602.o |
28 | obj-$(CONFIG_SND_BF5XX_SOC_AD73311) += snd-ad73311.o | 29 | obj-$(CONFIG_SND_BF5XX_SOC_AD73311) += snd-ad73311.o |
29 | obj-$(CONFIG_SND_BF5XX_SOC_AD193X) += snd-ad193x.o | 30 | obj-$(CONFIG_SND_BF5XX_SOC_AD193X) += snd-ad193x.o |
31 | obj-$(CONFIG_SND_SOC_BFIN_EVAL_ADAU1701) += snd-soc-bfin-eval-adau1701.o | ||
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 | |||
20 | static 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 | |||
26 | static 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 | |||
36 | static 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 | |||
60 | static struct snd_soc_ops bfin_eval_adau1701_ops = { | ||
61 | .hw_params = bfin_eval_adau1701_hw_params, | ||
62 | }; | ||
63 | |||
64 | static 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 | |||
85 | static 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 | |||
96 | static 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 | |||
105 | static 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 | |||
114 | static 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 | |||
124 | static int __init bfin_eval_adau1701_init(void) | ||
125 | { | ||
126 | return platform_driver_register(&bfin_eval_adau1701_driver); | ||
127 | } | ||
128 | module_init(bfin_eval_adau1701_init); | ||
129 | |||
130 | static void __exit bfin_eval_adau1701_exit(void) | ||
131 | { | ||
132 | platform_driver_unregister(&bfin_eval_adau1701_driver); | ||
133 | } | ||
134 | module_exit(bfin_eval_adau1701_exit); | ||
135 | |||
136 | MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); | ||
137 | MODULE_DESCRIPTION("ALSA SoC bfin ADAU1701 driver"); | ||
138 | MODULE_LICENSE("GPL"); | ||
139 | MODULE_ALIAS("platform:bfin-eval-adau1701"); | ||