aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_realtek.c
diff options
context:
space:
mode:
authorJonathan Woithe <jwoithe@physics.adelaide.edu.au>2006-02-28 05:45:11 -0500
committerJaroslav Kysela <perex@suse.cz>2006-03-22 04:32:53 -0500
commit0bfc90e95946ac420e2de049707232ce18ddeba9 (patch)
treec4e7f3c41db0cb4b9288e7d44de2a2056c762a7e /sound/pci/hda/patch_realtek.c
parent5c8f858d71054960f08c46703a3f0fb36a752079 (diff)
[ALSA] HDA/ALC260: 5/7 - add 'acer' model
Modules: HDA Codec driver This patch adds a new 'acer' model. It is based on work by Rimas and many other dedicated Acer owners over the past few weeks (see bug number 1618) - kudos to them. This adds support for a variety of Acer laptops, although we are still in the process of collecting pci/subsystem IDs to add. There are still some potentially outstanding issues: there are reports that the CD control might not yet be functional for example. However, the time is probably right to get a 'first cut' into the kernel which can be refined as more test reports come in. From the reports by various Acer owners, this code allows them to record from internal mics and external jacks. Playback also seems to work to all external jacks and the internal speaker. The 'beep' control doesn't appear functional at the moment. This patch depends on the changes made in patch 3/7. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r--sound/pci/hda/patch_realtek.c129
1 files changed, 129 insertions, 0 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 4f6dea23d8b2..104d2a37f45a 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -64,6 +64,7 @@ enum {
64 ALC260_HP, 64 ALC260_HP,
65 ALC260_HP_3013, 65 ALC260_HP_3013,
66 ALC260_FUJITSU_S702X, 66 ALC260_FUJITSU_S702X,
67 ALC260_ACER,
67#ifdef CONFIG_SND_DEBUG 68#ifdef CONFIG_SND_DEBUG
68 ALC260_TEST, 69 ALC260_TEST,
69#endif 70#endif
@@ -2504,6 +2505,19 @@ static struct hda_input_mux alc260_fujitsu_capture_source = {
2504 }, 2505 },
2505}; 2506};
2506 2507
2508/* Acer TravelMate(/Extensa/Aspire) notebooks have similar configutation to
2509 * the Fujitsu S702x, but jacks are marked differently. We won't allow
2510 * retasking the Headphone jack, so it won't be available here.
2511 */
2512static struct hda_input_mux alc260_acer_capture_source = {
2513 .num_items = 3,
2514 .items = {
2515 { "Mic", 0x0 },
2516 { "Line", 0x2 },
2517 { "CD", 0x4 },
2518 },
2519};
2520
2507/* 2521/*
2508 * This is just place-holder, so there's something for alc_build_pcms to look 2522 * This is just place-holder, so there's something for alc_build_pcms to look
2509 * at when it calculates the maximum number of channels. ALC260 has no mixer 2523 * at when it calculates the maximum number of channels. ALC260 has no mixer
@@ -2521,6 +2535,7 @@ static struct hda_channel_mode alc260_modes[1] = {
2521 * HP: base_output + input + capture_alt 2535 * HP: base_output + input + capture_alt
2522 * HP_3013: hp_3013 + input + capture 2536 * HP_3013: hp_3013 + input + capture
2523 * fujitsu: fujitsu + capture 2537 * fujitsu: fujitsu + capture
2538 * acer: acer + capture
2524 */ 2539 */
2525 2540
2526static struct snd_kcontrol_new alc260_base_output_mixer[] = { 2541static struct snd_kcontrol_new alc260_base_output_mixer[] = {
@@ -2579,6 +2594,22 @@ static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
2579 { } /* end */ 2594 { } /* end */
2580}; 2595};
2581 2596
2597static struct snd_kcontrol_new alc260_acer_mixer[] = {
2598 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
2599 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
2600 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
2601 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
2602 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
2603 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
2604 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
2605 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
2606 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
2607 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
2608 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),
2609 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),
2610 { } /* end */
2611};
2612
2582/* capture mixer elements */ 2613/* capture mixer elements */
2583static struct snd_kcontrol_new alc260_capture_mixer[] = { 2614static struct snd_kcontrol_new alc260_capture_mixer[] = {
2584 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), 2615 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT),
@@ -2860,6 +2891,90 @@ static struct hda_verb alc260_fujitsu_init_verbs[] = {
2860 { } 2891 { }
2861}; 2892};
2862 2893
2894/* Initialisation sequence for ALC260 as configured in Acer TravelMate and
2895 * similar laptops (adapted from Fujitsu init verbs).
2896 */
2897static struct hda_verb alc260_acer_init_verbs[] = {
2898 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
2899 * the headphone jack. Turn this on and rely on the standard mute
2900 * methods whenever the user wants to turn these outputs off.
2901 */
2902 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
2903 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
2904 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
2905 /* Internal speaker/Headphone jack is connected to Line-out pin */
2906 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2907 /* Internal microphone/Mic jack is connected to Mic1 pin */
2908 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2909 /* Line In jack is connected to Line1 pin */
2910 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2911 /* Ensure all other unused pins are disabled and muted. */
2912 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
2913 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2914 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
2915 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2916 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
2917 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2918 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
2919 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2920 /* Disable digital (SPDIF) pins */
2921 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
2922 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
2923
2924 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
2925 * bus when acting as outputs.
2926 */
2927 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
2928 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
2929
2930 /* Start with output sum widgets muted and their output gains at min */
2931 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2932 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2933 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2934 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2935 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2936 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2937 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2938 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2939 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2940
2941 /* Unmute Line-out pin widget amp left and right (no equiv mixer ctrl) */
2942 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2943 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
2944 * inputs. If the pin mode is changed by the user the pin mode control
2945 * will take care of enabling the pin's input/output buffers as needed.
2946 * Therefore there's no need to enable the input buffer at this
2947 * stage.
2948 */
2949 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2950 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2951
2952 /* Mute capture amp left and right */
2953 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2954 /* Set ADC connection select to match default mixer setting - mic
2955 * (on mic1 pin)
2956 */
2957 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
2958
2959 /* Do similar with the second ADC: mute capture input amp and
2960 * set ADC connection to line (on line1 pin)
2961 */
2962 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2963 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
2964
2965 /* Mute all inputs to mixer widget (even unconnected ones) */
2966 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
2967 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
2968 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
2969 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
2970 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
2971 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
2972 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
2973 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
2974
2975 { }
2976};
2977
2863/* Test configuration for debugging, modelled after the ALC880 test 2978/* Test configuration for debugging, modelled after the ALC880 test
2864 * configuration. 2979 * configuration.
2865 */ 2980 */
@@ -3296,6 +3411,8 @@ static struct hda_board_config alc260_cfg_tbl[] = {
3296 { .pci_subvendor = 0x103c, .pci_subdevice = 0x3016, .config = ALC260_HP }, 3411 { .pci_subvendor = 0x103c, .pci_subdevice = 0x3016, .config = ALC260_HP },
3297 { .modelname = "fujitsu", .config = ALC260_FUJITSU_S702X }, 3412 { .modelname = "fujitsu", .config = ALC260_FUJITSU_S702X },
3298 { .pci_subvendor = 0x10cf, .pci_subdevice = 0x1326, .config = ALC260_FUJITSU_S702X }, 3413 { .pci_subvendor = 0x10cf, .pci_subdevice = 0x1326, .config = ALC260_FUJITSU_S702X },
3414 { .modelname = "acer", .config = ALC260_ACER },
3415 { .pci_subvendor = 0x1025, .pci_subdevice = 0x008f, .config = ALC260_ACER },
3299#ifdef CONFIG_SND_DEBUG 3416#ifdef CONFIG_SND_DEBUG
3300 { .modelname = "test", .config = ALC260_TEST }, 3417 { .modelname = "test", .config = ALC260_TEST },
3301#endif 3418#endif
@@ -3356,6 +3473,18 @@ static struct alc_config_preset alc260_presets[] = {
3356 .channel_mode = alc260_modes, 3473 .channel_mode = alc260_modes,
3357 .input_mux = &alc260_fujitsu_capture_source, 3474 .input_mux = &alc260_fujitsu_capture_source,
3358 }, 3475 },
3476 [ALC260_ACER] = {
3477 .mixers = { alc260_acer_mixer,
3478 alc260_capture_mixer },
3479 .init_verbs = { alc260_acer_init_verbs },
3480 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
3481 .dac_nids = alc260_dac_nids,
3482 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
3483 .adc_nids = alc260_dual_adc_nids,
3484 .num_channel_mode = ARRAY_SIZE(alc260_modes),
3485 .channel_mode = alc260_modes,
3486 .input_mux = &alc260_acer_capture_source,
3487 },
3359#ifdef CONFIG_SND_DEBUG 3488#ifdef CONFIG_SND_DEBUG
3360 [ALC260_TEST] = { 3489 [ALC260_TEST] = {
3361 .mixers = { alc260_test_mixer, 3490 .mixers = { alc260_test_mixer,