diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2008-04-11 04:24:48 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2008-04-24 06:00:32 -0400 |
commit | 387fb6a206749e13377ef8847f77d5341c281e7b (patch) | |
tree | e382303d237cb13051f55a9dfac5fe17ac170300 /sound/pci/oxygen/virtuoso.c | |
parent | 1d98c7d4be6ac521e3391025ddffcfe0400c798c (diff) |
[ALSA] virtuoso: add GPIO 1 mixer control
Add a mixer control for switching whatever it is that is connected to
GPIO pin 1 on the Xonar DX.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/oxygen/virtuoso.c')
-rw-r--r-- | sound/pci/oxygen/virtuoso.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c index 07d7e9b6afbb..53d7289f21c0 100644 --- a/sound/pci/oxygen/virtuoso.c +++ b/sound/pci/oxygen/virtuoso.c | |||
@@ -470,6 +470,53 @@ static const struct snd_kcontrol_new alt_switch = { | |||
470 | .put = alt_switch_put, | 470 | .put = alt_switch_put, |
471 | }; | 471 | }; |
472 | 472 | ||
473 | static int unknown_info(struct snd_kcontrol *ctl, | ||
474 | struct snd_ctl_elem_info *info) | ||
475 | { | ||
476 | info->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | ||
477 | info->count = 1; | ||
478 | info->value.enumerated.items = 2; | ||
479 | if (info->value.enumerated.item > 1) | ||
480 | info->value.enumerated.item = 1; | ||
481 | sprintf(info->value.enumerated.name, "%u", info->value.enumerated.item); | ||
482 | return 0; | ||
483 | } | ||
484 | |||
485 | static int unknown_get(struct snd_kcontrol *ctl, | ||
486 | struct snd_ctl_elem_value *value) | ||
487 | { | ||
488 | struct oxygen *chip = ctl->private_data; | ||
489 | |||
490 | value->value.enumerated.item[0] = | ||
491 | !!(oxygen_read16(chip, OXYGEN_GPIO_DATA) & GPIO_DX_UNKNOWN1); | ||
492 | return 0; | ||
493 | } | ||
494 | |||
495 | static int unknown_put(struct snd_kcontrol *ctl, | ||
496 | struct snd_ctl_elem_value *value) | ||
497 | { | ||
498 | struct oxygen *chip = ctl->private_data; | ||
499 | u16 old_reg, new_reg; | ||
500 | |||
501 | spin_lock_irq(&chip->reg_lock); | ||
502 | old_reg = oxygen_read16(chip, OXYGEN_GPIO_DATA); | ||
503 | if (value->value.enumerated.item[0]) | ||
504 | new_reg = old_reg | GPIO_DX_UNKNOWN1; | ||
505 | else | ||
506 | new_reg = old_reg & ~GPIO_DX_UNKNOWN1; | ||
507 | oxygen_write16(chip, OXYGEN_GPIO_DATA, new_reg); | ||
508 | spin_unlock_irq(&chip->reg_lock); | ||
509 | return old_reg != new_reg; | ||
510 | } | ||
511 | |||
512 | static const struct snd_kcontrol_new unknown_switch = { | ||
513 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
514 | .name = "PanelConfig?", | ||
515 | .info = unknown_info, | ||
516 | .get = unknown_get, | ||
517 | .put = unknown_put, | ||
518 | }; | ||
519 | |||
473 | static void xonar_dx_ac97_switch(struct oxygen *chip, | 520 | static void xonar_dx_ac97_switch(struct oxygen *chip, |
474 | unsigned int reg, unsigned int mute) | 521 | unsigned int reg, unsigned int mute) |
475 | { | 522 | { |
@@ -515,6 +562,11 @@ static int xonar_mixer_init(struct oxygen *chip) | |||
515 | return snd_ctl_add(chip->card, snd_ctl_new1(&alt_switch, chip)); | 562 | return snd_ctl_add(chip->card, snd_ctl_new1(&alt_switch, chip)); |
516 | } | 563 | } |
517 | 564 | ||
565 | static int xonar_dx_mixer_init(struct oxygen *chip) | ||
566 | { | ||
567 | return snd_ctl_add(chip->card, snd_ctl_new1(&unknown_switch, chip)); | ||
568 | } | ||
569 | |||
518 | static const struct oxygen_model xonar_models[] = { | 570 | static const struct oxygen_model xonar_models[] = { |
519 | [MODEL_D2] = { | 571 | [MODEL_D2] = { |
520 | .shortname = "Xonar D2", | 572 | .shortname = "Xonar D2", |
@@ -574,6 +626,7 @@ static const struct oxygen_model xonar_models[] = { | |||
574 | .owner = THIS_MODULE, | 626 | .owner = THIS_MODULE, |
575 | .init = xonar_dx_init, | 627 | .init = xonar_dx_init, |
576 | .control_filter = xonar_dx_control_filter, | 628 | .control_filter = xonar_dx_control_filter, |
629 | .mixer_init = xonar_dx_mixer_init, | ||
577 | .cleanup = xonar_dx_cleanup, | 630 | .cleanup = xonar_dx_cleanup, |
578 | .set_dac_params = set_cs43xx_params, | 631 | .set_dac_params = set_cs43xx_params, |
579 | .set_adc_params = set_cs53x1_params, | 632 | .set_adc_params = set_cs53x1_params, |