aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_realtek.c
diff options
context:
space:
mode:
authorMariusz Domanski <mariook@wp.pl>2006-10-23 07:42:56 -0400
committerJaroslav Kysela <perex@suse.cz>2007-02-09 03:01:08 -0500
commit7cdbff945e9e3bb592dee2f66afbcc2255747f8f (patch)
tree728e4988fabf195ce308411a9dcac4aac3f5811a /sound/pci/hda/patch_realtek.c
parenta71a468a50f1385855e28864e26251b02df829bb (diff)
[ALSA] hda-codec - Add asus model to ALC861 codec
This patch adds support for Asus laptops (for example: Asus A6Rp-AP002). Signed-off-by: Mariusz Domanski <mariook@wp.pl> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r--sound/pci/hda/patch_realtek.c165
1 files changed, 163 insertions, 2 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 04749d2f7bdf..990714e2bcb3 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -100,6 +100,7 @@ enum {
100 ALC861_6ST_DIG, 100 ALC861_6ST_DIG,
101 ALC861_UNIWILL_M31, 101 ALC861_UNIWILL_M31,
102 ALC861_TOSHIBA, 102 ALC861_TOSHIBA,
103 ALC861_ASUS,
103 ALC861_AUTO, 104 ALC861_AUTO,
104 ALC861_MODEL_LAST, 105 ALC861_MODEL_LAST,
105}; 106};
@@ -6654,6 +6655,44 @@ static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
6654 { 4, alc861_uniwill_m31_ch4_init }, 6655 { 4, alc861_uniwill_m31_ch4_init },
6655}; 6656};
6656 6657
6658/* Set mic1 and line-in as input and unmute the mixer */
6659static struct hda_verb alc861_asus_ch2_init[] = {
6660 /* set pin widget 1Ah (line in) for input */
6661 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
6662 /* set pin widget 18h (mic1/2) for input, for mic also enable the vref */
6663 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
6664
6665 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
6666#if 0
6667 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
6668 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
6669#endif
6670 { } /* end */
6671};
6672/* Set mic1 nad line-in as output and mute mixer */
6673static struct hda_verb alc861_asus_ch6_init[] = {
6674 /* set pin widget 1Ah (line in) for output (Back Surround)*/
6675 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
6676 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
6677 /* set pin widget 18h (mic1) for output (CLFE)*/
6678 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
6679 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
6680 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
6681 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
6682
6683 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
6684#if 0
6685 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
6686 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
6687#endif
6688 { } /* end */
6689};
6690
6691static struct hda_channel_mode alc861_asus_modes[2] = {
6692 { 2, alc861_asus_ch2_init },
6693 { 6, alc861_asus_ch6_init },
6694};
6695
6657/* patch-ALC861 */ 6696/* patch-ALC861 */
6658 6697
6659static struct snd_kcontrol_new alc861_base_mixer[] = { 6698static struct snd_kcontrol_new alc861_base_mixer[] = {
@@ -6794,6 +6833,49 @@ static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
6794 }, 6833 },
6795 { } /* end */ 6834 { } /* end */
6796}; 6835};
6836
6837static struct snd_kcontrol_new alc861_asus_mixer[] = {
6838 /* output mixer control */
6839 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
6840 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
6841 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
6842 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
6843 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
6844
6845 /* Input mixer control */
6846 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
6847 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6848 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
6849 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
6850 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
6851 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
6852 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
6853 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
6854 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
6855 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), /* was HDA_INPUT (why?) */
6856
6857 /* Capture mixer control */
6858 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6859 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6860 {
6861 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6862 .name = "Capture Source",
6863 .count = 1,
6864 .info = alc_mux_enum_info,
6865 .get = alc_mux_enum_get,
6866 .put = alc_mux_enum_put,
6867 },
6868 {
6869 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6870 .name = "Channel Mode",
6871 .info = alc_ch_mode_info,
6872 .get = alc_ch_mode_get,
6873 .put = alc_ch_mode_put,
6874 .private_value = ARRAY_SIZE(alc861_asus_modes),
6875 },
6876 { }
6877};
6878
6797 6879
6798/* 6880/*
6799 * generic initialization of ADC, input mixers and output mixers 6881 * generic initialization of ADC, input mixers and output mixers
@@ -6983,6 +7065,68 @@ static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
6983 { } 7065 { }
6984}; 7066};
6985 7067
7068static struct hda_verb alc861_asus_init_verbs[] = {
7069 /*
7070 * Unmute ADC0 and set the default input to mic-in
7071 */
7072 /* port-A for surround (rear panel) | according to codec#0 this is the HP jack*/
7073 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
7074 /* route front PCM to HP */
7075 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
7076 /* port-B for mic-in (rear panel) with vref */
7077 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
7078 /* port-C for line-in (rear panel) */
7079 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
7080 /* port-D for Front */
7081 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
7082 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
7083 /* port-E for HP out (front panel) */
7084 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, /* this has to be set to VREF80 */
7085 /* route front PCM to HP */
7086 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x01 },
7087 /* port-F for mic-in (front panel) with vref */
7088 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
7089 /* port-G for CLFE (rear panel) */
7090 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
7091 /* port-H for side (rear panel) */
7092 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
7093 /* CD-in */
7094 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
7095 /* route front mic to ADC1*/
7096 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7097 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7098 /* Unmute DAC0~3 & spdif out*/
7099 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7100 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7101 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7102 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7103 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7104 /* Unmute Mixer 14 (mic) 1c (Line in)*/
7105 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7106 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7107 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7108 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7109
7110 /* Unmute Stereo Mixer 15 */
7111 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7112 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7113 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7114 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, /* Output 0~12 step */
7115
7116 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7117 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7118 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7119 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7120 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7121 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7122 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7123 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7124 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, /* hp used DAC 3 (Front) */
7125 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7126 { }
7127};
7128
7129
6986/* 7130/*
6987 * generic initialization of ADC, input mixers and output mixers 7131 * generic initialization of ADC, input mixers and output mixers
6988 */ 7132 */
@@ -7354,10 +7498,13 @@ static struct hda_board_config alc861_cfg_tbl[] = {
7354 { .pci_subvendor = 0x1584, .pci_subdevice = 0x9072, 7498 { .pci_subvendor = 0x1584, .pci_subdevice = 0x9072,
7355 .config = ALC861_UNIWILL_M31 }, 7499 .config = ALC861_UNIWILL_M31 },
7356 { .modelname = "toshiba", .config = ALC861_TOSHIBA }, 7500 { .modelname = "toshiba", .config = ALC861_TOSHIBA },
7357 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1338,
7358 .config = ALC861_TOSHIBA },
7359 { .pci_subvendor = 0x1179, .pci_subdevice = 0xff10, 7501 { .pci_subvendor = 0x1179, .pci_subdevice = 0xff10,
7360 .config = ALC861_TOSHIBA }, 7502 .config = ALC861_TOSHIBA },
7503 { .modelname = "asus", .config = ALC861_ASUS},
7504 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1393,
7505 .config = ALC861_ASUS },
7506 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1338,
7507 .config = ALC861_ASUS },
7361 { .modelname = "auto", .config = ALC861_AUTO }, 7508 { .modelname = "auto", .config = ALC861_AUTO },
7362 {} 7509 {}
7363}; 7510};
@@ -7438,6 +7585,20 @@ static struct alc_config_preset alc861_presets[] = {
7438 .unsol_event = alc861_toshiba_unsol_event, 7585 .unsol_event = alc861_toshiba_unsol_event,
7439 .init_hook = alc861_toshiba_automute, 7586 .init_hook = alc861_toshiba_automute,
7440 }, 7587 },
7588 [ALC861_ASUS] = {
7589 .mixers = { alc861_asus_mixer },
7590 .init_verbs = { alc861_asus_init_verbs },
7591 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
7592 .dac_nids = alc861_dac_nids,
7593 .dig_out_nid = ALC861_DIGOUT_NID,
7594 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
7595 .channel_mode = alc861_asus_modes,
7596 .need_dac_fix = 1,
7597 .hp_nid = 0x06,
7598 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
7599 .adc_nids = alc861_adc_nids,
7600 .input_mux = &alc861_capture_source,
7601 },
7441}; 7602};
7442 7603
7443 7604