aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@suse.cz>2004-05-17 19:33:58 +0200
committerJaroslav Kysela <perex@suse.cz>2004-05-17 19:33:58 +0200
commit5aeb5e480422cee99be66d370c0333e87f956b0f (patch)
treeaf2076505442935156acd27a64a6c13954848015 /sound
parentfc1e9e0eb9f9595c08b9369b44c9bf6f3641273f (diff)
downloadhistory-5aeb5e480422cee99be66d370c0333e87f956b0f.tar.gz
ALSA CVS update - Takashi Iwai <tiwai@suse.de>
ICE1712 driver fixes by Christoph Haderer <chris_web@gmx.at>: - added the support of DAC/ADC mute switches - fixed the capture route enum.
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/ice1712/aureon.c123
1 files changed, 109 insertions, 14 deletions
diff --git a/sound/pci/ice1712/aureon.c b/sound/pci/ice1712/aureon.c
index 943c755f9a6b50..686c1f206d91b9 100644
--- a/sound/pci/ice1712/aureon.c
+++ b/sound/pci/ice1712/aureon.c
@@ -135,6 +135,47 @@ static void wm_put(ice1712_t *ice, int reg, unsigned short val)
}
/*
+ * DAC mute control
+ */
+static int wm_dac_mute_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
+{
+ uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
+ uinfo->count = 1;
+ uinfo->value.integer.min = 0;
+ uinfo->value.integer.max = 1;
+ return 0;
+}
+
+static int wm_dac_mute_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+{
+ ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+ unsigned short val;
+
+ down(&ice->gpio_mutex);
+ val = wm_get(ice, snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)+WM_MUTE);
+ ucontrol->value.integer.value[0] = ~val>>4 & 0x1;
+ up(&ice->gpio_mutex);
+ return 0;
+}
+
+static int wm_dac_mute_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
+{
+ ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+ unsigned short new, old;
+ int change;
+
+ snd_ice1712_save_gpio_status(ice);
+ old = wm_get(ice, snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)+WM_MUTE);
+ new = (~ucontrol->value.integer.value[0]<<4&0x10) | (old&~0x10);
+ change = (new != old);
+ if (change)
+ wm_put(ice, snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)+WM_MUTE, new);
+ snd_ice1712_restore_gpio_status(ice);
+
+ return change;
+}
+
+/*
* DAC volume attenuation mixer control
*/
static int wm_dac_vol_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
@@ -192,6 +233,47 @@ static int wm_dac_vol_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontr
}
/*
+ * ADC mute control
+ */
+static int wm_adc_mute_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
+{
+ uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
+ uinfo->count = 1;
+ uinfo->value.integer.min = 0;
+ uinfo->value.integer.max = 1;
+ return 0;
+}
+
+static int wm_adc_mute_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+{
+ ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+ unsigned short val;
+
+ down(&ice->gpio_mutex);
+ val = wm_get(ice, snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)+WM_ADC_GAIN);
+ ucontrol->value.integer.value[0] = ~val>>5 & 0x1;
+ up(&ice->gpio_mutex);
+ return 0;
+}
+
+static int wm_adc_mute_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
+{
+ ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+ unsigned short new, old;
+ int change;
+
+ snd_ice1712_save_gpio_status(ice);
+ old = wm_get(ice, snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)+WM_ADC_GAIN);
+ new = (~ucontrol->value.integer.value[0]<<5&0x20) | (old&~0x20);
+ change = (new != old);
+ if (change)
+ wm_put(ice, snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)+WM_ADC_GAIN, new);
+ snd_ice1712_restore_gpio_status(ice);
+
+ return change;
+}
+
+/*
* ADC gain mixer control
*/
static int wm_adc_vol_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
@@ -227,10 +309,10 @@ static int wm_adc_vol_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontr
snd_ice1712_save_gpio_status(ice);
idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + WM_ADC_GAIN;
nvol = ucontrol->value.integer.value[0];
- ovol = wm_get(ice, idx) & 0x1f;
- change = (ovol != nvol);
+ ovol = wm_get(ice, idx);
+ change = ((ovol & 0x1f) != nvol);
if (change)
- wm_put(ice, idx, nvol);
+ wm_put(ice, idx, nvol | (ovol & ~0x1f));
snd_ice1712_restore_gpio_status(ice);
return change;
}
@@ -241,18 +323,15 @@ static int wm_adc_vol_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontr
static int wm_adc_mux_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
{
static char *texts[] = {
- "CD Left",
- "CD Right",
- "Aux Left",
- "Aux Right",
- "Line Left",
- "Line Right",
- "Mic Left",
- "Mic Right",
+ "CD", //AIN1
+ "Aux", //AIN2
+ "Line", //AIN3
+ "Mic", //AIN4
+ "AC97" //AIN5
};
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
- uinfo->count = 2;
- uinfo->value.enumerated.items = 8;
+ uinfo->count = 1;
+ uinfo->value.enumerated.items = 5;
if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
@@ -291,7 +370,7 @@ static int wm_adc_mux_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t *ucont
}
/*
- * Taken from prodigy.c
+ * Headphone Amplifier
*/
static int aureon_set_headphone_amp(ice1712_t *ice, int enable)
{
@@ -366,6 +445,13 @@ static snd_kcontrol_new_t aureon71_dac_control __devinitdata = {
static snd_kcontrol_new_t wm_controls[] __devinitdata = {
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+ .name = "Master Playback Switch",
+ .info = wm_dac_mute_info,
+ .get = wm_dac_mute_get,
+ .put = wm_dac_mute_put,
+ },
+ {
+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Master Playback Volume",
.info = wm_dac_vol_info,
.get = wm_dac_vol_get,
@@ -374,6 +460,15 @@ static snd_kcontrol_new_t wm_controls[] __devinitdata = {
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+ .name = "ADC Switch",
+ .count = 2,
+ .info = wm_adc_mute_info,
+ .get = wm_adc_mute_get,
+ .put = wm_adc_mute_put,
+
+ },
+ {
+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "ADC Volume",
.count = 2,
.info = wm_adc_vol_info,