13 #include <linux/slab.h>
14 #include <linux/module.h>
15 #include <linux/kernel.h>
16 #include <linux/device.h>
28 static const u16 wm9705_reg[] = {
29 0x6150, 0x8000, 0x8000, 0x8000,
30 0x0000, 0x8000, 0x8008, 0x8008,
31 0x8808, 0x8808, 0x8808, 0x8808,
32 0x8808, 0x0000, 0x8000, 0x0000,
33 0x0000, 0x0000, 0x0000, 0x000f,
34 0x0605, 0x0000, 0xbb80, 0x0000,
35 0x0000, 0xbb80, 0x0000, 0x0000,
36 0x0000, 0x2000, 0x0000, 0x0000,
37 0x0000, 0x0000, 0x0000, 0x0000,
38 0x0000, 0x0000, 0x0000, 0x0000,
39 0x0000, 0x0000, 0x0000, 0x0000,
40 0x0000, 0x0000, 0x0000, 0x0000,
41 0x0000, 0x0000, 0x0000, 0x0000,
42 0x0000, 0x0000, 0x0000, 0x0000,
43 0x0000, 0x0808, 0x0000, 0x0006,
44 0x0000, 0x0000, 0x574d, 0x4c05,
66 static const char *wm9705_mic[] = {
"Mic 1",
"Mic 2"};
67 static const char *wm9705_rec_sel[] = {
"Mic",
"CD",
"NC",
"NC",
68 "Line",
"Stereo Mix",
"Mono Mix",
"Phone"};
70 static const struct soc_enum wm9705_enum_mic =
72 static const struct soc_enum wm9705_enum_rec_l =
74 static const struct soc_enum wm9705_enum_rec_r =
99 &wm9705_mic_src_controls),
101 &wm9705_capture_selectl_controls),
103 &wm9705_capture_selectr_controls),
109 &wm9705_hp_mixer_controls[0],
147 {
"HP Mixer",
"PCBeep Playback Switch",
"PCBEEP PGA"},
148 {
"HP Mixer",
"CD Playback Switch",
"CD PGA"},
149 {
"HP Mixer",
"Mic Playback Switch",
"Mic PGA"},
150 {
"HP Mixer",
"Phone Playback Switch",
"Phone PGA"},
151 {
"HP Mixer",
"Line Playback Switch",
"Line PGA"},
152 {
"HP Mixer",
NULL,
"Left DAC"},
153 {
"HP Mixer",
NULL,
"Right DAC"},
156 {
"Mono Mixer",
NULL,
"HP Mixer"},
159 {
"Headphone PGA",
NULL,
"HP Mixer"},
160 {
"HPOUTL",
NULL,
"Headphone PGA"},
161 {
"HPOUTR",
NULL,
"Headphone PGA"},
162 {
"Line out PGA",
NULL,
"HP Mixer"},
163 {
"LOUT",
NULL,
"Line out PGA"},
164 {
"ROUT",
NULL,
"Line out PGA"},
165 {
"Mono PGA",
NULL,
"Mono Mixer"},
166 {
"MONOOUT",
NULL,
"Mono PGA"},
169 {
"CD PGA",
NULL,
"CDINL"},
170 {
"CD PGA",
NULL,
"CDINR"},
171 {
"Line PGA",
NULL,
"LINEINL"},
172 {
"Line PGA",
NULL,
"LINEINR"},
173 {
"Phone PGA",
NULL,
"PHONE"},
174 {
"Mic Source",
"Mic 1",
"MIC1"},
175 {
"Mic Source",
"Mic 2",
"MIC2"},
176 {
"Mic PGA",
NULL,
"Mic Source"},
177 {
"PCBEEP PGA",
NULL,
"PCBEEP"},
180 {
"Left Capture Source",
"Mic",
"Mic Source"},
181 {
"Left Capture Source",
"CD",
"CDINL"},
182 {
"Left Capture Source",
"Line",
"LINEINL"},
183 {
"Left Capture Source",
"Stereo Mix",
"HP Mixer"},
184 {
"Left Capture Source",
"Mono Mix",
"HP Mixer"},
185 {
"Left Capture Source",
"Phone",
"PHONE"},
188 {
"Right Capture Source",
"Mic",
"Mic Source"},
189 {
"Right Capture Source",
"CD",
"CDINR"},
190 {
"Right Capture Source",
"Line",
"LINEINR"},
191 {
"Right Capture Source",
"Stereo Mix",
"HP Mixer"},
192 {
"Right Capture Source",
"Mono Mix",
"HP Mixer"},
193 {
"Right Capture Source",
"Phone",
"PHONE"},
195 {
"ADC PGA",
NULL,
"Left Capture Source"},
196 {
"ADC PGA",
NULL,
"Right Capture Source"},
199 {
"Left ADC",
NULL,
"ADC PGA"},
200 {
"Right ADC",
NULL,
"ADC PGA"},
223 static int ac97_write(
struct snd_soc_codec *codec,
unsigned int reg,
251 return ac97_write(codec, reg, substream->
runtime->rate);
254 #define WM9705_AC97_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 | \
255 SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 | \
256 SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \
257 SNDRV_PCM_RATE_48000)
260 .prepare = ac97_prepare,
265 .name =
"wm9705-hifi",
268 .stream_name =
"HiFi Playback",
275 .stream_name =
"HiFi Capture",
281 .ops = &wm9705_dai_ops,
284 .name =
"wm9705-aux",
286 .stream_name =
"Aux Playback",
299 if (ac97_read(codec, 0) == wm9705_reg[0])
319 ret = wm9705_reset(codec);
325 for (i = 2; i <
ARRAY_SIZE(wm9705_reg) << 1; i += 2) {
332 #define wm9705_soc_suspend NULL
333 #define wm9705_soc_resume NULL
348 ret = wm9705_reset(codec);
369 .probe = wm9705_soc_probe,
370 .remove = wm9705_soc_remove,
376 .reg_word_size =
sizeof(
u16),
381 .dapm_routes = wm9705_audio_map,
382 .num_dapm_routes =
ARRAY_SIZE(wm9705_audio_map),
388 &soc_codec_dev_wm9705, wm9705_dai,
ARRAY_SIZE(wm9705_dai));
399 .name =
"wm9705-codec",
403 .probe = wm9705_probe,