diff options
Diffstat (limited to 'sound/pci/oxygen/virtuoso.c')
-rw-r--r-- | sound/pci/oxygen/virtuoso.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c index 665115d23627..23bfab448844 100644 --- a/sound/pci/oxygen/virtuoso.c +++ b/sound/pci/oxygen/virtuoso.c | |||
@@ -80,6 +80,8 @@ MODULE_DEVICE_TABLE(pci, xonar_ids); | |||
80 | #define GPIO_ALT 0x0080 | 80 | #define GPIO_ALT 0x0080 |
81 | #define GPIO_OUTPUT_ENABLE 0x0100 | 81 | #define GPIO_OUTPUT_ENABLE 0x0100 |
82 | 82 | ||
83 | #define GPIO_LINE_MUTE CM9780_GPO0 | ||
84 | |||
83 | /* register 16 */ | 85 | /* register 16 */ |
84 | #define PCM1796_ATL_MASK 0xff | 86 | #define PCM1796_ATL_MASK 0xff |
85 | /* register 17 */ | 87 | /* register 17 */ |
@@ -168,6 +170,7 @@ static void xonar_init(struct oxygen *chip) | |||
168 | GPIO_CS5381_M_SINGLE, | 170 | GPIO_CS5381_M_SINGLE, |
169 | GPIO_CS5381_M_MASK | GPIO_ALT); | 171 | GPIO_CS5381_M_MASK | GPIO_ALT); |
170 | oxygen_ac97_set_bits(chip, 0, CM9780_JACK, CM9780_FMIC2MIC); | 172 | oxygen_ac97_set_bits(chip, 0, CM9780_JACK, CM9780_FMIC2MIC); |
173 | oxygen_ac97_clear_bits(chip, 0, CM9780_GPIO_STATUS, GPIO_LINE_MUTE); | ||
171 | msleep(300); | 174 | msleep(300); |
172 | oxygen_set_bits16(chip, OXYGEN_GPIO_CONTROL, GPIO_OUTPUT_ENABLE); | 175 | oxygen_set_bits16(chip, OXYGEN_GPIO_CONTROL, GPIO_OUTPUT_ENABLE); |
173 | oxygen_set_bits16(chip, OXYGEN_GPIO_DATA, GPIO_OUTPUT_ENABLE); | 176 | oxygen_set_bits16(chip, OXYGEN_GPIO_DATA, GPIO_OUTPUT_ENABLE); |
@@ -231,6 +234,47 @@ static void set_cs5381_params(struct oxygen *chip, | |||
231 | value, GPIO_CS5381_M_MASK); | 234 | value, GPIO_CS5381_M_MASK); |
232 | } | 235 | } |
233 | 236 | ||
237 | static void mute_ac97_ctl(struct oxygen *chip, unsigned int control) | ||
238 | { | ||
239 | unsigned int index = chip->controls[control]->private_value & 0xff; | ||
240 | u16 value; | ||
241 | |||
242 | value = oxygen_read_ac97(chip, 0, index); | ||
243 | if (!(value & 0x8000)) { | ||
244 | oxygen_write_ac97(chip, 0, index, value | 0x8000); | ||
245 | snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, | ||
246 | &chip->controls[control]->id); | ||
247 | } | ||
248 | } | ||
249 | |||
250 | static void xonar_ac97_switch_hook(struct oxygen *chip, | ||
251 | unsigned int reg, int mute) | ||
252 | { | ||
253 | /* line-in is exclusive */ | ||
254 | switch (reg) { | ||
255 | case AC97_LINE: | ||
256 | oxygen_write_ac97_masked(chip, 0, CM9780_GPIO_STATUS, | ||
257 | mute ? GPIO_LINE_MUTE : 0, | ||
258 | GPIO_LINE_MUTE); | ||
259 | if (!mute) { | ||
260 | mute_ac97_ctl(chip, CONTROL_MIC_CAPTURE_SWITCH); | ||
261 | mute_ac97_ctl(chip, CONTROL_CD_CAPTURE_SWITCH); | ||
262 | mute_ac97_ctl(chip, CONTROL_AUX_CAPTURE_SWITCH); | ||
263 | } | ||
264 | break; | ||
265 | case AC97_MIC: | ||
266 | case AC97_CD: | ||
267 | case AC97_VIDEO: | ||
268 | case AC97_AUX: | ||
269 | if (!mute) { | ||
270 | oxygen_ac97_set_bits(chip, 0, CM9780_GPIO_STATUS, | ||
271 | GPIO_LINE_MUTE); | ||
272 | mute_ac97_ctl(chip, CONTROL_LINE_CAPTURE_SWITCH); | ||
273 | } | ||
274 | break; | ||
275 | } | ||
276 | } | ||
277 | |||
234 | static int pcm1796_volume_info(struct snd_kcontrol *ctl, | 278 | static int pcm1796_volume_info(struct snd_kcontrol *ctl, |
235 | struct snd_ctl_elem_info *info) | 279 | struct snd_ctl_elem_info *info) |
236 | { | 280 | { |
@@ -288,7 +332,10 @@ static int xonar_control_filter(struct snd_kcontrol_new *template) | |||
288 | template->info = pcm1796_volume_info, | 332 | template->info = pcm1796_volume_info, |
289 | template->tlv.p = pcm1796_db_scale; | 333 | template->tlv.p = pcm1796_db_scale; |
290 | } else if (!strncmp(template->name, "CD Capture ", 11)) { | 334 | } else if (!strncmp(template->name, "CD Capture ", 11)) { |
335 | /* CD in is actually connected to the video in pin */ | ||
291 | template->private_value ^= AC97_CD ^ AC97_VIDEO; | 336 | template->private_value ^= AC97_CD ^ AC97_VIDEO; |
337 | } else if (!strcmp(template->name, "Line Capture Volume")) { | ||
338 | return 1; /* line-in bypasses the AC'97 mixer */ | ||
292 | } | 339 | } |
293 | return 0; | 340 | return 0; |
294 | } | 341 | } |
@@ -310,6 +357,7 @@ static const struct oxygen_model model_xonar = { | |||
310 | .set_adc_params = set_cs5381_params, | 357 | .set_adc_params = set_cs5381_params, |
311 | .update_dac_volume = update_pcm1796_volume, | 358 | .update_dac_volume = update_pcm1796_volume, |
312 | .update_dac_mute = update_pcm1796_mute, | 359 | .update_dac_mute = update_pcm1796_mute, |
360 | .ac97_switch_hook = xonar_ac97_switch_hook, | ||
313 | .dac_channels = 8, | 361 | .dac_channels = 8, |
314 | .used_channels = OXYGEN_CHANNEL_B | | 362 | .used_channels = OXYGEN_CHANNEL_B | |
315 | OXYGEN_CHANNEL_C | | 363 | OXYGEN_CHANNEL_C | |