aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/hda')
-rw-r--r--sound/pci/hda/hda_codec.c10
-rw-r--r--sound/pci/hda/hda_generic.c7
-rw-r--r--sound/pci/hda/hda_intel.c2
-rw-r--r--sound/pci/hda/hda_local.h6
-rw-r--r--sound/pci/hda/hda_proc.c2
-rw-r--r--sound/pci/hda/patch_analog.c208
-rw-r--r--sound/pci/hda/patch_cirrus.c4
-rw-r--r--sound/pci/hda/patch_cmedia.c2
-rw-r--r--sound/pci/hda/patch_conexant.c14
-rw-r--r--sound/pci/hda/patch_hdmi.c12
-rw-r--r--sound/pci/hda/patch_realtek.c391
-rw-r--r--sound/pci/hda/patch_sigmatel.c89
-rw-r--r--sound/pci/hda/patch_via.c28
13 files changed, 513 insertions, 262 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 05e5ec88c2d9..ae5c5d5e4b7c 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -2134,10 +2134,10 @@ int snd_hda_codec_reset(struct hda_codec *codec)
2134 * This function returns zero if successful or a negative error code. 2134 * This function returns zero if successful or a negative error code.
2135 */ 2135 */
2136int snd_hda_add_vmaster(struct hda_codec *codec, char *name, 2136int snd_hda_add_vmaster(struct hda_codec *codec, char *name,
2137 unsigned int *tlv, const char **slaves) 2137 unsigned int *tlv, const char * const *slaves)
2138{ 2138{
2139 struct snd_kcontrol *kctl; 2139 struct snd_kcontrol *kctl;
2140 const char **s; 2140 const char * const *s;
2141 int err; 2141 int err;
2142 2142
2143 for (s = slaves; *s && !snd_hda_find_mixer_ctl(codec, *s); s++) 2143 for (s = slaves; *s && !snd_hda_find_mixer_ctl(codec, *s); s++)
@@ -3689,7 +3689,7 @@ EXPORT_SYMBOL_HDA(snd_hda_build_pcms);
3689 * If no entries are matching, the function returns a negative value. 3689 * If no entries are matching, the function returns a negative value.
3690 */ 3690 */
3691int snd_hda_check_board_config(struct hda_codec *codec, 3691int snd_hda_check_board_config(struct hda_codec *codec,
3692 int num_configs, const char **models, 3692 int num_configs, const char * const *models,
3693 const struct snd_pci_quirk *tbl) 3693 const struct snd_pci_quirk *tbl)
3694{ 3694{
3695 if (codec->modelname && models) { 3695 if (codec->modelname && models) {
@@ -3753,7 +3753,7 @@ EXPORT_SYMBOL_HDA(snd_hda_check_board_config);
3753 * If no entries are matching, the function returns a negative value. 3753 * If no entries are matching, the function returns a negative value.
3754 */ 3754 */
3755int snd_hda_check_board_codec_sid_config(struct hda_codec *codec, 3755int snd_hda_check_board_codec_sid_config(struct hda_codec *codec,
3756 int num_configs, const char **models, 3756 int num_configs, const char * const *models,
3757 const struct snd_pci_quirk *tbl) 3757 const struct snd_pci_quirk *tbl)
3758{ 3758{
3759 const struct snd_pci_quirk *q; 3759 const struct snd_pci_quirk *q;
@@ -4690,7 +4690,7 @@ const char *hda_get_input_pin_label(struct hda_codec *codec, hda_nid_t pin,
4690 int check_location) 4690 int check_location)
4691{ 4691{
4692 unsigned int def_conf; 4692 unsigned int def_conf;
4693 static const char *mic_names[] = { 4693 static const char * const mic_names[] = {
4694 "Internal Mic", "Dock Mic", "Mic", "Front Mic", "Rear Mic", 4694 "Internal Mic", "Dock Mic", "Mic", "Front Mic", "Rear Mic",
4695 }; 4695 };
4696 int attr; 4696 int attr;
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index fb0582f8d725..a63c54d9d767 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -762,7 +762,8 @@ static int check_existing_control(struct hda_codec *codec, const char *type, con
762/* 762/*
763 * build output mixer controls 763 * build output mixer controls
764 */ 764 */
765static int create_output_mixers(struct hda_codec *codec, const char **names) 765static int create_output_mixers(struct hda_codec *codec,
766 const char * const *names)
766{ 767{
767 struct hda_gspec *spec = codec->spec; 768 struct hda_gspec *spec = codec->spec;
768 int i, err; 769 int i, err;
@@ -780,8 +781,8 @@ static int create_output_mixers(struct hda_codec *codec, const char **names)
780static int build_output_controls(struct hda_codec *codec) 781static int build_output_controls(struct hda_codec *codec)
781{ 782{
782 struct hda_gspec *spec = codec->spec; 783 struct hda_gspec *spec = codec->spec;
783 static const char *types_speaker[] = { "Speaker", "Headphone" }; 784 static const char * const types_speaker[] = { "Speaker", "Headphone" };
784 static const char *types_line[] = { "Front", "Headphone" }; 785 static const char * const types_line[] = { "Front", "Headphone" };
785 786
786 switch (spec->pcm_vol_nodes) { 787 switch (spec->pcm_vol_nodes) {
787 case 1: 788 case 1:
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index d3d18be483e1..2e91a991eb15 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -2809,6 +2809,8 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = {
2809#endif 2809#endif
2810 /* Vortex86MX */ 2810 /* Vortex86MX */
2811 { PCI_DEVICE(0x17f3, 0x3010), .driver_data = AZX_DRIVER_GENERIC }, 2811 { PCI_DEVICE(0x17f3, 0x3010), .driver_data = AZX_DRIVER_GENERIC },
2812 /* VMware HDAudio */
2813 { PCI_DEVICE(0x15ad, 0x1977), .driver_data = AZX_DRIVER_GENERIC },
2812 /* AMD/ATI Generic, PCI class code and Vendor ID for HD Audio */ 2814 /* AMD/ATI Generic, PCI class code and Vendor ID for HD Audio */
2813 { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_ANY_ID), 2815 { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_ANY_ID),
2814 .class = PCI_CLASS_MULTIMEDIA_HD_AUDIO << 8, 2816 .class = PCI_CLASS_MULTIMEDIA_HD_AUDIO << 8,
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index 46bbefe2e4a9..3ab5e7a303db 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -140,7 +140,7 @@ void snd_hda_set_vmaster_tlv(struct hda_codec *codec, hda_nid_t nid, int dir,
140struct snd_kcontrol *snd_hda_find_mixer_ctl(struct hda_codec *codec, 140struct snd_kcontrol *snd_hda_find_mixer_ctl(struct hda_codec *codec,
141 const char *name); 141 const char *name);
142int snd_hda_add_vmaster(struct hda_codec *codec, char *name, 142int snd_hda_add_vmaster(struct hda_codec *codec, char *name,
143 unsigned int *tlv, const char **slaves); 143 unsigned int *tlv, const char * const *slaves);
144int snd_hda_codec_reset(struct hda_codec *codec); 144int snd_hda_codec_reset(struct hda_codec *codec);
145 145
146/* amp value bits */ 146/* amp value bits */
@@ -341,10 +341,10 @@ void snd_print_pcm_bits(int pcm, char *buf, int buflen);
341 * Misc 341 * Misc
342 */ 342 */
343int snd_hda_check_board_config(struct hda_codec *codec, int num_configs, 343int snd_hda_check_board_config(struct hda_codec *codec, int num_configs,
344 const char **modelnames, 344 const char * const *modelnames,
345 const struct snd_pci_quirk *pci_list); 345 const struct snd_pci_quirk *pci_list);
346int snd_hda_check_board_codec_sid_config(struct hda_codec *codec, 346int snd_hda_check_board_codec_sid_config(struct hda_codec *codec,
347 int num_configs, const char **models, 347 int num_configs, const char * const *models,
348 const struct snd_pci_quirk *tbl); 348 const struct snd_pci_quirk *tbl);
349int snd_hda_add_new_ctls(struct hda_codec *codec, 349int snd_hda_add_new_ctls(struct hda_codec *codec,
350 struct snd_kcontrol_new *knew); 350 struct snd_kcontrol_new *knew);
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c
index f025200f2a62..bfe74c2fb079 100644
--- a/sound/pci/hda/hda_proc.c
+++ b/sound/pci/hda/hda_proc.c
@@ -418,7 +418,7 @@ static void print_digital_conv(struct snd_info_buffer *buffer,
418 418
419static const char *get_pwr_state(u32 state) 419static const char *get_pwr_state(u32 state)
420{ 420{
421 static const char *buf[4] = { 421 static const char * const buf[4] = {
422 "D0", "D1", "D2", "D3" 422 "D0", "D1", "D2", "D3"
423 }; 423 };
424 if (state < 4) 424 if (state < 4)
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 46780670162b..8dabab798689 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -46,6 +46,9 @@ struct ad198x_spec {
46 unsigned int cur_eapd; 46 unsigned int cur_eapd;
47 unsigned int need_dac_fix; 47 unsigned int need_dac_fix;
48 48
49 hda_nid_t *alt_dac_nid;
50 struct hda_pcm_stream *stream_analog_alt_playback;
51
49 /* capture */ 52 /* capture */
50 unsigned int num_adc_nids; 53 unsigned int num_adc_nids;
51 hda_nid_t *adc_nids; 54 hda_nid_t *adc_nids;
@@ -81,8 +84,8 @@ struct ad198x_spec {
81#endif 84#endif
82 /* for virtual master */ 85 /* for virtual master */
83 hda_nid_t vmaster_nid; 86 hda_nid_t vmaster_nid;
84 const char **slave_vols; 87 const char * const *slave_vols;
85 const char **slave_sws; 88 const char * const *slave_sws;
86}; 89};
87 90
88/* 91/*
@@ -130,7 +133,7 @@ static int ad198x_init(struct hda_codec *codec)
130 return 0; 133 return 0;
131} 134}
132 135
133static const char *ad_slave_vols[] = { 136static const char * const ad_slave_vols[] = {
134 "Front Playback Volume", 137 "Front Playback Volume",
135 "Surround Playback Volume", 138 "Surround Playback Volume",
136 "Center Playback Volume", 139 "Center Playback Volume",
@@ -143,7 +146,7 @@ static const char *ad_slave_vols[] = {
143 NULL 146 NULL
144}; 147};
145 148
146static const char *ad_slave_sws[] = { 149static const char * const ad_slave_sws[] = {
147 "Front Playback Switch", 150 "Front Playback Switch",
148 "Surround Playback Switch", 151 "Surround Playback Switch",
149 "Center Playback Switch", 152 "Center Playback Switch",
@@ -156,6 +159,25 @@ static const char *ad_slave_sws[] = {
156 NULL 159 NULL
157}; 160};
158 161
162static const char * const ad1988_6stack_fp_slave_vols[] = {
163 "Front Playback Volume",
164 "Surround Playback Volume",
165 "Center Playback Volume",
166 "LFE Playback Volume",
167 "Side Playback Volume",
168 "IEC958 Playback Volume",
169 NULL
170};
171
172static const char * const ad1988_6stack_fp_slave_sws[] = {
173 "Front Playback Switch",
174 "Surround Playback Switch",
175 "Center Playback Switch",
176 "LFE Playback Switch",
177 "Side Playback Switch",
178 "IEC958 Playback Switch",
179 NULL
180};
159static void ad198x_free_kctls(struct hda_codec *codec); 181static void ad198x_free_kctls(struct hda_codec *codec);
160 182
161#ifdef CONFIG_SND_HDA_INPUT_BEEP 183#ifdef CONFIG_SND_HDA_INPUT_BEEP
@@ -309,6 +331,38 @@ static int ad198x_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
309 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); 331 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
310} 332}
311 333
334static int ad198x_alt_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
335 struct hda_codec *codec,
336 unsigned int stream_tag,
337 unsigned int format,
338 struct snd_pcm_substream *substream)
339{
340 struct ad198x_spec *spec = codec->spec;
341 snd_hda_codec_setup_stream(codec, spec->alt_dac_nid[0], stream_tag,
342 0, format);
343 return 0;
344}
345
346static int ad198x_alt_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
347 struct hda_codec *codec,
348 struct snd_pcm_substream *substream)
349{
350 struct ad198x_spec *spec = codec->spec;
351 snd_hda_codec_cleanup_stream(codec, spec->alt_dac_nid[0]);
352 return 0;
353}
354
355static struct hda_pcm_stream ad198x_pcm_analog_alt_playback = {
356 .substreams = 1,
357 .channels_min = 2,
358 .channels_max = 2,
359 /* NID is set in ad198x_build_pcms */
360 .ops = {
361 .prepare = ad198x_alt_playback_pcm_prepare,
362 .cleanup = ad198x_alt_playback_pcm_cleanup
363 },
364};
365
312/* 366/*
313 * Digital out 367 * Digital out
314 */ 368 */
@@ -446,6 +500,17 @@ static int ad198x_build_pcms(struct hda_codec *codec)
446 } 500 }
447 } 501 }
448 502
503 if (spec->alt_dac_nid && spec->stream_analog_alt_playback) {
504 codec->num_pcms++;
505 info = spec->pcm_rec + 2;
506 info->name = "AD198x Headphone";
507 info->pcm_type = HDA_PCM_TYPE_AUDIO;
508 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
509 *spec->stream_analog_alt_playback;
510 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
511 spec->alt_dac_nid[0];
512 }
513
449 return 0; 514 return 0;
450} 515}
451 516
@@ -1069,7 +1134,7 @@ enum {
1069 AD1986A_MODELS 1134 AD1986A_MODELS
1070}; 1135};
1071 1136
1072static const char *ad1986a_models[AD1986A_MODELS] = { 1137static const char * const ad1986a_models[AD1986A_MODELS] = {
1073 [AD1986A_6STACK] = "6stack", 1138 [AD1986A_6STACK] = "6stack",
1074 [AD1986A_3STACK] = "3stack", 1139 [AD1986A_3STACK] = "3stack",
1075 [AD1986A_LAPTOP] = "laptop", 1140 [AD1986A_LAPTOP] = "laptop",
@@ -1813,7 +1878,7 @@ enum {
1813 AD1981_MODELS 1878 AD1981_MODELS
1814}; 1879};
1815 1880
1816static const char *ad1981_models[AD1981_MODELS] = { 1881static const char * const ad1981_models[AD1981_MODELS] = {
1817 [AD1981_HP] = "hp", 1882 [AD1981_HP] = "hp",
1818 [AD1981_THINKPAD] = "thinkpad", 1883 [AD1981_THINKPAD] = "thinkpad",
1819 [AD1981_BASIC] = "basic", 1884 [AD1981_BASIC] = "basic",
@@ -2015,6 +2080,7 @@ static int patch_ad1981(struct hda_codec *codec)
2015enum { 2080enum {
2016 AD1988_6STACK, 2081 AD1988_6STACK,
2017 AD1988_6STACK_DIG, 2082 AD1988_6STACK_DIG,
2083 AD1988_6STACK_DIG_FP,
2018 AD1988_3STACK, 2084 AD1988_3STACK,
2019 AD1988_3STACK_DIG, 2085 AD1988_3STACK_DIG,
2020 AD1988_LAPTOP, 2086 AD1988_LAPTOP,
@@ -2047,6 +2113,10 @@ static hda_nid_t ad1988_6stack_dac_nids_rev2[4] = {
2047 0x04, 0x05, 0x0a, 0x06 2113 0x04, 0x05, 0x0a, 0x06
2048}; 2114};
2049 2115
2116static hda_nid_t ad1988_alt_dac_nid[1] = {
2117 0x03
2118};
2119
2050static hda_nid_t ad1988_3stack_dac_nids_rev2[3] = { 2120static hda_nid_t ad1988_3stack_dac_nids_rev2[3] = {
2051 0x04, 0x0a, 0x06 2121 0x04, 0x0a, 0x06
2052}; 2122};
@@ -2166,6 +2236,35 @@ static struct snd_kcontrol_new ad1988_6stack_mixers2[] = {
2166 { } /* end */ 2236 { } /* end */
2167}; 2237};
2168 2238
2239static struct snd_kcontrol_new ad1988_6stack_fp_mixers[] = {
2240 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
2241
2242 HDA_BIND_MUTE("Front Playback Switch", 0x29, 2, HDA_INPUT),
2243 HDA_BIND_MUTE("Surround Playback Switch", 0x2a, 2, HDA_INPUT),
2244 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x27, 1, 2, HDA_INPUT),
2245 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x27, 2, 2, HDA_INPUT),
2246 HDA_BIND_MUTE("Side Playback Switch", 0x28, 2, HDA_INPUT),
2247 HDA_BIND_MUTE("Headphone Playback Switch", 0x22, 2, HDA_INPUT),
2248 HDA_BIND_MUTE("Mono Playback Switch", 0x1e, 2, HDA_INPUT),
2249
2250 HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x6, HDA_INPUT),
2251 HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x6, HDA_INPUT),
2252 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x20, 0x0, HDA_INPUT),
2253 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x20, 0x0, HDA_INPUT),
2254 HDA_CODEC_VOLUME("Line Playback Volume", 0x20, 0x1, HDA_INPUT),
2255 HDA_CODEC_MUTE("Line Playback Switch", 0x20, 0x1, HDA_INPUT),
2256 HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x4, HDA_INPUT),
2257 HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x4, HDA_INPUT),
2258
2259 HDA_CODEC_VOLUME("Analog Mix Playback Volume", 0x21, 0x0, HDA_OUTPUT),
2260 HDA_CODEC_MUTE("Analog Mix Playback Switch", 0x21, 0x0, HDA_OUTPUT),
2261
2262 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x39, 0x0, HDA_OUTPUT),
2263 HDA_CODEC_VOLUME("Mic Boost Volume", 0x3c, 0x0, HDA_OUTPUT),
2264
2265 { } /* end */
2266};
2267
2169/* 3-stack mode */ 2268/* 3-stack mode */
2170static struct snd_kcontrol_new ad1988_3stack_mixers1[] = { 2269static struct snd_kcontrol_new ad1988_3stack_mixers1[] = {
2171 HDA_CODEC_VOLUME("Front Playback Volume", 0x04, 0x0, HDA_OUTPUT), 2270 HDA_CODEC_VOLUME("Front Playback Volume", 0x04, 0x0, HDA_OUTPUT),
@@ -2445,6 +2544,68 @@ static struct hda_verb ad1988_6stack_init_verbs[] = {
2445 { } 2544 { }
2446}; 2545};
2447 2546
2547static struct hda_verb ad1988_6stack_fp_init_verbs[] = {
2548 /* Front, Surround, CLFE, side DAC; unmute as default */
2549 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2550 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2551 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2552 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2553 /* Headphone; unmute as default */
2554 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2555 /* Port-A front headphon path */
2556 {0x37, AC_VERB_SET_CONNECT_SEL, 0x00}, /* DAC0:03h */
2557 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2558 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2559 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2560 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2561 /* Port-D line-out path */
2562 {0x29, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2563 {0x29, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2564 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2565 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2566 /* Port-F surround path */
2567 {0x2a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2568 {0x2a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2569 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2570 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2571 /* Port-G CLFE path */
2572 {0x27, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2573 {0x27, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2574 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2575 {0x24, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2576 /* Port-H side path */
2577 {0x28, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2578 {0x28, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2579 {0x25, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2580 {0x25, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2581 /* Mono out path */
2582 {0x36, AC_VERB_SET_CONNECT_SEL, 0x1}, /* DAC1:04h */
2583 {0x1e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2584 {0x1e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2585 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2586 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, 0xb01f}, /* unmute, 0dB */
2587 /* Port-B front mic-in path */
2588 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2589 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2590 {0x39, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2591 /* Port-C line-in path */
2592 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2593 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2594 {0x3a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2595 {0x33, AC_VERB_SET_CONNECT_SEL, 0x0},
2596 /* Port-E mic-in path */
2597 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2598 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2599 {0x3c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2600 {0x34, AC_VERB_SET_CONNECT_SEL, 0x0},
2601 /* Analog CD Input */
2602 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2603 /* Analog Mix output amp */
2604 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x1f}, /* 0dB */
2605
2606 { }
2607};
2608
2448static struct hda_verb ad1988_capture_init_verbs[] = { 2609static struct hda_verb ad1988_capture_init_verbs[] = {
2449 /* mute analog mix */ 2610 /* mute analog mix */
2450 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 2611 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
@@ -2792,7 +2953,9 @@ static int ad1988_auto_create_multi_out_ctls(struct ad198x_spec *spec,
2792 const struct auto_pin_cfg *cfg) 2953 const struct auto_pin_cfg *cfg)
2793{ 2954{
2794 char name[32]; 2955 char name[32];
2795 static const char *chname[4] = { "Front", "Surround", NULL /*CLFE*/, "Side" }; 2956 static const char * const chname[4] = {
2957 "Front", "Surround", NULL /*CLFE*/, "Side"
2958 };
2796 hda_nid_t nid; 2959 hda_nid_t nid;
2797 int i, err; 2960 int i, err;
2798 2961
@@ -3074,13 +3237,13 @@ static int ad1988_auto_init(struct hda_codec *codec)
3074 return 0; 3237 return 0;
3075} 3238}
3076 3239
3077
3078/* 3240/*
3079 */ 3241 */
3080 3242
3081static const char *ad1988_models[AD1988_MODEL_LAST] = { 3243static const char * const ad1988_models[AD1988_MODEL_LAST] = {
3082 [AD1988_6STACK] = "6stack", 3244 [AD1988_6STACK] = "6stack",
3083 [AD1988_6STACK_DIG] = "6stack-dig", 3245 [AD1988_6STACK_DIG] = "6stack-dig",
3246 [AD1988_6STACK_DIG_FP] = "6stack-dig-fp",
3084 [AD1988_3STACK] = "3stack", 3247 [AD1988_3STACK] = "3stack",
3085 [AD1988_3STACK_DIG] = "3stack-dig", 3248 [AD1988_3STACK_DIG] = "3stack-dig",
3086 [AD1988_LAPTOP] = "laptop", 3249 [AD1988_LAPTOP] = "laptop",
@@ -3140,6 +3303,7 @@ static int patch_ad1988(struct hda_codec *codec)
3140 switch (board_config) { 3303 switch (board_config) {
3141 case AD1988_6STACK: 3304 case AD1988_6STACK:
3142 case AD1988_6STACK_DIG: 3305 case AD1988_6STACK_DIG:
3306 case AD1988_6STACK_DIG_FP:
3143 spec->multiout.max_channels = 8; 3307 spec->multiout.max_channels = 8;
3144 spec->multiout.num_dacs = 4; 3308 spec->multiout.num_dacs = 4;
3145 if (is_rev2(codec)) 3309 if (is_rev2(codec))
@@ -3152,10 +3316,22 @@ static int patch_ad1988(struct hda_codec *codec)
3152 spec->mixers[0] = ad1988_6stack_mixers1_rev2; 3316 spec->mixers[0] = ad1988_6stack_mixers1_rev2;
3153 else 3317 else
3154 spec->mixers[0] = ad1988_6stack_mixers1; 3318 spec->mixers[0] = ad1988_6stack_mixers1;
3155 spec->mixers[1] = ad1988_6stack_mixers2; 3319 if (board_config == AD1988_6STACK_DIG_FP) {
3320 spec->mixers[1] = ad1988_6stack_fp_mixers;
3321 spec->slave_vols = ad1988_6stack_fp_slave_vols;
3322 spec->slave_sws = ad1988_6stack_fp_slave_sws;
3323 spec->alt_dac_nid = ad1988_alt_dac_nid;
3324 spec->stream_analog_alt_playback =
3325 &ad198x_pcm_analog_alt_playback;
3326 } else
3327 spec->mixers[1] = ad1988_6stack_mixers2;
3156 spec->num_init_verbs = 1; 3328 spec->num_init_verbs = 1;
3157 spec->init_verbs[0] = ad1988_6stack_init_verbs; 3329 if (board_config == AD1988_6STACK_DIG_FP)
3158 if (board_config == AD1988_6STACK_DIG) { 3330 spec->init_verbs[0] = ad1988_6stack_fp_init_verbs;
3331 else
3332 spec->init_verbs[0] = ad1988_6stack_init_verbs;
3333 if ((board_config == AD1988_6STACK_DIG) ||
3334 (board_config == AD1988_6STACK_DIG_FP)) {
3159 spec->multiout.dig_out_nid = AD1988_SPDIF_OUT; 3335 spec->multiout.dig_out_nid = AD1988_SPDIF_OUT;
3160 spec->dig_in_nid = AD1988_SPDIF_IN; 3336 spec->dig_in_nid = AD1988_SPDIF_IN;
3161 } 3337 }
@@ -3399,7 +3575,7 @@ static struct hda_amp_list ad1884_loopbacks[] = {
3399}; 3575};
3400#endif 3576#endif
3401 3577
3402static const char *ad1884_slave_vols[] = { 3578static const char * const ad1884_slave_vols[] = {
3403 "PCM Playback Volume", 3579 "PCM Playback Volume",
3404 "Mic Playback Volume", 3580 "Mic Playback Volume",
3405 "Mono Playback Volume", 3581 "Mono Playback Volume",
@@ -3637,7 +3813,7 @@ enum {
3637 AD1984_MODELS 3813 AD1984_MODELS
3638}; 3814};
3639 3815
3640static const char *ad1984_models[AD1984_MODELS] = { 3816static const char * const ad1984_models[AD1984_MODELS] = {
3641 [AD1984_BASIC] = "basic", 3817 [AD1984_BASIC] = "basic",
3642 [AD1984_THINKPAD] = "thinkpad", 3818 [AD1984_THINKPAD] = "thinkpad",
3643 [AD1984_DELL_DESKTOP] = "dell_desktop", 3819 [AD1984_DELL_DESKTOP] = "dell_desktop",
@@ -4308,7 +4484,7 @@ enum {
4308 AD1884A_MODELS 4484 AD1884A_MODELS
4309}; 4485};
4310 4486
4311static const char *ad1884a_models[AD1884A_MODELS] = { 4487static const char * const ad1884a_models[AD1884A_MODELS] = {
4312 [AD1884A_DESKTOP] = "desktop", 4488 [AD1884A_DESKTOP] = "desktop",
4313 [AD1884A_LAPTOP] = "laptop", 4489 [AD1884A_LAPTOP] = "laptop",
4314 [AD1884A_MOBILE] = "mobile", 4490 [AD1884A_MOBILE] = "mobile",
@@ -4696,7 +4872,7 @@ enum {
4696 AD1882_MODELS 4872 AD1882_MODELS
4697}; 4873};
4698 4874
4699static const char *ad1882_models[AD1986A_MODELS] = { 4875static const char * const ad1882_models[AD1986A_MODELS] = {
4700 [AD1882_3STACK] = "3stack", 4876 [AD1882_3STACK] = "3stack",
4701 [AD1882_6STACK] = "6stack", 4877 [AD1882_6STACK] = "6stack",
4702}; 4878};
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
index 18af38ebf757..a07b031090d8 100644
--- a/sound/pci/hda/patch_cirrus.c
+++ b/sound/pci/hda/patch_cirrus.c
@@ -490,7 +490,7 @@ static int parse_digital_input(struct hda_codec *codec)
490 * create mixer controls 490 * create mixer controls
491 */ 491 */
492 492
493static const char *dir_sfx[2] = { "Playback", "Capture" }; 493static const char * const dir_sfx[2] = { "Playback", "Capture" };
494 494
495static int add_mute(struct hda_codec *codec, const char *name, int index, 495static int add_mute(struct hda_codec *codec, const char *name, int index,
496 unsigned int pval, int dir, struct snd_kcontrol **kctlp) 496 unsigned int pval, int dir, struct snd_kcontrol **kctlp)
@@ -1156,7 +1156,7 @@ static int cs_parse_auto_config(struct hda_codec *codec)
1156 return 0; 1156 return 0;
1157} 1157}
1158 1158
1159static const char *cs420x_models[CS420X_MODELS] = { 1159static const char * const cs420x_models[CS420X_MODELS] = {
1160 [CS420X_MBP53] = "mbp53", 1160 [CS420X_MBP53] = "mbp53",
1161 [CS420X_MBP55] = "mbp55", 1161 [CS420X_MBP55] = "mbp55",
1162 [CS420X_IMAC27] = "imac27", 1162 [CS420X_IMAC27] = "imac27",
diff --git a/sound/pci/hda/patch_cmedia.c b/sound/pci/hda/patch_cmedia.c
index ff60908f4554..1f8bbcd0f802 100644
--- a/sound/pci/hda/patch_cmedia.c
+++ b/sound/pci/hda/patch_cmedia.c
@@ -608,7 +608,7 @@ static void cmi9880_free(struct hda_codec *codec)
608/* 608/*
609 */ 609 */
610 610
611static const char *cmi9880_models[CMI_MODELS] = { 611static const char * const cmi9880_models[CMI_MODELS] = {
612 [CMI_MINIMAL] = "minimal", 612 [CMI_MINIMAL] = "minimal",
613 [CMI_MIN_FP] = "min_fp", 613 [CMI_MIN_FP] = "min_fp",
614 [CMI_FULL] = "full", 614 [CMI_FULL] = "full",
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index e96581fcdbdb..9bb030a469cd 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -537,13 +537,13 @@ static struct snd_kcontrol_new cxt_beep_mixer[] = {
537}; 537};
538#endif 538#endif
539 539
540static const char *slave_vols[] = { 540static const char * const slave_vols[] = {
541 "Headphone Playback Volume", 541 "Headphone Playback Volume",
542 "Speaker Playback Volume", 542 "Speaker Playback Volume",
543 NULL 543 NULL
544}; 544};
545 545
546static const char *slave_sws[] = { 546static const char * const slave_sws[] = {
547 "Headphone Playback Switch", 547 "Headphone Playback Switch",
548 "Speaker Playback Switch", 548 "Speaker Playback Switch",
549 NULL 549 NULL
@@ -1134,7 +1134,7 @@ enum {
1134 CXT5045_MODELS 1134 CXT5045_MODELS
1135}; 1135};
1136 1136
1137static const char *cxt5045_models[CXT5045_MODELS] = { 1137static const char * const cxt5045_models[CXT5045_MODELS] = {
1138 [CXT5045_LAPTOP_HPSENSE] = "laptop-hpsense", 1138 [CXT5045_LAPTOP_HPSENSE] = "laptop-hpsense",
1139 [CXT5045_LAPTOP_MICSENSE] = "laptop-micsense", 1139 [CXT5045_LAPTOP_MICSENSE] = "laptop-micsense",
1140 [CXT5045_LAPTOP_HPMICSENSE] = "laptop-hpmicsense", 1140 [CXT5045_LAPTOP_HPMICSENSE] = "laptop-hpmicsense",
@@ -1579,7 +1579,7 @@ enum {
1579 CXT5047_MODELS 1579 CXT5047_MODELS
1580}; 1580};
1581 1581
1582static const char *cxt5047_models[CXT5047_MODELS] = { 1582static const char * const cxt5047_models[CXT5047_MODELS] = {
1583 [CXT5047_LAPTOP] = "laptop", 1583 [CXT5047_LAPTOP] = "laptop",
1584 [CXT5047_LAPTOP_HP] = "laptop-hp", 1584 [CXT5047_LAPTOP_HP] = "laptop-hp",
1585 [CXT5047_LAPTOP_EAPD] = "laptop-eapd", 1585 [CXT5047_LAPTOP_EAPD] = "laptop-eapd",
@@ -1995,7 +1995,7 @@ enum {
1995 CXT5051_MODELS 1995 CXT5051_MODELS
1996}; 1996};
1997 1997
1998static const char *cxt5051_models[CXT5051_MODELS] = { 1998static const char *const cxt5051_models[CXT5051_MODELS] = {
1999 [CXT5051_LAPTOP] = "laptop", 1999 [CXT5051_LAPTOP] = "laptop",
2000 [CXT5051_HP] = "hp", 2000 [CXT5051_HP] = "hp",
2001 [CXT5051_HP_DV6736] = "hp-dv6736", 2001 [CXT5051_HP_DV6736] = "hp-dv6736",
@@ -3084,7 +3084,7 @@ enum {
3084 CXT5066_MODELS 3084 CXT5066_MODELS
3085}; 3085};
3086 3086
3087static const char *cxt5066_models[CXT5066_MODELS] = { 3087static const char * const cxt5066_models[CXT5066_MODELS] = {
3088 [CXT5066_LAPTOP] = "laptop", 3088 [CXT5066_LAPTOP] = "laptop",
3089 [CXT5066_DELL_LAPTOP] = "dell-laptop", 3089 [CXT5066_DELL_LAPTOP] = "dell-laptop",
3090 [CXT5066_OLPC_XO_1_5] = "olpc-xo-1_5", 3090 [CXT5066_OLPC_XO_1_5] = "olpc-xo-1_5",
@@ -3746,7 +3746,7 @@ static int cx_auto_build_output_controls(struct hda_codec *codec)
3746 struct conexant_spec *spec = codec->spec; 3746 struct conexant_spec *spec = codec->spec;
3747 int i, err; 3747 int i, err;
3748 int num_line = 0, num_hp = 0, num_spk = 0; 3748 int num_line = 0, num_hp = 0, num_spk = 0;
3749 static const char *texts[3] = { "Front", "Surround", "CLFE" }; 3749 static const char * const texts[3] = { "Front", "Surround", "CLFE" };
3750 3750
3751 if (spec->dac_info_filled == 1) 3751 if (spec->dac_info_filled == 1)
3752 return cx_auto_add_pb_volume(codec, spec->dac_info[0].dac, 3752 return cx_auto_add_pb_volume(codec, spec->dac_info[0].dac,
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index f29b97b5de8f..2d5b83fa8d24 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -817,6 +817,7 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo,
817 struct hdmi_spec *spec = codec->spec; 817 struct hdmi_spec *spec = codec->spec;
818 struct hdmi_eld *eld; 818 struct hdmi_eld *eld;
819 struct hda_pcm_stream *codec_pars; 819 struct hda_pcm_stream *codec_pars;
820 struct snd_pcm_runtime *runtime = substream->runtime;
820 unsigned int idx; 821 unsigned int idx;
821 822
822 for (idx = 0; idx < spec->num_cvts; idx++) 823 for (idx = 0; idx < spec->num_cvts; idx++)
@@ -844,6 +845,14 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo,
844 hinfo->formats = codec_pars->formats; 845 hinfo->formats = codec_pars->formats;
845 hinfo->maxbps = codec_pars->maxbps; 846 hinfo->maxbps = codec_pars->maxbps;
846 } 847 }
848 /* store the updated parameters */
849 runtime->hw.channels_min = hinfo->channels_min;
850 runtime->hw.channels_max = hinfo->channels_max;
851 runtime->hw.formats = hinfo->formats;
852 runtime->hw.rates = hinfo->rates;
853
854 snd_pcm_hw_constraint_step(substream->runtime, 0,
855 SNDRV_PCM_HW_PARAM_CHANNELS, 2);
847 return 0; 856 return 0;
848} 857}
849 858
@@ -1238,6 +1247,9 @@ static int simple_playback_pcm_open(struct hda_pcm_stream *hinfo,
1238 snd_pcm_hw_constraint_list(substream->runtime, 0, 1247 snd_pcm_hw_constraint_list(substream->runtime, 0,
1239 SNDRV_PCM_HW_PARAM_CHANNELS, 1248 SNDRV_PCM_HW_PARAM_CHANNELS,
1240 hw_constraints_channels); 1249 hw_constraints_channels);
1250 } else {
1251 snd_pcm_hw_constraint_step(substream->runtime, 0,
1252 SNDRV_PCM_HW_PARAM_CHANNELS, 2);
1241 } 1253 }
1242 1254
1243 return snd_hda_multi_out_dig_open(codec, &spec->multiout); 1255 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 51c08edd7563..be4df4c6fd56 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -303,6 +303,8 @@ struct alc_customize_define {
303 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */ 303 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
304}; 304};
305 305
306struct alc_fixup;
307
306struct alc_spec { 308struct alc_spec {
307 /* codec parameterization */ 309 /* codec parameterization */
308 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ 310 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
@@ -404,6 +406,11 @@ struct alc_spec {
404 /* for PLL fix */ 406 /* for PLL fix */
405 hda_nid_t pll_nid; 407 hda_nid_t pll_nid;
406 unsigned int pll_coef_idx, pll_coef_bit; 408 unsigned int pll_coef_idx, pll_coef_bit;
409
410 /* fix-up list */
411 int fixup_id;
412 const struct alc_fixup *fixup_list;
413 const char *fixup_name;
407}; 414};
408 415
409/* 416/*
@@ -1683,88 +1690,133 @@ struct alc_model_fixup {
1683}; 1690};
1684 1691
1685struct alc_fixup { 1692struct alc_fixup {
1686 unsigned int sku; 1693 int type;
1687 const struct alc_pincfg *pins; 1694 bool chained;
1688 const struct hda_verb *verbs; 1695 int chain_id;
1689 void (*func)(struct hda_codec *codec, const struct alc_fixup *fix, 1696 union {
1690 int pre_init); 1697 unsigned int sku;
1698 const struct alc_pincfg *pins;
1699 const struct hda_verb *verbs;
1700 void (*func)(struct hda_codec *codec,
1701 const struct alc_fixup *fix,
1702 int action);
1703 } v;
1691}; 1704};
1692 1705
1693static void __alc_pick_fixup(struct hda_codec *codec, 1706enum {
1694 const struct alc_fixup *fix, 1707 ALC_FIXUP_INVALID,
1695 const char *modelname, 1708 ALC_FIXUP_SKU,
1696 int pre_init) 1709 ALC_FIXUP_PINS,
1697{ 1710 ALC_FIXUP_VERBS,
1698 const struct alc_pincfg *cfg; 1711 ALC_FIXUP_FUNC,
1699 struct alc_spec *spec; 1712};
1700 1713
1701 cfg = fix->pins; 1714enum {
1702 if (pre_init && fix->sku) { 1715 ALC_FIXUP_ACT_PRE_PROBE,
1703#ifdef CONFIG_SND_DEBUG_VERBOSE 1716 ALC_FIXUP_ACT_PROBE,
1704 snd_printdd(KERN_INFO "hda_codec: %s: Apply sku override for %s\n", 1717 ALC_FIXUP_ACT_INIT,
1705 codec->chip_name, modelname); 1718};
1706#endif
1707 spec = codec->spec;
1708 spec->cdefine.sku_cfg = fix->sku;
1709 spec->cdefine.fixup = 1;
1710 }
1711 if (pre_init && cfg) {
1712#ifdef CONFIG_SND_DEBUG_VERBOSE
1713 snd_printdd(KERN_INFO "hda_codec: %s: Apply pincfg for %s\n",
1714 codec->chip_name, modelname);
1715#endif
1716 for (; cfg->nid; cfg++)
1717 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1718 }
1719 if (!pre_init && fix->verbs) {
1720#ifdef CONFIG_SND_DEBUG_VERBOSE
1721 snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-verbs for %s\n",
1722 codec->chip_name, modelname);
1723#endif
1724 add_verb(codec->spec, fix->verbs);
1725 }
1726 if (fix->func) {
1727#ifdef CONFIG_SND_DEBUG_VERBOSE
1728 snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-func for %s\n",
1729 codec->chip_name, modelname);
1730#endif
1731 fix->func(codec, fix, pre_init);
1732 }
1733}
1734 1719
1735static void alc_pick_fixup(struct hda_codec *codec, 1720static void alc_apply_fixup(struct hda_codec *codec, int action)
1736 const struct snd_pci_quirk *quirk,
1737 const struct alc_fixup *fix,
1738 int pre_init)
1739{ 1721{
1740 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); 1722 struct alc_spec *spec = codec->spec;
1741 if (quirk) { 1723 int id = spec->fixup_id;
1742 fix += quirk->value;
1743#ifdef CONFIG_SND_DEBUG_VERBOSE 1724#ifdef CONFIG_SND_DEBUG_VERBOSE
1744 __alc_pick_fixup(codec, fix, quirk->name, pre_init); 1725 const char *modelname = spec->fixup_name;
1745#else
1746 __alc_pick_fixup(codec, fix, NULL, pre_init);
1747#endif 1726#endif
1727 int depth = 0;
1728
1729 if (!spec->fixup_list)
1730 return;
1731
1732 while (id >= 0) {
1733 const struct alc_fixup *fix = spec->fixup_list + id;
1734 const struct alc_pincfg *cfg;
1735
1736 switch (fix->type) {
1737 case ALC_FIXUP_SKU:
1738 if (action != ALC_FIXUP_ACT_PRE_PROBE || !fix->v.sku)
1739 break;;
1740 snd_printdd(KERN_INFO "hda_codec: %s: "
1741 "Apply sku override for %s\n",
1742 codec->chip_name, modelname);
1743 spec->cdefine.sku_cfg = fix->v.sku;
1744 spec->cdefine.fixup = 1;
1745 break;
1746 case ALC_FIXUP_PINS:
1747 cfg = fix->v.pins;
1748 if (action != ALC_FIXUP_ACT_PRE_PROBE || !cfg)
1749 break;
1750 snd_printdd(KERN_INFO "hda_codec: %s: "
1751 "Apply pincfg for %s\n",
1752 codec->chip_name, modelname);
1753 for (; cfg->nid; cfg++)
1754 snd_hda_codec_set_pincfg(codec, cfg->nid,
1755 cfg->val);
1756 break;
1757 case ALC_FIXUP_VERBS:
1758 if (action != ALC_FIXUP_ACT_PROBE || !fix->v.verbs)
1759 break;
1760 snd_printdd(KERN_INFO "hda_codec: %s: "
1761 "Apply fix-verbs for %s\n",
1762 codec->chip_name, modelname);
1763 add_verb(codec->spec, fix->v.verbs);
1764 break;
1765 case ALC_FIXUP_FUNC:
1766 if (!fix->v.func)
1767 break;
1768 snd_printdd(KERN_INFO "hda_codec: %s: "
1769 "Apply fix-func for %s\n",
1770 codec->chip_name, modelname);
1771 fix->v.func(codec, fix, action);
1772 break;
1773 default:
1774 snd_printk(KERN_ERR "hda_codec: %s: "
1775 "Invalid fixup type %d\n",
1776 codec->chip_name, fix->type);
1777 break;
1778 }
1779 if (!fix[id].chained)
1780 break;
1781 if (++depth > 10)
1782 break;
1783 id = fix[id].chain_id;
1748 } 1784 }
1749} 1785}
1750 1786
1751static void alc_pick_fixup_model(struct hda_codec *codec, 1787static void alc_pick_fixup(struct hda_codec *codec,
1752 const struct alc_model_fixup *models, 1788 const struct alc_model_fixup *models,
1753 const struct snd_pci_quirk *quirk, 1789 const struct snd_pci_quirk *quirk,
1754 const struct alc_fixup *fix, 1790 const struct alc_fixup *fixlist)
1755 int pre_init)
1756{ 1791{
1792 struct alc_spec *spec = codec->spec;
1793 int id = -1;
1794 const char *name = NULL;
1795
1757 if (codec->modelname && models) { 1796 if (codec->modelname && models) {
1758 while (models->name) { 1797 while (models->name) {
1759 if (!strcmp(codec->modelname, models->name)) { 1798 if (!strcmp(codec->modelname, models->name)) {
1760 fix += models->id; 1799 id = models->id;
1800 name = models->name;
1761 break; 1801 break;
1762 } 1802 }
1763 models++; 1803 models++;
1764 } 1804 }
1765 __alc_pick_fixup(codec, fix, codec->modelname, pre_init); 1805 }
1766 } else { 1806 if (id < 0) {
1767 alc_pick_fixup(codec, quirk, fix, pre_init); 1807 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1808 if (quirk) {
1809 id = quirk->value;
1810#ifdef CONFIG_SND_DEBUG_VERBOSE
1811 name = quirk->name;
1812#endif
1813 }
1814 }
1815
1816 spec->fixup_id = id;
1817 if (id >= 0) {
1818 spec->fixup_list = fixlist;
1819 spec->fixup_name = name;
1768 } 1820 }
1769} 1821}
1770 1822
@@ -2866,7 +2918,7 @@ static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2866/* 2918/*
2867 * slave controls for virtual master 2919 * slave controls for virtual master
2868 */ 2920 */
2869static const char *alc_slave_vols[] = { 2921static const char * const alc_slave_vols[] = {
2870 "Front Playback Volume", 2922 "Front Playback Volume",
2871 "Surround Playback Volume", 2923 "Surround Playback Volume",
2872 "Center Playback Volume", 2924 "Center Playback Volume",
@@ -2880,7 +2932,7 @@ static const char *alc_slave_vols[] = {
2880 NULL, 2932 NULL,
2881}; 2933};
2882 2934
2883static const char *alc_slave_sws[] = { 2935static const char * const alc_slave_sws[] = {
2884 "Front Playback Switch", 2936 "Front Playback Switch",
2885 "Surround Playback Switch", 2937 "Surround Playback Switch",
2886 "Center Playback Switch", 2938 "Center Playback Switch",
@@ -3861,6 +3913,8 @@ static int alc_init(struct hda_codec *codec)
3861 if (spec->init_hook) 3913 if (spec->init_hook)
3862 spec->init_hook(codec); 3914 spec->init_hook(codec);
3863 3915
3916 alc_apply_fixup(codec, ALC_FIXUP_ACT_INIT);
3917
3864 hda_call_check_power_status(codec, 0x01); 3918 hda_call_check_power_status(codec, 0x01);
3865 return 0; 3919 return 0;
3866} 3920}
@@ -4559,7 +4613,7 @@ static struct hda_verb alc880_test_init_verbs[] = {
4559/* 4613/*
4560 */ 4614 */
4561 4615
4562static const char *alc880_models[ALC880_MODEL_LAST] = { 4616static const char * const alc880_models[ALC880_MODEL_LAST] = {
4563 [ALC880_3ST] = "3stack", 4617 [ALC880_3ST] = "3stack",
4564 [ALC880_TCL_S700] = "tcl", 4618 [ALC880_TCL_S700] = "tcl",
4565 [ALC880_3ST_DIG] = "3stack-digout", 4619 [ALC880_3ST_DIG] = "3stack-digout",
@@ -5092,7 +5146,7 @@ static const char *alc_get_line_out_pfx(const struct auto_pin_cfg *cfg,
5092static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, 5146static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
5093 const struct auto_pin_cfg *cfg) 5147 const struct auto_pin_cfg *cfg)
5094{ 5148{
5095 static const char *chname[4] = { 5149 static const char * const chname[4] = {
5096 "Front", "Surround", NULL /*CLFE*/, "Side" 5150 "Front", "Surround", NULL /*CLFE*/, "Side"
5097 }; 5151 };
5098 const char *pfx = alc_get_line_out_pfx(cfg, false); 5152 const char *pfx = alc_get_line_out_pfx(cfg, false);
@@ -7090,7 +7144,8 @@ enum {
7090 7144
7091static const struct alc_fixup alc260_fixups[] = { 7145static const struct alc_fixup alc260_fixups[] = {
7092 [PINFIX_HP_DC5750] = { 7146 [PINFIX_HP_DC5750] = {
7093 .pins = (const struct alc_pincfg[]) { 7147 .type = ALC_FIXUP_PINS,
7148 .v.pins = (const struct alc_pincfg[]) {
7094 { 0x11, 0x90130110 }, /* speaker */ 7149 { 0x11, 0x90130110 }, /* speaker */
7095 { } 7150 { }
7096 } 7151 }
@@ -7105,7 +7160,7 @@ static struct snd_pci_quirk alc260_fixup_tbl[] = {
7105/* 7160/*
7106 * ALC260 configurations 7161 * ALC260 configurations
7107 */ 7162 */
7108static const char *alc260_models[ALC260_MODEL_LAST] = { 7163static const char * const alc260_models[ALC260_MODEL_LAST] = {
7109 [ALC260_BASIC] = "basic", 7164 [ALC260_BASIC] = "basic",
7110 [ALC260_HP] = "hp", 7165 [ALC260_HP] = "hp",
7111 [ALC260_HP_3013] = "hp-3013", 7166 [ALC260_HP_3013] = "hp-3013",
@@ -7301,8 +7356,10 @@ static int patch_alc260(struct hda_codec *codec)
7301 board_config = ALC260_AUTO; 7356 board_config = ALC260_AUTO;
7302 } 7357 }
7303 7358
7304 if (board_config == ALC260_AUTO) 7359 if (board_config == ALC260_AUTO) {
7305 alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 1); 7360 alc_pick_fixup(codec, NULL, alc260_fixup_tbl, alc260_fixups);
7361 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
7362 }
7306 7363
7307 if (board_config == ALC260_AUTO) { 7364 if (board_config == ALC260_AUTO) {
7308 /* automatic parse from the BIOS config */ 7365 /* automatic parse from the BIOS config */
@@ -7350,8 +7407,7 @@ static int patch_alc260(struct hda_codec *codec)
7350 set_capture_mixer(codec); 7407 set_capture_mixer(codec);
7351 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); 7408 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
7352 7409
7353 if (board_config == ALC260_AUTO) 7410 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
7354 alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 0);
7355 7411
7356 spec->vmaster_nid = 0x08; 7412 spec->vmaster_nid = 0x08;
7357 7413
@@ -9727,7 +9783,7 @@ static hda_nid_t alc1200_slave_dig_outs[] = {
9727/* 9783/*
9728 * configuration and preset 9784 * configuration and preset
9729 */ 9785 */
9730static const char *alc882_models[ALC882_MODEL_LAST] = { 9786static const char * const alc882_models[ALC882_MODEL_LAST] = {
9731 [ALC882_3ST_DIG] = "3stack-dig", 9787 [ALC882_3ST_DIG] = "3stack-dig",
9732 [ALC882_6ST_DIG] = "6stack-dig", 9788 [ALC882_6ST_DIG] = "6stack-dig",
9733 [ALC882_ARIMA] = "arima", 9789 [ALC882_ARIMA] = "arima",
@@ -10678,7 +10734,8 @@ enum {
10678 10734
10679static const struct alc_fixup alc882_fixups[] = { 10735static const struct alc_fixup alc882_fixups[] = {
10680 [PINFIX_ABIT_AW9D_MAX] = { 10736 [PINFIX_ABIT_AW9D_MAX] = {
10681 .pins = (const struct alc_pincfg[]) { 10737 .type = ALC_FIXUP_PINS,
10738 .v.pins = (const struct alc_pincfg[]) {
10682 { 0x15, 0x01080104 }, /* side */ 10739 { 0x15, 0x01080104 }, /* side */
10683 { 0x16, 0x01011012 }, /* rear */ 10740 { 0x16, 0x01011012 }, /* rear */
10684 { 0x17, 0x01016011 }, /* clfe */ 10741 { 0x17, 0x01016011 }, /* clfe */
@@ -10686,13 +10743,15 @@ static const struct alc_fixup alc882_fixups[] = {
10686 } 10743 }
10687 }, 10744 },
10688 [PINFIX_PB_M5210] = { 10745 [PINFIX_PB_M5210] = {
10689 .verbs = (const struct hda_verb[]) { 10746 .type = ALC_FIXUP_VERBS,
10747 .v.verbs = (const struct hda_verb[]) {
10690 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, 10748 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
10691 {} 10749 {}
10692 } 10750 }
10693 }, 10751 },
10694 [PINFIX_ACER_ASPIRE_7736] = { 10752 [PINFIX_ACER_ASPIRE_7736] = {
10695 .sku = ALC_FIXUP_SKU_IGNORE, 10753 .type = ALC_FIXUP_SKU,
10754 .v.sku = ALC_FIXUP_SKU_IGNORE,
10696 }, 10755 },
10697}; 10756};
10698 10757
@@ -10873,9 +10932,6 @@ static int alc_auto_add_mic_boost(struct hda_codec *codec)
10873 return 0; 10932 return 0;
10874} 10933}
10875 10934
10876static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
10877 const struct auto_pin_cfg *cfg);
10878
10879/* almost identical with ALC880 parser... */ 10935/* almost identical with ALC880 parser... */
10880static int alc882_parse_auto_config(struct hda_codec *codec) 10936static int alc882_parse_auto_config(struct hda_codec *codec)
10881{ 10937{
@@ -10893,10 +10949,7 @@ static int alc882_parse_auto_config(struct hda_codec *codec)
10893 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); 10949 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10894 if (err < 0) 10950 if (err < 0)
10895 return err; 10951 return err;
10896 if (codec->vendor_id == 0x10ec0887) 10952 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10897 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
10898 else
10899 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10900 if (err < 0) 10953 if (err < 0)
10901 return err; 10954 return err;
10902 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], 10955 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
@@ -10984,8 +11037,10 @@ static int patch_alc882(struct hda_codec *codec)
10984 board_config = ALC882_AUTO; 11037 board_config = ALC882_AUTO;
10985 } 11038 }
10986 11039
10987 if (board_config == ALC882_AUTO) 11040 if (board_config == ALC882_AUTO) {
10988 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1); 11041 alc_pick_fixup(codec, NULL, alc882_fixup_tbl, alc882_fixups);
11042 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
11043 }
10989 11044
10990 alc_auto_parse_customize_define(codec); 11045 alc_auto_parse_customize_define(codec);
10991 11046
@@ -11061,8 +11116,7 @@ static int patch_alc882(struct hda_codec *codec)
11061 if (has_cdefine_beep(codec)) 11116 if (has_cdefine_beep(codec))
11062 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); 11117 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11063 11118
11064 if (board_config == ALC882_AUTO) 11119 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
11065 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0);
11066 11120
11067 spec->vmaster_nid = 0x0c; 11121 spec->vmaster_nid = 0x0c;
11068 11122
@@ -12452,19 +12506,14 @@ enum {
12452 12506
12453static const struct alc_fixup alc262_fixups[] = { 12507static const struct alc_fixup alc262_fixups[] = {
12454 [PINFIX_FSC_H270] = { 12508 [PINFIX_FSC_H270] = {
12455 .pins = (const struct alc_pincfg[]) { 12509 .type = ALC_FIXUP_PINS,
12510 .v.pins = (const struct alc_pincfg[]) {
12456 { 0x14, 0x99130110 }, /* speaker */ 12511 { 0x14, 0x99130110 }, /* speaker */
12457 { 0x15, 0x0221142f }, /* front HP */ 12512 { 0x15, 0x0221142f }, /* front HP */
12458 { 0x1b, 0x0121141f }, /* rear HP */ 12513 { 0x1b, 0x0121141f }, /* rear HP */
12459 { } 12514 { }
12460 } 12515 }
12461 }, 12516 },
12462 [PINFIX_PB_M5210] = {
12463 .verbs = (const struct hda_verb[]) {
12464 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
12465 {}
12466 }
12467 },
12468}; 12517};
12469 12518
12470static struct snd_pci_quirk alc262_fixup_tbl[] = { 12519static struct snd_pci_quirk alc262_fixup_tbl[] = {
@@ -12554,7 +12603,7 @@ static void alc262_auto_init(struct hda_codec *codec)
12554/* 12603/*
12555 * configuration and preset 12604 * configuration and preset
12556 */ 12605 */
12557static const char *alc262_models[ALC262_MODEL_LAST] = { 12606static const char * const alc262_models[ALC262_MODEL_LAST] = {
12558 [ALC262_BASIC] = "basic", 12607 [ALC262_BASIC] = "basic",
12559 [ALC262_HIPPO] = "hippo", 12608 [ALC262_HIPPO] = "hippo",
12560 [ALC262_HIPPO_1] = "hippo_1", 12609 [ALC262_HIPPO_1] = "hippo_1",
@@ -12582,6 +12631,8 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = {
12582 ALC262_HP_BPC), 12631 ALC262_HP_BPC),
12583 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", 12632 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12584 ALC262_HP_BPC), 12633 ALC262_HP_BPC),
12634 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1500, "HP z series",
12635 ALC262_HP_BPC),
12585 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", 12636 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12586 ALC262_HP_BPC), 12637 ALC262_HP_BPC),
12587 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), 12638 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
@@ -12895,8 +12946,10 @@ static int patch_alc262(struct hda_codec *codec)
12895 board_config = ALC262_AUTO; 12946 board_config = ALC262_AUTO;
12896 } 12947 }
12897 12948
12898 if (board_config == ALC262_AUTO) 12949 if (board_config == ALC262_AUTO) {
12899 alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 1); 12950 alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups);
12951 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
12952 }
12900 12953
12901 if (board_config == ALC262_AUTO) { 12954 if (board_config == ALC262_AUTO) {
12902 /* automatic parse from the BIOS config */ 12955 /* automatic parse from the BIOS config */
@@ -12966,8 +13019,7 @@ static int patch_alc262(struct hda_codec *codec)
12966 if (!spec->no_analog && has_cdefine_beep(codec)) 13019 if (!spec->no_analog && has_cdefine_beep(codec))
12967 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); 13020 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12968 13021
12969 if (board_config == ALC262_AUTO) 13022 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
12970 alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 0);
12971 13023
12972 spec->vmaster_nid = 0x0c; 13024 spec->vmaster_nid = 0x0c;
12973 13025
@@ -13741,7 +13793,7 @@ static void alc268_auto_init(struct hda_codec *codec)
13741/* 13793/*
13742 * configuration and preset 13794 * configuration and preset
13743 */ 13795 */
13744static const char *alc268_models[ALC268_MODEL_LAST] = { 13796static const char * const alc268_models[ALC268_MODEL_LAST] = {
13745 [ALC267_QUANTA_IL1] = "quanta-il1", 13797 [ALC267_QUANTA_IL1] = "quanta-il1",
13746 [ALC268_3ST] = "3stack", 13798 [ALC268_3ST] = "3stack",
13747 [ALC268_TOSHIBA] = "toshiba", 13799 [ALC268_TOSHIBA] = "toshiba",
@@ -14822,17 +14874,19 @@ static int alc269_resume(struct hda_codec *codec)
14822#endif /* SND_HDA_NEEDS_RESUME */ 14874#endif /* SND_HDA_NEEDS_RESUME */
14823 14875
14824static void alc269_fixup_hweq(struct hda_codec *codec, 14876static void alc269_fixup_hweq(struct hda_codec *codec,
14825 const struct alc_fixup *fix, int pre_init) 14877 const struct alc_fixup *fix, int action)
14826{ 14878{
14827 int coef; 14879 int coef;
14828 14880
14881 if (action != ALC_FIXUP_ACT_INIT)
14882 return;
14829 coef = alc_read_coef_idx(codec, 0x1e); 14883 coef = alc_read_coef_idx(codec, 0x1e);
14830 alc_write_coef_idx(codec, 0x1e, coef | 0x80); 14884 alc_write_coef_idx(codec, 0x1e, coef | 0x80);
14831} 14885}
14832 14886
14833enum { 14887enum {
14834 ALC269_FIXUP_SONY_VAIO, 14888 ALC269_FIXUP_SONY_VAIO,
14835 ALC275_FIX_SONY_VAIO_GPIO2, 14889 ALC275_FIXUP_SONY_VAIO_GPIO2,
14836 ALC269_FIXUP_DELL_M101Z, 14890 ALC269_FIXUP_DELL_M101Z,
14837 ALC269_FIXUP_SKU_IGNORE, 14891 ALC269_FIXUP_SKU_IGNORE,
14838 ALC269_FIXUP_ASUS_G73JW, 14892 ALC269_FIXUP_ASUS_G73JW,
@@ -14842,22 +14896,26 @@ enum {
14842 14896
14843static const struct alc_fixup alc269_fixups[] = { 14897static const struct alc_fixup alc269_fixups[] = {
14844 [ALC269_FIXUP_SONY_VAIO] = { 14898 [ALC269_FIXUP_SONY_VAIO] = {
14845 .verbs = (const struct hda_verb[]) { 14899 .type = ALC_FIXUP_VERBS,
14900 .v.verbs = (const struct hda_verb[]) {
14846 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, 14901 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14847 {} 14902 {}
14848 } 14903 }
14849 }, 14904 },
14850 [ALC275_FIX_SONY_VAIO_GPIO2] = { 14905 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
14851 .verbs = (const struct hda_verb[]) { 14906 .type = ALC_FIXUP_VERBS,
14907 .v.verbs = (const struct hda_verb[]) {
14852 {0x01, AC_VERB_SET_GPIO_MASK, 0x04}, 14908 {0x01, AC_VERB_SET_GPIO_MASK, 0x04},
14853 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04}, 14909 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04},
14854 {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, 14910 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
14855 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14856 { } 14911 { }
14857 } 14912 },
14913 .chained = true,
14914 .chain_id = ALC269_FIXUP_SONY_VAIO
14858 }, 14915 },
14859 [ALC269_FIXUP_DELL_M101Z] = { 14916 [ALC269_FIXUP_DELL_M101Z] = {
14860 .verbs = (const struct hda_verb[]) { 14917 .type = ALC_FIXUP_VERBS,
14918 .v.verbs = (const struct hda_verb[]) {
14861 /* Enables internal speaker */ 14919 /* Enables internal speaker */
14862 {0x20, AC_VERB_SET_COEF_INDEX, 13}, 14920 {0x20, AC_VERB_SET_COEF_INDEX, 13},
14863 {0x20, AC_VERB_SET_PROC_COEF, 0x4040}, 14921 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
@@ -14865,39 +14923,39 @@ static const struct alc_fixup alc269_fixups[] = {
14865 } 14923 }
14866 }, 14924 },
14867 [ALC269_FIXUP_SKU_IGNORE] = { 14925 [ALC269_FIXUP_SKU_IGNORE] = {
14868 .sku = ALC_FIXUP_SKU_IGNORE, 14926 .type = ALC_FIXUP_SKU,
14927 .v.sku = ALC_FIXUP_SKU_IGNORE,
14869 }, 14928 },
14870 [ALC269_FIXUP_ASUS_G73JW] = { 14929 [ALC269_FIXUP_ASUS_G73JW] = {
14871 .pins = (const struct alc_pincfg[]) { 14930 .type = ALC_FIXUP_PINS,
14931 .v.pins = (const struct alc_pincfg[]) {
14872 { 0x17, 0x99130111 }, /* subwoofer */ 14932 { 0x17, 0x99130111 }, /* subwoofer */
14873 { } 14933 { }
14874 } 14934 }
14875 }, 14935 },
14876 [ALC269_FIXUP_LENOVO_EAPD] = { 14936 [ALC269_FIXUP_LENOVO_EAPD] = {
14877 .verbs = (const struct hda_verb[]) { 14937 .type = ALC_FIXUP_VERBS,
14938 .v.verbs = (const struct hda_verb[]) {
14878 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0}, 14939 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
14879 {} 14940 {}
14880 } 14941 }
14881 }, 14942 },
14882 [ALC275_FIXUP_SONY_HWEQ] = { 14943 [ALC275_FIXUP_SONY_HWEQ] = {
14883 .func = alc269_fixup_hweq, 14944 .type = ALC_FIXUP_FUNC,
14884 .verbs = (const struct hda_verb[]) { 14945 .v.func = alc269_fixup_hweq,
14885 {0x01, AC_VERB_SET_GPIO_MASK, 0x04}, 14946 .chained = true,
14886 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04}, 14947 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
14887 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
14888 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14889 { }
14890 }
14891 } 14948 }
14892}; 14949};
14893 14950
14894static struct snd_pci_quirk alc269_fixup_tbl[] = { 14951static struct snd_pci_quirk alc269_fixup_tbl[] = {
14895 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIX_SONY_VAIO_GPIO2), 14952 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
14896 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), 14953 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
14897 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), 14954 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
14898 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), 14955 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14899 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), 14956 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
14900 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE), 14957 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
14958 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
14901 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), 14959 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
14902 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), 14960 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
14903 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), 14961 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
@@ -14908,7 +14966,7 @@ static struct snd_pci_quirk alc269_fixup_tbl[] = {
14908/* 14966/*
14909 * configuration and preset 14967 * configuration and preset
14910 */ 14968 */
14911static const char *alc269_models[ALC269_MODEL_LAST] = { 14969static const char * const alc269_models[ALC269_MODEL_LAST] = {
14912 [ALC269_BASIC] = "basic", 14970 [ALC269_BASIC] = "basic",
14913 [ALC269_QUANTA_FL1] = "quanta", 14971 [ALC269_QUANTA_FL1] = "quanta",
14914 [ALC269_AMIC] = "laptop-amic", 14972 [ALC269_AMIC] = "laptop-amic",
@@ -15184,8 +15242,10 @@ static int patch_alc269(struct hda_codec *codec)
15184 board_config = ALC269_AUTO; 15242 board_config = ALC269_AUTO;
15185 } 15243 }
15186 15244
15187 if (board_config == ALC269_AUTO) 15245 if (board_config == ALC269_AUTO) {
15188 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1); 15246 alc_pick_fixup(codec, NULL, alc269_fixup_tbl, alc269_fixups);
15247 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
15248 }
15189 15249
15190 if (board_config == ALC269_AUTO) { 15250 if (board_config == ALC269_AUTO) {
15191 /* automatic parse from the BIOS config */ 15251 /* automatic parse from the BIOS config */
@@ -15246,8 +15306,7 @@ static int patch_alc269(struct hda_codec *codec)
15246 if (has_cdefine_beep(codec)) 15306 if (has_cdefine_beep(codec))
15247 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); 15307 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
15248 15308
15249 if (board_config == ALC269_AUTO) 15309 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
15250 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0);
15251 15310
15252 spec->vmaster_nid = 0x02; 15311 spec->vmaster_nid = 0x02;
15253 15312
@@ -15950,7 +16009,7 @@ static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
15950 const struct auto_pin_cfg *cfg) 16009 const struct auto_pin_cfg *cfg)
15951{ 16010{
15952 struct alc_spec *spec = codec->spec; 16011 struct alc_spec *spec = codec->spec;
15953 static const char *chname[4] = { 16012 static const char * const chname[4] = {
15954 "Front", "Surround", NULL /*CLFE*/, "Side" 16013 "Front", "Surround", NULL /*CLFE*/, "Side"
15955 }; 16014 };
15956 const char *pfx = alc_get_line_out_pfx(cfg, true); 16015 const char *pfx = alc_get_line_out_pfx(cfg, true);
@@ -16156,7 +16215,7 @@ static struct hda_amp_list alc861_loopbacks[] = {
16156/* 16215/*
16157 * configuration and preset 16216 * configuration and preset
16158 */ 16217 */
16159static const char *alc861_models[ALC861_MODEL_LAST] = { 16218static const char * const alc861_models[ALC861_MODEL_LAST] = {
16160 [ALC861_3ST] = "3stack", 16219 [ALC861_3ST] = "3stack",
16161 [ALC660_3ST] = "3stack-660", 16220 [ALC660_3ST] = "3stack-660",
16162 [ALC861_3ST_DIG] = "3stack-dig", 16221 [ALC861_3ST_DIG] = "3stack-dig",
@@ -16306,7 +16365,8 @@ enum {
16306 16365
16307static const struct alc_fixup alc861_fixups[] = { 16366static const struct alc_fixup alc861_fixups[] = {
16308 [PINFIX_FSC_AMILO_PI1505] = { 16367 [PINFIX_FSC_AMILO_PI1505] = {
16309 .pins = (const struct alc_pincfg[]) { 16368 .type = ALC_FIXUP_PINS,
16369 .v.pins = (const struct alc_pincfg[]) {
16310 { 0x0b, 0x0221101f }, /* HP */ 16370 { 0x0b, 0x0221101f }, /* HP */
16311 { 0x0f, 0x90170310 }, /* speaker */ 16371 { 0x0f, 0x90170310 }, /* speaker */
16312 { } 16372 { }
@@ -16341,8 +16401,10 @@ static int patch_alc861(struct hda_codec *codec)
16341 board_config = ALC861_AUTO; 16401 board_config = ALC861_AUTO;
16342 } 16402 }
16343 16403
16344 if (board_config == ALC861_AUTO) 16404 if (board_config == ALC861_AUTO) {
16345 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1); 16405 alc_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
16406 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
16407 }
16346 16408
16347 if (board_config == ALC861_AUTO) { 16409 if (board_config == ALC861_AUTO) {
16348 /* automatic parse from the BIOS config */ 16410 /* automatic parse from the BIOS config */
@@ -16379,8 +16441,7 @@ static int patch_alc861(struct hda_codec *codec)
16379 16441
16380 spec->vmaster_nid = 0x03; 16442 spec->vmaster_nid = 0x03;
16381 16443
16382 if (board_config == ALC861_AUTO) 16444 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
16383 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0);
16384 16445
16385 codec->patch_ops = alc_patch_ops; 16446 codec->patch_ops = alc_patch_ops;
16386 if (board_config == ALC861_AUTO) { 16447 if (board_config == ALC861_AUTO) {
@@ -16857,7 +16918,7 @@ static void alc861vd_dallas_setup(struct hda_codec *codec)
16857/* 16918/*
16858 * configuration and preset 16919 * configuration and preset
16859 */ 16920 */
16860static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { 16921static const char * const alc861vd_models[ALC861VD_MODEL_LAST] = {
16861 [ALC660VD_3ST] = "3stack-660", 16922 [ALC660VD_3ST] = "3stack-660",
16862 [ALC660VD_3ST_DIG] = "3stack-660-digout", 16923 [ALC660VD_3ST_DIG] = "3stack-660-digout",
16863 [ALC660VD_ASUS_V1S] = "asus-v1s", 16924 [ALC660VD_ASUS_V1S] = "asus-v1s",
@@ -17072,12 +17133,14 @@ static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
17072#define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) 17133#define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
17073 17134
17074/* add playback controls from the parsed DAC table */ 17135/* add playback controls from the parsed DAC table */
17075/* Based on ALC880 version. But ALC861VD and ALC887 have separate, 17136/* Based on ALC880 version. But ALC861VD has separate,
17076 * different NIDs for mute/unmute switch and volume control */ 17137 * different NIDs for mute/unmute switch and volume control */
17077static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, 17138static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
17078 const struct auto_pin_cfg *cfg) 17139 const struct auto_pin_cfg *cfg)
17079{ 17140{
17080 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; 17141 static const char * const chname[4] = {
17142 "Front", "Surround", "CLFE", "Side"
17143 };
17081 const char *pfx = alc_get_line_out_pfx(cfg, true); 17144 const char *pfx = alc_get_line_out_pfx(cfg, true);
17082 hda_nid_t nid_v, nid_s; 17145 hda_nid_t nid_v, nid_s;
17083 int i, err; 17146 int i, err;
@@ -17262,7 +17325,8 @@ enum {
17262/* reset GPIO1 */ 17325/* reset GPIO1 */
17263static const struct alc_fixup alc861vd_fixups[] = { 17326static const struct alc_fixup alc861vd_fixups[] = {
17264 [ALC660VD_FIX_ASUS_GPIO1] = { 17327 [ALC660VD_FIX_ASUS_GPIO1] = {
17265 .verbs = (const struct hda_verb[]) { 17328 .type = ALC_FIXUP_VERBS,
17329 .v.verbs = (const struct hda_verb[]) {
17266 {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, 17330 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
17267 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, 17331 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
17268 {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, 17332 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
@@ -17297,8 +17361,10 @@ static int patch_alc861vd(struct hda_codec *codec)
17297 board_config = ALC861VD_AUTO; 17361 board_config = ALC861VD_AUTO;
17298 } 17362 }
17299 17363
17300 if (board_config == ALC861VD_AUTO) 17364 if (board_config == ALC861VD_AUTO) {
17301 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1); 17365 alc_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
17366 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
17367 }
17302 17368
17303 if (board_config == ALC861VD_AUTO) { 17369 if (board_config == ALC861VD_AUTO) {
17304 /* automatic parse from the BIOS config */ 17370 /* automatic parse from the BIOS config */
@@ -17346,8 +17412,7 @@ static int patch_alc861vd(struct hda_codec *codec)
17346 17412
17347 spec->vmaster_nid = 0x02; 17413 spec->vmaster_nid = 0x02;
17348 17414
17349 if (board_config == ALC861VD_AUTO) 17415 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
17350 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0);
17351 17416
17352 codec->patch_ops = alc_patch_ops; 17417 codec->patch_ops = alc_patch_ops;
17353 17418
@@ -18630,7 +18695,7 @@ static struct snd_kcontrol_new alc272_nc10_mixer[] = {
18630/* 18695/*
18631 * configuration and preset 18696 * configuration and preset
18632 */ 18697 */
18633static const char *alc662_models[ALC662_MODEL_LAST] = { 18698static const char * const alc662_models[ALC662_MODEL_LAST] = {
18634 [ALC662_3ST_2ch_DIG] = "3stack-dig", 18699 [ALC662_3ST_2ch_DIG] = "3stack-dig",
18635 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", 18700 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
18636 [ALC662_3ST_6ch] = "3stack-6ch", 18701 [ALC662_3ST_6ch] = "3stack-6ch",
@@ -19145,7 +19210,7 @@ static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
19145 const struct auto_pin_cfg *cfg) 19210 const struct auto_pin_cfg *cfg)
19146{ 19211{
19147 struct alc_spec *spec = codec->spec; 19212 struct alc_spec *spec = codec->spec;
19148 static const char *chname[4] = { 19213 static const char * const chname[4] = {
19149 "Front", "Surround", NULL /*CLFE*/, "Side" 19214 "Front", "Surround", NULL /*CLFE*/, "Side"
19150 }; 19215 };
19151 const char *pfx = alc_get_line_out_pfx(cfg, true); 19216 const char *pfx = alc_get_line_out_pfx(cfg, true);
@@ -19378,7 +19443,10 @@ static void alc662_auto_init(struct hda_codec *codec)
19378} 19443}
19379 19444
19380static void alc272_fixup_mario(struct hda_codec *codec, 19445static void alc272_fixup_mario(struct hda_codec *codec,
19381 const struct alc_fixup *fix, int pre_init) { 19446 const struct alc_fixup *fix, int action)
19447{
19448 if (action != ALC_FIXUP_ACT_PROBE)
19449 return;
19382 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT, 19450 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
19383 (0x3b << AC_AMPCAP_OFFSET_SHIFT) | 19451 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
19384 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) | 19452 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
@@ -19392,24 +19460,35 @@ enum {
19392 ALC662_FIXUP_ASPIRE, 19460 ALC662_FIXUP_ASPIRE,
19393 ALC662_FIXUP_IDEAPAD, 19461 ALC662_FIXUP_IDEAPAD,
19394 ALC272_FIXUP_MARIO, 19462 ALC272_FIXUP_MARIO,
19463 ALC662_FIXUP_CZC_P10T,
19395}; 19464};
19396 19465
19397static const struct alc_fixup alc662_fixups[] = { 19466static const struct alc_fixup alc662_fixups[] = {
19398 [ALC662_FIXUP_ASPIRE] = { 19467 [ALC662_FIXUP_ASPIRE] = {
19399 .pins = (const struct alc_pincfg[]) { 19468 .type = ALC_FIXUP_PINS,
19469 .v.pins = (const struct alc_pincfg[]) {
19400 { 0x15, 0x99130112 }, /* subwoofer */ 19470 { 0x15, 0x99130112 }, /* subwoofer */
19401 { } 19471 { }
19402 } 19472 }
19403 }, 19473 },
19404 [ALC662_FIXUP_IDEAPAD] = { 19474 [ALC662_FIXUP_IDEAPAD] = {
19405 .pins = (const struct alc_pincfg[]) { 19475 .type = ALC_FIXUP_PINS,
19476 .v.pins = (const struct alc_pincfg[]) {
19406 { 0x17, 0x99130112 }, /* subwoofer */ 19477 { 0x17, 0x99130112 }, /* subwoofer */
19407 { } 19478 { }
19408 } 19479 }
19409 }, 19480 },
19410 [ALC272_FIXUP_MARIO] = { 19481 [ALC272_FIXUP_MARIO] = {
19411 .func = alc272_fixup_mario, 19482 .type = ALC_FIXUP_FUNC,
19412 } 19483 .v.func = alc272_fixup_mario,
19484 },
19485 [ALC662_FIXUP_CZC_P10T] = {
19486 .type = ALC_FIXUP_VERBS,
19487 .v.verbs = (const struct hda_verb[]) {
19488 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
19489 {}
19490 }
19491 },
19413}; 19492};
19414 19493
19415static struct snd_pci_quirk alc662_fixup_tbl[] = { 19494static struct snd_pci_quirk alc662_fixup_tbl[] = {
@@ -19417,6 +19496,7 @@ static struct snd_pci_quirk alc662_fixup_tbl[] = {
19417 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), 19496 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
19418 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), 19497 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
19419 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), 19498 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
19499 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
19420 {} 19500 {}
19421}; 19501};
19422 19502
@@ -19462,7 +19542,9 @@ static int patch_alc662(struct hda_codec *codec)
19462 } 19542 }
19463 19543
19464 if (board_config == ALC662_AUTO) { 19544 if (board_config == ALC662_AUTO) {
19465 alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 1); 19545 alc_pick_fixup(codec, alc662_fixup_models,
19546 alc662_fixup_tbl, alc662_fixups);
19547 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
19466 /* automatic parse from the BIOS config */ 19548 /* automatic parse from the BIOS config */
19467 err = alc662_parse_auto_config(codec); 19549 err = alc662_parse_auto_config(codec);
19468 if (err < 0) { 19550 if (err < 0) {
@@ -19520,12 +19602,11 @@ static int patch_alc662(struct hda_codec *codec)
19520 } 19602 }
19521 spec->vmaster_nid = 0x02; 19603 spec->vmaster_nid = 0x02;
19522 19604
19605 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
19606
19523 codec->patch_ops = alc_patch_ops; 19607 codec->patch_ops = alc_patch_ops;
19524 if (board_config == ALC662_AUTO) { 19608 if (board_config == ALC662_AUTO)
19525 spec->init_hook = alc662_auto_init; 19609 spec->init_hook = alc662_auto_init;
19526 alc_pick_fixup_model(codec, alc662_fixup_models,
19527 alc662_fixup_tbl, alc662_fixups, 0);
19528 }
19529 19610
19530 alc_init_jacks(codec); 19611 alc_init_jacks(codec);
19531 19612
@@ -19913,7 +19994,7 @@ static void alc680_auto_init(struct hda_codec *codec)
19913/* 19994/*
19914 * configuration and preset 19995 * configuration and preset
19915 */ 19996 */
19916static const char *alc680_models[ALC680_MODEL_LAST] = { 19997static const char * const alc680_models[ALC680_MODEL_LAST] = {
19917 [ALC680_BASE] = "base", 19998 [ALC680_BASE] = "base",
19918 [ALC680_AUTO] = "auto", 19999 [ALC680_AUTO] = "auto",
19919}; 20000};
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 4ab019d0924e..9ea48b425d0b 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -266,7 +266,7 @@ struct sigmatel_spec {
266 struct sigmatel_mic_route int_mic; 266 struct sigmatel_mic_route int_mic;
267 struct sigmatel_mic_route dock_mic; 267 struct sigmatel_mic_route dock_mic;
268 268
269 const char **spdif_labels; 269 const char * const *spdif_labels;
270 270
271 hda_nid_t dig_in_nid; 271 hda_nid_t dig_in_nid;
272 hda_nid_t mono_nid; 272 hda_nid_t mono_nid;
@@ -524,7 +524,7 @@ static unsigned long stac927x_capsws[] = {
524 HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT), 524 HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT),
525}; 525};
526 526
527static const char *stac927x_spdif_labels[5] = { 527static const char * const stac927x_spdif_labels[5] = {
528 "Digital Playback", "ADAT", "Analog Mux 1", 528 "Digital Playback", "ADAT", "Analog Mux 1",
529 "Analog Mux 2", "Analog Mux 3" 529 "Analog Mux 2", "Analog Mux 3"
530}; 530};
@@ -1062,7 +1062,7 @@ static struct snd_kcontrol_new stac_smux_mixer = {
1062 .put = stac92xx_smux_enum_put, 1062 .put = stac92xx_smux_enum_put,
1063}; 1063};
1064 1064
1065static const char *slave_vols[] = { 1065static const char * const slave_vols[] = {
1066 "Front Playback Volume", 1066 "Front Playback Volume",
1067 "Surround Playback Volume", 1067 "Surround Playback Volume",
1068 "Center Playback Volume", 1068 "Center Playback Volume",
@@ -1073,7 +1073,7 @@ static const char *slave_vols[] = {
1073 NULL 1073 NULL
1074}; 1074};
1075 1075
1076static const char *slave_sws[] = { 1076static const char * const slave_sws[] = {
1077 "Front Playback Switch", 1077 "Front Playback Switch",
1078 "Surround Playback Switch", 1078 "Surround Playback Switch",
1079 "Center Playback Switch", 1079 "Center Playback Switch",
@@ -1354,7 +1354,7 @@ static unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = {
1354 [STAC_9200_PANASONIC] = ref9200_pin_configs, 1354 [STAC_9200_PANASONIC] = ref9200_pin_configs,
1355}; 1355};
1356 1356
1357static const char *stac9200_models[STAC_9200_MODELS] = { 1357static const char * const stac9200_models[STAC_9200_MODELS] = {
1358 [STAC_AUTO] = "auto", 1358 [STAC_AUTO] = "auto",
1359 [STAC_REF] = "ref", 1359 [STAC_REF] = "ref",
1360 [STAC_9200_OQO] = "oqo", 1360 [STAC_9200_OQO] = "oqo",
@@ -1500,7 +1500,7 @@ static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = {
1500 [STAC_M6] = stac925xM6_pin_configs, 1500 [STAC_M6] = stac925xM6_pin_configs,
1501}; 1501};
1502 1502
1503static const char *stac925x_models[STAC_925x_MODELS] = { 1503static const char * const stac925x_models[STAC_925x_MODELS] = {
1504 [STAC_925x_AUTO] = "auto", 1504 [STAC_925x_AUTO] = "auto",
1505 [STAC_REF] = "ref", 1505 [STAC_REF] = "ref",
1506 [STAC_M1] = "m1", 1506 [STAC_M1] = "m1",
@@ -1574,7 +1574,7 @@ static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = {
1574 [STAC_92HD73XX_INTEL] = intel_dg45id_pin_configs, 1574 [STAC_92HD73XX_INTEL] = intel_dg45id_pin_configs,
1575}; 1575};
1576 1576
1577static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = { 1577static const char * const stac92hd73xx_models[STAC_92HD73XX_MODELS] = {
1578 [STAC_92HD73XX_AUTO] = "auto", 1578 [STAC_92HD73XX_AUTO] = "auto",
1579 [STAC_92HD73XX_NO_JD] = "no-jd", 1579 [STAC_92HD73XX_NO_JD] = "no-jd",
1580 [STAC_92HD73XX_REF] = "ref", 1580 [STAC_92HD73XX_REF] = "ref",
@@ -1660,7 +1660,7 @@ static unsigned int *stac92hd83xxx_brd_tbl[STAC_92HD83XXX_MODELS] = {
1660 [STAC_HP_DV7_4000] = hp_dv7_4000_pin_configs, 1660 [STAC_HP_DV7_4000] = hp_dv7_4000_pin_configs,
1661}; 1661};
1662 1662
1663static const char *stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = { 1663static const char * const stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = {
1664 [STAC_92HD83XXX_AUTO] = "auto", 1664 [STAC_92HD83XXX_AUTO] = "auto",
1665 [STAC_92HD83XXX_REF] = "ref", 1665 [STAC_92HD83XXX_REF] = "ref",
1666 [STAC_92HD83XXX_PWR_REF] = "mic-ref", 1666 [STAC_92HD83XXX_PWR_REF] = "mic-ref",
@@ -1722,7 +1722,7 @@ static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = {
1722 [STAC_HP_DV4_1222NR] = NULL, 1722 [STAC_HP_DV4_1222NR] = NULL,
1723}; 1723};
1724 1724
1725static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = { 1725static const char * const stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = {
1726 [STAC_92HD71BXX_AUTO] = "auto", 1726 [STAC_92HD71BXX_AUTO] = "auto",
1727 [STAC_92HD71BXX_REF] = "ref", 1727 [STAC_92HD71BXX_REF] = "ref",
1728 [STAC_DELL_M4_1] = "dell-m4-1", 1728 [STAC_DELL_M4_1] = "dell-m4-1",
@@ -1915,7 +1915,7 @@ static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = {
1915 [STAC_922X_DELL_M82] = dell_922x_m82_pin_configs, 1915 [STAC_922X_DELL_M82] = dell_922x_m82_pin_configs,
1916}; 1916};
1917 1917
1918static const char *stac922x_models[STAC_922X_MODELS] = { 1918static const char * const stac922x_models[STAC_922X_MODELS] = {
1919 [STAC_922X_AUTO] = "auto", 1919 [STAC_922X_AUTO] = "auto",
1920 [STAC_D945_REF] = "ref", 1920 [STAC_D945_REF] = "ref",
1921 [STAC_D945GTP5] = "5stack", 1921 [STAC_D945GTP5] = "5stack",
@@ -2077,7 +2077,7 @@ static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = {
2077 [STAC_927X_VOLKNOB] = NULL, 2077 [STAC_927X_VOLKNOB] = NULL,
2078}; 2078};
2079 2079
2080static const char *stac927x_models[STAC_927X_MODELS] = { 2080static const char * const stac927x_models[STAC_927X_MODELS] = {
2081 [STAC_927X_AUTO] = "auto", 2081 [STAC_927X_AUTO] = "auto",
2082 [STAC_D965_REF_NO_JD] = "ref-no-jd", 2082 [STAC_D965_REF_NO_JD] = "ref-no-jd",
2083 [STAC_D965_REF] = "ref", 2083 [STAC_D965_REF] = "ref",
@@ -2180,7 +2180,7 @@ static unsigned int *stac9205_brd_tbl[STAC_9205_MODELS] = {
2180 [STAC_9205_EAPD] = NULL, 2180 [STAC_9205_EAPD] = NULL,
2181}; 2181};
2182 2182
2183static const char *stac9205_models[STAC_9205_MODELS] = { 2183static const char * const stac9205_models[STAC_9205_MODELS] = {
2184 [STAC_9205_AUTO] = "auto", 2184 [STAC_9205_AUTO] = "auto",
2185 [STAC_9205_REF] = "ref", 2185 [STAC_9205_REF] = "ref",
2186 [STAC_9205_DELL_M42] = "dell-m42", 2186 [STAC_9205_DELL_M42] = "dell-m42",
@@ -3123,7 +3123,7 @@ static int create_multi_out_ctls(struct hda_codec *codec, int num_outs,
3123 int type) 3123 int type)
3124{ 3124{
3125 struct sigmatel_spec *spec = codec->spec; 3125 struct sigmatel_spec *spec = codec->spec;
3126 static const char *chname[4] = { 3126 static const char * const chname[4] = {
3127 "Front", "Surround", NULL /*CLFE*/, "Side" 3127 "Front", "Surround", NULL /*CLFE*/, "Side"
3128 }; 3128 };
3129 hda_nid_t nid; 3129 hda_nid_t nid;
@@ -3256,7 +3256,7 @@ static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec,
3256} 3256}
3257 3257
3258/* labels for mono mux outputs */ 3258/* labels for mono mux outputs */
3259static const char *stac92xx_mono_labels[4] = { 3259static const char * const stac92xx_mono_labels[4] = {
3260 "DAC0", "DAC1", "Mixer", "DAC2" 3260 "DAC0", "DAC1", "Mixer", "DAC2"
3261}; 3261};
3262 3262
@@ -3380,7 +3380,7 @@ static int stac92xx_auto_create_mux_input_ctls(struct hda_codec *codec)
3380 return 0; 3380 return 0;
3381}; 3381};
3382 3382
3383static const char *stac92xx_spdif_labels[3] = { 3383static const char * const stac92xx_spdif_labels[3] = {
3384 "Digital Playback", "Analog Mux 1", "Analog Mux 2", 3384 "Digital Playback", "Analog Mux 1", "Analog Mux 2",
3385}; 3385};
3386 3386
@@ -3388,7 +3388,7 @@ static int stac92xx_auto_create_spdif_mux_ctls(struct hda_codec *codec)
3388{ 3388{
3389 struct sigmatel_spec *spec = codec->spec; 3389 struct sigmatel_spec *spec = codec->spec;
3390 struct hda_input_mux *spdif_mux = &spec->private_smux; 3390 struct hda_input_mux *spdif_mux = &spec->private_smux;
3391 const char **labels = spec->spdif_labels; 3391 const char * const *labels = spec->spdif_labels;
3392 int i, num_cons; 3392 int i, num_cons;
3393 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS]; 3393 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS];
3394 3394
@@ -3409,7 +3409,7 @@ static int stac92xx_auto_create_spdif_mux_ctls(struct hda_codec *codec)
3409} 3409}
3410 3410
3411/* labels for dmic mux inputs */ 3411/* labels for dmic mux inputs */
3412static const char *stac92xx_dmic_labels[5] = { 3412static const char * const stac92xx_dmic_labels[5] = {
3413 "Analog Inputs", "Digital Mic 1", "Digital Mic 2", 3413 "Analog Inputs", "Digital Mic 1", "Digital Mic 2",
3414 "Digital Mic 3", "Digital Mic 4" 3414 "Digital Mic 3", "Digital Mic 4"
3415}; 3415};
@@ -5333,7 +5333,7 @@ again:
5333 return 0; 5333 return 0;
5334} 5334}
5335 5335
5336static int stac92hd83xxx_set_system_btl_amp(struct hda_codec *codec) 5336static int hp_bnb2011_with_dock(struct hda_codec *codec)
5337{ 5337{
5338 if (codec->vendor_id != 0x111d7605 && 5338 if (codec->vendor_id != 0x111d7605 &&
5339 codec->vendor_id != 0x111d76d1) 5339 codec->vendor_id != 0x111d76d1)
@@ -5348,10 +5348,6 @@ static int stac92hd83xxx_set_system_btl_amp(struct hda_codec *codec)
5348 case 0x103c161d: 5348 case 0x103c161d:
5349 case 0x103c161e: 5349 case 0x103c161e:
5350 case 0x103c161f: 5350 case 0x103c161f:
5351 case 0x103c1620:
5352 case 0x103c1621:
5353 case 0x103c1622:
5354 case 0x103c1623:
5355 5351
5356 case 0x103c162a: 5352 case 0x103c162a:
5357 case 0x103c162b: 5353 case 0x103c162b:
@@ -5360,41 +5356,9 @@ static int stac92hd83xxx_set_system_btl_amp(struct hda_codec *codec)
5360 case 0x103c1631: 5356 case 0x103c1631:
5361 5357
5362 case 0x103c1633: 5358 case 0x103c1633:
5363 5359 case 0x103c1634:
5364 case 0x103c1635: 5360 case 0x103c1635:
5365 5361
5366 case 0x103c164f:
5367
5368 case 0x103c1676:
5369 case 0x103c1677:
5370 case 0x103c1678:
5371 case 0x103c1679:
5372 case 0x103c167a:
5373 case 0x103c167b:
5374 case 0x103c167c:
5375 case 0x103c167d:
5376 case 0x103c167e:
5377 case 0x103c167f:
5378 case 0x103c1680:
5379 case 0x103c1681:
5380 case 0x103c1682:
5381 case 0x103c1683:
5382 case 0x103c1684:
5383 case 0x103c1685:
5384 case 0x103c1686:
5385 case 0x103c1687:
5386 case 0x103c1688:
5387 case 0x103c1689:
5388 case 0x103c168a:
5389 case 0x103c168b:
5390 case 0x103c168c:
5391 case 0x103c168d:
5392 case 0x103c168e:
5393 case 0x103c168f:
5394 case 0x103c1690:
5395 case 0x103c1691:
5396 case 0x103c1692:
5397
5398 case 0x103c3587: 5362 case 0x103c3587:
5399 case 0x103c3588: 5363 case 0x103c3588:
5400 case 0x103c3589: 5364 case 0x103c3589:
@@ -5402,9 +5366,9 @@ static int stac92hd83xxx_set_system_btl_amp(struct hda_codec *codec)
5402 5366
5403 case 0x103c3667: 5367 case 0x103c3667:
5404 case 0x103c3668: 5368 case 0x103c3668:
5405 /* set BTL amp level to 13.43dB for louder speaker output */ 5369 case 0x103c3669:
5406 return snd_hda_codec_write_cache(codec, codec->afg, 0, 5370
5407 0x7F4, 0x14); 5371 return 1;
5408 } 5372 }
5409 return 0; 5373 return 0;
5410} 5374}
@@ -5420,6 +5384,11 @@ static int patch_stac92hd83xxx(struct hda_codec *codec)
5420 if (spec == NULL) 5384 if (spec == NULL)
5421 return -ENOMEM; 5385 return -ENOMEM;
5422 5386
5387 if (hp_bnb2011_with_dock(codec)) {
5388 snd_hda_codec_set_pincfg(codec, 0xa, 0x2101201f);
5389 snd_hda_codec_set_pincfg(codec, 0xf, 0x2181205e);
5390 }
5391
5423 /* reset pin power-down; Windows may leave these bits after reboot */ 5392 /* reset pin power-down; Windows may leave these bits after reboot */
5424 snd_hda_codec_write_cache(codec, codec->afg, 0, 0x7EC, 0); 5393 snd_hda_codec_write_cache(codec, codec->afg, 0, 0x7EC, 0);
5425 snd_hda_codec_write_cache(codec, codec->afg, 0, 0x7ED, 0); 5394 snd_hda_codec_write_cache(codec, codec->afg, 0, 0x7ED, 0);
@@ -5546,8 +5515,6 @@ again:
5546 AC_VERB_SET_CONNECT_SEL, num_dacs); 5515 AC_VERB_SET_CONNECT_SEL, num_dacs);
5547 } 5516 }
5548 5517
5549 stac92hd83xxx_set_system_btl_amp(codec);
5550
5551 codec->proc_widget_hook = stac92hd_proc_hook; 5518 codec->proc_widget_hook = stac92hd_proc_hook;
5552 5519
5553 return 0; 5520 return 0;
@@ -6270,7 +6237,7 @@ static unsigned int stac9872_vaio_pin_configs[9] = {
6270 0x90a7013e 6237 0x90a7013e
6271}; 6238};
6272 6239
6273static const char *stac9872_models[STAC_9872_MODELS] = { 6240static const char * const stac9872_models[STAC_9872_MODELS] = {
6274 [STAC_9872_AUTO] = "auto", 6241 [STAC_9872_AUTO] = "auto",
6275 [STAC_9872_VAIO] = "vaio", 6242 [STAC_9872_VAIO] = "vaio",
6276}; 6243};
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
index 7f4852a478a1..a76c3260d941 100644
--- a/sound/pci/hda/patch_via.c
+++ b/sound/pci/hda/patch_via.c
@@ -2281,7 +2281,9 @@ static int vt1708_auto_create_multi_out_ctls(struct via_spec *spec,
2281 const struct auto_pin_cfg *cfg) 2281 const struct auto_pin_cfg *cfg)
2282{ 2282{
2283 char name[32]; 2283 char name[32];
2284 static const char *chname[4] = { "Front", "Surround", "C/LFE", "Side" }; 2284 static const char * const chname[4] = {
2285 "Front", "Surround", "C/LFE", "Side"
2286 };
2285 hda_nid_t nid, nid_vol, nid_vols[] = {0x17, 0x19, 0x1a, 0x1b}; 2287 hda_nid_t nid, nid_vol, nid_vols[] = {0x17, 0x19, 0x1a, 0x1b};
2286 int i, err; 2288 int i, err;
2287 2289
@@ -2370,7 +2372,7 @@ static void create_hp_imux(struct via_spec *spec)
2370{ 2372{
2371 int i; 2373 int i;
2372 struct hda_input_mux *imux = &spec->private_imux[1]; 2374 struct hda_input_mux *imux = &spec->private_imux[1];
2373 static const char *texts[] = { "OFF", "ON", NULL}; 2375 static const char * const texts[] = { "OFF", "ON", NULL};
2374 2376
2375 /* for hp mode select */ 2377 /* for hp mode select */
2376 for (i = 0; texts[i]; i++) 2378 for (i = 0; texts[i]; i++)
@@ -2890,7 +2892,9 @@ static int vt1709_auto_create_multi_out_ctls(struct via_spec *spec,
2890 const struct auto_pin_cfg *cfg) 2892 const struct auto_pin_cfg *cfg)
2891{ 2893{
2892 char name[32]; 2894 char name[32];
2893 static const char *chname[4] = { "Front", "Surround", "C/LFE", "Side" }; 2895 static const char * const chname[4] = {
2896 "Front", "Surround", "C/LFE", "Side"
2897 };
2894 hda_nid_t nid, nid_vol, nid_vols[] = {0x18, 0x1a, 0x1b, 0x29}; 2898 hda_nid_t nid, nid_vol, nid_vols[] = {0x18, 0x1a, 0x1b, 0x29};
2895 int i, err; 2899 int i, err;
2896 2900
@@ -3433,7 +3437,9 @@ static int vt1708B_auto_create_multi_out_ctls(struct via_spec *spec,
3433 const struct auto_pin_cfg *cfg) 3437 const struct auto_pin_cfg *cfg)
3434{ 3438{
3435 char name[32]; 3439 char name[32];
3436 static const char *chname[4] = { "Front", "Surround", "C/LFE", "Side" }; 3440 static const char * const chname[4] = {
3441 "Front", "Surround", "C/LFE", "Side"
3442 };
3437 hda_nid_t nid_vols[] = {0x16, 0x18, 0x26, 0x27}; 3443 hda_nid_t nid_vols[] = {0x16, 0x18, 0x26, 0x27};
3438 hda_nid_t nid, nid_vol = 0; 3444 hda_nid_t nid, nid_vol = 0;
3439 int i, err; 3445 int i, err;
@@ -3861,7 +3867,9 @@ static int vt1708S_auto_create_multi_out_ctls(struct via_spec *spec,
3861 const struct auto_pin_cfg *cfg) 3867 const struct auto_pin_cfg *cfg)
3862{ 3868{
3863 char name[32]; 3869 char name[32];
3864 static const char *chname[4] = { "Front", "Surround", "C/LFE", "Side" }; 3870 static const char * const chname[4] = {
3871 "Front", "Surround", "C/LFE", "Side"
3872 };
3865 hda_nid_t nid_vols[] = {0x10, 0x11, 0x24, 0x25}; 3873 hda_nid_t nid_vols[] = {0x10, 0x11, 0x24, 0x25};
3866 hda_nid_t nid_mutes[] = {0x1C, 0x18, 0x26, 0x27}; 3874 hda_nid_t nid_mutes[] = {0x1C, 0x18, 0x26, 0x27};
3867 hda_nid_t nid, nid_vol, nid_mute; 3875 hda_nid_t nid, nid_vol, nid_mute;
@@ -4304,7 +4312,7 @@ static int vt1702_auto_create_hp_ctls(struct via_spec *spec, hda_nid_t pin)
4304{ 4312{
4305 int err, i; 4313 int err, i;
4306 struct hda_input_mux *imux; 4314 struct hda_input_mux *imux;
4307 static const char *texts[] = { "ON", "OFF", NULL}; 4315 static const char * const texts[] = { "ON", "OFF", NULL};
4308 if (!pin) 4316 if (!pin)
4309 return 0; 4317 return 0;
4310 spec->multiout.hp_nid = 0x1D; 4318 spec->multiout.hp_nid = 0x1D;
@@ -4615,7 +4623,9 @@ static int vt1718S_auto_create_multi_out_ctls(struct via_spec *spec,
4615 const struct auto_pin_cfg *cfg) 4623 const struct auto_pin_cfg *cfg)
4616{ 4624{
4617 char name[32]; 4625 char name[32];
4618 static const char *chname[4] = { "Front", "Surround", "C/LFE", "Side" }; 4626 static const char * const chname[4] = {
4627 "Front", "Surround", "C/LFE", "Side"
4628 };
4619 hda_nid_t nid_vols[] = {0x8, 0x9, 0xa, 0xb}; 4629 hda_nid_t nid_vols[] = {0x8, 0x9, 0xa, 0xb};
4620 hda_nid_t nid_mutes[] = {0x24, 0x25, 0x26, 0x27}; 4630 hda_nid_t nid_mutes[] = {0x24, 0x25, 0x26, 0x27};
4621 hda_nid_t nid, nid_vol, nid_mute = 0; 4631 hda_nid_t nid, nid_vol, nid_mute = 0;
@@ -5064,7 +5074,9 @@ static int vt1716S_auto_create_multi_out_ctls(struct via_spec *spec,
5064 const struct auto_pin_cfg *cfg) 5074 const struct auto_pin_cfg *cfg)
5065{ 5075{
5066 char name[32]; 5076 char name[32];
5067 static const char *chname[3] = { "Front", "Surround", "C/LFE" }; 5077 static const char * const chname[3] = {
5078 "Front", "Surround", "C/LFE"
5079 };
5068 hda_nid_t nid_vols[] = {0x10, 0x11, 0x25}; 5080 hda_nid_t nid_vols[] = {0x10, 0x11, 0x25};
5069 hda_nid_t nid_mutes[] = {0x1C, 0x18, 0x27}; 5081 hda_nid_t nid_mutes[] = {0x1C, 0x18, 0x27};
5070 hda_nid_t nid, nid_vol, nid_mute; 5082 hda_nid_t nid, nid_vol, nid_mute;