diff options
Diffstat (limited to 'sound/pci/emu10k1/emumixer.c')
-rw-r--r-- | sound/pci/emu10k1/emumixer.c | 745 |
1 files changed, 743 insertions, 2 deletions
diff --git a/sound/pci/emu10k1/emumixer.c b/sound/pci/emu10k1/emumixer.c index c31f3d0877fa..4db6e1ca1665 100644 --- a/sound/pci/emu10k1/emumixer.c +++ b/sound/pci/emu10k1/emumixer.c | |||
@@ -5,6 +5,9 @@ | |||
5 | * Routines for control of EMU10K1 chips / mixer routines | 5 | * Routines for control of EMU10K1 chips / mixer routines |
6 | * Multichannel PCM support Copyright (c) Lee Revell <rlrevell@joe-job.com> | 6 | * Multichannel PCM support Copyright (c) Lee Revell <rlrevell@joe-job.com> |
7 | * | 7 | * |
8 | * Copyright (c) by James Courtier-Dutton <James@superbug.co.uk> | ||
9 | * Added EMU 1010 support. | ||
10 | * | ||
8 | * BUGS: | 11 | * BUGS: |
9 | * -- | 12 | * -- |
10 | * | 13 | * |
@@ -32,9 +35,15 @@ | |||
32 | #include <linux/init.h> | 35 | #include <linux/init.h> |
33 | #include <sound/core.h> | 36 | #include <sound/core.h> |
34 | #include <sound/emu10k1.h> | 37 | #include <sound/emu10k1.h> |
38 | #include <linux/delay.h> | ||
39 | #include <sound/tlv.h> | ||
40 | |||
41 | #include "p17v.h" | ||
35 | 42 | ||
36 | #define AC97_ID_STAC9758 0x83847658 | 43 | #define AC97_ID_STAC9758 0x83847658 |
37 | 44 | ||
45 | static const DECLARE_TLV_DB_SCALE(snd_audigy_db_scale2, -10350, 50, 1); /* WM8775 gain scale */ | ||
46 | |||
38 | static int snd_emu10k1_spdif_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 47 | static int snd_emu10k1_spdif_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
39 | { | 48 | { |
40 | uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; | 49 | uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; |
@@ -68,6 +77,669 @@ static int snd_emu10k1_spdif_get_mask(struct snd_kcontrol *kcontrol, | |||
68 | return 0; | 77 | return 0; |
69 | } | 78 | } |
70 | 79 | ||
80 | static char *emu1010_src_texts[] = { | ||
81 | "Silence", | ||
82 | "Dock Mic A", | ||
83 | "Dock Mic B", | ||
84 | "Dock ADC1 Left", | ||
85 | "Dock ADC1 Right", | ||
86 | "Dock ADC2 Left", | ||
87 | "Dock ADC2 Right", | ||
88 | "Dock ADC3 Left", | ||
89 | "Dock ADC3 Right", | ||
90 | "0202 ADC Left", | ||
91 | "0202 ADC Right", | ||
92 | "0202 SPDIF Left", | ||
93 | "0202 SPDIF Right", | ||
94 | "ADAT 0", | ||
95 | "ADAT 1", | ||
96 | "ADAT 2", | ||
97 | "ADAT 3", | ||
98 | "ADAT 4", | ||
99 | "ADAT 5", | ||
100 | "ADAT 6", | ||
101 | "ADAT 7", | ||
102 | "DSP 0", | ||
103 | "DSP 1", | ||
104 | "DSP 2", | ||
105 | "DSP 3", | ||
106 | "DSP 4", | ||
107 | "DSP 5", | ||
108 | "DSP 6", | ||
109 | "DSP 7", | ||
110 | "DSP 8", | ||
111 | "DSP 9", | ||
112 | "DSP 10", | ||
113 | "DSP 11", | ||
114 | "DSP 12", | ||
115 | "DSP 13", | ||
116 | "DSP 14", | ||
117 | "DSP 15", | ||
118 | "DSP 16", | ||
119 | "DSP 17", | ||
120 | "DSP 18", | ||
121 | "DSP 19", | ||
122 | "DSP 20", | ||
123 | "DSP 21", | ||
124 | "DSP 22", | ||
125 | "DSP 23", | ||
126 | "DSP 24", | ||
127 | "DSP 25", | ||
128 | "DSP 26", | ||
129 | "DSP 27", | ||
130 | "DSP 28", | ||
131 | "DSP 29", | ||
132 | "DSP 30", | ||
133 | "DSP 31", | ||
134 | }; | ||
135 | |||
136 | static unsigned int emu1010_src_regs[] = { | ||
137 | EMU_SRC_SILENCE,/* 0 */ | ||
138 | EMU_SRC_DOCK_MIC_A1, /* 1 */ | ||
139 | EMU_SRC_DOCK_MIC_B1, /* 2 */ | ||
140 | EMU_SRC_DOCK_ADC1_LEFT1, /* 3 */ | ||
141 | EMU_SRC_DOCK_ADC1_RIGHT1, /* 4 */ | ||
142 | EMU_SRC_DOCK_ADC2_LEFT1, /* 5 */ | ||
143 | EMU_SRC_DOCK_ADC2_RIGHT1, /* 6 */ | ||
144 | EMU_SRC_DOCK_ADC3_LEFT1, /* 7 */ | ||
145 | EMU_SRC_DOCK_ADC3_RIGHT1, /* 8 */ | ||
146 | EMU_SRC_HAMOA_ADC_LEFT1, /* 9 */ | ||
147 | EMU_SRC_HAMOA_ADC_RIGHT1, /* 10 */ | ||
148 | EMU_SRC_HANA_SPDIF_LEFT1, /* 11 */ | ||
149 | EMU_SRC_HANA_SPDIF_RIGHT1, /* 12 */ | ||
150 | EMU_SRC_HANA_ADAT, /* 13 */ | ||
151 | EMU_SRC_HANA_ADAT+1, /* 14 */ | ||
152 | EMU_SRC_HANA_ADAT+2, /* 15 */ | ||
153 | EMU_SRC_HANA_ADAT+3, /* 16 */ | ||
154 | EMU_SRC_HANA_ADAT+4, /* 17 */ | ||
155 | EMU_SRC_HANA_ADAT+5, /* 18 */ | ||
156 | EMU_SRC_HANA_ADAT+6, /* 19 */ | ||
157 | EMU_SRC_HANA_ADAT+7, /* 20 */ | ||
158 | EMU_SRC_ALICE_EMU32A, /* 21 */ | ||
159 | EMU_SRC_ALICE_EMU32A+1, /* 22 */ | ||
160 | EMU_SRC_ALICE_EMU32A+2, /* 23 */ | ||
161 | EMU_SRC_ALICE_EMU32A+3, /* 24 */ | ||
162 | EMU_SRC_ALICE_EMU32A+4, /* 25 */ | ||
163 | EMU_SRC_ALICE_EMU32A+5, /* 26 */ | ||
164 | EMU_SRC_ALICE_EMU32A+6, /* 27 */ | ||
165 | EMU_SRC_ALICE_EMU32A+7, /* 28 */ | ||
166 | EMU_SRC_ALICE_EMU32A+8, /* 29 */ | ||
167 | EMU_SRC_ALICE_EMU32A+9, /* 30 */ | ||
168 | EMU_SRC_ALICE_EMU32A+0xa, /* 31 */ | ||
169 | EMU_SRC_ALICE_EMU32A+0xb, /* 32 */ | ||
170 | EMU_SRC_ALICE_EMU32A+0xc, /* 33 */ | ||
171 | EMU_SRC_ALICE_EMU32A+0xd, /* 34 */ | ||
172 | EMU_SRC_ALICE_EMU32A+0xe, /* 35 */ | ||
173 | EMU_SRC_ALICE_EMU32A+0xf, /* 36 */ | ||
174 | EMU_SRC_ALICE_EMU32B, /* 37 */ | ||
175 | EMU_SRC_ALICE_EMU32B+1, /* 38 */ | ||
176 | EMU_SRC_ALICE_EMU32B+2, /* 39 */ | ||
177 | EMU_SRC_ALICE_EMU32B+3, /* 40 */ | ||
178 | EMU_SRC_ALICE_EMU32B+4, /* 41 */ | ||
179 | EMU_SRC_ALICE_EMU32B+5, /* 42 */ | ||
180 | EMU_SRC_ALICE_EMU32B+6, /* 43 */ | ||
181 | EMU_SRC_ALICE_EMU32B+7, /* 44 */ | ||
182 | EMU_SRC_ALICE_EMU32B+8, /* 45 */ | ||
183 | EMU_SRC_ALICE_EMU32B+9, /* 46 */ | ||
184 | EMU_SRC_ALICE_EMU32B+0xa, /* 47 */ | ||
185 | EMU_SRC_ALICE_EMU32B+0xb, /* 48 */ | ||
186 | EMU_SRC_ALICE_EMU32B+0xc, /* 49 */ | ||
187 | EMU_SRC_ALICE_EMU32B+0xd, /* 50 */ | ||
188 | EMU_SRC_ALICE_EMU32B+0xe, /* 51 */ | ||
189 | EMU_SRC_ALICE_EMU32B+0xf, /* 52 */ | ||
190 | }; | ||
191 | |||
192 | static unsigned int emu1010_output_dst[] = { | ||
193 | EMU_DST_DOCK_DAC1_LEFT1, /* 0 */ | ||
194 | EMU_DST_DOCK_DAC1_RIGHT1, /* 1 */ | ||
195 | EMU_DST_DOCK_DAC2_LEFT1, /* 2 */ | ||
196 | EMU_DST_DOCK_DAC2_RIGHT1, /* 3 */ | ||
197 | EMU_DST_DOCK_DAC3_LEFT1, /* 4 */ | ||
198 | EMU_DST_DOCK_DAC3_RIGHT1, /* 5 */ | ||
199 | EMU_DST_DOCK_DAC4_LEFT1, /* 6 */ | ||
200 | EMU_DST_DOCK_DAC4_RIGHT1, /* 7 */ | ||
201 | EMU_DST_DOCK_PHONES_LEFT1, /* 8 */ | ||
202 | EMU_DST_DOCK_PHONES_RIGHT1, /* 9 */ | ||
203 | EMU_DST_DOCK_SPDIF_LEFT1, /* 10 */ | ||
204 | EMU_DST_DOCK_SPDIF_RIGHT1, /* 11 */ | ||
205 | EMU_DST_HANA_SPDIF_LEFT1, /* 12 */ | ||
206 | EMU_DST_HANA_SPDIF_RIGHT1, /* 13 */ | ||
207 | EMU_DST_HAMOA_DAC_LEFT1, /* 14 */ | ||
208 | EMU_DST_HAMOA_DAC_RIGHT1, /* 15 */ | ||
209 | EMU_DST_HANA_ADAT, /* 16 */ | ||
210 | EMU_DST_HANA_ADAT+1, /* 17 */ | ||
211 | EMU_DST_HANA_ADAT+2, /* 18 */ | ||
212 | EMU_DST_HANA_ADAT+3, /* 19 */ | ||
213 | EMU_DST_HANA_ADAT+4, /* 20 */ | ||
214 | EMU_DST_HANA_ADAT+5, /* 21 */ | ||
215 | EMU_DST_HANA_ADAT+6, /* 22 */ | ||
216 | EMU_DST_HANA_ADAT+7, /* 23 */ | ||
217 | }; | ||
218 | |||
219 | static unsigned int emu1010_input_dst[] = { | ||
220 | EMU_DST_ALICE2_EMU32_0, | ||
221 | EMU_DST_ALICE2_EMU32_1, | ||
222 | EMU_DST_ALICE2_EMU32_2, | ||
223 | EMU_DST_ALICE2_EMU32_3, | ||
224 | EMU_DST_ALICE2_EMU32_4, | ||
225 | EMU_DST_ALICE2_EMU32_5, | ||
226 | EMU_DST_ALICE2_EMU32_6, | ||
227 | EMU_DST_ALICE2_EMU32_7, | ||
228 | EMU_DST_ALICE2_EMU32_8, | ||
229 | EMU_DST_ALICE2_EMU32_9, | ||
230 | EMU_DST_ALICE2_EMU32_A, | ||
231 | EMU_DST_ALICE2_EMU32_B, | ||
232 | EMU_DST_ALICE2_EMU32_C, | ||
233 | EMU_DST_ALICE2_EMU32_D, | ||
234 | EMU_DST_ALICE2_EMU32_E, | ||
235 | EMU_DST_ALICE2_EMU32_F, | ||
236 | EMU_DST_ALICE_I2S0_LEFT, | ||
237 | EMU_DST_ALICE_I2S0_RIGHT, | ||
238 | EMU_DST_ALICE_I2S1_LEFT, | ||
239 | EMU_DST_ALICE_I2S1_RIGHT, | ||
240 | EMU_DST_ALICE_I2S2_LEFT, | ||
241 | EMU_DST_ALICE_I2S2_RIGHT, | ||
242 | }; | ||
243 | |||
244 | static int snd_emu1010_input_output_source_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | ||
245 | { | ||
246 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | ||
247 | uinfo->count = 1; | ||
248 | uinfo->value.enumerated.items = 53; | ||
249 | if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) | ||
250 | uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; | ||
251 | strcpy(uinfo->value.enumerated.name, emu1010_src_texts[uinfo->value.enumerated.item]); | ||
252 | return 0; | ||
253 | } | ||
254 | |||
255 | static int snd_emu1010_output_source_get(struct snd_kcontrol *kcontrol, | ||
256 | struct snd_ctl_elem_value *ucontrol) | ||
257 | { | ||
258 | struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); | ||
259 | int channel; | ||
260 | |||
261 | channel = (kcontrol->private_value) & 0xff; | ||
262 | ucontrol->value.enumerated.item[0] = emu->emu1010.output_source[channel]; | ||
263 | return 0; | ||
264 | } | ||
265 | |||
266 | static int snd_emu1010_output_source_put(struct snd_kcontrol *kcontrol, | ||
267 | struct snd_ctl_elem_value *ucontrol) | ||
268 | { | ||
269 | struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); | ||
270 | int change = 0; | ||
271 | unsigned int val; | ||
272 | int channel; | ||
273 | |||
274 | channel = (kcontrol->private_value) & 0xff; | ||
275 | if (emu->emu1010.output_source[channel] != ucontrol->value.enumerated.item[0]) { | ||
276 | val = emu->emu1010.output_source[channel] = ucontrol->value.enumerated.item[0]; | ||
277 | change = 1; | ||
278 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
279 | emu1010_output_dst[channel], emu1010_src_regs[val]); | ||
280 | } | ||
281 | return change; | ||
282 | } | ||
283 | |||
284 | static int snd_emu1010_input_source_get(struct snd_kcontrol *kcontrol, | ||
285 | struct snd_ctl_elem_value *ucontrol) | ||
286 | { | ||
287 | struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); | ||
288 | int channel; | ||
289 | |||
290 | channel = (kcontrol->private_value) & 0xff; | ||
291 | ucontrol->value.enumerated.item[0] = emu->emu1010.input_source[channel]; | ||
292 | return 0; | ||
293 | } | ||
294 | |||
295 | static int snd_emu1010_input_source_put(struct snd_kcontrol *kcontrol, | ||
296 | struct snd_ctl_elem_value *ucontrol) | ||
297 | { | ||
298 | struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); | ||
299 | int change = 0; | ||
300 | unsigned int val; | ||
301 | int channel; | ||
302 | |||
303 | channel = (kcontrol->private_value) & 0xff; | ||
304 | if (emu->emu1010.input_source[channel] != ucontrol->value.enumerated.item[0]) { | ||
305 | val = emu->emu1010.input_source[channel] = ucontrol->value.enumerated.item[0]; | ||
306 | change = 1; | ||
307 | snd_emu1010_fpga_link_dst_src_write(emu, | ||
308 | emu1010_input_dst[channel], emu1010_src_regs[val]); | ||
309 | } | ||
310 | return change; | ||
311 | } | ||
312 | |||
313 | #define EMU1010_SOURCE_OUTPUT(xname,chid) \ | ||
314 | { \ | ||
315 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | ||
316 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ | ||
317 | .info = snd_emu1010_input_output_source_info, \ | ||
318 | .get = snd_emu1010_output_source_get, \ | ||
319 | .put = snd_emu1010_output_source_put, \ | ||
320 | .private_value = chid \ | ||
321 | } | ||
322 | |||
323 | static struct snd_kcontrol_new snd_emu1010_output_enum_ctls[] __devinitdata = { | ||
324 | EMU1010_SOURCE_OUTPUT("Dock DAC1 Left Playback Enum", 0), | ||
325 | EMU1010_SOURCE_OUTPUT("Dock DAC1 Right Playback Enum", 1), | ||
326 | EMU1010_SOURCE_OUTPUT("Dock DAC2 Left Playback Enum", 2), | ||
327 | EMU1010_SOURCE_OUTPUT("Dock DAC2 Right Playback Enum", 3), | ||
328 | EMU1010_SOURCE_OUTPUT("Dock DAC3 Left Playback Enum", 4), | ||
329 | EMU1010_SOURCE_OUTPUT("Dock DAC3 Right Playback Enum", 5), | ||
330 | EMU1010_SOURCE_OUTPUT("Dock DAC4 Left Playback Enum", 6), | ||
331 | EMU1010_SOURCE_OUTPUT("Dock DAC4 Right Playback Enum", 7), | ||
332 | EMU1010_SOURCE_OUTPUT("Dock Phones Left Playback Enum", 8), | ||
333 | EMU1010_SOURCE_OUTPUT("Dock Phones Right Playback Enum", 9), | ||
334 | EMU1010_SOURCE_OUTPUT("Dock SPDIF Left Playback Enum", 0xa), | ||
335 | EMU1010_SOURCE_OUTPUT("Dock SPDIF Right Playback Enum", 0xb), | ||
336 | EMU1010_SOURCE_OUTPUT("1010 SPDIF Left Playback Enum", 0xc), | ||
337 | EMU1010_SOURCE_OUTPUT("1010 SPDIF Right Playback Enum", 0xd), | ||
338 | EMU1010_SOURCE_OUTPUT("0202 DAC Left Playback Enum", 0xe), | ||
339 | EMU1010_SOURCE_OUTPUT("0202 DAC Right Playback Enum", 0xf), | ||
340 | EMU1010_SOURCE_OUTPUT("1010 ADAT 0 Playback Enum", 0x10), | ||
341 | EMU1010_SOURCE_OUTPUT("1010 ADAT 1 Playback Enum", 0x11), | ||
342 | EMU1010_SOURCE_OUTPUT("1010 ADAT 2 Playback Enum", 0x12), | ||
343 | EMU1010_SOURCE_OUTPUT("1010 ADAT 3 Playback Enum", 0x13), | ||
344 | EMU1010_SOURCE_OUTPUT("1010 ADAT 4 Playback Enum", 0x14), | ||
345 | EMU1010_SOURCE_OUTPUT("1010 ADAT 5 Playback Enum", 0x15), | ||
346 | EMU1010_SOURCE_OUTPUT("1010 ADAT 6 Playback Enum", 0x16), | ||
347 | EMU1010_SOURCE_OUTPUT("1010 ADAT 7 Playback Enum", 0x17), | ||
348 | }; | ||
349 | |||
350 | #define EMU1010_SOURCE_INPUT(xname,chid) \ | ||
351 | { \ | ||
352 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | ||
353 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ | ||
354 | .info = snd_emu1010_input_output_source_info, \ | ||
355 | .get = snd_emu1010_input_source_get, \ | ||
356 | .put = snd_emu1010_input_source_put, \ | ||
357 | .private_value = chid \ | ||
358 | } | ||
359 | |||
360 | static struct snd_kcontrol_new snd_emu1010_input_enum_ctls[] __devinitdata = { | ||
361 | EMU1010_SOURCE_INPUT("DSP 0 Capture Enum", 0), | ||
362 | EMU1010_SOURCE_INPUT("DSP 1 Capture Enum", 1), | ||
363 | EMU1010_SOURCE_INPUT("DSP 2 Capture Enum", 2), | ||
364 | EMU1010_SOURCE_INPUT("DSP 3 Capture Enum", 3), | ||
365 | EMU1010_SOURCE_INPUT("DSP 4 Capture Enum", 4), | ||
366 | EMU1010_SOURCE_INPUT("DSP 5 Capture Enum", 5), | ||
367 | EMU1010_SOURCE_INPUT("DSP 6 Capture Enum", 6), | ||
368 | EMU1010_SOURCE_INPUT("DSP 7 Capture Enum", 7), | ||
369 | EMU1010_SOURCE_INPUT("DSP 8 Capture Enum", 8), | ||
370 | EMU1010_SOURCE_INPUT("DSP 9 Capture Enum", 9), | ||
371 | EMU1010_SOURCE_INPUT("DSP A Capture Enum", 0xa), | ||
372 | EMU1010_SOURCE_INPUT("DSP B Capture Enum", 0xb), | ||
373 | EMU1010_SOURCE_INPUT("DSP C Capture Enum", 0xc), | ||
374 | EMU1010_SOURCE_INPUT("DSP D Capture Enum", 0xd), | ||
375 | EMU1010_SOURCE_INPUT("DSP E Capture Enum", 0xe), | ||
376 | EMU1010_SOURCE_INPUT("DSP F Capture Enum", 0xf), | ||
377 | EMU1010_SOURCE_INPUT("DSP 10 Capture Enum", 0x10), | ||
378 | EMU1010_SOURCE_INPUT("DSP 11 Capture Enum", 0x11), | ||
379 | EMU1010_SOURCE_INPUT("DSP 12 Capture Enum", 0x12), | ||
380 | EMU1010_SOURCE_INPUT("DSP 13 Capture Enum", 0x13), | ||
381 | EMU1010_SOURCE_INPUT("DSP 14 Capture Enum", 0x14), | ||
382 | EMU1010_SOURCE_INPUT("DSP 15 Capture Enum", 0x15), | ||
383 | }; | ||
384 | |||
385 | |||
386 | |||
387 | |||
388 | static int snd_emu1010_adc_pads_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | ||
389 | { | ||
390 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; | ||
391 | uinfo->count = 1; | ||
392 | uinfo->value.integer.min = 0; | ||
393 | uinfo->value.integer.max = 1; | ||
394 | return 0; | ||
395 | } | ||
396 | |||
397 | static int snd_emu1010_adc_pads_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | ||
398 | { | ||
399 | struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); | ||
400 | unsigned int mask = kcontrol->private_value & 0xff; | ||
401 | ucontrol->value.integer.value[0] = (emu->emu1010.adc_pads & mask) ? 1 : 0; | ||
402 | return 0; | ||
403 | } | ||
404 | |||
405 | static int snd_emu1010_adc_pads_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | ||
406 | { | ||
407 | struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); | ||
408 | unsigned int mask = kcontrol->private_value & 0xff; | ||
409 | unsigned int val, cache; | ||
410 | val = ucontrol->value.integer.value[0]; | ||
411 | cache = emu->emu1010.adc_pads; | ||
412 | if (val == 1) | ||
413 | cache = cache | mask; | ||
414 | else | ||
415 | cache = cache & ~mask; | ||
416 | if (cache != emu->emu1010.adc_pads) { | ||
417 | snd_emu1010_fpga_write(emu, EMU_HANA_ADC_PADS, cache ); | ||
418 | emu->emu1010.adc_pads = cache; | ||
419 | } | ||
420 | |||
421 | return 0; | ||
422 | } | ||
423 | |||
424 | |||
425 | |||
426 | #define EMU1010_ADC_PADS(xname,chid) \ | ||
427 | { \ | ||
428 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | ||
429 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ | ||
430 | .info = snd_emu1010_adc_pads_info, \ | ||
431 | .get = snd_emu1010_adc_pads_get, \ | ||
432 | .put = snd_emu1010_adc_pads_put, \ | ||
433 | .private_value = chid \ | ||
434 | } | ||
435 | |||
436 | static struct snd_kcontrol_new snd_emu1010_adc_pads[] __devinitdata = { | ||
437 | EMU1010_ADC_PADS("ADC1 14dB PAD Audio Dock Capture Switch", EMU_HANA_DOCK_ADC_PAD1), | ||
438 | EMU1010_ADC_PADS("ADC2 14dB PAD Audio Dock Capture Switch", EMU_HANA_DOCK_ADC_PAD2), | ||
439 | EMU1010_ADC_PADS("ADC3 14dB PAD Audio Dock Capture Switch", EMU_HANA_DOCK_ADC_PAD3), | ||
440 | EMU1010_ADC_PADS("ADC1 14dB PAD 0202 Capture Switch", EMU_HANA_0202_ADC_PAD1), | ||
441 | }; | ||
442 | |||
443 | static int snd_emu1010_dac_pads_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | ||
444 | { | ||
445 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; | ||
446 | uinfo->count = 1; | ||
447 | uinfo->value.integer.min = 0; | ||
448 | uinfo->value.integer.max = 1; | ||
449 | return 0; | ||
450 | } | ||
451 | |||
452 | static int snd_emu1010_dac_pads_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | ||
453 | { | ||
454 | struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); | ||
455 | unsigned int mask = kcontrol->private_value & 0xff; | ||
456 | ucontrol->value.integer.value[0] = (emu->emu1010.dac_pads & mask) ? 1 : 0; | ||
457 | return 0; | ||
458 | } | ||
459 | |||
460 | static int snd_emu1010_dac_pads_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | ||
461 | { | ||
462 | struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); | ||
463 | unsigned int mask = kcontrol->private_value & 0xff; | ||
464 | unsigned int val, cache; | ||
465 | val = ucontrol->value.integer.value[0]; | ||
466 | cache = emu->emu1010.dac_pads; | ||
467 | if (val == 1) | ||
468 | cache = cache | mask; | ||
469 | else | ||
470 | cache = cache & ~mask; | ||
471 | if (cache != emu->emu1010.dac_pads) { | ||
472 | snd_emu1010_fpga_write(emu, EMU_HANA_DAC_PADS, cache ); | ||
473 | emu->emu1010.dac_pads = cache; | ||
474 | } | ||
475 | |||
476 | return 0; | ||
477 | } | ||
478 | |||
479 | |||
480 | |||
481 | #define EMU1010_DAC_PADS(xname,chid) \ | ||
482 | { \ | ||
483 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | ||
484 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ | ||
485 | .info = snd_emu1010_dac_pads_info, \ | ||
486 | .get = snd_emu1010_dac_pads_get, \ | ||
487 | .put = snd_emu1010_dac_pads_put, \ | ||
488 | .private_value = chid \ | ||
489 | } | ||
490 | |||
491 | static struct snd_kcontrol_new snd_emu1010_dac_pads[] __devinitdata = { | ||
492 | EMU1010_DAC_PADS("DAC1 Audio Dock 14dB PAD Playback Switch", EMU_HANA_DOCK_DAC_PAD1), | ||
493 | EMU1010_DAC_PADS("DAC2 Audio Dock 14dB PAD Playback Switch", EMU_HANA_DOCK_DAC_PAD2), | ||
494 | EMU1010_DAC_PADS("DAC3 Audio Dock 14dB PAD Playback Switch", EMU_HANA_DOCK_DAC_PAD3), | ||
495 | EMU1010_DAC_PADS("DAC4 Audio Dock 14dB PAD Playback Switch", EMU_HANA_DOCK_DAC_PAD4), | ||
496 | EMU1010_DAC_PADS("DAC1 0202 14dB PAD Playback Switch", EMU_HANA_0202_DAC_PAD1), | ||
497 | }; | ||
498 | |||
499 | |||
500 | static int snd_emu1010_internal_clock_info(struct snd_kcontrol *kcontrol, | ||
501 | struct snd_ctl_elem_info *uinfo) | ||
502 | { | ||
503 | static char *texts[2] = { | ||
504 | "44100", "48000" | ||
505 | }; | ||
506 | |||
507 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | ||
508 | uinfo->count = 1; | ||
509 | uinfo->value.enumerated.items = 2; | ||
510 | if (uinfo->value.enumerated.item > 1) | ||
511 | uinfo->value.enumerated.item = 1; | ||
512 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | ||
513 | return 0; | ||
514 | } | ||
515 | |||
516 | static int snd_emu1010_internal_clock_get(struct snd_kcontrol *kcontrol, | ||
517 | struct snd_ctl_elem_value *ucontrol) | ||
518 | { | ||
519 | struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); | ||
520 | |||
521 | ucontrol->value.enumerated.item[0] = emu->emu1010.internal_clock; | ||
522 | return 0; | ||
523 | } | ||
524 | |||
525 | static int snd_emu1010_internal_clock_put(struct snd_kcontrol *kcontrol, | ||
526 | struct snd_ctl_elem_value *ucontrol) | ||
527 | { | ||
528 | struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); | ||
529 | unsigned int val; | ||
530 | int change = 0; | ||
531 | |||
532 | val = ucontrol->value.enumerated.item[0] ; | ||
533 | change = (emu->emu1010.internal_clock != val); | ||
534 | if (change) { | ||
535 | emu->emu1010.internal_clock = val; | ||
536 | switch (val) { | ||
537 | case 0: | ||
538 | /* 44100 */ | ||
539 | /* Mute all */ | ||
540 | snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_MUTE ); | ||
541 | /* Default fallback clock 48kHz */ | ||
542 | snd_emu1010_fpga_write(emu, EMU_HANA_DEFCLOCK, EMU_HANA_DEFCLOCK_44_1K ); | ||
543 | /* Word Clock source, Internal 44.1kHz x1 */ | ||
544 | snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, | ||
545 | EMU_HANA_WCLOCK_INT_44_1K | EMU_HANA_WCLOCK_1X ); | ||
546 | /* Set LEDs on Audio Dock */ | ||
547 | snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, | ||
548 | EMU_HANA_DOCK_LEDS_2_44K | EMU_HANA_DOCK_LEDS_2_LOCK ); | ||
549 | /* Allow DLL to settle */ | ||
550 | msleep(10); | ||
551 | /* Unmute all */ | ||
552 | snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE ); | ||
553 | break; | ||
554 | case 1: | ||
555 | /* 48000 */ | ||
556 | /* Mute all */ | ||
557 | snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_MUTE ); | ||
558 | /* Default fallback clock 48kHz */ | ||
559 | snd_emu1010_fpga_write(emu, EMU_HANA_DEFCLOCK, EMU_HANA_DEFCLOCK_48K ); | ||
560 | /* Word Clock source, Internal 48kHz x1 */ | ||
561 | snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, | ||
562 | EMU_HANA_WCLOCK_INT_48K | EMU_HANA_WCLOCK_1X ); | ||
563 | /* Set LEDs on Audio Dock */ | ||
564 | snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, | ||
565 | EMU_HANA_DOCK_LEDS_2_48K | EMU_HANA_DOCK_LEDS_2_LOCK ); | ||
566 | /* Allow DLL to settle */ | ||
567 | msleep(10); | ||
568 | /* Unmute all */ | ||
569 | snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE ); | ||
570 | break; | ||
571 | } | ||
572 | } | ||
573 | return change; | ||
574 | } | ||
575 | |||
576 | static struct snd_kcontrol_new snd_emu1010_internal_clock = | ||
577 | { | ||
578 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, | ||
579 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
580 | .name = "Clock Internal Rate", | ||
581 | .count = 1, | ||
582 | .info = snd_emu1010_internal_clock_info, | ||
583 | .get = snd_emu1010_internal_clock_get, | ||
584 | .put = snd_emu1010_internal_clock_put | ||
585 | }; | ||
586 | |||
587 | static int snd_audigy_i2c_capture_source_info(struct snd_kcontrol *kcontrol, | ||
588 | struct snd_ctl_elem_info *uinfo) | ||
589 | { | ||
590 | #if 0 | ||
591 | static char *texts[4] = { | ||
592 | "Unknown1", "Unknown2", "Mic", "Line" | ||
593 | }; | ||
594 | #endif | ||
595 | static char *texts[2] = { | ||
596 | "Mic", "Line" | ||
597 | }; | ||
598 | |||
599 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | ||
600 | uinfo->count = 1; | ||
601 | uinfo->value.enumerated.items = 2; | ||
602 | if (uinfo->value.enumerated.item > 1) | ||
603 | uinfo->value.enumerated.item = 1; | ||
604 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | ||
605 | return 0; | ||
606 | } | ||
607 | |||
608 | static int snd_audigy_i2c_capture_source_get(struct snd_kcontrol *kcontrol, | ||
609 | struct snd_ctl_elem_value *ucontrol) | ||
610 | { | ||
611 | struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); | ||
612 | |||
613 | ucontrol->value.enumerated.item[0] = emu->i2c_capture_source; | ||
614 | return 0; | ||
615 | } | ||
616 | |||
617 | static int snd_audigy_i2c_capture_source_put(struct snd_kcontrol *kcontrol, | ||
618 | struct snd_ctl_elem_value *ucontrol) | ||
619 | { | ||
620 | struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); | ||
621 | unsigned int source_id; | ||
622 | unsigned int ngain, ogain; | ||
623 | u32 gpio; | ||
624 | int change = 0; | ||
625 | unsigned long flags; | ||
626 | u32 source; | ||
627 | /* If the capture source has changed, | ||
628 | * update the capture volume from the cached value | ||
629 | * for the particular source. | ||
630 | */ | ||
631 | source_id = ucontrol->value.enumerated.item[0]; /* Use 2 and 3 */ | ||
632 | change = (emu->i2c_capture_source != source_id); | ||
633 | if (change) { | ||
634 | snd_emu10k1_i2c_write(emu, ADC_MUX, 0); /* Mute input */ | ||
635 | spin_lock_irqsave(&emu->emu_lock, flags); | ||
636 | gpio = inl(emu->port + A_IOCFG); | ||
637 | if (source_id==0) | ||
638 | outl(gpio | 0x4, emu->port + A_IOCFG); | ||
639 | else | ||
640 | outl(gpio & ~0x4, emu->port + A_IOCFG); | ||
641 | spin_unlock_irqrestore(&emu->emu_lock, flags); | ||
642 | |||
643 | ngain = emu->i2c_capture_volume[source_id][0]; /* Left */ | ||
644 | ogain = emu->i2c_capture_volume[emu->i2c_capture_source][0]; /* Left */ | ||
645 | if (ngain != ogain) | ||
646 | snd_emu10k1_i2c_write(emu, ADC_ATTEN_ADCL, ((ngain) & 0xff)); | ||
647 | ngain = emu->i2c_capture_volume[source_id][1]; /* Right */ | ||
648 | ogain = emu->i2c_capture_volume[emu->i2c_capture_source][1]; /* Right */ | ||
649 | if (ngain != ogain) | ||
650 | snd_emu10k1_i2c_write(emu, ADC_ATTEN_ADCR, ((ngain) & 0xff)); | ||
651 | |||
652 | source = 1 << (source_id + 2); | ||
653 | snd_emu10k1_i2c_write(emu, ADC_MUX, source); /* Set source */ | ||
654 | emu->i2c_capture_source = source_id; | ||
655 | } | ||
656 | return change; | ||
657 | } | ||
658 | |||
659 | static struct snd_kcontrol_new snd_audigy_i2c_capture_source = | ||
660 | { | ||
661 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
662 | .name = "Capture Source", | ||
663 | .info = snd_audigy_i2c_capture_source_info, | ||
664 | .get = snd_audigy_i2c_capture_source_get, | ||
665 | .put = snd_audigy_i2c_capture_source_put | ||
666 | }; | ||
667 | |||
668 | static int snd_audigy_i2c_volume_info(struct snd_kcontrol *kcontrol, | ||
669 | struct snd_ctl_elem_info *uinfo) | ||
670 | { | ||
671 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | ||
672 | uinfo->count = 2; | ||
673 | uinfo->value.integer.min = 0; | ||
674 | uinfo->value.integer.max = 255; | ||
675 | return 0; | ||
676 | } | ||
677 | |||
678 | static int snd_audigy_i2c_volume_get(struct snd_kcontrol *kcontrol, | ||
679 | struct snd_ctl_elem_value *ucontrol) | ||
680 | { | ||
681 | struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); | ||
682 | int source_id; | ||
683 | |||
684 | source_id = kcontrol->private_value; | ||
685 | |||
686 | ucontrol->value.integer.value[0] = emu->i2c_capture_volume[source_id][0]; | ||
687 | ucontrol->value.integer.value[1] = emu->i2c_capture_volume[source_id][1]; | ||
688 | return 0; | ||
689 | } | ||
690 | |||
691 | static int snd_audigy_i2c_volume_put(struct snd_kcontrol *kcontrol, | ||
692 | struct snd_ctl_elem_value *ucontrol) | ||
693 | { | ||
694 | struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); | ||
695 | unsigned int ogain; | ||
696 | unsigned int ngain; | ||
697 | int source_id; | ||
698 | int change = 0; | ||
699 | |||
700 | source_id = kcontrol->private_value; | ||
701 | ogain = emu->i2c_capture_volume[source_id][0]; /* Left */ | ||
702 | ngain = ucontrol->value.integer.value[0]; | ||
703 | if (ngain > 0xff) | ||
704 | return 0; | ||
705 | if (ogain != ngain) { | ||
706 | if (emu->i2c_capture_source == source_id) | ||
707 | snd_emu10k1_i2c_write(emu, ADC_ATTEN_ADCL, ((ngain) & 0xff) ); | ||
708 | emu->i2c_capture_volume[source_id][0] = ucontrol->value.integer.value[0]; | ||
709 | change = 1; | ||
710 | } | ||
711 | ogain = emu->i2c_capture_volume[source_id][1]; /* Right */ | ||
712 | ngain = ucontrol->value.integer.value[1]; | ||
713 | if (ngain > 0xff) | ||
714 | return 0; | ||
715 | if (ogain != ngain) { | ||
716 | if (emu->i2c_capture_source == source_id) | ||
717 | snd_emu10k1_i2c_write(emu, ADC_ATTEN_ADCR, ((ngain) & 0xff)); | ||
718 | emu->i2c_capture_volume[source_id][1] = ucontrol->value.integer.value[1]; | ||
719 | change = 1; | ||
720 | } | ||
721 | |||
722 | return change; | ||
723 | } | ||
724 | |||
725 | #define I2C_VOLUME(xname,chid) \ | ||
726 | { \ | ||
727 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | ||
728 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \ | ||
729 | SNDRV_CTL_ELEM_ACCESS_TLV_READ, \ | ||
730 | .info = snd_audigy_i2c_volume_info, \ | ||
731 | .get = snd_audigy_i2c_volume_get, \ | ||
732 | .put = snd_audigy_i2c_volume_put, \ | ||
733 | .tlv = { .p = snd_audigy_db_scale2 }, \ | ||
734 | .private_value = chid \ | ||
735 | } | ||
736 | |||
737 | |||
738 | static struct snd_kcontrol_new snd_audigy_i2c_volume_ctls[] __devinitdata = { | ||
739 | I2C_VOLUME("Mic Capture Volume", 0), | ||
740 | I2C_VOLUME("Line Capture Volume", 0) | ||
741 | }; | ||
742 | |||
71 | #if 0 | 743 | #if 0 |
72 | static int snd_audigy_spdif_output_rate_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 744 | static int snd_audigy_spdif_output_rate_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
73 | { | 745 | { |
@@ -668,7 +1340,9 @@ static int snd_emu10k1_shared_spdif_put(struct snd_kcontrol *kcontrol, | |||
668 | int change = 0; | 1340 | int change = 0; |
669 | 1341 | ||
670 | spin_lock_irqsave(&emu->reg_lock, flags); | 1342 | spin_lock_irqsave(&emu->reg_lock, flags); |
671 | if (emu->audigy) { | 1343 | if ( emu->card_capabilities->i2c_adc) { |
1344 | /* Do nothing for Audigy 2 ZS Notebook */ | ||
1345 | } else if (emu->audigy) { | ||
672 | reg = inl(emu->port + A_IOCFG); | 1346 | reg = inl(emu->port + A_IOCFG); |
673 | val = ucontrol->value.integer.value[0] ? A_IOCFG_GPOUT0 : 0; | 1347 | val = ucontrol->value.integer.value[0] ? A_IOCFG_GPOUT0 : 0; |
674 | change = (reg & A_IOCFG_GPOUT0) != val; | 1348 | change = (reg & A_IOCFG_GPOUT0) != val; |
@@ -806,6 +1480,24 @@ int __devinit snd_emu10k1_mixer(struct snd_emu10k1 *emu, | |||
806 | "AMic Playback Volume", "Mic Playback Volume", | 1480 | "AMic Playback Volume", "Mic Playback Volume", |
807 | NULL | 1481 | NULL |
808 | }; | 1482 | }; |
1483 | static char *audigy_rename_ctls_i2c_adc[] = { | ||
1484 | //"Analog Mix Capture Volume","OLD Analog Mix Capture Volume", | ||
1485 | "Line Capture Volume", "Analog Mix Capture Volume", | ||
1486 | "Wave Playback Volume", "OLD PCM Playback Volume", | ||
1487 | "Wave Master Playback Volume", "Master Playback Volume", | ||
1488 | "AMic Playback Volume", "Old Mic Playback Volume", | ||
1489 | "CD Capture Volume", "IEC958 Optical Capture Volume", | ||
1490 | NULL | ||
1491 | }; | ||
1492 | static char *audigy_remove_ctls_i2c_adc[] = { | ||
1493 | /* On the Audigy2 ZS Notebook | ||
1494 | * Capture via WM8775 */ | ||
1495 | "Mic Capture Volume", | ||
1496 | "Analog Mix Capture Volume", | ||
1497 | "Aux Capture Volume", | ||
1498 | "IEC958 Optical Capture Volume", | ||
1499 | NULL | ||
1500 | }; | ||
809 | static char *audigy_remove_ctls_1361t_adc[] = { | 1501 | static char *audigy_remove_ctls_1361t_adc[] = { |
810 | /* On the Audigy2 the AC97 playback is piped into | 1502 | /* On the Audigy2 the AC97 playback is piped into |
811 | * the Philips ADC for 24bit capture */ | 1503 | * the Philips ADC for 24bit capture */ |
@@ -890,6 +1582,7 @@ int __devinit snd_emu10k1_mixer(struct snd_emu10k1 *emu, | |||
890 | if (emu->ac97->id == AC97_ID_STAC9758) { | 1582 | if (emu->ac97->id == AC97_ID_STAC9758) { |
891 | emu->rear_ac97 = 1; | 1583 | emu->rear_ac97 = 1; |
892 | snd_emu10k1_ptr_write(emu, AC97SLOT, 0, AC97SLOT_CNTR|AC97SLOT_LFE|AC97SLOT_REAR_LEFT|AC97SLOT_REAR_RIGHT); | 1584 | snd_emu10k1_ptr_write(emu, AC97SLOT, 0, AC97SLOT_CNTR|AC97SLOT_LFE|AC97SLOT_REAR_LEFT|AC97SLOT_REAR_RIGHT); |
1585 | snd_ac97_write_cache(emu->ac97, AC97_HEADPHONE, 0x0202); | ||
893 | } | 1586 | } |
894 | /* remove unused AC97 controls */ | 1587 | /* remove unused AC97 controls */ |
895 | snd_ac97_write_cache(emu->ac97, AC97_SURROUND_MASTER, 0x0202); | 1588 | snd_ac97_write_cache(emu->ac97, AC97_SURROUND_MASTER, 0x0202); |
@@ -898,6 +1591,10 @@ int __devinit snd_emu10k1_mixer(struct snd_emu10k1 *emu, | |||
898 | } | 1591 | } |
899 | for (; *c; c++) | 1592 | for (; *c; c++) |
900 | remove_ctl(card, *c); | 1593 | remove_ctl(card, *c); |
1594 | } else if (emu->card_capabilities->i2c_adc) { | ||
1595 | c = audigy_remove_ctls_i2c_adc; | ||
1596 | for (; *c; c++) | ||
1597 | remove_ctl(card, *c); | ||
901 | } else { | 1598 | } else { |
902 | no_ac97: | 1599 | no_ac97: |
903 | if (emu->card_capabilities->ecard) | 1600 | if (emu->card_capabilities->ecard) |
@@ -911,6 +1608,8 @@ int __devinit snd_emu10k1_mixer(struct snd_emu10k1 *emu, | |||
911 | if (emu->audigy) | 1608 | if (emu->audigy) |
912 | if (emu->card_capabilities->adc_1361t) | 1609 | if (emu->card_capabilities->adc_1361t) |
913 | c = audigy_rename_ctls_1361t_adc; | 1610 | c = audigy_rename_ctls_1361t_adc; |
1611 | else if (emu->card_capabilities->i2c_adc) | ||
1612 | c = audigy_rename_ctls_i2c_adc; | ||
914 | else | 1613 | else |
915 | c = audigy_rename_ctls; | 1614 | c = audigy_rename_ctls; |
916 | else | 1615 | else |
@@ -1021,7 +1720,7 @@ int __devinit snd_emu10k1_mixer(struct snd_emu10k1 *emu, | |||
1021 | return err; | 1720 | return err; |
1022 | } | 1721 | } |
1023 | 1722 | ||
1024 | if ( emu->card_capabilities->emu1212m) { | 1723 | if ( emu->card_capabilities->emu1010) { |
1025 | ; /* Disable the snd_audigy_spdif_shared_spdif */ | 1724 | ; /* Disable the snd_audigy_spdif_shared_spdif */ |
1026 | } else if (emu->audigy) { | 1725 | } else if (emu->audigy) { |
1027 | if ((kctl = snd_ctl_new1(&snd_audigy_shared_spdif, emu)) == NULL) | 1726 | if ((kctl = snd_ctl_new1(&snd_audigy_shared_spdif, emu)) == NULL) |
@@ -1045,6 +1744,48 @@ int __devinit snd_emu10k1_mixer(struct snd_emu10k1 *emu, | |||
1045 | if ((err = snd_p16v_mixer(emu))) | 1744 | if ((err = snd_p16v_mixer(emu))) |
1046 | return err; | 1745 | return err; |
1047 | } | 1746 | } |
1747 | |||
1748 | if ( emu->card_capabilities->emu1010) { | ||
1749 | int i; | ||
1750 | |||
1751 | for (i = 0; i < ARRAY_SIZE(snd_emu1010_output_enum_ctls); i++) { | ||
1752 | err = snd_ctl_add(card, snd_ctl_new1(&snd_emu1010_output_enum_ctls[i], emu)); | ||
1753 | if (err < 0) | ||
1754 | return err; | ||
1755 | } | ||
1756 | for (i = 0; i < ARRAY_SIZE(snd_emu1010_input_enum_ctls); i++) { | ||
1757 | err = snd_ctl_add(card, snd_ctl_new1(&snd_emu1010_input_enum_ctls[i], emu)); | ||
1758 | if (err < 0) | ||
1759 | return err; | ||
1760 | } | ||
1761 | for (i = 0; i < ARRAY_SIZE(snd_emu1010_adc_pads); i++) { | ||
1762 | err = snd_ctl_add(card, snd_ctl_new1(&snd_emu1010_adc_pads[i], emu)); | ||
1763 | if (err < 0) | ||
1764 | return err; | ||
1765 | } | ||
1766 | for (i = 0; i < ARRAY_SIZE(snd_emu1010_dac_pads); i++) { | ||
1767 | err = snd_ctl_add(card, snd_ctl_new1(&snd_emu1010_dac_pads[i], emu)); | ||
1768 | if (err < 0) | ||
1769 | return err; | ||
1770 | } | ||
1771 | err = snd_ctl_add(card, snd_ctl_new1(&snd_emu1010_internal_clock, emu)); | ||
1772 | if (err < 0) | ||
1773 | return err; | ||
1774 | } | ||
1775 | |||
1776 | if ( emu->card_capabilities->i2c_adc) { | ||
1777 | int i; | ||
1778 | |||
1779 | err = snd_ctl_add(card, snd_ctl_new1(&snd_audigy_i2c_capture_source, emu)); | ||
1780 | if (err < 0) | ||
1781 | return err; | ||
1782 | |||
1783 | for (i = 0; i < ARRAY_SIZE(snd_audigy_i2c_volume_ctls); i++) { | ||
1784 | err = snd_ctl_add(card, snd_ctl_new1(&snd_audigy_i2c_volume_ctls[i], emu)); | ||
1785 | if (err < 0) | ||
1786 | return err; | ||
1787 | } | ||
1788 | } | ||
1048 | 1789 | ||
1049 | return 0; | 1790 | return 0; |
1050 | } | 1791 | } |