[ALSA] oxygen: fix line-in recording selection (now for real)
On C-Media cards, the GPIO pin 0 of the CM9780 must be handled exactly like on Xonar cards, so move the Xonar code to the common mixer code. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:

committed by
Takashi Iwai

parent
0c4cc4430f
commit
e97f79994a
@@ -30,10 +30,6 @@
|
||||
* GPIO 5 <- external power present (D2X only)
|
||||
* GPIO 7 -> ALT
|
||||
* GPIO 8 -> enable output to speakers
|
||||
*
|
||||
* CM9780:
|
||||
*
|
||||
* GPIO 0 -> enable AC'97 bypass (line in -> ADC)
|
||||
*/
|
||||
|
||||
#include <linux/pci.h>
|
||||
@@ -81,8 +77,6 @@ MODULE_DEVICE_TABLE(pci, xonar_ids);
|
||||
#define GPIO_ALT 0x0080
|
||||
#define GPIO_OUTPUT_ENABLE 0x0100
|
||||
|
||||
#define GPIO_LINE_MUTE CM9780_GPO0
|
||||
|
||||
struct xonar_data {
|
||||
u8 is_d2x;
|
||||
u8 has_power;
|
||||
@@ -134,7 +128,6 @@ static void xonar_init(struct oxygen *chip)
|
||||
& GPIO_EXT_POWER);
|
||||
}
|
||||
oxygen_ac97_set_bits(chip, 0, CM9780_JACK, CM9780_FMIC2MIC);
|
||||
oxygen_ac97_clear_bits(chip, 0, CM9780_GPIO_STATUS, GPIO_LINE_MUTE);
|
||||
msleep(300);
|
||||
oxygen_set_bits16(chip, OXYGEN_GPIO_CONTROL, GPIO_OUTPUT_ENABLE);
|
||||
oxygen_set_bits16(chip, OXYGEN_GPIO_DATA, GPIO_OUTPUT_ENABLE);
|
||||
@@ -219,49 +212,6 @@ static void xonar_gpio_changed(struct oxygen *chip)
|
||||
}
|
||||
}
|
||||
|
||||
static void mute_ac97_ctl(struct oxygen *chip, unsigned int control)
|
||||
{
|
||||
unsigned int priv_idx = chip->controls[control]->private_value & 0xff;
|
||||
u16 value;
|
||||
|
||||
value = oxygen_read_ac97(chip, 0, priv_idx);
|
||||
if (!(value & 0x8000)) {
|
||||
oxygen_write_ac97(chip, 0, priv_idx, value | 0x8000);
|
||||
snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
|
||||
&chip->controls[control]->id);
|
||||
}
|
||||
}
|
||||
|
||||
static void xonar_ac97_switch_hook(struct oxygen *chip, unsigned int codec,
|
||||
unsigned int reg, int mute)
|
||||
{
|
||||
if (codec != 0)
|
||||
return;
|
||||
/* line-in is exclusive */
|
||||
switch (reg) {
|
||||
case AC97_LINE:
|
||||
oxygen_write_ac97_masked(chip, 0, CM9780_GPIO_STATUS,
|
||||
mute ? GPIO_LINE_MUTE : 0,
|
||||
GPIO_LINE_MUTE);
|
||||
if (!mute) {
|
||||
mute_ac97_ctl(chip, CONTROL_MIC_CAPTURE_SWITCH);
|
||||
mute_ac97_ctl(chip, CONTROL_CD_CAPTURE_SWITCH);
|
||||
mute_ac97_ctl(chip, CONTROL_AUX_CAPTURE_SWITCH);
|
||||
}
|
||||
break;
|
||||
case AC97_MIC:
|
||||
case AC97_CD:
|
||||
case AC97_VIDEO:
|
||||
case AC97_AUX:
|
||||
if (!mute) {
|
||||
oxygen_ac97_set_bits(chip, 0, CM9780_GPIO_STATUS,
|
||||
GPIO_LINE_MUTE);
|
||||
mute_ac97_ctl(chip, CONTROL_LINE_CAPTURE_SWITCH);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static int pcm1796_volume_info(struct snd_kcontrol *ctl,
|
||||
struct snd_ctl_elem_info *info)
|
||||
{
|
||||
@@ -321,8 +271,6 @@ static int xonar_control_filter(struct snd_kcontrol_new *template)
|
||||
} else if (!strncmp(template->name, "CD Capture ", 11)) {
|
||||
/* CD in is actually connected to the video in pin */
|
||||
template->private_value ^= AC97_CD ^ AC97_VIDEO;
|
||||
} else if (!strcmp(template->name, "Line Capture Volume")) {
|
||||
return 1; /* line-in bypasses the AC'97 mixer */
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -345,7 +293,6 @@ static const struct oxygen_model model_xonar = {
|
||||
.set_adc_params = set_cs5381_params,
|
||||
.update_dac_volume = update_pcm1796_volume,
|
||||
.update_dac_mute = update_pcm1796_mute,
|
||||
.ac97_switch_hook = xonar_ac97_switch_hook,
|
||||
.gpio_changed = xonar_gpio_changed,
|
||||
.model_data_size = sizeof(struct xonar_data),
|
||||
.pcm_dev_cfg = PLAYBACK_0_TO_I2S |
|
||||
|
Reference in New Issue
Block a user