diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2008-04-15 02:57:31 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2008-04-24 06:00:36 -0400 |
commit | a8bb1bad9b16ab91de6568ac9356b8f705f7272b (patch) | |
tree | 95d0802d80185bf31b813fab13fbc39d5e8357b5 /sound | |
parent | 6e9fc6bd5db34a6580e1917bd0fea4b0754c7de8 (diff) |
[ALSA] virtuoso: fix DX front panel I/O
Fix the GPIO 1 mixer control to enable I/O through the front panel
connector of the Xonar DX.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/pci/oxygen/virtuoso.c | 51 |
1 files changed, 20 insertions, 31 deletions
diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c index c7080d6b71c2..6f5c2531abd0 100644 --- a/sound/pci/oxygen/virtuoso.c +++ b/sound/pci/oxygen/virtuoso.c | |||
@@ -47,7 +47,7 @@ | |||
47 | * GPI 0 <- external power present | 47 | * GPI 0 <- external power present |
48 | * | 48 | * |
49 | * GPIO 0 -> enable output to speakers | 49 | * GPIO 0 -> enable output to speakers |
50 | * GPIO 1 -> ? | 50 | * GPIO 1 -> enable front panel I/O |
51 | * GPIO 2 -> M0 of CS5361 | 51 | * GPIO 2 -> M0 of CS5361 |
52 | * GPIO 3 -> M1 of CS5361 | 52 | * GPIO 3 -> M1 of CS5361 |
53 | * GPIO 8 -> route input jack to line-in (0) or mic-in (1) | 53 | * GPIO 8 -> route input jack to line-in (0) or mic-in (1) |
@@ -119,7 +119,7 @@ MODULE_DEVICE_TABLE(pci, xonar_ids); | |||
119 | 119 | ||
120 | #define GPI_DX_EXT_POWER 0x01 | 120 | #define GPI_DX_EXT_POWER 0x01 |
121 | #define GPIO_DX_OUTPUT_ENABLE 0x0001 | 121 | #define GPIO_DX_OUTPUT_ENABLE 0x0001 |
122 | #define GPIO_DX_UNKNOWN1 0x0002 | 122 | #define GPIO_DX_FRONT_PANEL 0x0002 |
123 | #define GPIO_DX_INPUT_ROUTE 0x0100 | 123 | #define GPIO_DX_INPUT_ROUTE 0x0100 |
124 | 124 | ||
125 | #define I2C_DEVICE_CS4398 0x9e /* 10011, AD1=1, AD0=1, /W=0 */ | 125 | #define I2C_DEVICE_CS4398 0x9e /* 10011, AD1=1, AD0=1, /W=0 */ |
@@ -268,8 +268,9 @@ static void xonar_dx_init(struct oxygen *chip) | |||
268 | cs4362a_write(chip, 0x01, CS4362A_CPEN); | 268 | cs4362a_write(chip, 0x01, CS4362A_CPEN); |
269 | 269 | ||
270 | oxygen_set_bits16(chip, OXYGEN_GPIO_CONTROL, | 270 | oxygen_set_bits16(chip, OXYGEN_GPIO_CONTROL, |
271 | GPIO_DX_UNKNOWN1 | GPIO_DX_INPUT_ROUTE); | 271 | GPIO_DX_FRONT_PANEL | GPIO_DX_INPUT_ROUTE); |
272 | oxygen_clear_bits16(chip, OXYGEN_GPIO_DATA, GPIO_DX_INPUT_ROUTE); | 272 | oxygen_clear_bits16(chip, OXYGEN_GPIO_DATA, |
273 | GPIO_DX_FRONT_PANEL | GPIO_DX_INPUT_ROUTE); | ||
273 | 274 | ||
274 | xonar_common_init(chip); | 275 | xonar_common_init(chip); |
275 | 276 | ||
@@ -471,51 +472,39 @@ static const struct snd_kcontrol_new alt_switch = { | |||
471 | .put = alt_switch_put, | 472 | .put = alt_switch_put, |
472 | }; | 473 | }; |
473 | 474 | ||
474 | static int unknown_info(struct snd_kcontrol *ctl, | 475 | static int front_panel_get(struct snd_kcontrol *ctl, |
475 | struct snd_ctl_elem_info *info) | 476 | struct snd_ctl_elem_value *value) |
476 | { | ||
477 | info->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | ||
478 | info->count = 1; | ||
479 | info->value.enumerated.items = 2; | ||
480 | if (info->value.enumerated.item > 1) | ||
481 | info->value.enumerated.item = 1; | ||
482 | sprintf(info->value.enumerated.name, "%u", info->value.enumerated.item); | ||
483 | return 0; | ||
484 | } | ||
485 | |||
486 | static int unknown_get(struct snd_kcontrol *ctl, | ||
487 | struct snd_ctl_elem_value *value) | ||
488 | { | 477 | { |
489 | struct oxygen *chip = ctl->private_data; | 478 | struct oxygen *chip = ctl->private_data; |
490 | 479 | ||
491 | value->value.enumerated.item[0] = | 480 | value->value.integer.value[0] = |
492 | !!(oxygen_read16(chip, OXYGEN_GPIO_DATA) & GPIO_DX_UNKNOWN1); | 481 | !!(oxygen_read16(chip, OXYGEN_GPIO_DATA) & GPIO_DX_FRONT_PANEL); |
493 | return 0; | 482 | return 0; |
494 | } | 483 | } |
495 | 484 | ||
496 | static int unknown_put(struct snd_kcontrol *ctl, | 485 | static int front_panel_put(struct snd_kcontrol *ctl, |
497 | struct snd_ctl_elem_value *value) | 486 | struct snd_ctl_elem_value *value) |
498 | { | 487 | { |
499 | struct oxygen *chip = ctl->private_data; | 488 | struct oxygen *chip = ctl->private_data; |
500 | u16 old_reg, new_reg; | 489 | u16 old_reg, new_reg; |
501 | 490 | ||
502 | spin_lock_irq(&chip->reg_lock); | 491 | spin_lock_irq(&chip->reg_lock); |
503 | old_reg = oxygen_read16(chip, OXYGEN_GPIO_DATA); | 492 | old_reg = oxygen_read16(chip, OXYGEN_GPIO_DATA); |
504 | if (value->value.enumerated.item[0]) | 493 | if (value->value.integer.value[0]) |
505 | new_reg = old_reg | GPIO_DX_UNKNOWN1; | 494 | new_reg = old_reg | GPIO_DX_FRONT_PANEL; |
506 | else | 495 | else |
507 | new_reg = old_reg & ~GPIO_DX_UNKNOWN1; | 496 | new_reg = old_reg & ~GPIO_DX_FRONT_PANEL; |
508 | oxygen_write16(chip, OXYGEN_GPIO_DATA, new_reg); | 497 | oxygen_write16(chip, OXYGEN_GPIO_DATA, new_reg); |
509 | spin_unlock_irq(&chip->reg_lock); | 498 | spin_unlock_irq(&chip->reg_lock); |
510 | return old_reg != new_reg; | 499 | return old_reg != new_reg; |
511 | } | 500 | } |
512 | 501 | ||
513 | static const struct snd_kcontrol_new unknown_switch = { | 502 | static const struct snd_kcontrol_new front_panel_switch = { |
514 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 503 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
515 | .name = "PanelConfig?", | 504 | .name = "Front Panel Switch", |
516 | .info = unknown_info, | 505 | .info = snd_ctl_boolean_mono_info, |
517 | .get = unknown_get, | 506 | .get = front_panel_get, |
518 | .put = unknown_put, | 507 | .put = front_panel_put, |
519 | }; | 508 | }; |
520 | 509 | ||
521 | static void xonar_dx_ac97_switch(struct oxygen *chip, | 510 | static void xonar_dx_ac97_switch(struct oxygen *chip, |
@@ -565,7 +554,7 @@ static int xonar_mixer_init(struct oxygen *chip) | |||
565 | 554 | ||
566 | static int xonar_dx_mixer_init(struct oxygen *chip) | 555 | static int xonar_dx_mixer_init(struct oxygen *chip) |
567 | { | 556 | { |
568 | return snd_ctl_add(chip->card, snd_ctl_new1(&unknown_switch, chip)); | 557 | return snd_ctl_add(chip->card, snd_ctl_new1(&front_panel_switch, chip)); |
569 | } | 558 | } |
570 | 559 | ||
571 | static const struct oxygen_model xonar_models[] = { | 560 | static const struct oxygen_model xonar_models[] = { |