diff options
author | Tobin Davis <tdavis@dsl-only.net> | 2006-12-15 04:02:12 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2007-02-09 03:02:27 -0500 |
commit | 9102cd1c35c9be223e0f60b7c42cb581f0d42f1a (patch) | |
tree | 2185bc43e289da58da6593b9bf26dd724c5bcfbb /sound/pci | |
parent | 4484bb2e93a9ab636d149edc6515c75ea224e2b0 (diff) |
[ALSA] hda-codec (realtek): add support for MacPro series workstations
This patch adds limited support for Intel-based MacPro workstations.
Currently, the front headphone jack is not functioning, but line out
and line in are working. S/PDIF not tested.
Signed-off-by: Tobin Davis <tdavis@dsl-only.net>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index a1b6c9661d45..c4a06c5f7d93 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -112,6 +112,7 @@ enum { | |||
112 | ALC882_6ST_DIG, | 112 | ALC882_6ST_DIG, |
113 | ALC882_ARIMA, | 113 | ALC882_ARIMA, |
114 | ALC882_AUTO, | 114 | ALC882_AUTO, |
115 | ALC885_MACPRO, | ||
115 | ALC882_MODEL_LAST, | 116 | ALC882_MODEL_LAST, |
116 | }; | 117 | }; |
117 | 118 | ||
@@ -4507,6 +4508,100 @@ static struct hda_verb alc882_eapd_verbs[] = { | |||
4507 | { } | 4508 | { } |
4508 | }; | 4509 | }; |
4509 | 4510 | ||
4511 | /* Mac Pro test */ | ||
4512 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { | ||
4513 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
4514 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
4515 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), | ||
4516 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
4517 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
4518 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
4519 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
4520 | { } /* end */ | ||
4521 | }; | ||
4522 | |||
4523 | static struct hda_verb alc882_macpro_init_verbs[] = { | ||
4524 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | ||
4525 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
4526 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
4527 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
4528 | /* Front Pin: output 0 (0x0c) */ | ||
4529 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
4530 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
4531 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
4532 | /* Front Mic pin: input vref at 80% */ | ||
4533 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
4534 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
4535 | /* Speaker: output */ | ||
4536 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
4537 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
4538 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, | ||
4539 | /* Headphone output (output 0 - 0x0c) */ | ||
4540 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
4541 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
4542 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
4543 | |||
4544 | /* FIXME: use matrix-type input source selection */ | ||
4545 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | ||
4546 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | ||
4547 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
4548 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
4549 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
4550 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
4551 | /* Input mixer2 */ | ||
4552 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
4553 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
4554 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
4555 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
4556 | /* Input mixer3 */ | ||
4557 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
4558 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
4559 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
4560 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
4561 | /* ADC1: mute amp left and right */ | ||
4562 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
4563 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
4564 | /* ADC2: mute amp left and right */ | ||
4565 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
4566 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
4567 | /* ADC3: mute amp left and right */ | ||
4568 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
4569 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
4570 | |||
4571 | { } | ||
4572 | }; | ||
4573 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) | ||
4574 | { | ||
4575 | unsigned int gpiostate, gpiomask, gpiodir; | ||
4576 | |||
4577 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, | ||
4578 | AC_VERB_GET_GPIO_DATA, 0); | ||
4579 | |||
4580 | if (!muted) | ||
4581 | gpiostate |= (1 << pin); | ||
4582 | else | ||
4583 | gpiostate &= ~(1 << pin); | ||
4584 | |||
4585 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, | ||
4586 | AC_VERB_GET_GPIO_MASK, 0); | ||
4587 | gpiomask |= (1 << pin); | ||
4588 | |||
4589 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, | ||
4590 | AC_VERB_GET_GPIO_DIRECTION, 0); | ||
4591 | gpiodir |= (1 << pin); | ||
4592 | |||
4593 | |||
4594 | snd_hda_codec_write(codec, codec->afg, 0, | ||
4595 | AC_VERB_SET_GPIO_MASK, gpiomask); | ||
4596 | snd_hda_codec_write(codec, codec->afg, 0, | ||
4597 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); | ||
4598 | |||
4599 | msleep(1); | ||
4600 | |||
4601 | snd_hda_codec_write(codec, codec->afg, 0, | ||
4602 | AC_VERB_SET_GPIO_DATA, gpiostate); | ||
4603 | } | ||
4604 | |||
4510 | /* | 4605 | /* |
4511 | * generic initialization of ADC, input mixers and output mixers | 4606 | * generic initialization of ADC, input mixers and output mixers |
4512 | */ | 4607 | */ |
@@ -4633,6 +4728,7 @@ static const char *alc882_models[ALC882_MODEL_LAST] = { | |||
4633 | [ALC882_3ST_DIG] = "3stack-dig", | 4728 | [ALC882_3ST_DIG] = "3stack-dig", |
4634 | [ALC882_6ST_DIG] = "6stack-dig", | 4729 | [ALC882_6ST_DIG] = "6stack-dig", |
4635 | [ALC882_ARIMA] = "arima", | 4730 | [ALC882_ARIMA] = "arima", |
4731 | [ALC885_MACPRO] = "macpro", | ||
4636 | [ALC882_AUTO] = "auto", | 4732 | [ALC882_AUTO] = "auto", |
4637 | }; | 4733 | }; |
4638 | 4734 | ||
@@ -4677,6 +4773,17 @@ static struct alc_config_preset alc882_presets[] = { | |||
4677 | .channel_mode = alc882_sixstack_modes, | 4773 | .channel_mode = alc882_sixstack_modes, |
4678 | .input_mux = &alc882_capture_source, | 4774 | .input_mux = &alc882_capture_source, |
4679 | }, | 4775 | }, |
4776 | [ALC885_MACPRO] = { | ||
4777 | .mixers = { alc882_macpro_mixer }, | ||
4778 | .init_verbs = { alc882_macpro_init_verbs }, | ||
4779 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
4780 | .dac_nids = alc882_dac_nids, | ||
4781 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
4782 | .dig_in_nid = ALC882_DIGIN_NID, | ||
4783 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | ||
4784 | .channel_mode = alc882_ch_modes, | ||
4785 | .input_mux = &alc882_capture_source, | ||
4786 | }, | ||
4680 | }; | 4787 | }; |
4681 | 4788 | ||
4682 | 4789 | ||
@@ -4804,6 +4911,11 @@ static int patch_alc882(struct hda_codec *codec) | |||
4804 | if (board_config != ALC882_AUTO) | 4911 | if (board_config != ALC882_AUTO) |
4805 | setup_preset(spec, &alc882_presets[board_config]); | 4912 | setup_preset(spec, &alc882_presets[board_config]); |
4806 | 4913 | ||
4914 | if (board_config == ALC885_MACPRO) { | ||
4915 | alc882_gpio_mute(codec, 0, 0); | ||
4916 | alc882_gpio_mute(codec, 1, 0); | ||
4917 | } | ||
4918 | |||
4807 | spec->stream_name_analog = "ALC882 Analog"; | 4919 | spec->stream_name_analog = "ALC882 Analog"; |
4808 | spec->stream_analog_playback = &alc882_pcm_analog_playback; | 4920 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
4809 | spec->stream_analog_capture = &alc882_pcm_analog_capture; | 4921 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |