diff options
| -rw-r--r-- | sound/pci/oxygen/oxygen_mixer.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/sound/pci/oxygen/oxygen_mixer.c b/sound/pci/oxygen/oxygen_mixer.c index 304da169bfdc..5401c547c4e3 100644 --- a/sound/pci/oxygen/oxygen_mixer.c +++ b/sound/pci/oxygen/oxygen_mixer.c | |||
| @@ -575,8 +575,10 @@ static int ac97_switch_put(struct snd_kcontrol *ctl, | |||
| 575 | static int ac97_volume_info(struct snd_kcontrol *ctl, | 575 | static int ac97_volume_info(struct snd_kcontrol *ctl, |
| 576 | struct snd_ctl_elem_info *info) | 576 | struct snd_ctl_elem_info *info) |
| 577 | { | 577 | { |
| 578 | int stereo = (ctl->private_value >> 16) & 1; | ||
| 579 | |||
| 578 | info->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 580 | info->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
| 579 | info->count = 2; | 581 | info->count = stereo ? 2 : 1; |
| 580 | info->value.integer.min = 0; | 582 | info->value.integer.min = 0; |
| 581 | info->value.integer.max = 0x1f; | 583 | info->value.integer.max = 0x1f; |
| 582 | return 0; | 584 | return 0; |
| @@ -587,6 +589,7 @@ static int ac97_volume_get(struct snd_kcontrol *ctl, | |||
| 587 | { | 589 | { |
| 588 | struct oxygen *chip = ctl->private_data; | 590 | struct oxygen *chip = ctl->private_data; |
| 589 | unsigned int codec = (ctl->private_value >> 24) & 1; | 591 | unsigned int codec = (ctl->private_value >> 24) & 1; |
| 592 | int stereo = (ctl->private_value >> 16) & 1; | ||
| 590 | unsigned int index = ctl->private_value & 0xff; | 593 | unsigned int index = ctl->private_value & 0xff; |
| 591 | u16 reg; | 594 | u16 reg; |
| 592 | 595 | ||
| @@ -594,7 +597,8 @@ static int ac97_volume_get(struct snd_kcontrol *ctl, | |||
| 594 | reg = oxygen_read_ac97(chip, codec, index); | 597 | reg = oxygen_read_ac97(chip, codec, index); |
| 595 | mutex_unlock(&chip->mutex); | 598 | mutex_unlock(&chip->mutex); |
| 596 | value->value.integer.value[0] = 31 - (reg & 0x1f); | 599 | value->value.integer.value[0] = 31 - (reg & 0x1f); |
| 597 | value->value.integer.value[1] = 31 - ((reg >> 8) & 0x1f); | 600 | if (stereo) |
| 601 | value->value.integer.value[1] = 31 - ((reg >> 8) & 0x1f); | ||
| 598 | return 0; | 602 | return 0; |
| 599 | } | 603 | } |
| 600 | 604 | ||
| @@ -603,6 +607,7 @@ static int ac97_volume_put(struct snd_kcontrol *ctl, | |||
| 603 | { | 607 | { |
| 604 | struct oxygen *chip = ctl->private_data; | 608 | struct oxygen *chip = ctl->private_data; |
| 605 | unsigned int codec = (ctl->private_value >> 24) & 1; | 609 | unsigned int codec = (ctl->private_value >> 24) & 1; |
| 610 | int stereo = (ctl->private_value >> 16) & 1; | ||
| 606 | unsigned int index = ctl->private_value & 0xff; | 611 | unsigned int index = ctl->private_value & 0xff; |
| 607 | u16 oldreg, newreg; | 612 | u16 oldreg, newreg; |
| 608 | int change; | 613 | int change; |
| @@ -612,8 +617,11 @@ static int ac97_volume_put(struct snd_kcontrol *ctl, | |||
| 612 | newreg = oldreg; | 617 | newreg = oldreg; |
| 613 | newreg = (newreg & ~0x1f) | | 618 | newreg = (newreg & ~0x1f) | |
| 614 | (31 - (value->value.integer.value[0] & 0x1f)); | 619 | (31 - (value->value.integer.value[0] & 0x1f)); |
| 615 | newreg = (newreg & ~0x1f00) | | 620 | if (stereo) |
| 616 | ((31 - (value->value.integer.value[0] & 0x1f)) << 8); | 621 | newreg = (newreg & ~0x1f00) | |
| 622 | ((31 - (value->value.integer.value[1] & 0x1f)) << 8); | ||
| 623 | else | ||
| 624 | newreg = (newreg & ~0x1f00) | ((newreg & 0x1f) << 8); | ||
| 617 | change = newreg != oldreg; | 625 | change = newreg != oldreg; |
| 618 | if (change) | 626 | if (change) |
| 619 | oxygen_write_ac97(chip, codec, index, newreg); | 627 | oxygen_write_ac97(chip, codec, index, newreg); |
| @@ -673,7 +681,7 @@ static int ac97_fp_rec_volume_put(struct snd_kcontrol *ctl, | |||
| 673 | .private_value = ((codec) << 24) | ((invert) << 16) | \ | 681 | .private_value = ((codec) << 24) | ((invert) << 16) | \ |
| 674 | ((bitnr) << 8) | (index), \ | 682 | ((bitnr) << 8) | (index), \ |
| 675 | } | 683 | } |
| 676 | #define AC97_VOLUME(xname, codec, index) { \ | 684 | #define AC97_VOLUME(xname, codec, index, stereo) { \ |
| 677 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | 685 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 678 | .name = xname, \ | 686 | .name = xname, \ |
| 679 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \ | 687 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| @@ -682,7 +690,7 @@ static int ac97_fp_rec_volume_put(struct snd_kcontrol *ctl, | |||
| 682 | .get = ac97_volume_get, \ | 690 | .get = ac97_volume_get, \ |
| 683 | .put = ac97_volume_put, \ | 691 | .put = ac97_volume_put, \ |
| 684 | .tlv = { .p = ac97_db_scale, }, \ | 692 | .tlv = { .p = ac97_db_scale, }, \ |
| 685 | .private_value = ((codec) << 24) | (index), \ | 693 | .private_value = ((codec) << 24) | ((stereo) << 16) | (index), \ |
| 686 | } | 694 | } |
| 687 | 695 | ||
| 688 | static DECLARE_TLV_DB_SCALE(monitor_db_scale, -1000, 1000, 0); | 696 | static DECLARE_TLV_DB_SCALE(monitor_db_scale, -1000, 1000, 0); |
| @@ -882,18 +890,18 @@ static const struct { | |||
| 882 | }; | 890 | }; |
| 883 | 891 | ||
| 884 | static const struct snd_kcontrol_new ac97_controls[] = { | 892 | static const struct snd_kcontrol_new ac97_controls[] = { |
| 885 | AC97_VOLUME("Mic Capture Volume", 0, AC97_MIC), | 893 | AC97_VOLUME("Mic Capture Volume", 0, AC97_MIC, 0), |
| 886 | AC97_SWITCH("Mic Capture Switch", 0, AC97_MIC, 15, 1), | 894 | AC97_SWITCH("Mic Capture Switch", 0, AC97_MIC, 15, 1), |
| 887 | AC97_SWITCH("Mic Boost (+20dB)", 0, AC97_MIC, 6, 0), | 895 | AC97_SWITCH("Mic Boost (+20dB)", 0, AC97_MIC, 6, 0), |
| 888 | AC97_SWITCH("Line Capture Switch", 0, AC97_LINE, 15, 1), | 896 | AC97_SWITCH("Line Capture Switch", 0, AC97_LINE, 15, 1), |
| 889 | AC97_VOLUME("CD Capture Volume", 0, AC97_CD), | 897 | AC97_VOLUME("CD Capture Volume", 0, AC97_CD, 1), |
| 890 | AC97_SWITCH("CD Capture Switch", 0, AC97_CD, 15, 1), | 898 | AC97_SWITCH("CD Capture Switch", 0, AC97_CD, 15, 1), |
| 891 | AC97_VOLUME("Aux Capture Volume", 0, AC97_AUX), | 899 | AC97_VOLUME("Aux Capture Volume", 0, AC97_AUX, 1), |
| 892 | AC97_SWITCH("Aux Capture Switch", 0, AC97_AUX, 15, 1), | 900 | AC97_SWITCH("Aux Capture Switch", 0, AC97_AUX, 15, 1), |
| 893 | }; | 901 | }; |
| 894 | 902 | ||
| 895 | static const struct snd_kcontrol_new ac97_fp_controls[] = { | 903 | static const struct snd_kcontrol_new ac97_fp_controls[] = { |
| 896 | AC97_VOLUME("Front Panel Playback Volume", 1, AC97_HEADPHONE), | 904 | AC97_VOLUME("Front Panel Playback Volume", 1, AC97_HEADPHONE, 1), |
| 897 | AC97_SWITCH("Front Panel Playback Switch", 1, AC97_HEADPHONE, 15, 1), | 905 | AC97_SWITCH("Front Panel Playback Switch", 1, AC97_HEADPHONE, 15, 1), |
| 898 | { | 906 | { |
| 899 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 907 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
