diff options
author | Jassi Brar <jassi.brar@samsung.com> | 2010-12-19 21:05:57 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-12-20 08:46:27 -0500 |
commit | 96657d33b9ba4e7bd3728ee319ed96ed3f09c40b (patch) | |
tree | 756311f61cae76b279b8145b02e483a686c0ec5c /sound | |
parent | 4d81acff4099ae5eccd113f10e8038b65b1fc638 (diff) |
ASoC: SMDKV310: Add I2S support
Add ASoC machine driver for SMDKV310/C210 boards that have
a WM8994 attached to I2S-0.
Signed-off-by: Jassi Brar <jassi.brar@samsung.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/samsung/Kconfig | 8 | ||||
-rw-r--r-- | sound/soc/samsung/Makefile | 2 | ||||
-rw-r--r-- | sound/soc/samsung/smdk_wm8994.c | 176 |
3 files changed, 186 insertions, 0 deletions
diff --git a/sound/soc/samsung/Kconfig b/sound/soc/samsung/Kconfig index 9cedf345933c..11ff4adf9901 100644 --- a/sound/soc/samsung/Kconfig +++ b/sound/soc/samsung/Kconfig | |||
@@ -68,6 +68,14 @@ config ASOC_SAMSUNG_SMDK_WM8580 | |||
68 | help | 68 | help |
69 | Say Y if you want to add support for SoC audio on the SMDKs. | 69 | Say Y if you want to add support for SoC audio on the SMDKs. |
70 | 70 | ||
71 | config ASOC_SAMSUNG_SMDK_WM8994 | ||
72 | tristate "SoC I2S Audio support for WM8994 on SMDK" | ||
73 | depends on ASOC_SAMSUNG && (MACH_SMDKV310 || MACH_SMDKC210) | ||
74 | select SND_SOC_WM8994 | ||
75 | select SND_SAMSUNG_I2S | ||
76 | help | ||
77 | Say Y if you want to add support for SoC audio on the SMDKs. | ||
78 | |||
71 | config ASOC_SAMSUNG_SMDK2443_WM9710 | 79 | config ASOC_SAMSUNG_SMDK2443_WM9710 |
72 | tristate "SoC AC97 Audio support for SMDK2443 - WM9710" | 80 | tristate "SoC AC97 Audio support for SMDK2443 - WM9710" |
73 | depends on ASOC_SAMSUNG && MACH_SMDK2443 | 81 | depends on ASOC_SAMSUNG && MACH_SMDK2443 |
diff --git a/sound/soc/samsung/Makefile b/sound/soc/samsung/Makefile index 622e76eb9775..fe694cc5c3a3 100644 --- a/sound/soc/samsung/Makefile +++ b/sound/soc/samsung/Makefile | |||
@@ -30,6 +30,7 @@ snd-soc-s3c24xx-simtec-tlv320aic23-objs := s3c24xx_simtec_tlv320aic23.o | |||
30 | snd-soc-h1940-uda1380-objs := h1940_uda1380.o | 30 | snd-soc-h1940-uda1380-objs := h1940_uda1380.o |
31 | snd-soc-rx1950-uda1380-objs := rx1950_uda1380.o | 31 | snd-soc-rx1950-uda1380-objs := rx1950_uda1380.o |
32 | snd-soc-smdk-wm8580-objs := smdk_wm8580.o | 32 | snd-soc-smdk-wm8580-objs := smdk_wm8580.o |
33 | snd-soc-smdk-wm8994-objs := smdk_wm8994.o | ||
33 | snd-soc-smdk-wm9713-objs := smdk_wm9713.o | 34 | snd-soc-smdk-wm9713-objs := smdk_wm9713.o |
34 | snd-soc-s3c64xx-smartq-wm8987-objs := smartq_wm8987.o | 35 | snd-soc-s3c64xx-smartq-wm8987-objs := smartq_wm8987.o |
35 | snd-soc-goni-wm8994-objs := goni_wm8994.o | 36 | snd-soc-goni-wm8994-objs := goni_wm8994.o |
@@ -47,6 +48,7 @@ obj-$(CONFIG_ASOC_SAMSUNG_SIMTEC_TLV320AIC23) += snd-soc-s3c24xx-simtec-tlv320ai | |||
47 | obj-$(CONFIG_ASOC_SAMSUNG_H1940_UDA1380) += snd-soc-h1940-uda1380.o | 48 | obj-$(CONFIG_ASOC_SAMSUNG_H1940_UDA1380) += snd-soc-h1940-uda1380.o |
48 | obj-$(CONFIG_ASOC_SAMSUNG_RX1950_UDA1380) += snd-soc-rx1950-uda1380.o | 49 | obj-$(CONFIG_ASOC_SAMSUNG_RX1950_UDA1380) += snd-soc-rx1950-uda1380.o |
49 | obj-$(CONFIG_ASOC_SAMSUNG_SMDK_WM8580) += snd-soc-smdk-wm8580.o | 50 | obj-$(CONFIG_ASOC_SAMSUNG_SMDK_WM8580) += snd-soc-smdk-wm8580.o |
51 | obj-$(CONFIG_ASOC_SAMSUNG_SMDK_WM8994) += snd-soc-smdk-wm8994.o | ||
50 | obj-$(CONFIG_ASOC_SAMSUNG_SMDK_WM9713) += snd-soc-smdk-wm9713.o | 52 | obj-$(CONFIG_ASOC_SAMSUNG_SMDK_WM9713) += snd-soc-smdk-wm9713.o |
51 | obj-$(CONFIG_ASOC_SMARTQ) += snd-soc-s3c64xx-smartq-wm8987.o | 53 | obj-$(CONFIG_ASOC_SMARTQ) += snd-soc-s3c64xx-smartq-wm8987.o |
52 | obj-$(CONFIG_ASOC_SAMSUNG_SMDK_SPDIF) += snd-soc-smdk-spdif.o | 54 | obj-$(CONFIG_ASOC_SAMSUNG_SMDK_SPDIF) += snd-soc-smdk-spdif.o |
diff --git a/sound/soc/samsung/smdk_wm8994.c b/sound/soc/samsung/smdk_wm8994.c new file mode 100644 index 000000000000..e7c1009a1e1d --- /dev/null +++ b/sound/soc/samsung/smdk_wm8994.c | |||
@@ -0,0 +1,176 @@ | |||
1 | /* | ||
2 | * smdk_wm8994.c | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms of the GNU General Public License as published by the | ||
6 | * Free Software Foundation; either version 2 of the License, or (at your | ||
7 | * option) any later version. | ||
8 | */ | ||
9 | |||
10 | #include "../codecs/wm8994.h" | ||
11 | |||
12 | /* | ||
13 | * Default CFG switch settings to use this driver: | ||
14 | * SMDKV310: CFG5-1000, CFG7-111111 | ||
15 | */ | ||
16 | |||
17 | /* | ||
18 | * Configure audio route as :- | ||
19 | * $ amixer sset 'DAC1' on,on | ||
20 | * $ amixer sset 'Right Headphone Mux' 'DAC' | ||
21 | * $ amixer sset 'Left Headphone Mux' 'DAC' | ||
22 | * $ amixer sset 'DAC1R Mixer AIF1.1' on | ||
23 | * $ amixer sset 'DAC1L Mixer AIF1.1' on | ||
24 | * $ amixer sset 'IN2L' on | ||
25 | * $ amixer sset 'IN2L PGA IN2LN' on | ||
26 | * $ amixer sset 'MIXINL IN2L' on | ||
27 | * $ amixer sset 'AIF1ADC1L Mixer ADC/DMIC' on | ||
28 | * $ amixer sset 'IN2R' on | ||
29 | * $ amixer sset 'IN2R PGA IN2RN' on | ||
30 | * $ amixer sset 'MIXINR IN2R' on | ||
31 | * $ amixer sset 'AIF1ADC1R Mixer ADC/DMIC' on | ||
32 | */ | ||
33 | |||
34 | /* SMDK has a 16.934MHZ crystal attached to WM8994 */ | ||
35 | #define SMDK_WM8994_FREQ 16934000 | ||
36 | |||
37 | static int smdk_hw_params(struct snd_pcm_substream *substream, | ||
38 | struct snd_pcm_hw_params *params) | ||
39 | { | ||
40 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
41 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; | ||
42 | struct snd_soc_dai *codec_dai = rtd->codec_dai; | ||
43 | unsigned int pll_out; | ||
44 | int ret; | ||
45 | |||
46 | /* AIF1CLK should be >=3MHz for optimal performance */ | ||
47 | if (params_rate(params) == 8000 || params_rate(params) == 11025) | ||
48 | pll_out = params_rate(params) * 512; | ||
49 | else | ||
50 | pll_out = params_rate(params) * 256; | ||
51 | |||
52 | ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | ||
53 | | SND_SOC_DAIFMT_NB_NF | ||
54 | | SND_SOC_DAIFMT_CBM_CFM); | ||
55 | if (ret < 0) | ||
56 | return ret; | ||
57 | |||
58 | ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | ||
59 | | SND_SOC_DAIFMT_NB_NF | ||
60 | | SND_SOC_DAIFMT_CBM_CFM); | ||
61 | if (ret < 0) | ||
62 | return ret; | ||
63 | |||
64 | ret = snd_soc_dai_set_pll(codec_dai, WM8994_FLL1, WM8994_FLL_SRC_MCLK1, | ||
65 | SMDK_WM8994_FREQ, pll_out); | ||
66 | if (ret < 0) | ||
67 | return ret; | ||
68 | |||
69 | ret = snd_soc_dai_set_sysclk(codec_dai, WM8994_SYSCLK_FLL1, | ||
70 | pll_out, SND_SOC_CLOCK_IN); | ||
71 | if (ret < 0) | ||
72 | return ret; | ||
73 | |||
74 | return 0; | ||
75 | } | ||
76 | |||
77 | /* | ||
78 | * SMDK WM8994 DAI operations. | ||
79 | */ | ||
80 | static struct snd_soc_ops smdk_ops = { | ||
81 | .hw_params = smdk_hw_params, | ||
82 | }; | ||
83 | |||
84 | static int smdk_wm8994_init_paiftx(struct snd_soc_pcm_runtime *rtd) | ||
85 | { | ||
86 | struct snd_soc_codec *codec = rtd->codec; | ||
87 | struct snd_soc_dapm_context *dapm = &codec->dapm; | ||
88 | |||
89 | /* HeadPhone */ | ||
90 | snd_soc_dapm_enable_pin(dapm, "HPOUT1R"); | ||
91 | snd_soc_dapm_enable_pin(dapm, "HPOUT1L"); | ||
92 | |||
93 | /* MicIn */ | ||
94 | snd_soc_dapm_enable_pin(dapm, "IN1LN"); | ||
95 | snd_soc_dapm_enable_pin(dapm, "IN1RN"); | ||
96 | |||
97 | /* LineIn */ | ||
98 | snd_soc_dapm_enable_pin(dapm, "IN2LN"); | ||
99 | snd_soc_dapm_enable_pin(dapm, "IN2RN"); | ||
100 | |||
101 | /* Other pins NC */ | ||
102 | snd_soc_dapm_nc_pin(dapm, "HPOUT2P"); | ||
103 | snd_soc_dapm_nc_pin(dapm, "HPOUT2N"); | ||
104 | snd_soc_dapm_nc_pin(dapm, "SPKOUTLN"); | ||
105 | snd_soc_dapm_nc_pin(dapm, "SPKOUTLP"); | ||
106 | snd_soc_dapm_nc_pin(dapm, "SPKOUTRP"); | ||
107 | snd_soc_dapm_nc_pin(dapm, "SPKOUTRN"); | ||
108 | snd_soc_dapm_nc_pin(dapm, "LINEOUT1N"); | ||
109 | snd_soc_dapm_nc_pin(dapm, "LINEOUT1P"); | ||
110 | snd_soc_dapm_nc_pin(dapm, "LINEOUT2N"); | ||
111 | snd_soc_dapm_nc_pin(dapm, "LINEOUT2P"); | ||
112 | snd_soc_dapm_nc_pin(dapm, "IN1LP"); | ||
113 | snd_soc_dapm_nc_pin(dapm, "IN2LP:VXRN"); | ||
114 | snd_soc_dapm_nc_pin(dapm, "IN1RP"); | ||
115 | snd_soc_dapm_nc_pin(dapm, "IN2RP:VXRP"); | ||
116 | |||
117 | snd_soc_dapm_sync(dapm); | ||
118 | |||
119 | return 0; | ||
120 | } | ||
121 | |||
122 | static struct snd_soc_dai_link smdk_dai[] = { | ||
123 | { /* Primary DAI i/f */ | ||
124 | .name = "WM8994 AIF1", | ||
125 | .stream_name = "Pri_Dai", | ||
126 | .cpu_dai_name = "samsung-i2s.0", | ||
127 | .codec_dai_name = "wm8994-aif1", | ||
128 | .platform_name = "samsung-audio", | ||
129 | .codec_name = "wm8994-codec", | ||
130 | .init = smdk_wm8994_init_paiftx, | ||
131 | .ops = &smdk_ops, | ||
132 | }, { /* Sec_Fifo Playback i/f */ | ||
133 | .name = "Sec_FIFO TX", | ||
134 | .stream_name = "Sec_Dai", | ||
135 | .cpu_dai_name = "samsung-i2s.4", | ||
136 | .codec_dai_name = "wm8994-aif1", | ||
137 | .platform_name = "samsung-audio", | ||
138 | .codec_name = "wm8994-codec", | ||
139 | .ops = &smdk_ops, | ||
140 | }, | ||
141 | }; | ||
142 | |||
143 | static struct snd_soc_card smdk = { | ||
144 | .name = "SMDK-I2S", | ||
145 | .dai_link = smdk_dai, | ||
146 | .num_links = ARRAY_SIZE(smdk_dai), | ||
147 | }; | ||
148 | |||
149 | static struct platform_device *smdk_snd_device; | ||
150 | |||
151 | static int __init smdk_audio_init(void) | ||
152 | { | ||
153 | int ret; | ||
154 | |||
155 | smdk_snd_device = platform_device_alloc("soc-audio", -1); | ||
156 | if (!smdk_snd_device) | ||
157 | return -ENOMEM; | ||
158 | |||
159 | platform_set_drvdata(smdk_snd_device, &smdk); | ||
160 | |||
161 | ret = platform_device_add(smdk_snd_device); | ||
162 | if (ret) | ||
163 | platform_device_put(smdk_snd_device); | ||
164 | |||
165 | return ret; | ||
166 | } | ||
167 | module_init(smdk_audio_init); | ||
168 | |||
169 | static void __exit smdk_audio_exit(void) | ||
170 | { | ||
171 | platform_device_unregister(smdk_snd_device); | ||
172 | } | ||
173 | module_exit(smdk_audio_exit); | ||
174 | |||
175 | MODULE_DESCRIPTION("ALSA SoC SMDK WM8994"); | ||
176 | MODULE_LICENSE("GPL"); | ||