diff options
author | Jonathan Woithe <jwoithe@physics.adelaide.edu.au> | 2006-03-28 05:47:09 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-03-31 10:59:00 -0500 |
commit | a1e8d2da03b3a1017aab01d49666ec9b67927de5 (patch) | |
tree | f0c9c97632bdf2514644cb29d10c963a2a531cd5 /sound/pci | |
parent | cf40a310a7aaf1944eea3e01e9c120b31850c3b6 (diff) |
[ALSA] HDA/Realtek: multiple input mux definitions and pin mode additions
The following patch relative to CVS from 20060324 adds the following
features to the Realtek HDA codec.
1) Define two new pin modes: ALC_PIN_DIR_IN_NOMICBIAS and
ALC_PIN_DIR_INOUT_NOMICBIAS. These can be used with jack mode switch
definitions in mixers to prevent the user being offered the mic bias
options if the hardware doesn't support it.
2) Add the ability to have different input mux definitions for different
ADCs. This is needed because the ALC260 chip uses different mux layouts
for the two onboard ADCs. A new field (num_mux_defs) was added to the
alc_spec and alc_config_preset structures to support this.
3) Adjust numerous comments to make them consistent with the above changes.
4) Utilise the new multi-mux definition functionality for the ALC260 fujitsu
model to allow recording of the mixer output.
5) Utilise the new multi-mux definition functionality for the ALC260 test
model to make the mux selections a little less confusing.
6) Allow the headphone jack of the ALC260 acer model to be retasked in
the mixer.
6) Utilise the new multi-mux definition functionality for the ALC260 acer
model to give access to the mixer output and the retasked headphone
jack.
At this stage the *_NOMICBIAS modes are not used. We have reports that the
"Line" jack of at least some Acer models doesn't pass the bias out, and we
also know that NIDs 0x0f and 0x10 don't seem to accept the mic bias requests
at all. However, I feel we need to collect more evidence on both counts
before committing to the use of *_NOMICBIAS. In the case of the Acers, it's
not clear whether this issue (probably caused by the inclusion of DC
blocking capacitors) affects all Acer models or just a small number. With
the issue with NIDs 0x0f and 0x10 it's unclear whether this is a hardware
bug which will be addressed in later chip revisions or if it's an
intentional restriction. The datasheet makes no mention of the restriction
so at this stage I'm inclined to consider it a hardware bug. Comments in
the source reflect this reasoning.
On a similar theme, the headphone jack of the Fujitsu S7020 also doesn't
appear to pass mic bias voltage. I'm still investigating this however.
With the ability to retask the headphone jack, owners of ALC260-based Acer
laptops should now be able to record 4 channels of audio if they desire. The
multiple mux definitions allow this jack to be presented from both ADCs
(since this mux input is one of those which differs between the muxes).
This patch has been tested on a Fujitsu S7020 laptop and appears to behave
itself both for the "test" and "fujitsu" models. Definitions using only a
single mux specification also work. Other ALC chips should be fine but I
cannot test these myself. The "auto" modes should also continue to function
but again I have not verified this.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 205 |
1 files changed, 149 insertions, 56 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 6b45635b3ea3..66bbdb60f50b 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -132,6 +132,7 @@ struct alc_spec { | |||
132 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ | 132 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
133 | 133 | ||
134 | /* capture source */ | 134 | /* capture source */ |
135 | unsigned int num_mux_defs; | ||
135 | const struct hda_input_mux *input_mux; | 136 | const struct hda_input_mux *input_mux; |
136 | unsigned int cur_mux[3]; | 137 | unsigned int cur_mux[3]; |
137 | 138 | ||
@@ -173,6 +174,7 @@ struct alc_config_preset { | |||
173 | hda_nid_t dig_in_nid; | 174 | hda_nid_t dig_in_nid; |
174 | unsigned int num_channel_mode; | 175 | unsigned int num_channel_mode; |
175 | const struct hda_channel_mode *channel_mode; | 176 | const struct hda_channel_mode *channel_mode; |
177 | unsigned int num_mux_defs; | ||
176 | const struct hda_input_mux *input_mux; | 178 | const struct hda_input_mux *input_mux; |
177 | void (*unsol_event)(struct hda_codec *, unsigned int); | 179 | void (*unsol_event)(struct hda_codec *, unsigned int); |
178 | void (*init_hook)(struct hda_codec *); | 180 | void (*init_hook)(struct hda_codec *); |
@@ -186,7 +188,10 @@ static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_ | |||
186 | { | 188 | { |
187 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 189 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
188 | struct alc_spec *spec = codec->spec; | 190 | struct alc_spec *spec = codec->spec; |
189 | return snd_hda_input_mux_info(spec->input_mux, uinfo); | 191 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
192 | if (mux_idx >= spec->num_mux_defs) | ||
193 | mux_idx = 0; | ||
194 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); | ||
190 | } | 195 | } |
191 | 196 | ||
192 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 197 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
@@ -204,7 +209,8 @@ static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v | |||
204 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 209 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
205 | struct alc_spec *spec = codec->spec; | 210 | struct alc_spec *spec = codec->spec; |
206 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | 211 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
207 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, | 212 | unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
213 | return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol, | ||
208 | spec->adc_nids[adc_idx], &spec->cur_mux[adc_idx]); | 214 | spec->adc_nids[adc_idx], &spec->cur_mux[adc_idx]); |
209 | } | 215 | } |
210 | 216 | ||
@@ -246,7 +252,8 @@ static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_va | |||
246 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these | 252 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
247 | * are requested. Therefore order this list so that this behaviour will not | 253 | * are requested. Therefore order this list so that this behaviour will not |
248 | * cause problems when mixer clients move through the enum sequentially. | 254 | * cause problems when mixer clients move through the enum sequentially. |
249 | * NIDs 0x0f and 0x10 have been observed to have this behaviour. | 255 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
256 | * March 2006. | ||
250 | */ | 257 | */ |
251 | static char *alc_pin_mode_names[] = { | 258 | static char *alc_pin_mode_names[] = { |
252 | "Mic 50pc bias", "Mic 80pc bias", | 259 | "Mic 50pc bias", "Mic 80pc bias", |
@@ -256,19 +263,27 @@ static unsigned char alc_pin_mode_values[] = { | |||
256 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, | 263 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
257 | }; | 264 | }; |
258 | /* The control can present all 5 options, or it can limit the options based | 265 | /* The control can present all 5 options, or it can limit the options based |
259 | * in the pin being assumed to be exclusively an input or an output pin. | 266 | * in the pin being assumed to be exclusively an input or an output pin. In |
267 | * addition, "input" pins may or may not process the mic bias option | ||
268 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to | ||
269 | * accept requests for bias as of chip versions up to March 2006) and/or | ||
270 | * wiring in the computer. | ||
260 | */ | 271 | */ |
261 | #define ALC_PIN_DIR_IN 0x00 | 272 | #define ALC_PIN_DIR_IN 0x00 |
262 | #define ALC_PIN_DIR_OUT 0x01 | 273 | #define ALC_PIN_DIR_OUT 0x01 |
263 | #define ALC_PIN_DIR_INOUT 0x02 | 274 | #define ALC_PIN_DIR_INOUT 0x02 |
275 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 | ||
276 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 | ||
264 | 277 | ||
265 | /* Info about the pin modes supported by the three different pin directions. | 278 | /* Info about the pin modes supported by the different pin direction modes. |
266 | * For each direction the minimum and maximum values are given. | 279 | * For each direction the minimum and maximum values are given. |
267 | */ | 280 | */ |
268 | static signed char alc_pin_mode_dir_info[3][2] = { | 281 | static signed char alc_pin_mode_dir_info[5][2] = { |
269 | { 0, 2 }, /* ALC_PIN_DIR_IN */ | 282 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
270 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ | 283 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
271 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ | 284 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
285 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ | ||
286 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ | ||
272 | }; | 287 | }; |
273 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) | 288 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
274 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) | 289 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
@@ -330,9 +345,10 @@ static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v | |||
330 | * input modes. | 345 | * input modes. |
331 | * | 346 | * |
332 | * Dynamically switching the input/output buffers probably | 347 | * Dynamically switching the input/output buffers probably |
333 | * reduces noise slightly, particularly on input. However, | 348 | * reduces noise slightly (particularly on input) so we'll |
334 | * havingboth input and output buffers enabled | 349 | * do it. However, having both input and output buffers |
335 | * simultaneously doesn't seem to be problematic. | 350 | * enabled simultaneously doesn't seem to be problematic if |
351 | * this turns out to be necessary in the future. | ||
336 | */ | 352 | */ |
337 | if (val <= 2) { | 353 | if (val <= 2) { |
338 | snd_hda_codec_write(codec,nid,0,AC_VERB_SET_AMP_GAIN_MUTE, | 354 | snd_hda_codec_write(codec,nid,0,AC_VERB_SET_AMP_GAIN_MUTE, |
@@ -484,6 +500,9 @@ static void setup_preset(struct alc_spec *spec, const struct alc_config_preset * | |||
484 | spec->multiout.dig_out_nid = preset->dig_out_nid; | 500 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
485 | spec->multiout.hp_nid = preset->hp_nid; | 501 | spec->multiout.hp_nid = preset->hp_nid; |
486 | 502 | ||
503 | spec->num_mux_defs = preset->num_mux_defs; | ||
504 | if (! spec->num_mux_defs) | ||
505 | spec->num_mux_defs = 1; | ||
487 | spec->input_mux = preset->input_mux; | 506 | spec->input_mux = preset->input_mux; |
488 | 507 | ||
489 | spec->num_adc_nids = preset->num_adc_nids; | 508 | spec->num_adc_nids = preset->num_adc_nids; |
@@ -2686,6 +2705,7 @@ static int alc880_parse_auto_config(struct hda_codec *codec) | |||
2686 | 2705 | ||
2687 | spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs; | 2706 | spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs; |
2688 | 2707 | ||
2708 | spec->num_mux_defs = 1; | ||
2689 | spec->input_mux = &spec->private_imux; | 2709 | spec->input_mux = &spec->private_imux; |
2690 | 2710 | ||
2691 | return 1; | 2711 | return 1; |
@@ -2815,30 +2835,56 @@ static struct hda_input_mux alc260_capture_source = { | |||
2815 | }; | 2835 | }; |
2816 | 2836 | ||
2817 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, | 2837 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
2818 | * headphone jack and the internal CD lines. | 2838 | * headphone jack and the internal CD lines since these are the only pins at |
2839 | * which audio can appear. For flexibility, also allow the option of | ||
2840 | * recording the mixer output on the second ADC (ADC0 doesn't have a | ||
2841 | * connection to the mixer output). | ||
2819 | */ | 2842 | */ |
2820 | static struct hda_input_mux alc260_fujitsu_capture_source = { | 2843 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
2821 | .num_items = 3, | 2844 | { |
2822 | .items = { | 2845 | .num_items = 3, |
2823 | { "Mic/Line", 0x0 }, | 2846 | .items = { |
2824 | { "CD", 0x4 }, | 2847 | { "Mic/Line", 0x0 }, |
2825 | { "Headphone", 0x2 }, | 2848 | { "CD", 0x4 }, |
2849 | { "Headphone", 0x2 }, | ||
2850 | }, | ||
2826 | }, | 2851 | }, |
2852 | { | ||
2853 | .num_items = 4, | ||
2854 | .items = { | ||
2855 | { "Mic/Line", 0x0 }, | ||
2856 | { "CD", 0x4 }, | ||
2857 | { "Headphone", 0x2 }, | ||
2858 | { "Mixer", 0x5 }, | ||
2859 | }, | ||
2860 | }, | ||
2861 | |||
2827 | }; | 2862 | }; |
2828 | 2863 | ||
2829 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configutation to | 2864 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
2830 | * the Fujitsu S702x, but jacks are marked differently. We won't allow | 2865 | * the Fujitsu S702x, but jacks are marked differently. |
2831 | * retasking the Headphone jack, so it won't be available here. | ||
2832 | */ | 2866 | */ |
2833 | static struct hda_input_mux alc260_acer_capture_source = { | 2867 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
2834 | .num_items = 3, | 2868 | { |
2835 | .items = { | 2869 | .num_items = 4, |
2836 | { "Mic", 0x0 }, | 2870 | .items = { |
2837 | { "Line", 0x2 }, | 2871 | { "Mic", 0x0 }, |
2838 | { "CD", 0x4 }, | 2872 | { "Line", 0x2 }, |
2873 | { "CD", 0x4 }, | ||
2874 | { "Headphone", 0x5 }, | ||
2875 | }, | ||
2876 | }, | ||
2877 | { | ||
2878 | .num_items = 5, | ||
2879 | .items = { | ||
2880 | { "Mic", 0x0 }, | ||
2881 | { "Line", 0x2 }, | ||
2882 | { "CD", 0x4 }, | ||
2883 | { "Headphone", 0x6 }, | ||
2884 | { "Mixer", 0x5 }, | ||
2885 | }, | ||
2839 | }, | 2886 | }, |
2840 | }; | 2887 | }; |
2841 | |||
2842 | /* | 2888 | /* |
2843 | * This is just place-holder, so there's something for alc_build_pcms to look | 2889 | * This is just place-holder, so there's something for alc_build_pcms to look |
2844 | * at when it calculates the maximum number of channels. ALC260 has no mixer | 2890 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
@@ -2899,6 +2945,9 @@ static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { | |||
2899 | { } /* end */ | 2945 | { } /* end */ |
2900 | }; | 2946 | }; |
2901 | 2947 | ||
2948 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, | ||
2949 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. | ||
2950 | */ | ||
2902 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { | 2951 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
2903 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), | 2952 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
2904 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), | 2953 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
@@ -2915,9 +2964,28 @@ static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { | |||
2915 | { } /* end */ | 2964 | { } /* end */ |
2916 | }; | 2965 | }; |
2917 | 2966 | ||
2967 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current | ||
2968 | * versions of the ALC260 don't act on requests to enable mic bias from NID | ||
2969 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 | ||
2970 | * datasheet doesn't mention this restriction. At this stage it's not clear | ||
2971 | * whether this behaviour is intentional or is a hardware bug in chip | ||
2972 | * revisions available in early 2006. Therefore for now allow the | ||
2973 | * "Headphone Jack Mode" control to span all choices, but if it turns out | ||
2974 | * that the lack of mic bias for this NID is intentional we could change the | ||
2975 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. | ||
2976 | * | ||
2977 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 | ||
2978 | * don't appear to make the mic bias available from the "line" jack, even | ||
2979 | * though the NID used for this jack (0x14) can supply it. The theory is | ||
2980 | * that perhaps Acer have included blocking capacitors between the ALC260 | ||
2981 | * and the output jack. If this turns out to be the case for all such | ||
2982 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT | ||
2983 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. | ||
2984 | */ | ||
2918 | static struct snd_kcontrol_new alc260_acer_mixer[] = { | 2985 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
2919 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | 2986 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
2920 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), | 2987 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
2988 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), | ||
2921 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | 2989 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
2922 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | 2990 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
2923 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | 2991 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
@@ -3131,7 +3199,8 @@ static struct hda_verb alc260_hp_3013_init_verbs[] = { | |||
3131 | }; | 3199 | }; |
3132 | 3200 | ||
3133 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x | 3201 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
3134 | * laptops. | 3202 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
3203 | * audio = 0x16, internal speaker = 0x10. | ||
3135 | */ | 3204 | */ |
3136 | static struct hda_verb alc260_fujitsu_init_verbs[] = { | 3205 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
3137 | /* Disable all GPIOs */ | 3206 | /* Disable all GPIOs */ |
@@ -3278,10 +3347,10 @@ static struct hda_verb alc260_acer_init_verbs[] = { | |||
3278 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | 3347 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
3279 | 3348 | ||
3280 | /* Do similar with the second ADC: mute capture input amp and | 3349 | /* Do similar with the second ADC: mute capture input amp and |
3281 | * set ADC connection to line (on line1 pin) | 3350 | * set ADC connection to mic to match ALSA's default state. |
3282 | */ | 3351 | */ |
3283 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | 3352 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
3284 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, | 3353 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
3285 | 3354 | ||
3286 | /* Mute all inputs to mixer widget (even unconnected ones) */ | 3355 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
3287 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | 3356 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
@@ -3306,26 +3375,35 @@ static hda_nid_t alc260_test_dac_nids[1] = { | |||
3306 | static hda_nid_t alc260_test_adc_nids[2] = { | 3375 | static hda_nid_t alc260_test_adc_nids[2] = { |
3307 | 0x04, 0x05, | 3376 | 0x04, 0x05, |
3308 | }; | 3377 | }; |
3309 | /* This is a bit messy since the two input muxes in the ALC260 have slight | 3378 | /* For testing the ALC260, each input MUX needs its own definition since |
3310 | * variations in their signal assignments. The ideal way to deal with this | 3379 | * the signal assignments are different. This assumes that the first ADC |
3311 | * is to extend alc_spec.input_mux to allow a different input MUX for each | 3380 | * is NID 0x04. |
3312 | * ADC. For the purposes of the test model it's sufficient to just list | ||
3313 | * both options for affected signal indices. The separate input mux | ||
3314 | * functionality only needs to be considered if a model comes along which | ||
3315 | * actually uses signals 0x5, 0x6 and 0x7 for something which makes sense to | ||
3316 | * record. | ||
3317 | */ | 3381 | */ |
3318 | static struct hda_input_mux alc260_test_capture_source = { | 3382 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
3319 | .num_items = 8, | 3383 | { |
3320 | .items = { | 3384 | .num_items = 7, |
3321 | { "MIC1 pin", 0x0 }, | 3385 | .items = { |
3322 | { "MIC2 pin", 0x1 }, | 3386 | { "MIC1 pin", 0x0 }, |
3323 | { "LINE1 pin", 0x2 }, | 3387 | { "MIC2 pin", 0x1 }, |
3324 | { "LINE2 pin", 0x3 }, | 3388 | { "LINE1 pin", 0x2 }, |
3325 | { "CD pin", 0x4 }, | 3389 | { "LINE2 pin", 0x3 }, |
3326 | { "LINE-OUT pin (cap1), Mixer (cap2)", 0x5 }, | 3390 | { "CD pin", 0x4 }, |
3327 | { "HP-OUT pin (cap1), LINE-OUT pin (cap2)", 0x6 }, | 3391 | { "LINE-OUT pin", 0x5 }, |
3328 | { "HP-OUT pin (cap2 only)", 0x7 }, | 3392 | { "HP-OUT pin", 0x6 }, |
3393 | }, | ||
3394 | }, | ||
3395 | { | ||
3396 | .num_items = 8, | ||
3397 | .items = { | ||
3398 | { "MIC1 pin", 0x0 }, | ||
3399 | { "MIC2 pin", 0x1 }, | ||
3400 | { "LINE1 pin", 0x2 }, | ||
3401 | { "LINE2 pin", 0x3 }, | ||
3402 | { "CD pin", 0x4 }, | ||
3403 | { "Mixer", 0x5 }, | ||
3404 | { "LINE-OUT pin", 0x6 }, | ||
3405 | { "HP-OUT pin", 0x7 }, | ||
3406 | }, | ||
3329 | }, | 3407 | }, |
3330 | }; | 3408 | }; |
3331 | static struct snd_kcontrol_new alc260_test_mixer[] = { | 3409 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
@@ -3337,7 +3415,17 @@ static struct snd_kcontrol_new alc260_test_mixer[] = { | |||
3337 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), | 3415 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
3338 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), | 3416 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
3339 | 3417 | ||
3340 | /* Modes for retasking pin widgets */ | 3418 | /* Modes for retasking pin widgets |
3419 | * Note: the ALC260 doesn't seem to act on requests to enable mic | ||
3420 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't | ||
3421 | * mention this restriction. At this stage it's not clear whether | ||
3422 | * this behaviour is intentional or is a hardware bug in chip | ||
3423 | * revisions available at least up until early 2006. Therefore for | ||
3424 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all | ||
3425 | * choices, but if it turns out that the lack of mic bias for these | ||
3426 | * NIDs is intentional we could change their modes from | ||
3427 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. | ||
3428 | */ | ||
3341 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), | 3429 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
3342 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), | 3430 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
3343 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), | 3431 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
@@ -3699,6 +3787,7 @@ static int alc260_parse_auto_config(struct hda_codec *codec) | |||
3699 | 3787 | ||
3700 | spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs; | 3788 | spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs; |
3701 | 3789 | ||
3790 | spec->num_mux_defs = 1; | ||
3702 | spec->input_mux = &spec->private_imux; | 3791 | spec->input_mux = &spec->private_imux; |
3703 | 3792 | ||
3704 | /* check whether NID 0x04 is valid */ | 3793 | /* check whether NID 0x04 is valid */ |
@@ -3804,7 +3893,8 @@ static struct alc_config_preset alc260_presets[] = { | |||
3804 | .adc_nids = alc260_dual_adc_nids, | 3893 | .adc_nids = alc260_dual_adc_nids, |
3805 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | 3894 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
3806 | .channel_mode = alc260_modes, | 3895 | .channel_mode = alc260_modes, |
3807 | .input_mux = &alc260_fujitsu_capture_source, | 3896 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
3897 | .input_mux = alc260_fujitsu_capture_sources, | ||
3808 | }, | 3898 | }, |
3809 | [ALC260_ACER] = { | 3899 | [ALC260_ACER] = { |
3810 | .mixers = { alc260_acer_mixer, | 3900 | .mixers = { alc260_acer_mixer, |
@@ -3816,7 +3906,8 @@ static struct alc_config_preset alc260_presets[] = { | |||
3816 | .adc_nids = alc260_dual_adc_nids, | 3906 | .adc_nids = alc260_dual_adc_nids, |
3817 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | 3907 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
3818 | .channel_mode = alc260_modes, | 3908 | .channel_mode = alc260_modes, |
3819 | .input_mux = &alc260_acer_capture_source, | 3909 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
3910 | .input_mux = alc260_acer_capture_sources, | ||
3820 | }, | 3911 | }, |
3821 | #ifdef CONFIG_SND_DEBUG | 3912 | #ifdef CONFIG_SND_DEBUG |
3822 | [ALC260_TEST] = { | 3913 | [ALC260_TEST] = { |
@@ -3829,7 +3920,8 @@ static struct alc_config_preset alc260_presets[] = { | |||
3829 | .adc_nids = alc260_test_adc_nids, | 3920 | .adc_nids = alc260_test_adc_nids, |
3830 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | 3921 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
3831 | .channel_mode = alc260_modes, | 3922 | .channel_mode = alc260_modes, |
3832 | .input_mux = &alc260_test_capture_source, | 3923 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
3924 | .input_mux = alc260_test_capture_sources, | ||
3833 | }, | 3925 | }, |
3834 | #endif | 3926 | #endif |
3835 | }; | 3927 | }; |
@@ -3921,7 +4013,6 @@ static struct hda_input_mux alc882_capture_source = { | |||
3921 | { "CD", 0x4 }, | 4013 | { "CD", 0x4 }, |
3922 | }, | 4014 | }, |
3923 | }; | 4015 | }; |
3924 | |||
3925 | #define alc882_mux_enum_info alc_mux_enum_info | 4016 | #define alc882_mux_enum_info alc_mux_enum_info |
3926 | #define alc882_mux_enum_get alc_mux_enum_get | 4017 | #define alc882_mux_enum_get alc_mux_enum_get |
3927 | 4018 | ||
@@ -4823,6 +4914,7 @@ static int alc262_parse_auto_config(struct hda_codec *codec) | |||
4823 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; | 4914 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
4824 | 4915 | ||
4825 | spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs; | 4916 | spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs; |
4917 | spec->num_mux_defs = 1; | ||
4826 | spec->input_mux = &spec->private_imux; | 4918 | spec->input_mux = &spec->private_imux; |
4827 | 4919 | ||
4828 | return 1; | 4920 | return 1; |
@@ -5499,6 +5591,7 @@ static int alc861_parse_auto_config(struct hda_codec *codec) | |||
5499 | 5591 | ||
5500 | spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs; | 5592 | spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs; |
5501 | 5593 | ||
5594 | spec->num_mux_defs = 1; | ||
5502 | spec->input_mux = &spec->private_imux; | 5595 | spec->input_mux = &spec->private_imux; |
5503 | 5596 | ||
5504 | spec->adc_nids = alc861_adc_nids; | 5597 | spec->adc_nids = alc861_adc_nids; |