aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/s3c24xx/smdk64xx_wm8580.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/s3c24xx/smdk64xx_wm8580.c')
-rw-r--r--sound/soc/s3c24xx/smdk64xx_wm8580.c68
1 files changed, 37 insertions, 31 deletions
diff --git a/sound/soc/s3c24xx/smdk64xx_wm8580.c b/sound/soc/s3c24xx/smdk64xx_wm8580.c
index 07e8e51d10d6..052e499b68d1 100644
--- a/sound/soc/s3c24xx/smdk64xx_wm8580.c
+++ b/sound/soc/s3c24xx/smdk64xx_wm8580.c
@@ -22,6 +22,12 @@
22#include "s3c-dma.h" 22#include "s3c-dma.h"
23#include "s3c64xx-i2s.h" 23#include "s3c64xx-i2s.h"
24 24
25/*
26 * Default CFG switch settings to use this driver:
27 *
28 * SMDK6410: Set CFG1 1-3 Off, CFG2 1-4 On
29 */
30
25/* SMDK64XX has a 12MHZ crystal attached to WM8580 */ 31/* SMDK64XX has a 12MHZ crystal attached to WM8580 */
26#define SMDK64XX_WM8580_FREQ 12000000 32#define SMDK64XX_WM8580_FREQ 12000000
27 33
@@ -29,8 +35,8 @@ static int smdk64xx_hw_params(struct snd_pcm_substream *substream,
29 struct snd_pcm_hw_params *params) 35 struct snd_pcm_hw_params *params)
30{ 36{
31 struct snd_soc_pcm_runtime *rtd = substream->private_data; 37 struct snd_soc_pcm_runtime *rtd = substream->private_data;
32 struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; 38 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
33 struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; 39 struct snd_soc_dai *codec_dai = rtd->codec_dai;
34 unsigned int pll_out; 40 unsigned int pll_out;
35 int bfs, rfs, ret; 41 int bfs, rfs, ret;
36 42
@@ -107,14 +113,13 @@ static int smdk64xx_hw_params(struct snd_pcm_substream *substream,
107 if (ret < 0) 113 if (ret < 0)
108 return ret; 114 return ret;
109 115
110 /* Explicitly set WM8580-DAC to source from MCLK */ 116 ret = snd_soc_dai_set_pll(codec_dai, WM8580_PLLA, 0,
111 ret = snd_soc_dai_set_clkdiv(codec_dai, WM8580_DAC_CLKSEL, 117 SMDK64XX_WM8580_FREQ, pll_out);
112 WM8580_CLKSRC_MCLK);
113 if (ret < 0) 118 if (ret < 0)
114 return ret; 119 return ret;
115 120
116 ret = snd_soc_dai_set_pll(codec_dai, WM8580_PLLA, 0, 121 ret = snd_soc_dai_set_sysclk(codec_dai, WM8580_CLKSRC_PLLA,
117 SMDK64XX_WM8580_FREQ, pll_out); 122 pll_out, SND_SOC_CLOCK_IN);
118 if (ret < 0) 123 if (ret < 0)
119 return ret; 124 return ret;
120 125
@@ -138,9 +143,9 @@ static struct snd_soc_ops smdk64xx_ops = {
138 143
139/* SMDK64xx Playback widgets */ 144/* SMDK64xx Playback widgets */
140static const struct snd_soc_dapm_widget wm8580_dapm_widgets_pbk[] = { 145static const struct snd_soc_dapm_widget wm8580_dapm_widgets_pbk[] = {
141 SND_SOC_DAPM_HP("Front-L/R", NULL), 146 SND_SOC_DAPM_HP("Front", NULL),
142 SND_SOC_DAPM_HP("Center/Sub", NULL), 147 SND_SOC_DAPM_HP("Center+Sub", NULL),
143 SND_SOC_DAPM_HP("Rear-L/R", NULL), 148 SND_SOC_DAPM_HP("Rear", NULL),
144}; 149};
145 150
146/* SMDK64xx Capture widgets */ 151/* SMDK64xx Capture widgets */
@@ -162,20 +167,22 @@ static const struct snd_soc_dapm_route audio_map_tx[] = {
162/* SMDK-PAIFRX connections */ 167/* SMDK-PAIFRX connections */
163static const struct snd_soc_dapm_route audio_map_rx[] = { 168static const struct snd_soc_dapm_route audio_map_rx[] = {
164 /* Front Left/Right are fed VOUT1L/R */ 169 /* Front Left/Right are fed VOUT1L/R */
165 {"Front-L/R", NULL, "VOUT1L"}, 170 {"Front", NULL, "VOUT1L"},
166 {"Front-L/R", NULL, "VOUT1R"}, 171 {"Front", NULL, "VOUT1R"},
167 172
168 /* Center/Sub are fed VOUT2L/R */ 173 /* Center/Sub are fed VOUT2L/R */
169 {"Center/Sub", NULL, "VOUT2L"}, 174 {"Center+Sub", NULL, "VOUT2L"},
170 {"Center/Sub", NULL, "VOUT2R"}, 175 {"Center+Sub", NULL, "VOUT2R"},
171 176
172 /* Rear Left/Right are fed VOUT3L/R */ 177 /* Rear Left/Right are fed VOUT3L/R */
173 {"Rear-L/R", NULL, "VOUT3L"}, 178 {"Rear", NULL, "VOUT3L"},
174 {"Rear-L/R", NULL, "VOUT3R"}, 179 {"Rear", NULL, "VOUT3R"},
175}; 180};
176 181
177static int smdk64xx_wm8580_init_paiftx(struct snd_soc_codec *codec) 182static int smdk64xx_wm8580_init_paiftx(struct snd_soc_pcm_runtime *rtd)
178{ 183{
184 struct snd_soc_codec *codec = rtd->codec;
185
179 /* Add smdk64xx specific Capture widgets */ 186 /* Add smdk64xx specific Capture widgets */
180 snd_soc_dapm_new_controls(codec, wm8580_dapm_widgets_cpt, 187 snd_soc_dapm_new_controls(codec, wm8580_dapm_widgets_cpt,
181 ARRAY_SIZE(wm8580_dapm_widgets_cpt)); 188 ARRAY_SIZE(wm8580_dapm_widgets_cpt));
@@ -194,8 +201,10 @@ static int smdk64xx_wm8580_init_paiftx(struct snd_soc_codec *codec)
194 return 0; 201 return 0;
195} 202}
196 203
197static int smdk64xx_wm8580_init_paifrx(struct snd_soc_codec *codec) 204static int smdk64xx_wm8580_init_paifrx(struct snd_soc_pcm_runtime *rtd)
198{ 205{
206 struct snd_soc_codec *codec = rtd->codec;
207
199 /* Add smdk64xx specific Playback widgets */ 208 /* Add smdk64xx specific Playback widgets */
200 snd_soc_dapm_new_controls(codec, wm8580_dapm_widgets_pbk, 209 snd_soc_dapm_new_controls(codec, wm8580_dapm_widgets_pbk,
201 ARRAY_SIZE(wm8580_dapm_widgets_pbk)); 210 ARRAY_SIZE(wm8580_dapm_widgets_pbk));
@@ -213,33 +222,31 @@ static struct snd_soc_dai_link smdk64xx_dai[] = {
213{ /* Primary Playback i/f */ 222{ /* Primary Playback i/f */
214 .name = "WM8580 PAIF RX", 223 .name = "WM8580 PAIF RX",
215 .stream_name = "Playback", 224 .stream_name = "Playback",
216 .cpu_dai = &s3c64xx_i2s_v4_dai, 225 .cpu_dai_name = "s3c64xx-iis-v4",
217 .codec_dai = &wm8580_dai[WM8580_DAI_PAIFRX], 226 .codec_dai_name = "wm8580-hifi-playback",
227 .platform_name = "s3c24xx-pcm-audio",
228 .codec_name = "wm8580-codec.0-001b",
218 .init = smdk64xx_wm8580_init_paifrx, 229 .init = smdk64xx_wm8580_init_paifrx,
219 .ops = &smdk64xx_ops, 230 .ops = &smdk64xx_ops,
220}, 231},
221{ /* Primary Capture i/f */ 232{ /* Primary Capture i/f */
222 .name = "WM8580 PAIF TX", 233 .name = "WM8580 PAIF TX",
223 .stream_name = "Capture", 234 .stream_name = "Capture",
224 .cpu_dai = &s3c64xx_i2s_v4_dai, 235 .cpu_dai_name = "s3c64xx-iis-v4",
225 .codec_dai = &wm8580_dai[WM8580_DAI_PAIFTX], 236 .codec_dai_name = "wm8580-hifi-capture",
237 .platform_name = "s3c24xx-pcm-audio",
238 .codec_name = "wm8580-codec.0-001b",
226 .init = smdk64xx_wm8580_init_paiftx, 239 .init = smdk64xx_wm8580_init_paiftx,
227 .ops = &smdk64xx_ops, 240 .ops = &smdk64xx_ops,
228}, 241},
229}; 242};
230 243
231static struct snd_soc_card smdk64xx = { 244static struct snd_soc_card smdk64xx = {
232 .name = "smdk64xx", 245 .name = "SMDK64xx 5.1",
233 .platform = &s3c24xx_soc_platform,
234 .dai_link = smdk64xx_dai, 246 .dai_link = smdk64xx_dai,
235 .num_links = ARRAY_SIZE(smdk64xx_dai), 247 .num_links = ARRAY_SIZE(smdk64xx_dai),
236}; 248};
237 249
238static struct snd_soc_device smdk64xx_snd_devdata = {
239 .card = &smdk64xx,
240 .codec_dev = &soc_codec_dev_wm8580,
241};
242
243static struct platform_device *smdk64xx_snd_device; 250static struct platform_device *smdk64xx_snd_device;
244 251
245static int __init smdk64xx_audio_init(void) 252static int __init smdk64xx_audio_init(void)
@@ -250,8 +257,7 @@ static int __init smdk64xx_audio_init(void)
250 if (!smdk64xx_snd_device) 257 if (!smdk64xx_snd_device)
251 return -ENOMEM; 258 return -ENOMEM;
252 259
253 platform_set_drvdata(smdk64xx_snd_device, &smdk64xx_snd_devdata); 260 platform_set_drvdata(smdk64xx_snd_device, &smdk64xx);
254 smdk64xx_snd_devdata.dev = &smdk64xx_snd_device->dev;
255 ret = platform_device_add(smdk64xx_snd_device); 261 ret = platform_device_add(smdk64xx_snd_device);
256 262
257 if (ret) 263 if (ret)