diff options
Diffstat (limited to 'sound/pci/emu10k1/emumixer.c')
-rw-r--r-- | sound/pci/emu10k1/emumixer.c | 216 |
1 files changed, 170 insertions, 46 deletions
diff --git a/sound/pci/emu10k1/emumixer.c b/sound/pci/emu10k1/emumixer.c index c8176dc8142f..2edf92a4f065 100644 --- a/sound/pci/emu10k1/emumixer.c +++ b/sound/pci/emu10k1/emumixer.c | |||
@@ -315,30 +315,30 @@ static int snd_emu1010_input_source_put(struct snd_kcontrol *kcontrol, | |||
315 | } | 315 | } |
316 | 316 | ||
317 | static struct snd_kcontrol_new snd_emu1010_output_enum_ctls[] __devinitdata = { | 317 | static struct snd_kcontrol_new snd_emu1010_output_enum_ctls[] __devinitdata = { |
318 | EMU1010_SOURCE_OUTPUT("Playback Dock DAC1 Left", 0), | 318 | EMU1010_SOURCE_OUTPUT("Dock DAC1 Left Playback Switch", 0), |
319 | EMU1010_SOURCE_OUTPUT("Playback Dock DAC1 Right", 1), | 319 | EMU1010_SOURCE_OUTPUT("Dock DAC1 Right Playback Switch", 1), |
320 | EMU1010_SOURCE_OUTPUT("Playback Dock DAC2 Left", 2), | 320 | EMU1010_SOURCE_OUTPUT("Dock DAC2 Left Playback Switch", 2), |
321 | EMU1010_SOURCE_OUTPUT("Playback Dock DAC2 Right", 3), | 321 | EMU1010_SOURCE_OUTPUT("Dock DAC2 Right Playback Switch", 3), |
322 | EMU1010_SOURCE_OUTPUT("Playback Dock DAC3 Left", 4), | 322 | EMU1010_SOURCE_OUTPUT("Dock DAC3 Left Playback Switch", 4), |
323 | EMU1010_SOURCE_OUTPUT("Playback Dock DAC3 Right", 5), | 323 | EMU1010_SOURCE_OUTPUT("Dock DAC3 Right Playback Switch", 5), |
324 | EMU1010_SOURCE_OUTPUT("Playback Dock DAC4 Left", 6), | 324 | EMU1010_SOURCE_OUTPUT("Dock DAC4 Left Playback Switch", 6), |
325 | EMU1010_SOURCE_OUTPUT("Playback Dock DAC4 Right", 7), | 325 | EMU1010_SOURCE_OUTPUT("Dock DAC4 Right Playback Switch", 7), |
326 | EMU1010_SOURCE_OUTPUT("Playback Dock Phones Left", 8), | 326 | EMU1010_SOURCE_OUTPUT("Dock Phones Left Playback Switch", 8), |
327 | EMU1010_SOURCE_OUTPUT("Playback Dock Phones Right", 9), | 327 | EMU1010_SOURCE_OUTPUT("Dock Phones Right Playback Switch", 9), |
328 | EMU1010_SOURCE_OUTPUT("Playback Dock SPDIF Left", 0xa), | 328 | EMU1010_SOURCE_OUTPUT("Dock SPDIF Left Playback Switch", 0xa), |
329 | EMU1010_SOURCE_OUTPUT("Playback Dock SPDIF Right", 0xb), | 329 | EMU1010_SOURCE_OUTPUT("Dock SPDIF Right Playback Switch", 0xb), |
330 | EMU1010_SOURCE_OUTPUT("Playback 1010 SPDIF Left", 0xc), | 330 | EMU1010_SOURCE_OUTPUT("1010 SPDIF Left Playback Switch", 0xc), |
331 | EMU1010_SOURCE_OUTPUT("Playback 1010 SPDIF Right", 0xd), | 331 | EMU1010_SOURCE_OUTPUT("1010 SPDIF Right Playback Switch", 0xd), |
332 | EMU1010_SOURCE_OUTPUT("Playback 0202 DAC Left", 0xe), | 332 | EMU1010_SOURCE_OUTPUT("0202 DAC Left Playback Switch", 0xe), |
333 | EMU1010_SOURCE_OUTPUT("Playback 0202 DAC Right", 0xf), | 333 | EMU1010_SOURCE_OUTPUT("0202 DAC Right Playback Switch", 0xf), |
334 | EMU1010_SOURCE_OUTPUT("Playback 1010 ADAT 0", 0x10), | 334 | EMU1010_SOURCE_OUTPUT("1010 ADAT 0 Playback Switch", 0x10), |
335 | EMU1010_SOURCE_OUTPUT("Playback 1010 ADAT 1", 0x11), | 335 | EMU1010_SOURCE_OUTPUT("1010 ADAT 1 Playback Switch", 0x11), |
336 | EMU1010_SOURCE_OUTPUT("Playback 1010 ADAT 2", 0x12), | 336 | EMU1010_SOURCE_OUTPUT("1010 ADAT 2 Playback Switch", 0x12), |
337 | EMU1010_SOURCE_OUTPUT("Playback 1010 ADAT 3", 0x13), | 337 | EMU1010_SOURCE_OUTPUT("1010 ADAT 3 Playback Switch", 0x13), |
338 | EMU1010_SOURCE_OUTPUT("Playback 1010 ADAT 4", 0x14), | 338 | EMU1010_SOURCE_OUTPUT("1010 ADAT 4 Playback Switch", 0x14), |
339 | EMU1010_SOURCE_OUTPUT("Playback 1010 ADAT 5", 0x15), | 339 | EMU1010_SOURCE_OUTPUT("1010 ADAT 5 Playback Switch", 0x15), |
340 | EMU1010_SOURCE_OUTPUT("Playback 1010 ADAT 6", 0x16), | 340 | EMU1010_SOURCE_OUTPUT("1010 ADAT 6 Playback Switch", 0x16), |
341 | EMU1010_SOURCE_OUTPUT("Playback 1010 ADAT 7", 0x17), | 341 | EMU1010_SOURCE_OUTPUT("1010 ADAT 7 Playback Switch", 0x17), |
342 | }; | 342 | }; |
343 | 343 | ||
344 | #define EMU1010_SOURCE_INPUT(xname,chid) \ | 344 | #define EMU1010_SOURCE_INPUT(xname,chid) \ |
@@ -352,28 +352,142 @@ static struct snd_kcontrol_new snd_emu1010_output_enum_ctls[] __devinitdata = { | |||
352 | } | 352 | } |
353 | 353 | ||
354 | static struct snd_kcontrol_new snd_emu1010_input_enum_ctls[] __devinitdata = { | 354 | static struct snd_kcontrol_new snd_emu1010_input_enum_ctls[] __devinitdata = { |
355 | EMU1010_SOURCE_INPUT("DSP 0 CAPTURE ENUM", 0), | 355 | EMU1010_SOURCE_INPUT("DSP 0 Capture Switch", 0), |
356 | EMU1010_SOURCE_INPUT("DSP 1 CAPTURE ENUM", 1), | 356 | EMU1010_SOURCE_INPUT("DSP 1 Capture Switch", 1), |
357 | EMU1010_SOURCE_INPUT("DSP 2 CAPTURE ENUM", 2), | 357 | EMU1010_SOURCE_INPUT("DSP 2 Capture Switch", 2), |
358 | EMU1010_SOURCE_INPUT("DSP 3 CAPTURE ENUM", 3), | 358 | EMU1010_SOURCE_INPUT("DSP 3 Capture Switch", 3), |
359 | EMU1010_SOURCE_INPUT("DSP 4 CAPTURE ENUM", 4), | 359 | EMU1010_SOURCE_INPUT("DSP 4 Capture Switch", 4), |
360 | EMU1010_SOURCE_INPUT("DSP 5 CAPTURE ENUM", 5), | 360 | EMU1010_SOURCE_INPUT("DSP 5 Capture Switch", 5), |
361 | EMU1010_SOURCE_INPUT("DSP 6 CAPTURE ENUM", 6), | 361 | EMU1010_SOURCE_INPUT("DSP 6 Capture Switch", 6), |
362 | EMU1010_SOURCE_INPUT("DSP 7 CAPTURE ENUM", 7), | 362 | EMU1010_SOURCE_INPUT("DSP 7 Capture Switch", 7), |
363 | EMU1010_SOURCE_INPUT("DSP 8 CAPTURE ENUM", 8), | 363 | EMU1010_SOURCE_INPUT("DSP 8 Capture Switch", 8), |
364 | EMU1010_SOURCE_INPUT("DSP 9 CAPTURE ENUM", 9), | 364 | EMU1010_SOURCE_INPUT("DSP 9 Capture Switch", 9), |
365 | EMU1010_SOURCE_INPUT("DSP A CAPTURE ENUM", 0xa), | 365 | EMU1010_SOURCE_INPUT("DSP A Capture Switch", 0xa), |
366 | EMU1010_SOURCE_INPUT("DSP B CAPTURE ENUM", 0xb), | 366 | EMU1010_SOURCE_INPUT("DSP B Capture Switch", 0xb), |
367 | EMU1010_SOURCE_INPUT("DSP C CAPTURE ENUM", 0xc), | 367 | EMU1010_SOURCE_INPUT("DSP C Capture Switch", 0xc), |
368 | EMU1010_SOURCE_INPUT("DSP D CAPTURE ENUM", 0xd), | 368 | EMU1010_SOURCE_INPUT("DSP D Capture Switch", 0xd), |
369 | EMU1010_SOURCE_INPUT("DSP E CAPTURE ENUM", 0xe), | 369 | EMU1010_SOURCE_INPUT("DSP E Capture Switch", 0xe), |
370 | EMU1010_SOURCE_INPUT("DSP F CAPTURE ENUM", 0xf), | 370 | EMU1010_SOURCE_INPUT("DSP F Capture Switch", 0xf), |
371 | EMU1010_SOURCE_INPUT("DSP 10 CAPTURE ENUM", 0x10), | 371 | EMU1010_SOURCE_INPUT("DSP 10 Capture Switch", 0x10), |
372 | EMU1010_SOURCE_INPUT("DSP 11 CAPTURE ENUM", 0x11), | 372 | EMU1010_SOURCE_INPUT("DSP 11 Capture Switch", 0x11), |
373 | EMU1010_SOURCE_INPUT("DSP 12 CAPTURE ENUM", 0x12), | 373 | EMU1010_SOURCE_INPUT("DSP 12 Capture Switch", 0x12), |
374 | EMU1010_SOURCE_INPUT("DSP 13 CAPTURE ENUM", 0x13), | 374 | EMU1010_SOURCE_INPUT("DSP 13 Capture Switch", 0x13), |
375 | EMU1010_SOURCE_INPUT("DSP 14 CAPTURE ENUM", 0x14), | 375 | EMU1010_SOURCE_INPUT("DSP 14 Capture Switch", 0x14), |
376 | EMU1010_SOURCE_INPUT("DSP 15 CAPTURE ENUM", 0x15), | 376 | EMU1010_SOURCE_INPUT("DSP 15 Capture Switch", 0x15), |
377 | }; | ||
378 | |||
379 | |||
380 | |||
381 | |||
382 | static int snd_emu1010_adc_pads_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | ||
383 | { | ||
384 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; | ||
385 | uinfo->count = 1; | ||
386 | uinfo->value.integer.min = 0; | ||
387 | uinfo->value.integer.max = 1; | ||
388 | return 0; | ||
389 | } | ||
390 | |||
391 | static int snd_emu1010_adc_pads_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | ||
392 | { | ||
393 | struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); | ||
394 | unsigned int mask = kcontrol->private_value & 0xff; | ||
395 | ucontrol->value.integer.value[0] = (emu->emu1010.adc_pads & mask) ? 1 : 0; | ||
396 | return 0; | ||
397 | } | ||
398 | |||
399 | static int snd_emu1010_adc_pads_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | ||
400 | { | ||
401 | struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); | ||
402 | unsigned int mask = kcontrol->private_value & 0xff; | ||
403 | unsigned int val, cache; | ||
404 | val = ucontrol->value.integer.value[0]; | ||
405 | cache = emu->emu1010.adc_pads; | ||
406 | if (val == 1) | ||
407 | cache = cache | mask; | ||
408 | else | ||
409 | cache = cache & ~mask; | ||
410 | if (cache != emu->emu1010.adc_pads) { | ||
411 | snd_emu1010_fpga_write(emu, EMU_HANA_ADC_PADS, cache ); | ||
412 | emu->emu1010.adc_pads = cache; | ||
413 | } | ||
414 | |||
415 | return 0; | ||
416 | } | ||
417 | |||
418 | |||
419 | |||
420 | #define EMU1010_ADC_PADS(xname,chid) \ | ||
421 | { \ | ||
422 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | ||
423 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ | ||
424 | .info = snd_emu1010_adc_pads_info, \ | ||
425 | .get = snd_emu1010_adc_pads_get, \ | ||
426 | .put = snd_emu1010_adc_pads_put, \ | ||
427 | .private_value = chid \ | ||
428 | } | ||
429 | |||
430 | static struct snd_kcontrol_new snd_emu1010_adc_pads[] __devinitdata = { | ||
431 | EMU1010_ADC_PADS("ADC1 14dB PAD Audio Dock Capture Switch", EMU_HANA_DOCK_ADC_PAD1), | ||
432 | EMU1010_ADC_PADS("ADC2 14dB PAD Audio Dock Capture Switch", EMU_HANA_DOCK_ADC_PAD2), | ||
433 | EMU1010_ADC_PADS("ADC3 14dB PAD Audio Dock Capture Switch", EMU_HANA_DOCK_ADC_PAD3), | ||
434 | EMU1010_ADC_PADS("ADC1 14dB PAD 0202 Capture Switch", EMU_HANA_0202_ADC_PAD1), | ||
435 | }; | ||
436 | |||
437 | static int snd_emu1010_dac_pads_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | ||
438 | { | ||
439 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; | ||
440 | uinfo->count = 1; | ||
441 | uinfo->value.integer.min = 0; | ||
442 | uinfo->value.integer.max = 1; | ||
443 | return 0; | ||
444 | } | ||
445 | |||
446 | static int snd_emu1010_dac_pads_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | ||
447 | { | ||
448 | struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); | ||
449 | unsigned int mask = kcontrol->private_value & 0xff; | ||
450 | ucontrol->value.integer.value[0] = (emu->emu1010.dac_pads & mask) ? 1 : 0; | ||
451 | return 0; | ||
452 | } | ||
453 | |||
454 | static int snd_emu1010_dac_pads_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | ||
455 | { | ||
456 | struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); | ||
457 | unsigned int mask = kcontrol->private_value & 0xff; | ||
458 | unsigned int val, cache; | ||
459 | val = ucontrol->value.integer.value[0]; | ||
460 | cache = emu->emu1010.dac_pads; | ||
461 | if (val == 1) | ||
462 | cache = cache | mask; | ||
463 | else | ||
464 | cache = cache & ~mask; | ||
465 | if (cache != emu->emu1010.dac_pads) { | ||
466 | snd_emu1010_fpga_write(emu, EMU_HANA_DAC_PADS, cache ); | ||
467 | emu->emu1010.dac_pads = cache; | ||
468 | } | ||
469 | |||
470 | return 0; | ||
471 | } | ||
472 | |||
473 | |||
474 | |||
475 | #define EMU1010_DAC_PADS(xname,chid) \ | ||
476 | { \ | ||
477 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | ||
478 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ | ||
479 | .info = snd_emu1010_dac_pads_info, \ | ||
480 | .get = snd_emu1010_dac_pads_get, \ | ||
481 | .put = snd_emu1010_dac_pads_put, \ | ||
482 | .private_value = chid \ | ||
483 | } | ||
484 | |||
485 | static struct snd_kcontrol_new snd_emu1010_dac_pads[] __devinitdata = { | ||
486 | EMU1010_DAC_PADS("DAC1 Audio Dock 14dB PAD Playback Switch", EMU_HANA_DOCK_DAC_PAD1), | ||
487 | EMU1010_DAC_PADS("DAC2 Audio Dock 14dB PAD Playback Switch", EMU_HANA_DOCK_DAC_PAD2), | ||
488 | EMU1010_DAC_PADS("DAC3 Audio Dock 14dB PAD Playback Switch", EMU_HANA_DOCK_DAC_PAD3), | ||
489 | EMU1010_DAC_PADS("DAC4 Audio Dock 14dB PAD Playback Switch", EMU_HANA_DOCK_DAC_PAD4), | ||
490 | EMU1010_DAC_PADS("DAC1 0202 14dB PAD Playback Switch", EMU_HANA_0202_DAC_PAD1), | ||
377 | }; | 491 | }; |
378 | 492 | ||
379 | #if 0 | 493 | #if 0 |
@@ -1367,6 +1481,16 @@ int __devinit snd_emu10k1_mixer(struct snd_emu10k1 *emu, | |||
1367 | if (err < 0) | 1481 | if (err < 0) |
1368 | return err; | 1482 | return err; |
1369 | } | 1483 | } |
1484 | for (i = 0; i < ARRAY_SIZE(snd_emu1010_adc_pads); i++) { | ||
1485 | err = snd_ctl_add(card, snd_ctl_new1(&snd_emu1010_adc_pads[i], emu)); | ||
1486 | if (err < 0) | ||
1487 | return err; | ||
1488 | } | ||
1489 | for (i = 0; i < ARRAY_SIZE(snd_emu1010_dac_pads); i++) { | ||
1490 | err = snd_ctl_add(card, snd_ctl_new1(&snd_emu1010_dac_pads[i], emu)); | ||
1491 | if (err < 0) | ||
1492 | return err; | ||
1493 | } | ||
1370 | } | 1494 | } |
1371 | 1495 | ||
1372 | return 0; | 1496 | return 0; |