aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2009-10-06 02:21:04 -0400
committerTakashi Iwai <tiwai@suse.de>2009-10-06 08:58:58 -0400
commit2fb930b53f513cbc4c102d415d2923a8a7091337 (patch)
treeb07211090d75e2d568c62995d35447ecfce1319f /sound
parent08d1e635089f41e28fec644a8620a0e8d66b1235 (diff)
sound: via82xx: move DXS volume controls to PCM interface
The "VIA DXS" controls are actually volume controls that apply to the four PCM substreams, so we better indicate this connection by moving the controls to the PCM interface. Commit b452e08e73c0e3dbb0be82130217be4b7084299e in 2.6.30 broke the restoring of these volumes by "alsactl restore" that most distributions use; the renaming in this patch cures that regression by preventing alsactl from applying the old, wrong volume levels to the new controls. http://bugzilla.kernel.org/show_bug.cgi?id=14151 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=532613 Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Cc: <stable@kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/via82xx.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index acfa4760da49..91683a349035 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -1626,7 +1626,7 @@ static int snd_via8233_dxs_volume_get(struct snd_kcontrol *kcontrol,
1626 struct snd_ctl_elem_value *ucontrol) 1626 struct snd_ctl_elem_value *ucontrol)
1627{ 1627{
1628 struct via82xx *chip = snd_kcontrol_chip(kcontrol); 1628 struct via82xx *chip = snd_kcontrol_chip(kcontrol);
1629 unsigned int idx = snd_ctl_get_ioff(kcontrol, &ucontrol->id); 1629 unsigned int idx = kcontrol->id.subdevice;
1630 1630
1631 ucontrol->value.integer.value[0] = VIA_DXS_MAX_VOLUME - chip->playback_volume[idx][0]; 1631 ucontrol->value.integer.value[0] = VIA_DXS_MAX_VOLUME - chip->playback_volume[idx][0];
1632 ucontrol->value.integer.value[1] = VIA_DXS_MAX_VOLUME - chip->playback_volume[idx][1]; 1632 ucontrol->value.integer.value[1] = VIA_DXS_MAX_VOLUME - chip->playback_volume[idx][1];
@@ -1646,7 +1646,7 @@ static int snd_via8233_dxs_volume_put(struct snd_kcontrol *kcontrol,
1646 struct snd_ctl_elem_value *ucontrol) 1646 struct snd_ctl_elem_value *ucontrol)
1647{ 1647{
1648 struct via82xx *chip = snd_kcontrol_chip(kcontrol); 1648 struct via82xx *chip = snd_kcontrol_chip(kcontrol);
1649 unsigned int idx = snd_ctl_get_ioff(kcontrol, &ucontrol->id); 1649 unsigned int idx = kcontrol->id.subdevice;
1650 unsigned long port = chip->port + 0x10 * idx; 1650 unsigned long port = chip->port + 0x10 * idx;
1651 unsigned char val; 1651 unsigned char val;
1652 int i, change = 0; 1652 int i, change = 0;
@@ -1705,11 +1705,12 @@ static struct snd_kcontrol_new snd_via8233_pcmdxs_volume_control __devinitdata =
1705}; 1705};
1706 1706
1707static struct snd_kcontrol_new snd_via8233_dxs_volume_control __devinitdata = { 1707static struct snd_kcontrol_new snd_via8233_dxs_volume_control __devinitdata = {
1708 .name = "VIA DXS Playback Volume", 1708 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
1709 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1709 .device = 0,
1710 /* .subdevice set later */
1711 .name = "PCM Playback Volume",
1710 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | 1712 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
1711 SNDRV_CTL_ELEM_ACCESS_TLV_READ), 1713 SNDRV_CTL_ELEM_ACCESS_TLV_READ),
1712 .count = 4,
1713 .info = snd_via8233_dxs_volume_info, 1714 .info = snd_via8233_dxs_volume_info,
1714 .get = snd_via8233_dxs_volume_get, 1715 .get = snd_via8233_dxs_volume_get,
1715 .put = snd_via8233_dxs_volume_put, 1716 .put = snd_via8233_dxs_volume_put,
@@ -1936,10 +1937,18 @@ static int __devinit snd_via8233_init_misc(struct via82xx *chip)
1936 } 1937 }
1937 else /* Using DXS when PCM emulation is enabled is really weird */ 1938 else /* Using DXS when PCM emulation is enabled is really weird */
1938 { 1939 {
1939 /* Standalone DXS controls */ 1940 for (i = 0; i < 4; ++i) {
1940 err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_via8233_dxs_volume_control, chip)); 1941 struct snd_kcontrol *kctl;
1941 if (err < 0) 1942
1942 return err; 1943 kctl = snd_ctl_new1(
1944 &snd_via8233_dxs_volume_control, chip);
1945 if (!kctl)
1946 return -ENOMEM;
1947 kctl->id.subdevice = i;
1948 err = snd_ctl_add(chip->card, kctl);
1949 if (err < 0)
1950 return err;
1951 }
1943 } 1952 }
1944 } 1953 }
1945 /* select spdif data slot 10/11 */ 1954 /* select spdif data slot 10/11 */