diff options
author | Jaroslav Kysela <perex@suse.cz> | 2004-05-17 19:33:15 +0200 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2004-05-17 19:33:15 +0200 |
commit | ae5f5d815dfee0bb149c22fc95507f20d293ea16 (patch) | |
tree | efea76d64289b8e401a2c4c4cdfd0da3adffe3e2 /sound | |
parent | 7113237cbd0c07769731243135ad8d79b258603e (diff) | |
download | history-ae5f5d815dfee0bb149c22fc95507f20d293ea16.tar.gz |
ALSA CVS update - Takashi Iwai <tiwai@suse.de>
ICE1712 driver
added headphone amplifier switch.
initial patch by Radoslaw 'AstralStorm' Szkodzinski.
Diffstat (limited to 'sound')
-rw-r--r-- | sound/pci/ice1712/aureon.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/sound/pci/ice1712/aureon.c b/sound/pci/ice1712/aureon.c index 8c886ca530d629..f453d7574d0572 100644 --- a/sound/pci/ice1712/aureon.c +++ b/sound/pci/ice1712/aureon.c @@ -291,6 +291,57 @@ static int wm_adc_mux_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t *ucont } /* + * Taken from prodigy.c + */ +static int aureon_set_headphone_amp(ice1712_t *ice, int enable) +{ + unsigned int tmp, tmp2; + + tmp2 = tmp = snd_ice1712_gpio_read(ice); + if (enable) + tmp |= AUREON_HP_SEL; + else + tmp &= ~ AUREON_HP_SEL; + if (tmp != tmp2) { + snd_ice1712_gpio_write(ice, tmp); + return 1; + } + return 0; +} + +static int aureon_get_headphone_amp(ice1712_t *ice) +{ + unsigned int tmp = snd_ice1712_gpio_read(ice); + + return ( tmp & AUREON_HP_SEL )!= 0; +} + +static int aureon_hpamp_info(snd_kcontrol_t *k, 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 aureon_hpamp_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +{ + ice1712_t *ice = snd_kcontrol_chip(kcontrol); + + ucontrol->value.integer.value[0] = aureon_get_headphone_amp(ice); + return 0; +} + + +static int aureon_hpamp_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) +{ + ice1712_t *ice = snd_kcontrol_chip(kcontrol); + + return aureon_set_headphone_amp(ice,ucontrol->value.integer.value[0]); +} + +/* * mixers */ @@ -336,6 +387,13 @@ static snd_kcontrol_new_t wm_controls[] __devinitdata = { .get = wm_adc_mux_get, .put = wm_adc_mux_put, }, + { + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .name = "Headphone Amplifier Switch", + .info = aureon_hpamp_info, + .get = aureon_hpamp_get, + .put = aureon_hpamp_put + }, }; |