aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/soc/samsung/Kconfig8
-rw-r--r--sound/soc/samsung/Makefile2
-rw-r--r--sound/soc/samsung/smdk_wm8994pcm.c176
3 files changed, 186 insertions, 0 deletions
diff --git a/sound/soc/samsung/Kconfig b/sound/soc/samsung/Kconfig
index c611e45ff71d..54b0e4b7faf7 100644
--- a/sound/soc/samsung/Kconfig
+++ b/sound/soc/samsung/Kconfig
@@ -171,6 +171,14 @@ config SND_SOC_SMDK_WM8580_PCM
171 help 171 help
172 Say Y if you want to add support for SoC audio on the SMDK. 172 Say Y if you want to add support for SoC audio on the SMDK.
173 173
174config SND_SOC_SMDK_WM8994_PCM
175 tristate "SoC PCM Audio support for WM8994 on SMDK"
176 depends on SND_SOC_SAMSUNG && (MACH_SMDKC210 || MACH_SMDKV310)
177 select SND_SOC_WM8994
178 select SND_SAMSUNG_PCM
179 help
180 Say Y if you want to add support for SoC audio on the SMDK
181
174config SND_SOC_SPEYSIDE 182config SND_SOC_SPEYSIDE
175 tristate "Audio support for Wolfson Speyside" 183 tristate "Audio support for Wolfson Speyside"
176 depends on SND_SOC_SAMSUNG && MACH_WLF_CRAGG_6410 184 depends on SND_SOC_SAMSUNG && MACH_WLF_CRAGG_6410
diff --git a/sound/soc/samsung/Makefile b/sound/soc/samsung/Makefile
index e04df65db1fc..9eb3b12eb72f 100644
--- a/sound/soc/samsung/Makefile
+++ b/sound/soc/samsung/Makefile
@@ -35,6 +35,7 @@ snd-soc-s3c64xx-smartq-wm8987-objs := smartq_wm8987.o
35snd-soc-goni-wm8994-objs := goni_wm8994.o 35snd-soc-goni-wm8994-objs := goni_wm8994.o
36snd-soc-smdk-spdif-objs := smdk_spdif.o 36snd-soc-smdk-spdif-objs := smdk_spdif.o
37snd-soc-smdk-wm8580pcm-objs := smdk_wm8580pcm.o 37snd-soc-smdk-wm8580pcm-objs := smdk_wm8580pcm.o
38snd-soc-smdk-wm8994pcm-objs := smdk_wm8994pcm.o
38snd-soc-speyside-objs := speyside.o 39snd-soc-speyside-objs := speyside.o
39snd-soc-speyside-wm8962-objs := speyside_wm8962.o 40snd-soc-speyside-wm8962-objs := speyside_wm8962.o
40 41
@@ -55,5 +56,6 @@ obj-$(CONFIG_SND_SOC_SMARTQ) += snd-soc-s3c64xx-smartq-wm8987.o
55obj-$(CONFIG_SND_SOC_SAMSUNG_SMDK_SPDIF) += snd-soc-smdk-spdif.o 56obj-$(CONFIG_SND_SOC_SAMSUNG_SMDK_SPDIF) += snd-soc-smdk-spdif.o
56obj-$(CONFIG_SND_SOC_GONI_AQUILA_WM8994) += snd-soc-goni-wm8994.o 57obj-$(CONFIG_SND_SOC_GONI_AQUILA_WM8994) += snd-soc-goni-wm8994.o
57obj-$(CONFIG_SND_SOC_SMDK_WM8580_PCM) += snd-soc-smdk-wm8580pcm.o 58obj-$(CONFIG_SND_SOC_SMDK_WM8580_PCM) += snd-soc-smdk-wm8580pcm.o
59obj-$(CONFIG_SND_SOC_SMDK_WM8994_PCM) += snd-soc-smdk-wm8994pcm.o
58obj-$(CONFIG_SND_SOC_SPEYSIDE) += snd-soc-speyside.o 60obj-$(CONFIG_SND_SOC_SPEYSIDE) += snd-soc-speyside.o
59obj-$(CONFIG_SND_SOC_SPEYSIDE_WM8962) += snd-soc-speyside-wm8962.o 61obj-$(CONFIG_SND_SOC_SPEYSIDE_WM8962) += snd-soc-speyside-wm8962.o
diff --git a/sound/soc/samsung/smdk_wm8994pcm.c b/sound/soc/samsung/smdk_wm8994pcm.c
new file mode 100644
index 000000000000..5f2111685480
--- /dev/null
+++ b/sound/soc/samsung/smdk_wm8994pcm.c
@@ -0,0 +1,176 @@
1/*
2 * sound/soc/samsung/smdk_wm8994pcm.c
3 *
4 * Copyright (c) 2011 Samsung Electronics Co., Ltd
5 * http://www.samsung.com
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12#include <sound/soc.h>
13#include <sound/pcm.h>
14#include <sound/pcm_params.h>
15
16#include "../codecs/wm8994.h"
17#include "dma.h"
18#include "pcm.h"
19
20/*
21 * Board Settings:
22 * o '1' means 'ON'
23 * o '0' means 'OFF'
24 * o 'X' means 'Don't care'
25 *
26 * SMDKC210, SMDKV310: CFG3- 1001, CFG5-1000, CFG7-111111
27 */
28
29/*
30 * Configure audio route as :-
31 * $ amixer sset 'DAC1' on,on
32 * $ amixer sset 'Right Headphone Mux' 'DAC'
33 * $ amixer sset 'Left Headphone Mux' 'DAC'
34 * $ amixer sset 'DAC1R Mixer AIF1.1' on
35 * $ amixer sset 'DAC1L Mixer AIF1.1' on
36 * $ amixer sset 'IN2L' on
37 * $ amixer sset 'IN2L PGA IN2LN' on
38 * $ amixer sset 'MIXINL IN2L' on
39 * $ amixer sset 'AIF1ADC1L Mixer ADC/DMIC' on
40 * $ amixer sset 'IN2R' on
41 * $ amixer sset 'IN2R PGA IN2RN' on
42 * $ amixer sset 'MIXINR IN2R' on
43 * $ amixer sset 'AIF1ADC1R Mixer ADC/DMIC' on
44 */
45
46/* SMDK has a 16.9344MHZ crystal attached to WM8994 */
47#define SMDK_WM8994_FREQ 16934400
48
49static int smdk_wm8994_pcm_hw_params(struct snd_pcm_substream *substream,
50 struct snd_pcm_hw_params *params)
51{
52 struct snd_soc_pcm_runtime *rtd = substream->private_data;
53 struct snd_soc_dai *codec_dai = rtd->codec_dai;
54 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
55 unsigned long mclk_freq;
56 int rfs, ret;
57
58 switch(params_rate(params)) {
59 case 8000:
60 rfs = 512;
61 break;
62 default:
63 dev_err(cpu_dai->dev, "%s:%d Sampling Rate %u not supported!\n",
64 __func__, __LINE__, params_rate(params));
65 return -EINVAL;
66 }
67
68 mclk_freq = params_rate(params) * rfs;
69
70 /* Set the codec DAI configuration */
71 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_DSP_B
72 | SND_SOC_DAIFMT_IB_NF
73 | SND_SOC_DAIFMT_CBS_CFS);
74 if (ret < 0)
75 return ret;
76
77 /* Set the cpu DAI configuration */
78 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_DSP_B
79 | SND_SOC_DAIFMT_IB_NF
80 | SND_SOC_DAIFMT_CBS_CFS);
81 if (ret < 0)
82 return ret;
83
84 ret = snd_soc_dai_set_sysclk(codec_dai, WM8994_SYSCLK_FLL1,
85 mclk_freq, SND_SOC_CLOCK_IN);
86 if (ret < 0)
87 return ret;
88
89 ret = snd_soc_dai_set_pll(codec_dai, WM8994_FLL1, WM8994_FLL_SRC_MCLK1,
90 SMDK_WM8994_FREQ, mclk_freq);
91 if (ret < 0)
92 return ret;
93
94 /* Set PCM source clock on CPU */
95 ret = snd_soc_dai_set_sysclk(cpu_dai, S3C_PCM_CLKSRC_MUX,
96 mclk_freq, SND_SOC_CLOCK_IN);
97 if (ret < 0)
98 return ret;
99
100 /* Set SCLK_DIV for making bclk */
101 ret = snd_soc_dai_set_clkdiv(cpu_dai, S3C_PCM_SCLK_PER_FS, rfs);
102 if (ret < 0)
103 return ret;
104
105 return 0;
106}
107
108static struct snd_soc_ops smdk_wm8994_pcm_ops = {
109 .hw_params = smdk_wm8994_pcm_hw_params,
110};
111
112static struct snd_soc_dai_link smdk_dai[] = {
113 {
114 .name = "WM8994 PAIF PCM",
115 .stream_name = "Primary PCM",
116 .cpu_dai_name = "samsung-pcm.0",
117 .codec_dai_name = "wm8994-aif1",
118 .platform_name = "samsung-audio",
119 .codec_name = "wm8994-codec",
120 .ops = &smdk_wm8994_pcm_ops,
121 },
122};
123
124static struct snd_soc_card smdk_pcm = {
125 .name = "SMDK-PCM",
126 .dai_link = smdk_dai,
127 .num_links = 1,
128};
129
130static int __devinit snd_smdk_probe(struct platform_device *pdev)
131{
132 int ret = 0;
133
134 smdk_pcm.dev = &pdev->dev;
135 ret = snd_soc_register_card(&smdk_pcm);
136 if (ret) {
137 dev_err(&pdev->dev, "snd_soc_register_card failed %d\n", ret);
138 return ret;
139 }
140
141 return 0;
142}
143
144static int __devexit snd_smdk_remove(struct platform_device *pdev)
145{
146 snd_soc_unregister_card(&smdk_pcm);
147 platform_set_drvdata(pdev, NULL);
148 return 0;
149}
150
151static struct platform_driver snd_smdk_driver = {
152 .driver = {
153 .owner = THIS_MODULE,
154 .name = "samsung-smdk-pcm",
155 },
156 .probe = snd_smdk_probe,
157 .remove = __devexit_p(snd_smdk_remove),
158};
159
160static int __init smdk_audio_init(void)
161{
162 return platform_driver_register(&snd_smdk_driver);
163}
164
165module_init(smdk_audio_init);
166
167static void __exit smdk_audio_exit(void)
168{
169 platform_driver_unregister(&snd_smdk_driver);
170}
171
172module_exit(smdk_audio_exit);
173
174MODULE_AUTHOR("Sangbeom Kim, <sbkim73@samsung.com>");
175MODULE_DESCRIPTION("ALSA SoC SMDK WM8994 for PCM");
176MODULE_LICENSE("GPL");