Update of /cvsroot/alsa/alsa-kernel/pci/ice1712 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23852
Modified Files: aureon.c Log Message: fixes by Christoph Haderer <[EMAIL PROTECTED]>: - added the support of DAC/ADC mute switches - fixed the capture route enum. Index: aureon.c =================================================================== RCS file: /cvsroot/alsa/alsa-kernel/pci/ice1712/aureon.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- aureon.c 14 May 2004 11:00:23 -0000 1.8 +++ aureon.c 14 May 2004 13:08:15 -0000 1.9 @@ -135,6 +135,47 @@ } /* + * 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 @@ } /* + * 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 @@ 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_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 @@ } /* - * 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 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 @@ }, { .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, ------------------------------------------------------- This SF.Net email is sponsored by: SourceForge.net Broadband Sign-up now for SourceForge Broadband and get the fastest 6.0/768 connection for only $19.95/mo for the first 3 months! http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click _______________________________________________ Alsa-cvslog mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/alsa-cvslog