aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/emu10k1/emumixer.c
diff options
context:
space:
mode:
authorJames Courtier-Dutton <James@superbug.co.uk>2006-10-01 05:48:04 -0400
committerJaroslav Kysela <perex@suse.cz>2007-02-09 02:59:59 -0500
commit9f4bd5dde81b5cb94e4f52f2f05825aa0422f1ff (patch)
tree884d0016c361a555ab1bc95287e64a6c109a0609 /sound/pci/emu10k1/emumixer.c
parent5986a2ec35836a878350c54af4bd91b1de6abc59 (diff)
[ALSA] snd-emu10k1: Added support for emu1010, including E-Mu 1212m and E-Mu 1820m
Signed-off-by: James Courtier-Dutton <James@superbug.co.uk> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci/emu10k1/emumixer.c')
-rw-r--r--sound/pci/emu10k1/emumixer.c325
1 files changed, 324 insertions, 1 deletions
diff --git a/sound/pci/emu10k1/emumixer.c b/sound/pci/emu10k1/emumixer.c
index c31f3d0877fa..c8176dc8142f 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 *
@@ -68,6 +71,311 @@ static int snd_emu10k1_spdif_get_mask(struct snd_kcontrol *kcontrol,
68 return 0; 71 return 0;
69} 72}
70 73
74static char *emu1010_src_texts[] = {
75 "Silence",
76 "Dock Mic A",
77 "Dock Mic B",
78 "Dock ADC1 Left",
79 "Dock ADC1 Right",
80 "Dock ADC2 Left",
81 "Dock ADC2 Right",
82 "Dock ADC3 Left",
83 "Dock ADC3 Right",
84 "0202 ADC Left",
85 "0202 ADC Right",
86 "0202 SPDIF Left",
87 "0202 SPDIF Right",
88 "ADAT 0",
89 "ADAT 1",
90 "ADAT 2",
91 "ADAT 3",
92 "ADAT 4",
93 "ADAT 5",
94 "ADAT 6",
95 "ADAT 7",
96 "DSP 0",
97 "DSP 1",
98 "DSP 2",
99 "DSP 3",
100 "DSP 4",
101 "DSP 5",
102 "DSP 6",
103 "DSP 7",
104 "DSP 8",
105 "DSP 9",
106 "DSP 10",
107 "DSP 11",
108 "DSP 12",
109 "DSP 13",
110 "DSP 14",
111 "DSP 15",
112 "DSP 16",
113 "DSP 17",
114 "DSP 18",
115 "DSP 19",
116 "DSP 20",
117 "DSP 21",
118 "DSP 22",
119 "DSP 23",
120 "DSP 24",
121 "DSP 25",
122 "DSP 26",
123 "DSP 27",
124 "DSP 28",
125 "DSP 29",
126 "DSP 30",
127 "DSP 31",
128};
129
130static unsigned int emu1010_src_regs[] = {
131 EMU_SRC_SILENCE,/* 0 */
132 EMU_SRC_DOCK_MIC_A1, /* 1 */
133 EMU_SRC_DOCK_MIC_B1, /* 2 */
134 EMU_SRC_DOCK_ADC1_LEFT1, /* 3 */
135 EMU_SRC_DOCK_ADC1_RIGHT1, /* 4 */
136 EMU_SRC_DOCK_ADC2_LEFT1, /* 5 */
137 EMU_SRC_DOCK_ADC2_RIGHT1, /* 6 */
138 EMU_SRC_DOCK_ADC3_LEFT1, /* 7 */
139 EMU_SRC_DOCK_ADC3_RIGHT1, /* 8 */
140 EMU_SRC_HAMOA_ADC_LEFT1, /* 9 */
141 EMU_SRC_HAMOA_ADC_RIGHT1, /* 10 */
142 EMU_SRC_HANA_SPDIF_LEFT1, /* 11 */
143 EMU_SRC_HANA_SPDIF_RIGHT1, /* 12 */
144 EMU_SRC_HANA_ADAT, /* 13 */
145 EMU_SRC_HANA_ADAT+1, /* 14 */
146 EMU_SRC_HANA_ADAT+2, /* 15 */
147 EMU_SRC_HANA_ADAT+3, /* 16 */
148 EMU_SRC_HANA_ADAT+4, /* 17 */
149 EMU_SRC_HANA_ADAT+5, /* 18 */
150 EMU_SRC_HANA_ADAT+6, /* 19 */
151 EMU_SRC_HANA_ADAT+7, /* 20 */
152 EMU_SRC_ALICE_EMU32A, /* 21 */
153 EMU_SRC_ALICE_EMU32A+1, /* 22 */
154 EMU_SRC_ALICE_EMU32A+2, /* 23 */
155 EMU_SRC_ALICE_EMU32A+3, /* 24 */
156 EMU_SRC_ALICE_EMU32A+4, /* 25 */
157 EMU_SRC_ALICE_EMU32A+5, /* 26 */
158 EMU_SRC_ALICE_EMU32A+6, /* 27 */
159 EMU_SRC_ALICE_EMU32A+7, /* 28 */
160 EMU_SRC_ALICE_EMU32A+8, /* 29 */
161 EMU_SRC_ALICE_EMU32A+9, /* 30 */
162 EMU_SRC_ALICE_EMU32A+0xa, /* 31 */
163 EMU_SRC_ALICE_EMU32A+0xb, /* 32 */
164 EMU_SRC_ALICE_EMU32A+0xc, /* 33 */
165 EMU_SRC_ALICE_EMU32A+0xd, /* 34 */
166 EMU_SRC_ALICE_EMU32A+0xe, /* 35 */
167 EMU_SRC_ALICE_EMU32A+0xf, /* 36 */
168 EMU_SRC_ALICE_EMU32B, /* 37 */
169 EMU_SRC_ALICE_EMU32B+1, /* 38 */
170 EMU_SRC_ALICE_EMU32B+2, /* 39 */
171 EMU_SRC_ALICE_EMU32B+3, /* 40 */
172 EMU_SRC_ALICE_EMU32B+4, /* 41 */
173 EMU_SRC_ALICE_EMU32B+5, /* 42 */
174 EMU_SRC_ALICE_EMU32B+6, /* 43 */
175 EMU_SRC_ALICE_EMU32B+7, /* 44 */
176 EMU_SRC_ALICE_EMU32B+8, /* 45 */
177 EMU_SRC_ALICE_EMU32B+9, /* 46 */
178 EMU_SRC_ALICE_EMU32B+0xa, /* 47 */
179 EMU_SRC_ALICE_EMU32B+0xb, /* 48 */
180 EMU_SRC_ALICE_EMU32B+0xc, /* 49 */
181 EMU_SRC_ALICE_EMU32B+0xd, /* 50 */
182 EMU_SRC_ALICE_EMU32B+0xe, /* 51 */
183 EMU_SRC_ALICE_EMU32B+0xf, /* 52 */
184};
185
186static unsigned int emu1010_output_dst[] = {
187 EMU_DST_DOCK_DAC1_LEFT1, /* 0 */
188 EMU_DST_DOCK_DAC1_RIGHT1, /* 1 */
189 EMU_DST_DOCK_DAC2_LEFT1, /* 2 */
190 EMU_DST_DOCK_DAC2_RIGHT1, /* 3 */
191 EMU_DST_DOCK_DAC3_LEFT1, /* 4 */
192 EMU_DST_DOCK_DAC3_RIGHT1, /* 5 */
193 EMU_DST_DOCK_DAC4_LEFT1, /* 6 */
194 EMU_DST_DOCK_DAC4_RIGHT1, /* 7 */
195 EMU_DST_DOCK_PHONES_LEFT1, /* 8 */
196 EMU_DST_DOCK_PHONES_RIGHT1, /* 9 */
197 EMU_DST_DOCK_SPDIF_LEFT1, /* 10 */
198 EMU_DST_DOCK_SPDIF_RIGHT1, /* 11 */
199 EMU_DST_HANA_SPDIF_LEFT1, /* 12 */
200 EMU_DST_HANA_SPDIF_RIGHT1, /* 13 */
201 EMU_DST_HAMOA_DAC_LEFT1, /* 14 */
202 EMU_DST_HAMOA_DAC_RIGHT1, /* 15 */
203 EMU_DST_HANA_ADAT, /* 16 */
204 EMU_DST_HANA_ADAT+1, /* 17 */
205 EMU_DST_HANA_ADAT+2, /* 18 */
206 EMU_DST_HANA_ADAT+3, /* 19 */
207 EMU_DST_HANA_ADAT+4, /* 20 */
208 EMU_DST_HANA_ADAT+5, /* 21 */
209 EMU_DST_HANA_ADAT+6, /* 22 */
210 EMU_DST_HANA_ADAT+7, /* 23 */
211};
212
213static unsigned int emu1010_input_dst[] = {
214 EMU_DST_ALICE2_EMU32_0,
215 EMU_DST_ALICE2_EMU32_1,
216 EMU_DST_ALICE2_EMU32_2,
217 EMU_DST_ALICE2_EMU32_3,
218 EMU_DST_ALICE2_EMU32_4,
219 EMU_DST_ALICE2_EMU32_5,
220 EMU_DST_ALICE2_EMU32_6,
221 EMU_DST_ALICE2_EMU32_7,
222 EMU_DST_ALICE2_EMU32_8,
223 EMU_DST_ALICE2_EMU32_9,
224 EMU_DST_ALICE2_EMU32_A,
225 EMU_DST_ALICE2_EMU32_B,
226 EMU_DST_ALICE2_EMU32_C,
227 EMU_DST_ALICE2_EMU32_D,
228 EMU_DST_ALICE2_EMU32_E,
229 EMU_DST_ALICE2_EMU32_F,
230 EMU_DST_ALICE_I2S0_LEFT,
231 EMU_DST_ALICE_I2S0_RIGHT,
232 EMU_DST_ALICE_I2S1_LEFT,
233 EMU_DST_ALICE_I2S1_RIGHT,
234 EMU_DST_ALICE_I2S2_LEFT,
235 EMU_DST_ALICE_I2S2_RIGHT,
236};
237
238static int snd_emu1010_input_output_source_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
239{
240 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
241 uinfo->count = 1;
242 uinfo->value.enumerated.items = 53;
243 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
244 uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
245 strcpy(uinfo->value.enumerated.name, emu1010_src_texts[uinfo->value.enumerated.item]);
246 return 0;
247}
248
249static int snd_emu1010_output_source_get(struct snd_kcontrol *kcontrol,
250 struct snd_ctl_elem_value *ucontrol)
251{
252 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
253 int channel;
254
255 channel = (kcontrol->private_value) & 0xff;
256 ucontrol->value.enumerated.item[0] = emu->emu1010.output_source[channel];
257 return 0;
258}
259
260static int snd_emu1010_output_source_put(struct snd_kcontrol *kcontrol,
261 struct snd_ctl_elem_value *ucontrol)
262{
263 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
264 int change = 0;
265 unsigned int val;
266 int channel;
267
268 channel = (kcontrol->private_value) & 0xff;
269 if (emu->emu1010.output_source[channel] != ucontrol->value.enumerated.item[0]) {
270 val = emu->emu1010.output_source[channel] = ucontrol->value.enumerated.item[0];
271 change = 1;
272 snd_emu1010_fpga_link_dst_src_write(emu,
273 emu1010_output_dst[channel], emu1010_src_regs[val]);
274 }
275 return change;
276}
277
278static int snd_emu1010_input_source_get(struct snd_kcontrol *kcontrol,
279 struct snd_ctl_elem_value *ucontrol)
280{
281 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
282 int channel;
283
284 channel = (kcontrol->private_value) & 0xff;
285 ucontrol->value.enumerated.item[0] = emu->emu1010.input_source[channel];
286 return 0;
287}
288
289static int snd_emu1010_input_source_put(struct snd_kcontrol *kcontrol,
290 struct snd_ctl_elem_value *ucontrol)
291{
292 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
293 int change = 0;
294 unsigned int val;
295 int channel;
296
297 channel = (kcontrol->private_value) & 0xff;
298 if (emu->emu1010.input_source[channel] != ucontrol->value.enumerated.item[0]) {
299 val = emu->emu1010.input_source[channel] = ucontrol->value.enumerated.item[0];
300 change = 1;
301 snd_emu1010_fpga_link_dst_src_write(emu,
302 emu1010_input_dst[channel], emu1010_src_regs[val]);
303 }
304 return change;
305}
306
307#define EMU1010_SOURCE_OUTPUT(xname,chid) \
308{ \
309 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
310 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
311 .info = snd_emu1010_input_output_source_info, \
312 .get = snd_emu1010_output_source_get, \
313 .put = snd_emu1010_output_source_put, \
314 .private_value = chid \
315}
316
317static struct snd_kcontrol_new snd_emu1010_output_enum_ctls[] __devinitdata = {
318 EMU1010_SOURCE_OUTPUT("Playback Dock DAC1 Left", 0),
319 EMU1010_SOURCE_OUTPUT("Playback Dock DAC1 Right", 1),
320 EMU1010_SOURCE_OUTPUT("Playback Dock DAC2 Left", 2),
321 EMU1010_SOURCE_OUTPUT("Playback Dock DAC2 Right", 3),
322 EMU1010_SOURCE_OUTPUT("Playback Dock DAC3 Left", 4),
323 EMU1010_SOURCE_OUTPUT("Playback Dock DAC3 Right", 5),
324 EMU1010_SOURCE_OUTPUT("Playback Dock DAC4 Left", 6),
325 EMU1010_SOURCE_OUTPUT("Playback Dock DAC4 Right", 7),
326 EMU1010_SOURCE_OUTPUT("Playback Dock Phones Left", 8),
327 EMU1010_SOURCE_OUTPUT("Playback Dock Phones Right", 9),
328 EMU1010_SOURCE_OUTPUT("Playback Dock SPDIF Left", 0xa),
329 EMU1010_SOURCE_OUTPUT("Playback Dock SPDIF Right", 0xb),
330 EMU1010_SOURCE_OUTPUT("Playback 1010 SPDIF Left", 0xc),
331 EMU1010_SOURCE_OUTPUT("Playback 1010 SPDIF Right", 0xd),
332 EMU1010_SOURCE_OUTPUT("Playback 0202 DAC Left", 0xe),
333 EMU1010_SOURCE_OUTPUT("Playback 0202 DAC Right", 0xf),
334 EMU1010_SOURCE_OUTPUT("Playback 1010 ADAT 0", 0x10),
335 EMU1010_SOURCE_OUTPUT("Playback 1010 ADAT 1", 0x11),
336 EMU1010_SOURCE_OUTPUT("Playback 1010 ADAT 2", 0x12),
337 EMU1010_SOURCE_OUTPUT("Playback 1010 ADAT 3", 0x13),
338 EMU1010_SOURCE_OUTPUT("Playback 1010 ADAT 4", 0x14),
339 EMU1010_SOURCE_OUTPUT("Playback 1010 ADAT 5", 0x15),
340 EMU1010_SOURCE_OUTPUT("Playback 1010 ADAT 6", 0x16),
341 EMU1010_SOURCE_OUTPUT("Playback 1010 ADAT 7", 0x17),
342};
343
344#define EMU1010_SOURCE_INPUT(xname,chid) \
345{ \
346 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
347 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
348 .info = snd_emu1010_input_output_source_info, \
349 .get = snd_emu1010_input_source_get, \
350 .put = snd_emu1010_input_source_put, \
351 .private_value = chid \
352}
353
354static struct snd_kcontrol_new snd_emu1010_input_enum_ctls[] __devinitdata = {
355 EMU1010_SOURCE_INPUT("DSP 0 CAPTURE ENUM", 0),
356 EMU1010_SOURCE_INPUT("DSP 1 CAPTURE ENUM", 1),
357 EMU1010_SOURCE_INPUT("DSP 2 CAPTURE ENUM", 2),
358 EMU1010_SOURCE_INPUT("DSP 3 CAPTURE ENUM", 3),
359 EMU1010_SOURCE_INPUT("DSP 4 CAPTURE ENUM", 4),
360 EMU1010_SOURCE_INPUT("DSP 5 CAPTURE ENUM", 5),
361 EMU1010_SOURCE_INPUT("DSP 6 CAPTURE ENUM", 6),
362 EMU1010_SOURCE_INPUT("DSP 7 CAPTURE ENUM", 7),
363 EMU1010_SOURCE_INPUT("DSP 8 CAPTURE ENUM", 8),
364 EMU1010_SOURCE_INPUT("DSP 9 CAPTURE ENUM", 9),
365 EMU1010_SOURCE_INPUT("DSP A CAPTURE ENUM", 0xa),
366 EMU1010_SOURCE_INPUT("DSP B CAPTURE ENUM", 0xb),
367 EMU1010_SOURCE_INPUT("DSP C CAPTURE ENUM", 0xc),
368 EMU1010_SOURCE_INPUT("DSP D CAPTURE ENUM", 0xd),
369 EMU1010_SOURCE_INPUT("DSP E CAPTURE ENUM", 0xe),
370 EMU1010_SOURCE_INPUT("DSP F CAPTURE ENUM", 0xf),
371 EMU1010_SOURCE_INPUT("DSP 10 CAPTURE ENUM", 0x10),
372 EMU1010_SOURCE_INPUT("DSP 11 CAPTURE ENUM", 0x11),
373 EMU1010_SOURCE_INPUT("DSP 12 CAPTURE ENUM", 0x12),
374 EMU1010_SOURCE_INPUT("DSP 13 CAPTURE ENUM", 0x13),
375 EMU1010_SOURCE_INPUT("DSP 14 CAPTURE ENUM", 0x14),
376 EMU1010_SOURCE_INPUT("DSP 15 CAPTURE ENUM", 0x15),
377};
378
71#if 0 379#if 0
72static int snd_audigy_spdif_output_rate_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 380static int snd_audigy_spdif_output_rate_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
73{ 381{
@@ -1021,7 +1329,7 @@ int __devinit snd_emu10k1_mixer(struct snd_emu10k1 *emu,
1021 return err; 1329 return err;
1022 } 1330 }
1023 1331
1024 if ( emu->card_capabilities->emu1212m) { 1332 if ( emu->card_capabilities->emu1010) {
1025 ; /* Disable the snd_audigy_spdif_shared_spdif */ 1333 ; /* Disable the snd_audigy_spdif_shared_spdif */
1026 } else if (emu->audigy) { 1334 } else if (emu->audigy) {
1027 if ((kctl = snd_ctl_new1(&snd_audigy_shared_spdif, emu)) == NULL) 1335 if ((kctl = snd_ctl_new1(&snd_audigy_shared_spdif, emu)) == NULL)
@@ -1045,6 +1353,21 @@ int __devinit snd_emu10k1_mixer(struct snd_emu10k1 *emu,
1045 if ((err = snd_p16v_mixer(emu))) 1353 if ((err = snd_p16v_mixer(emu)))
1046 return err; 1354 return err;
1047 } 1355 }
1356
1357 if ( emu->card_capabilities->emu1010) {
1358 int i;
1359
1360 for (i = 0; i < ARRAY_SIZE(snd_emu1010_output_enum_ctls); i++) {
1361 err = snd_ctl_add(card, snd_ctl_new1(&snd_emu1010_output_enum_ctls[i], emu));
1362 if (err < 0)
1363 return err;
1364 }
1365 for (i = 0; i < ARRAY_SIZE(snd_emu1010_input_enum_ctls); i++) {
1366 err = snd_ctl_add(card, snd_ctl_new1(&snd_emu1010_input_enum_ctls[i], emu));
1367 if (err < 0)
1368 return err;
1369 }
1370 }
1048 1371
1049 return 0; 1372 return 0;
1050} 1373}