aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2011-05-22 04:01:35 -0400
committerTakashi Iwai <tiwai@suse.de>2011-05-22 04:01:35 -0400
commitf686c74cc3e78349d16d46fc72807354574b1516 (patch)
treea6f9d06629184a0044feaa5563a71709a0213ee5 /sound
parent7ec298dfef00e2c8effe8658011e03d86911b0bf (diff)
parent50e3bbf9898840eead86f90a43b3625a2b2f4112 (diff)
Merge branch 'topic/hda' into for-linus
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/hda_codec.c97
-rw-r--r--sound/pci/hda/hda_codec.h4
-rw-r--r--sound/pci/hda/hda_intel.c38
-rw-r--r--sound/pci/hda/hda_local.h16
-rw-r--r--sound/pci/hda/patch_analog.c345
-rw-r--r--sound/pci/hda/patch_ca0110.c16
-rw-r--r--sound/pci/hda/patch_cirrus.c52
-rw-r--r--sound/pci/hda/patch_cmedia.c40
-rw-r--r--sound/pci/hda/patch_conexant.c1085
-rw-r--r--sound/pci/hda/patch_hdmi.c39
-rw-r--r--sound/pci/hda/patch_realtek.c3681
-rw-r--r--sound/pci/hda/patch_si3054.c11
-rw-r--r--sound/pci/hda/patch_sigmatel.c431
-rw-r--r--sound/pci/hda/patch_via.c1526
14 files changed, 4106 insertions, 3275 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 759ade12e75..8edd998509f 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -307,6 +307,12 @@ int snd_hda_get_sub_nodes(struct hda_codec *codec, hda_nid_t nid,
307} 307}
308EXPORT_SYMBOL_HDA(snd_hda_get_sub_nodes); 308EXPORT_SYMBOL_HDA(snd_hda_get_sub_nodes);
309 309
310static int _hda_get_connections(struct hda_codec *codec, hda_nid_t nid,
311 hda_nid_t *conn_list, int max_conns);
312static bool add_conn_list(struct snd_array *array, hda_nid_t nid);
313static int copy_conn_list(hda_nid_t nid, hda_nid_t *dst, int max_dst,
314 hda_nid_t *src, int len);
315
310/** 316/**
311 * snd_hda_get_connections - get connection list 317 * snd_hda_get_connections - get connection list
312 * @codec: the HDA codec 318 * @codec: the HDA codec
@@ -320,7 +326,44 @@ EXPORT_SYMBOL_HDA(snd_hda_get_sub_nodes);
320 * Returns the number of connections, or a negative error code. 326 * Returns the number of connections, or a negative error code.
321 */ 327 */
322int snd_hda_get_connections(struct hda_codec *codec, hda_nid_t nid, 328int snd_hda_get_connections(struct hda_codec *codec, hda_nid_t nid,
323 hda_nid_t *conn_list, int max_conns) 329 hda_nid_t *conn_list, int max_conns)
330{
331 struct snd_array *array = &codec->conn_lists;
332 int i, len, old_used;
333 hda_nid_t list[HDA_MAX_CONNECTIONS];
334
335 /* look up the cached results */
336 for (i = 0; i < array->used; ) {
337 hda_nid_t *p = snd_array_elem(array, i);
338 len = p[1];
339 if (nid == *p)
340 return copy_conn_list(nid, conn_list, max_conns,
341 p + 2, len);
342 i += len + 2;
343 }
344
345 len = _hda_get_connections(codec, nid, list, HDA_MAX_CONNECTIONS);
346 if (len < 0)
347 return len;
348
349 /* add to the cache */
350 old_used = array->used;
351 if (!add_conn_list(array, nid) || !add_conn_list(array, len))
352 goto error_add;
353 for (i = 0; i < len; i++)
354 if (!add_conn_list(array, list[i]))
355 goto error_add;
356
357 return copy_conn_list(nid, conn_list, max_conns, list, len);
358
359 error_add:
360 array->used = old_used;
361 return -ENOMEM;
362}
363EXPORT_SYMBOL_HDA(snd_hda_get_connections);
364
365static int _hda_get_connections(struct hda_codec *codec, hda_nid_t nid,
366 hda_nid_t *conn_list, int max_conns)
324{ 367{
325 unsigned int parm; 368 unsigned int parm;
326 int i, conn_len, conns; 369 int i, conn_len, conns;
@@ -417,8 +460,28 @@ int snd_hda_get_connections(struct hda_codec *codec, hda_nid_t nid,
417 } 460 }
418 return conns; 461 return conns;
419} 462}
420EXPORT_SYMBOL_HDA(snd_hda_get_connections);
421 463
464static bool add_conn_list(struct snd_array *array, hda_nid_t nid)
465{
466 hda_nid_t *p = snd_array_new(array);
467 if (!p)
468 return false;
469 *p = nid;
470 return true;
471}
472
473static int copy_conn_list(hda_nid_t nid, hda_nid_t *dst, int max_dst,
474 hda_nid_t *src, int len)
475{
476 if (len > max_dst) {
477 snd_printk(KERN_ERR "hda_codec: "
478 "Too many connections %d for NID 0x%x\n",
479 len, nid);
480 return -EINVAL;
481 }
482 memcpy(dst, src, len * sizeof(hda_nid_t));
483 return len;
484}
422 485
423/** 486/**
424 * snd_hda_queue_unsol_event - add an unsolicited event to queue 487 * snd_hda_queue_unsol_event - add an unsolicited event to queue
@@ -1019,6 +1082,7 @@ static void snd_hda_codec_free(struct hda_codec *codec)
1019 list_del(&codec->list); 1082 list_del(&codec->list);
1020 snd_array_free(&codec->mixers); 1083 snd_array_free(&codec->mixers);
1021 snd_array_free(&codec->nids); 1084 snd_array_free(&codec->nids);
1085 snd_array_free(&codec->conn_lists);
1022 codec->bus->caddr_tbl[codec->addr] = NULL; 1086 codec->bus->caddr_tbl[codec->addr] = NULL;
1023 if (codec->patch_ops.free) 1087 if (codec->patch_ops.free)
1024 codec->patch_ops.free(codec); 1088 codec->patch_ops.free(codec);
@@ -1079,6 +1143,7 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus,
1079 snd_array_init(&codec->init_pins, sizeof(struct hda_pincfg), 16); 1143 snd_array_init(&codec->init_pins, sizeof(struct hda_pincfg), 16);
1080 snd_array_init(&codec->driver_pins, sizeof(struct hda_pincfg), 16); 1144 snd_array_init(&codec->driver_pins, sizeof(struct hda_pincfg), 16);
1081 snd_array_init(&codec->cvt_setups, sizeof(struct hda_cvt_setup), 8); 1145 snd_array_init(&codec->cvt_setups, sizeof(struct hda_cvt_setup), 8);
1146 snd_array_init(&codec->conn_lists, sizeof(hda_nid_t), 64);
1082 if (codec->bus->modelname) { 1147 if (codec->bus->modelname) {
1083 codec->modelname = kstrdup(codec->bus->modelname, GFP_KERNEL); 1148 codec->modelname = kstrdup(codec->bus->modelname, GFP_KERNEL);
1084 if (!codec->modelname) { 1149 if (!codec->modelname) {
@@ -2556,7 +2621,7 @@ static unsigned int convert_to_spdif_status(unsigned short val)
2556static void set_dig_out(struct hda_codec *codec, hda_nid_t nid, 2621static void set_dig_out(struct hda_codec *codec, hda_nid_t nid,
2557 int verb, int val) 2622 int verb, int val)
2558{ 2623{
2559 hda_nid_t *d; 2624 const hda_nid_t *d;
2560 2625
2561 snd_hda_codec_write_cache(codec, nid, 0, verb, val); 2626 snd_hda_codec_write_cache(codec, nid, 0, verb, val);
2562 d = codec->slave_dig_outs; 2627 d = codec->slave_dig_outs;
@@ -3807,7 +3872,8 @@ EXPORT_SYMBOL_HDA(snd_hda_check_board_codec_sid_config);
3807 * 3872 *
3808 * Returns 0 if successful, or a negative error code. 3873 * Returns 0 if successful, or a negative error code.
3809 */ 3874 */
3810int snd_hda_add_new_ctls(struct hda_codec *codec, struct snd_kcontrol_new *knew) 3875int snd_hda_add_new_ctls(struct hda_codec *codec,
3876 const struct snd_kcontrol_new *knew)
3811{ 3877{
3812 int err; 3878 int err;
3813 3879
@@ -3950,7 +4016,7 @@ int snd_hda_check_amp_list_power(struct hda_codec *codec,
3950 struct hda_loopback_check *check, 4016 struct hda_loopback_check *check,
3951 hda_nid_t nid) 4017 hda_nid_t nid)
3952{ 4018{
3953 struct hda_amp_list *p; 4019 const struct hda_amp_list *p;
3954 int ch, v; 4020 int ch, v;
3955 4021
3956 if (!check->amplist) 4022 if (!check->amplist)
@@ -4118,7 +4184,7 @@ static void setup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid,
4118 -1); 4184 -1);
4119 snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format); 4185 snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format);
4120 if (codec->slave_dig_outs) { 4186 if (codec->slave_dig_outs) {
4121 hda_nid_t *d; 4187 const hda_nid_t *d;
4122 for (d = codec->slave_dig_outs; *d; d++) 4188 for (d = codec->slave_dig_outs; *d; d++)
4123 snd_hda_codec_setup_stream(codec, *d, stream_tag, 0, 4189 snd_hda_codec_setup_stream(codec, *d, stream_tag, 0,
4124 format); 4190 format);
@@ -4133,7 +4199,7 @@ static void cleanup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid)
4133{ 4199{
4134 snd_hda_codec_cleanup_stream(codec, nid); 4200 snd_hda_codec_cleanup_stream(codec, nid);
4135 if (codec->slave_dig_outs) { 4201 if (codec->slave_dig_outs) {
4136 hda_nid_t *d; 4202 const hda_nid_t *d;
4137 for (d = codec->slave_dig_outs; *d; d++) 4203 for (d = codec->slave_dig_outs; *d; d++)
4138 snd_hda_codec_cleanup_stream(codec, *d); 4204 snd_hda_codec_cleanup_stream(codec, *d);
4139 } 4205 }
@@ -4280,7 +4346,7 @@ int snd_hda_multi_out_analog_prepare(struct hda_codec *codec,
4280 unsigned int format, 4346 unsigned int format,
4281 struct snd_pcm_substream *substream) 4347 struct snd_pcm_substream *substream)
4282{ 4348{
4283 hda_nid_t *nids = mout->dac_nids; 4349 const hda_nid_t *nids = mout->dac_nids;
4284 int chs = substream->runtime->channels; 4350 int chs = substream->runtime->channels;
4285 int i; 4351 int i;
4286 4352
@@ -4335,7 +4401,7 @@ EXPORT_SYMBOL_HDA(snd_hda_multi_out_analog_prepare);
4335int snd_hda_multi_out_analog_cleanup(struct hda_codec *codec, 4401int snd_hda_multi_out_analog_cleanup(struct hda_codec *codec,
4336 struct hda_multi_out *mout) 4402 struct hda_multi_out *mout)
4337{ 4403{
4338 hda_nid_t *nids = mout->dac_nids; 4404 const hda_nid_t *nids = mout->dac_nids;
4339 int i; 4405 int i;
4340 4406
4341 for (i = 0; i < mout->num_dacs; i++) 4407 for (i = 0; i < mout->num_dacs; i++)
@@ -4360,7 +4426,7 @@ EXPORT_SYMBOL_HDA(snd_hda_multi_out_analog_cleanup);
4360 * Helper for automatic pin configuration 4426 * Helper for automatic pin configuration
4361 */ 4427 */
4362 4428
4363static int is_in_nid_list(hda_nid_t nid, hda_nid_t *list) 4429static int is_in_nid_list(hda_nid_t nid, const hda_nid_t *list)
4364{ 4430{
4365 for (; *list; list++) 4431 for (; *list; list++)
4366 if (*list == nid) 4432 if (*list == nid)
@@ -4441,7 +4507,7 @@ static void sort_autocfg_input_pins(struct auto_pin_cfg *cfg)
4441 */ 4507 */
4442int snd_hda_parse_pin_def_config(struct hda_codec *codec, 4508int snd_hda_parse_pin_def_config(struct hda_codec *codec,
4443 struct auto_pin_cfg *cfg, 4509 struct auto_pin_cfg *cfg,
4444 hda_nid_t *ignore_nids) 4510 const hda_nid_t *ignore_nids)
4445{ 4511{
4446 hda_nid_t nid, end_nid; 4512 hda_nid_t nid, end_nid;
4447 short seq, assoc_line_out, assoc_speaker; 4513 short seq, assoc_line_out, assoc_speaker;
@@ -4632,10 +4698,13 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec,
4632 /* 4698 /*
4633 * debug prints of the parsed results 4699 * debug prints of the parsed results
4634 */ 4700 */
4635 snd_printd("autoconfig: line_outs=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n", 4701 snd_printd("autoconfig: line_outs=%d (0x%x/0x%x/0x%x/0x%x/0x%x) type:%s\n",
4636 cfg->line_outs, cfg->line_out_pins[0], cfg->line_out_pins[1], 4702 cfg->line_outs, cfg->line_out_pins[0], cfg->line_out_pins[1],
4637 cfg->line_out_pins[2], cfg->line_out_pins[3], 4703 cfg->line_out_pins[2], cfg->line_out_pins[3],
4638 cfg->line_out_pins[4]); 4704 cfg->line_out_pins[4],
4705 cfg->line_out_type == AUTO_PIN_HP_OUT ? "hp" :
4706 (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT ?
4707 "speaker" : "line"));
4639 snd_printd(" speaker_outs=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n", 4708 snd_printd(" speaker_outs=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n",
4640 cfg->speaker_outs, cfg->speaker_pins[0], 4709 cfg->speaker_outs, cfg->speaker_pins[0],
4641 cfg->speaker_pins[1], cfg->speaker_pins[2], 4710 cfg->speaker_pins[1], cfg->speaker_pins[2],
@@ -4986,6 +5055,8 @@ static const char *get_jack_default_name(struct hda_codec *codec, hda_nid_t nid,
4986 return "Line-out"; 5055 return "Line-out";
4987 case SND_JACK_HEADSET: 5056 case SND_JACK_HEADSET:
4988 return "Headset"; 5057 return "Headset";
5058 case SND_JACK_VIDEOOUT:
5059 return "HDMI/DP";
4989 default: 5060 default:
4990 return "Misc"; 5061 return "Misc";
4991 } 5062 }
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index e46d5420a9f..59c97306c1d 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -825,12 +825,14 @@ struct hda_codec {
825 struct hda_cache_rec amp_cache; /* cache for amp access */ 825 struct hda_cache_rec amp_cache; /* cache for amp access */
826 struct hda_cache_rec cmd_cache; /* cache for other commands */ 826 struct hda_cache_rec cmd_cache; /* cache for other commands */
827 827
828 struct snd_array conn_lists; /* connection-list array */
829
828 struct mutex spdif_mutex; 830 struct mutex spdif_mutex;
829 struct mutex control_mutex; 831 struct mutex control_mutex;
830 unsigned int spdif_status; /* IEC958 status bits */ 832 unsigned int spdif_status; /* IEC958 status bits */
831 unsigned short spdif_ctls; /* SPDIF control bits */ 833 unsigned short spdif_ctls; /* SPDIF control bits */
832 unsigned int spdif_in_enable; /* SPDIF input enable? */ 834 unsigned int spdif_in_enable; /* SPDIF input enable? */
833 hda_nid_t *slave_dig_outs; /* optional digital out slave widgets */ 835 const hda_nid_t *slave_dig_outs; /* optional digital out slave widgets */
834 struct snd_array init_pins; /* initial (BIOS) pin configurations */ 836 struct snd_array init_pins; /* initial (BIOS) pin configurations */
835 struct snd_array driver_pins; /* pin configs set by codec parser */ 837 struct snd_array driver_pins; /* pin configs set by codec parser */
836 struct snd_array cvt_setups; /* audio convert setups */ 838 struct snd_array cvt_setups; /* audio convert setups */
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 70a9d32f0e9..43a036716d2 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -126,6 +126,7 @@ MODULE_SUPPORTED_DEVICE("{{Intel, ICH6},"
126 "{Intel, ICH10}," 126 "{Intel, ICH10},"
127 "{Intel, PCH}," 127 "{Intel, PCH},"
128 "{Intel, CPT}," 128 "{Intel, CPT},"
129 "{Intel, PPT},"
129 "{Intel, PBG}," 130 "{Intel, PBG},"
130 "{Intel, SCH}," 131 "{Intel, SCH},"
131 "{ATI, SB450}," 132 "{ATI, SB450},"
@@ -1091,7 +1092,13 @@ static void azx_init_pci(struct azx *chip)
1091 ? "Failed" : "OK"); 1092 ? "Failed" : "OK");
1092 } 1093 }
1093 break; 1094 break;
1094 1095 default:
1096 /* AMD Hudson needs the similar snoop, as it seems... */
1097 if (chip->pci->vendor == PCI_VENDOR_ID_AMD)
1098 update_pci_byte(chip->pci,
1099 ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR,
1100 0x07, ATI_SB450_HDAUDIO_ENABLE_SNOOP);
1101 break;
1095 } 1102 }
1096} 1103}
1097 1104
@@ -1446,6 +1453,17 @@ static int __devinit azx_codec_create(struct azx *chip, const char *model)
1446 } 1453 }
1447 } 1454 }
1448 1455
1456 /* AMD chipsets often cause the communication stalls upon certain
1457 * sequence like the pin-detection. It seems that forcing the synced
1458 * access works around the stall. Grrr...
1459 */
1460 if (chip->pci->vendor == PCI_VENDOR_ID_AMD ||
1461 chip->pci->vendor == PCI_VENDOR_ID_ATI) {
1462 snd_printk(KERN_INFO SFX "Enable sync_write for AMD chipset\n");
1463 chip->bus->sync_write = 1;
1464 chip->bus->allow_bus_reset = 1;
1465 }
1466
1449 /* Then create codec instances */ 1467 /* Then create codec instances */
1450 for (c = 0; c < max_slots; c++) { 1468 for (c = 0; c < max_slots; c++) {
1451 if ((chip->codec_mask & (1 << c)) & chip->codec_probe_mask) { 1469 if ((chip->codec_mask & (1 << c)) & chip->codec_probe_mask) {
@@ -2349,9 +2367,16 @@ static int __devinit check_position_fix(struct azx *chip, int fix)
2349 /* Check VIA/ATI HD Audio Controller exist */ 2367 /* Check VIA/ATI HD Audio Controller exist */
2350 switch (chip->driver_type) { 2368 switch (chip->driver_type) {
2351 case AZX_DRIVER_VIA: 2369 case AZX_DRIVER_VIA:
2352 case AZX_DRIVER_ATI:
2353 /* Use link position directly, avoid any transfer problem. */ 2370 /* Use link position directly, avoid any transfer problem. */
2354 return POS_FIX_VIACOMBO; 2371 return POS_FIX_VIACOMBO;
2372 case AZX_DRIVER_ATI:
2373 /* ATI chipsets don't work well with position-buffer */
2374 return POS_FIX_LPIB;
2375 case AZX_DRIVER_GENERIC:
2376 /* AMD chipsets also don't work with position-buffer */
2377 if (chip->pci->vendor == PCI_VENDOR_ID_AMD)
2378 return POS_FIX_LPIB;
2379 break;
2355 } 2380 }
2356 2381
2357 return POS_FIX_AUTO; 2382 return POS_FIX_AUTO;
@@ -2549,6 +2574,13 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci,
2549 gcap &= ~ICH6_GCAP_64OK; 2574 gcap &= ~ICH6_GCAP_64OK;
2550 pci_dev_put(p_smbus); 2575 pci_dev_put(p_smbus);
2551 } 2576 }
2577 } else {
2578 /* FIXME: not sure whether this is really needed, but
2579 * Hudson isn't stable enough for allowing everything...
2580 * let's check later again.
2581 */
2582 if (chip->pci->vendor == PCI_VENDOR_ID_AMD)
2583 gcap &= ~ICH6_GCAP_64OK;
2552 } 2584 }
2553 2585
2554 /* disable 64bit DMA address for Teradici */ 2586 /* disable 64bit DMA address for Teradici */
@@ -2759,6 +2791,8 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = {
2759 { PCI_DEVICE(0x8086, 0x1c20), .driver_data = AZX_DRIVER_PCH }, 2791 { PCI_DEVICE(0x8086, 0x1c20), .driver_data = AZX_DRIVER_PCH },
2760 /* PBG */ 2792 /* PBG */
2761 { PCI_DEVICE(0x8086, 0x1d20), .driver_data = AZX_DRIVER_PCH }, 2793 { PCI_DEVICE(0x8086, 0x1d20), .driver_data = AZX_DRIVER_PCH },
2794 /* Panther Point */
2795 { PCI_DEVICE(0x8086, 0x1e20), .driver_data = AZX_DRIVER_PCH },
2762 /* SCH */ 2796 /* SCH */
2763 { PCI_DEVICE(0x8086, 0x811b), .driver_data = AZX_DRIVER_SCH }, 2797 { PCI_DEVICE(0x8086, 0x811b), .driver_data = AZX_DRIVER_SCH },
2764 /* Generic Intel */ 2798 /* Generic Intel */
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index ff5e2ac2239..08ec073444e 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -267,11 +267,11 @@ enum { HDA_DIG_NONE, HDA_DIG_EXCLUSIVE, HDA_DIG_ANALOG_DUP }; /* dig_out_used */
267 267
268struct hda_multi_out { 268struct hda_multi_out {
269 int num_dacs; /* # of DACs, must be more than 1 */ 269 int num_dacs; /* # of DACs, must be more than 1 */
270 hda_nid_t *dac_nids; /* DAC list */ 270 const hda_nid_t *dac_nids; /* DAC list */
271 hda_nid_t hp_nid; /* optional DAC for HP, 0 when not exists */ 271 hda_nid_t hp_nid; /* optional DAC for HP, 0 when not exists */
272 hda_nid_t extra_out_nid[3]; /* optional DACs, 0 when not exists */ 272 hda_nid_t extra_out_nid[3]; /* optional DACs, 0 when not exists */
273 hda_nid_t dig_out_nid; /* digital out audio widget */ 273 hda_nid_t dig_out_nid; /* digital out audio widget */
274 hda_nid_t *slave_dig_outs; 274 const hda_nid_t *slave_dig_outs;
275 int max_channels; /* currently supported analog channels */ 275 int max_channels; /* currently supported analog channels */
276 int dig_out_used; /* current usage of digital out (HDA_DIG_XXX) */ 276 int dig_out_used; /* current usage of digital out (HDA_DIG_XXX) */
277 int no_share_stream; /* don't share a stream with multiple pins */ 277 int no_share_stream; /* don't share a stream with multiple pins */
@@ -347,7 +347,7 @@ int snd_hda_check_board_codec_sid_config(struct hda_codec *codec,
347 int num_configs, const char * const *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 const struct snd_kcontrol_new *knew);
351 351
352/* 352/*
353 * unsolicited event handler 353 * unsolicited event handler
@@ -443,7 +443,7 @@ struct auto_pin_cfg {
443 443
444int snd_hda_parse_pin_def_config(struct hda_codec *codec, 444int snd_hda_parse_pin_def_config(struct hda_codec *codec,
445 struct auto_pin_cfg *cfg, 445 struct auto_pin_cfg *cfg,
446 hda_nid_t *ignore_nids); 446 const hda_nid_t *ignore_nids);
447 447
448/* amp values */ 448/* amp values */
449#define AMP_IN_MUTE(idx) (0x7080 | ((idx)<<8)) 449#define AMP_IN_MUTE(idx) (0x7080 | ((idx)<<8))
@@ -493,6 +493,12 @@ u32 snd_hda_query_pin_caps(struct hda_codec *codec, hda_nid_t nid);
493u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid); 493u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid);
494int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid); 494int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid);
495 495
496static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid)
497{
498 return (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_PRES_DETECT) &&
499 (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP);
500}
501
496/* flags for hda_nid_item */ 502/* flags for hda_nid_item */
497#define HDA_NID_ITEM_AMP (1<<0) 503#define HDA_NID_ITEM_AMP (1<<0)
498 504
@@ -567,7 +573,7 @@ struct hda_amp_list {
567}; 573};
568 574
569struct hda_loopback_check { 575struct hda_loopback_check {
570 struct hda_amp_list *amplist; 576 const struct hda_amp_list *amplist;
571 int power_on; 577 int power_on;
572}; 578};
573 579
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 2942d2a9ea1..f1b3875c57d 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -30,7 +30,7 @@
30#include "hda_beep.h" 30#include "hda_beep.h"
31 31
32struct ad198x_spec { 32struct ad198x_spec {
33 struct snd_kcontrol_new *mixers[6]; 33 const struct snd_kcontrol_new *mixers[6];
34 int num_mixers; 34 int num_mixers;
35 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ 35 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
36 const struct hda_verb *init_verbs[6]; /* initialization verbs 36 const struct hda_verb *init_verbs[6]; /* initialization verbs
@@ -46,17 +46,17 @@ 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; 49 const hda_nid_t *alt_dac_nid;
50 struct hda_pcm_stream *stream_analog_alt_playback; 50 const struct hda_pcm_stream *stream_analog_alt_playback;
51 51
52 /* capture */ 52 /* capture */
53 unsigned int num_adc_nids; 53 unsigned int num_adc_nids;
54 hda_nid_t *adc_nids; 54 const hda_nid_t *adc_nids;
55 hda_nid_t dig_in_nid; /* digital-in NID; optional */ 55 hda_nid_t dig_in_nid; /* digital-in NID; optional */
56 56
57 /* capture source */ 57 /* capture source */
58 const struct hda_input_mux *input_mux; 58 const struct hda_input_mux *input_mux;
59 hda_nid_t *capsrc_nids; 59 const hda_nid_t *capsrc_nids;
60 unsigned int cur_mux[3]; 60 unsigned int cur_mux[3];
61 61
62 /* channel model */ 62 /* channel model */
@@ -182,13 +182,13 @@ static void ad198x_free_kctls(struct hda_codec *codec);
182 182
183#ifdef CONFIG_SND_HDA_INPUT_BEEP 183#ifdef CONFIG_SND_HDA_INPUT_BEEP
184/* additional beep mixers; the actual parameters are overwritten at build */ 184/* additional beep mixers; the actual parameters are overwritten at build */
185static struct snd_kcontrol_new ad_beep_mixer[] = { 185static const struct snd_kcontrol_new ad_beep_mixer[] = {
186 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_OUTPUT), 186 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_OUTPUT),
187 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_OUTPUT), 187 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_OUTPUT),
188 { } /* end */ 188 { } /* end */
189}; 189};
190 190
191static struct snd_kcontrol_new ad_beep2_mixer[] = { 191static const struct snd_kcontrol_new ad_beep2_mixer[] = {
192 HDA_CODEC_VOLUME("Digital Beep Playback Volume", 0, 0, HDA_OUTPUT), 192 HDA_CODEC_VOLUME("Digital Beep Playback Volume", 0, 0, HDA_OUTPUT),
193 HDA_CODEC_MUTE_BEEP("Digital Beep Playback Switch", 0, 0, HDA_OUTPUT), 193 HDA_CODEC_MUTE_BEEP("Digital Beep Playback Switch", 0, 0, HDA_OUTPUT),
194 { } /* end */ 194 { } /* end */
@@ -231,7 +231,7 @@ static int ad198x_build_controls(struct hda_codec *codec)
231 /* create beep controls if needed */ 231 /* create beep controls if needed */
232#ifdef CONFIG_SND_HDA_INPUT_BEEP 232#ifdef CONFIG_SND_HDA_INPUT_BEEP
233 if (spec->beep_amp) { 233 if (spec->beep_amp) {
234 struct snd_kcontrol_new *knew; 234 const struct snd_kcontrol_new *knew;
235 knew = spec->analog_beep ? ad_beep2_mixer : ad_beep_mixer; 235 knew = spec->analog_beep ? ad_beep2_mixer : ad_beep_mixer;
236 for ( ; knew->name; knew++) { 236 for ( ; knew->name; knew++) {
237 struct snd_kcontrol *kctl; 237 struct snd_kcontrol *kctl;
@@ -331,7 +331,7 @@ static int ad198x_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
331 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); 331 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
332} 332}
333 333
334static struct hda_pcm_stream ad198x_pcm_analog_alt_playback = { 334static const struct hda_pcm_stream ad198x_pcm_analog_alt_playback = {
335 .substreams = 1, 335 .substreams = 1,
336 .channels_min = 2, 336 .channels_min = 2,
337 .channels_max = 2, 337 .channels_max = 2,
@@ -403,7 +403,7 @@ static int ad198x_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
403 403
404/* 404/*
405 */ 405 */
406static struct hda_pcm_stream ad198x_pcm_analog_playback = { 406static const struct hda_pcm_stream ad198x_pcm_analog_playback = {
407 .substreams = 1, 407 .substreams = 1,
408 .channels_min = 2, 408 .channels_min = 2,
409 .channels_max = 6, /* changed later */ 409 .channels_max = 6, /* changed later */
@@ -415,7 +415,7 @@ static struct hda_pcm_stream ad198x_pcm_analog_playback = {
415 }, 415 },
416}; 416};
417 417
418static struct hda_pcm_stream ad198x_pcm_analog_capture = { 418static const struct hda_pcm_stream ad198x_pcm_analog_capture = {
419 .substreams = 1, 419 .substreams = 1,
420 .channels_min = 2, 420 .channels_min = 2,
421 .channels_max = 2, 421 .channels_max = 2,
@@ -426,7 +426,7 @@ static struct hda_pcm_stream ad198x_pcm_analog_capture = {
426 }, 426 },
427}; 427};
428 428
429static struct hda_pcm_stream ad198x_pcm_digital_playback = { 429static const struct hda_pcm_stream ad198x_pcm_digital_playback = {
430 .substreams = 1, 430 .substreams = 1,
431 .channels_min = 2, 431 .channels_min = 2,
432 .channels_max = 2, 432 .channels_max = 2,
@@ -439,7 +439,7 @@ static struct hda_pcm_stream ad198x_pcm_digital_playback = {
439 }, 439 },
440}; 440};
441 441
442static struct hda_pcm_stream ad198x_pcm_digital_capture = { 442static const struct hda_pcm_stream ad198x_pcm_digital_capture = {
443 .substreams = 1, 443 .substreams = 1,
444 .channels_min = 2, 444 .channels_min = 2,
445 .channels_max = 2, 445 .channels_max = 2,
@@ -489,11 +489,6 @@ static int ad198x_build_pcms(struct hda_codec *codec)
489 return 0; 489 return 0;
490} 490}
491 491
492static inline void ad198x_shutup(struct hda_codec *codec)
493{
494 snd_hda_shutup_pins(codec);
495}
496
497static void ad198x_free_kctls(struct hda_codec *codec) 492static void ad198x_free_kctls(struct hda_codec *codec)
498{ 493{
499 struct ad198x_spec *spec = codec->spec; 494 struct ad198x_spec *spec = codec->spec;
@@ -547,6 +542,12 @@ static void ad198x_power_eapd(struct hda_codec *codec)
547 } 542 }
548} 543}
549 544
545static void ad198x_shutup(struct hda_codec *codec)
546{
547 snd_hda_shutup_pins(codec);
548 ad198x_power_eapd(codec);
549}
550
550static void ad198x_free(struct hda_codec *codec) 551static void ad198x_free(struct hda_codec *codec)
551{ 552{
552 struct ad198x_spec *spec = codec->spec; 553 struct ad198x_spec *spec = codec->spec;
@@ -564,12 +565,11 @@ static void ad198x_free(struct hda_codec *codec)
564static int ad198x_suspend(struct hda_codec *codec, pm_message_t state) 565static int ad198x_suspend(struct hda_codec *codec, pm_message_t state)
565{ 566{
566 ad198x_shutup(codec); 567 ad198x_shutup(codec);
567 ad198x_power_eapd(codec);
568 return 0; 568 return 0;
569} 569}
570#endif 570#endif
571 571
572static struct hda_codec_ops ad198x_patch_ops = { 572static const struct hda_codec_ops ad198x_patch_ops = {
573 .build_controls = ad198x_build_controls, 573 .build_controls = ad198x_build_controls,
574 .build_pcms = ad198x_build_pcms, 574 .build_pcms = ad198x_build_pcms,
575 .init = ad198x_init, 575 .init = ad198x_init,
@@ -639,13 +639,13 @@ static int ad198x_ch_mode_put(struct snd_kcontrol *kcontrol,
639#define AD1986A_CLFE_DAC 0x05 639#define AD1986A_CLFE_DAC 0x05
640#define AD1986A_ADC 0x06 640#define AD1986A_ADC 0x06
641 641
642static hda_nid_t ad1986a_dac_nids[3] = { 642static const hda_nid_t ad1986a_dac_nids[3] = {
643 AD1986A_FRONT_DAC, AD1986A_SURR_DAC, AD1986A_CLFE_DAC 643 AD1986A_FRONT_DAC, AD1986A_SURR_DAC, AD1986A_CLFE_DAC
644}; 644};
645static hda_nid_t ad1986a_adc_nids[1] = { AD1986A_ADC }; 645static const hda_nid_t ad1986a_adc_nids[1] = { AD1986A_ADC };
646static hda_nid_t ad1986a_capsrc_nids[1] = { 0x12 }; 646static const hda_nid_t ad1986a_capsrc_nids[1] = { 0x12 };
647 647
648static struct hda_input_mux ad1986a_capture_source = { 648static const struct hda_input_mux ad1986a_capture_source = {
649 .num_items = 7, 649 .num_items = 7,
650 .items = { 650 .items = {
651 { "Mic", 0x0 }, 651 { "Mic", 0x0 },
@@ -659,7 +659,7 @@ static struct hda_input_mux ad1986a_capture_source = {
659}; 659};
660 660
661 661
662static struct hda_bind_ctls ad1986a_bind_pcm_vol = { 662static const struct hda_bind_ctls ad1986a_bind_pcm_vol = {
663 .ops = &snd_hda_bind_vol, 663 .ops = &snd_hda_bind_vol,
664 .values = { 664 .values = {
665 HDA_COMPOSE_AMP_VAL(AD1986A_FRONT_DAC, 3, 0, HDA_OUTPUT), 665 HDA_COMPOSE_AMP_VAL(AD1986A_FRONT_DAC, 3, 0, HDA_OUTPUT),
@@ -669,7 +669,7 @@ static struct hda_bind_ctls ad1986a_bind_pcm_vol = {
669 }, 669 },
670}; 670};
671 671
672static struct hda_bind_ctls ad1986a_bind_pcm_sw = { 672static const struct hda_bind_ctls ad1986a_bind_pcm_sw = {
673 .ops = &snd_hda_bind_sw, 673 .ops = &snd_hda_bind_sw,
674 .values = { 674 .values = {
675 HDA_COMPOSE_AMP_VAL(AD1986A_FRONT_DAC, 3, 0, HDA_OUTPUT), 675 HDA_COMPOSE_AMP_VAL(AD1986A_FRONT_DAC, 3, 0, HDA_OUTPUT),
@@ -682,7 +682,7 @@ static struct hda_bind_ctls ad1986a_bind_pcm_sw = {
682/* 682/*
683 * mixers 683 * mixers
684 */ 684 */
685static struct snd_kcontrol_new ad1986a_mixers[] = { 685static const struct snd_kcontrol_new ad1986a_mixers[] = {
686 /* 686 /*
687 * bind volumes/mutes of 3 DACs as a single PCM control for simplicity 687 * bind volumes/mutes of 3 DACs as a single PCM control for simplicity
688 */ 688 */
@@ -723,7 +723,7 @@ static struct snd_kcontrol_new ad1986a_mixers[] = {
723}; 723};
724 724
725/* additional mixers for 3stack mode */ 725/* additional mixers for 3stack mode */
726static struct snd_kcontrol_new ad1986a_3st_mixers[] = { 726static const struct snd_kcontrol_new ad1986a_3st_mixers[] = {
727 { 727 {
728 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 728 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
729 .name = "Channel Mode", 729 .name = "Channel Mode",
@@ -735,10 +735,10 @@ static struct snd_kcontrol_new ad1986a_3st_mixers[] = {
735}; 735};
736 736
737/* laptop model - 2ch only */ 737/* laptop model - 2ch only */
738static hda_nid_t ad1986a_laptop_dac_nids[1] = { AD1986A_FRONT_DAC }; 738static const hda_nid_t ad1986a_laptop_dac_nids[1] = { AD1986A_FRONT_DAC };
739 739
740/* master controls both pins 0x1a and 0x1b */ 740/* master controls both pins 0x1a and 0x1b */
741static struct hda_bind_ctls ad1986a_laptop_master_vol = { 741static const struct hda_bind_ctls ad1986a_laptop_master_vol = {
742 .ops = &snd_hda_bind_vol, 742 .ops = &snd_hda_bind_vol,
743 .values = { 743 .values = {
744 HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, HDA_OUTPUT), 744 HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, HDA_OUTPUT),
@@ -747,7 +747,7 @@ static struct hda_bind_ctls ad1986a_laptop_master_vol = {
747 }, 747 },
748}; 748};
749 749
750static struct hda_bind_ctls ad1986a_laptop_master_sw = { 750static const struct hda_bind_ctls ad1986a_laptop_master_sw = {
751 .ops = &snd_hda_bind_sw, 751 .ops = &snd_hda_bind_sw,
752 .values = { 752 .values = {
753 HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, HDA_OUTPUT), 753 HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, HDA_OUTPUT),
@@ -756,7 +756,7 @@ static struct hda_bind_ctls ad1986a_laptop_master_sw = {
756 }, 756 },
757}; 757};
758 758
759static struct snd_kcontrol_new ad1986a_laptop_mixers[] = { 759static const struct snd_kcontrol_new ad1986a_laptop_mixers[] = {
760 HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT), 760 HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT),
761 HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT), 761 HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT),
762 HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol), 762 HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol),
@@ -787,7 +787,7 @@ static struct snd_kcontrol_new ad1986a_laptop_mixers[] = {
787 787
788/* laptop-eapd model - 2ch only */ 788/* laptop-eapd model - 2ch only */
789 789
790static struct hda_input_mux ad1986a_laptop_eapd_capture_source = { 790static const struct hda_input_mux ad1986a_laptop_eapd_capture_source = {
791 .num_items = 3, 791 .num_items = 3,
792 .items = { 792 .items = {
793 { "Mic", 0x0 }, 793 { "Mic", 0x0 },
@@ -796,7 +796,7 @@ static struct hda_input_mux ad1986a_laptop_eapd_capture_source = {
796 }, 796 },
797}; 797};
798 798
799static struct hda_input_mux ad1986a_automic_capture_source = { 799static const struct hda_input_mux ad1986a_automic_capture_source = {
800 .num_items = 2, 800 .num_items = 2,
801 .items = { 801 .items = {
802 { "Mic", 0x0 }, 802 { "Mic", 0x0 },
@@ -804,13 +804,13 @@ static struct hda_input_mux ad1986a_automic_capture_source = {
804 }, 804 },
805}; 805};
806 806
807static struct snd_kcontrol_new ad1986a_laptop_master_mixers[] = { 807static const struct snd_kcontrol_new ad1986a_laptop_master_mixers[] = {
808 HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol), 808 HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol),
809 HDA_BIND_SW("Master Playback Switch", &ad1986a_laptop_master_sw), 809 HDA_BIND_SW("Master Playback Switch", &ad1986a_laptop_master_sw),
810 { } /* end */ 810 { } /* end */
811}; 811};
812 812
813static struct snd_kcontrol_new ad1986a_laptop_eapd_mixers[] = { 813static const struct snd_kcontrol_new ad1986a_laptop_eapd_mixers[] = {
814 HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT), 814 HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT),
815 HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT), 815 HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT),
816 HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), 816 HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT),
@@ -837,7 +837,7 @@ static struct snd_kcontrol_new ad1986a_laptop_eapd_mixers[] = {
837 { } /* end */ 837 { } /* end */
838}; 838};
839 839
840static struct snd_kcontrol_new ad1986a_laptop_intmic_mixers[] = { 840static const struct snd_kcontrol_new ad1986a_laptop_intmic_mixers[] = {
841 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x17, 0, HDA_OUTPUT), 841 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x17, 0, HDA_OUTPUT),
842 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x17, 0, HDA_OUTPUT), 842 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x17, 0, HDA_OUTPUT),
843 { } /* end */ 843 { } /* end */
@@ -931,7 +931,7 @@ static int ad1986a_hp_master_sw_put(struct snd_kcontrol *kcontrol,
931 return change; 931 return change;
932} 932}
933 933
934static struct snd_kcontrol_new ad1986a_automute_master_mixers[] = { 934static const struct snd_kcontrol_new ad1986a_automute_master_mixers[] = {
935 HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol), 935 HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol),
936 { 936 {
937 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 937 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -949,7 +949,7 @@ static struct snd_kcontrol_new ad1986a_automute_master_mixers[] = {
949/* 949/*
950 * initialization verbs 950 * initialization verbs
951 */ 951 */
952static struct hda_verb ad1986a_init_verbs[] = { 952static const struct hda_verb ad1986a_init_verbs[] = {
953 /* Front, Surround, CLFE DAC; mute as default */ 953 /* Front, Surround, CLFE DAC; mute as default */
954 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080}, 954 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080},
955 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080}, 955 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080},
@@ -1004,7 +1004,7 @@ static struct hda_verb ad1986a_init_verbs[] = {
1004 { } /* end */ 1004 { } /* end */
1005}; 1005};
1006 1006
1007static struct hda_verb ad1986a_ch2_init[] = { 1007static const struct hda_verb ad1986a_ch2_init[] = {
1008 /* Surround out -> Line In */ 1008 /* Surround out -> Line In */
1009 { 0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, 1009 { 0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1010 /* Line-in selectors */ 1010 /* Line-in selectors */
@@ -1016,7 +1016,7 @@ static struct hda_verb ad1986a_ch2_init[] = {
1016 { } /* end */ 1016 { } /* end */
1017}; 1017};
1018 1018
1019static struct hda_verb ad1986a_ch4_init[] = { 1019static const struct hda_verb ad1986a_ch4_init[] = {
1020 /* Surround out -> Surround */ 1020 /* Surround out -> Surround */
1021 { 0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 1021 { 0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1022 { 0x10, AC_VERB_SET_CONNECT_SEL, 0x0 }, 1022 { 0x10, AC_VERB_SET_CONNECT_SEL, 0x0 },
@@ -1026,7 +1026,7 @@ static struct hda_verb ad1986a_ch4_init[] = {
1026 { } /* end */ 1026 { } /* end */
1027}; 1027};
1028 1028
1029static struct hda_verb ad1986a_ch6_init[] = { 1029static const struct hda_verb ad1986a_ch6_init[] = {
1030 /* Surround out -> Surround out */ 1030 /* Surround out -> Surround out */
1031 { 0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 1031 { 0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1032 { 0x10, AC_VERB_SET_CONNECT_SEL, 0x0 }, 1032 { 0x10, AC_VERB_SET_CONNECT_SEL, 0x0 },
@@ -1036,19 +1036,19 @@ static struct hda_verb ad1986a_ch6_init[] = {
1036 { } /* end */ 1036 { } /* end */
1037}; 1037};
1038 1038
1039static struct hda_channel_mode ad1986a_modes[3] = { 1039static const struct hda_channel_mode ad1986a_modes[3] = {
1040 { 2, ad1986a_ch2_init }, 1040 { 2, ad1986a_ch2_init },
1041 { 4, ad1986a_ch4_init }, 1041 { 4, ad1986a_ch4_init },
1042 { 6, ad1986a_ch6_init }, 1042 { 6, ad1986a_ch6_init },
1043}; 1043};
1044 1044
1045/* eapd initialization */ 1045/* eapd initialization */
1046static struct hda_verb ad1986a_eapd_init_verbs[] = { 1046static const struct hda_verb ad1986a_eapd_init_verbs[] = {
1047 {0x1b, AC_VERB_SET_EAPD_BTLENABLE, 0x00 }, 1047 {0x1b, AC_VERB_SET_EAPD_BTLENABLE, 0x00 },
1048 {} 1048 {}
1049}; 1049};
1050 1050
1051static struct hda_verb ad1986a_automic_verbs[] = { 1051static const struct hda_verb ad1986a_automic_verbs[] = {
1052 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1052 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1053 {0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1053 {0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1054 /*{0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},*/ 1054 /*{0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},*/
@@ -1058,7 +1058,7 @@ static struct hda_verb ad1986a_automic_verbs[] = {
1058}; 1058};
1059 1059
1060/* Ultra initialization */ 1060/* Ultra initialization */
1061static struct hda_verb ad1986a_ultra_init[] = { 1061static const struct hda_verb ad1986a_ultra_init[] = {
1062 /* eapd initialization */ 1062 /* eapd initialization */
1063 { 0x1b, AC_VERB_SET_EAPD_BTLENABLE, 0x00 }, 1063 { 0x1b, AC_VERB_SET_EAPD_BTLENABLE, 0x00 },
1064 /* CLFE -> Mic in */ 1064 /* CLFE -> Mic in */
@@ -1069,7 +1069,7 @@ static struct hda_verb ad1986a_ultra_init[] = {
1069}; 1069};
1070 1070
1071/* pin sensing on HP jack */ 1071/* pin sensing on HP jack */
1072static struct hda_verb ad1986a_hp_init_verbs[] = { 1072static const struct hda_verb ad1986a_hp_init_verbs[] = {
1073 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1986A_HP_EVENT}, 1073 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1986A_HP_EVENT},
1074 {} 1074 {}
1075}; 1075};
@@ -1120,7 +1120,7 @@ static const char * const ad1986a_models[AD1986A_MODELS] = {
1120 [AD1986A_SAMSUNG_P50] = "samsung-p50", 1120 [AD1986A_SAMSUNG_P50] = "samsung-p50",
1121}; 1121};
1122 1122
1123static struct snd_pci_quirk ad1986a_cfg_tbl[] = { 1123static const struct snd_pci_quirk ad1986a_cfg_tbl[] = {
1124 SND_PCI_QUIRK(0x103c, 0x30af, "HP B2800", AD1986A_LAPTOP_EAPD), 1124 SND_PCI_QUIRK(0x103c, 0x30af, "HP B2800", AD1986A_LAPTOP_EAPD),
1125 SND_PCI_QUIRK(0x1043, 0x1153, "ASUS M9", AD1986A_LAPTOP_EAPD), 1125 SND_PCI_QUIRK(0x1043, 0x1153, "ASUS M9", AD1986A_LAPTOP_EAPD),
1126 SND_PCI_QUIRK(0x1043, 0x11f7, "ASUS U5A", AD1986A_LAPTOP_EAPD), 1126 SND_PCI_QUIRK(0x1043, 0x11f7, "ASUS U5A", AD1986A_LAPTOP_EAPD),
@@ -1152,7 +1152,7 @@ static struct snd_pci_quirk ad1986a_cfg_tbl[] = {
1152}; 1152};
1153 1153
1154#ifdef CONFIG_SND_HDA_POWER_SAVE 1154#ifdef CONFIG_SND_HDA_POWER_SAVE
1155static struct hda_amp_list ad1986a_loopbacks[] = { 1155static const struct hda_amp_list ad1986a_loopbacks[] = {
1156 { 0x13, HDA_OUTPUT, 0 }, /* Mic */ 1156 { 0x13, HDA_OUTPUT, 0 }, /* Mic */
1157 { 0x14, HDA_OUTPUT, 0 }, /* Phone */ 1157 { 0x14, HDA_OUTPUT, 0 }, /* Phone */
1158 { 0x15, HDA_OUTPUT, 0 }, /* CD */ 1158 { 0x15, HDA_OUTPUT, 0 }, /* CD */
@@ -1329,11 +1329,11 @@ static int patch_ad1986a(struct hda_codec *codec)
1329#define AD1983_DAC 0x03 1329#define AD1983_DAC 0x03
1330#define AD1983_ADC 0x04 1330#define AD1983_ADC 0x04
1331 1331
1332static hda_nid_t ad1983_dac_nids[1] = { AD1983_DAC }; 1332static const hda_nid_t ad1983_dac_nids[1] = { AD1983_DAC };
1333static hda_nid_t ad1983_adc_nids[1] = { AD1983_ADC }; 1333static const hda_nid_t ad1983_adc_nids[1] = { AD1983_ADC };
1334static hda_nid_t ad1983_capsrc_nids[1] = { 0x15 }; 1334static const hda_nid_t ad1983_capsrc_nids[1] = { 0x15 };
1335 1335
1336static struct hda_input_mux ad1983_capture_source = { 1336static const struct hda_input_mux ad1983_capture_source = {
1337 .num_items = 4, 1337 .num_items = 4,
1338 .items = { 1338 .items = {
1339 { "Mic", 0x0 }, 1339 { "Mic", 0x0 },
@@ -1348,7 +1348,7 @@ static struct hda_input_mux ad1983_capture_source = {
1348 */ 1348 */
1349static int ad1983_spdif_route_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 1349static int ad1983_spdif_route_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
1350{ 1350{
1351 static char *texts[] = { "PCM", "ADC" }; 1351 static const char * const texts[] = { "PCM", "ADC" };
1352 1352
1353 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 1353 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
1354 uinfo->count = 1; 1354 uinfo->count = 1;
@@ -1385,7 +1385,7 @@ static int ad1983_spdif_route_put(struct snd_kcontrol *kcontrol, struct snd_ctl_
1385 return 0; 1385 return 0;
1386} 1386}
1387 1387
1388static struct snd_kcontrol_new ad1983_mixers[] = { 1388static const struct snd_kcontrol_new ad1983_mixers[] = {
1389 HDA_CODEC_VOLUME("Front Playback Volume", 0x05, 0x0, HDA_OUTPUT), 1389 HDA_CODEC_VOLUME("Front Playback Volume", 0x05, 0x0, HDA_OUTPUT),
1390 HDA_CODEC_MUTE("Front Playback Switch", 0x05, 0x0, HDA_OUTPUT), 1390 HDA_CODEC_MUTE("Front Playback Switch", 0x05, 0x0, HDA_OUTPUT),
1391 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x06, 0x0, HDA_OUTPUT), 1391 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x06, 0x0, HDA_OUTPUT),
@@ -1418,7 +1418,7 @@ static struct snd_kcontrol_new ad1983_mixers[] = {
1418 { } /* end */ 1418 { } /* end */
1419}; 1419};
1420 1420
1421static struct hda_verb ad1983_init_verbs[] = { 1421static const struct hda_verb ad1983_init_verbs[] = {
1422 /* Front, HP, Mono; mute as default */ 1422 /* Front, HP, Mono; mute as default */
1423 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080}, 1423 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080},
1424 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080}, 1424 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080},
@@ -1458,7 +1458,7 @@ static struct hda_verb ad1983_init_verbs[] = {
1458}; 1458};
1459 1459
1460#ifdef CONFIG_SND_HDA_POWER_SAVE 1460#ifdef CONFIG_SND_HDA_POWER_SAVE
1461static struct hda_amp_list ad1983_loopbacks[] = { 1461static const struct hda_amp_list ad1983_loopbacks[] = {
1462 { 0x12, HDA_OUTPUT, 0 }, /* Mic */ 1462 { 0x12, HDA_OUTPUT, 0 }, /* Mic */
1463 { 0x13, HDA_OUTPUT, 0 }, /* Line */ 1463 { 0x13, HDA_OUTPUT, 0 }, /* Line */
1464 { } /* end */ 1464 { } /* end */
@@ -1518,12 +1518,12 @@ static int patch_ad1983(struct hda_codec *codec)
1518#define AD1981_DAC 0x03 1518#define AD1981_DAC 0x03
1519#define AD1981_ADC 0x04 1519#define AD1981_ADC 0x04
1520 1520
1521static hda_nid_t ad1981_dac_nids[1] = { AD1981_DAC }; 1521static const hda_nid_t ad1981_dac_nids[1] = { AD1981_DAC };
1522static hda_nid_t ad1981_adc_nids[1] = { AD1981_ADC }; 1522static const hda_nid_t ad1981_adc_nids[1] = { AD1981_ADC };
1523static hda_nid_t ad1981_capsrc_nids[1] = { 0x15 }; 1523static const hda_nid_t ad1981_capsrc_nids[1] = { 0x15 };
1524 1524
1525/* 0x0c, 0x09, 0x0e, 0x0f, 0x19, 0x05, 0x18, 0x17 */ 1525/* 0x0c, 0x09, 0x0e, 0x0f, 0x19, 0x05, 0x18, 0x17 */
1526static struct hda_input_mux ad1981_capture_source = { 1526static const struct hda_input_mux ad1981_capture_source = {
1527 .num_items = 7, 1527 .num_items = 7,
1528 .items = { 1528 .items = {
1529 { "Front Mic", 0x0 }, 1529 { "Front Mic", 0x0 },
@@ -1536,7 +1536,7 @@ static struct hda_input_mux ad1981_capture_source = {
1536 }, 1536 },
1537}; 1537};
1538 1538
1539static struct snd_kcontrol_new ad1981_mixers[] = { 1539static const struct snd_kcontrol_new ad1981_mixers[] = {
1540 HDA_CODEC_VOLUME("Front Playback Volume", 0x05, 0x0, HDA_OUTPUT), 1540 HDA_CODEC_VOLUME("Front Playback Volume", 0x05, 0x0, HDA_OUTPUT),
1541 HDA_CODEC_MUTE("Front Playback Switch", 0x05, 0x0, HDA_OUTPUT), 1541 HDA_CODEC_MUTE("Front Playback Switch", 0x05, 0x0, HDA_OUTPUT),
1542 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x06, 0x0, HDA_OUTPUT), 1542 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x06, 0x0, HDA_OUTPUT),
@@ -1577,7 +1577,7 @@ static struct snd_kcontrol_new ad1981_mixers[] = {
1577 { } /* end */ 1577 { } /* end */
1578}; 1578};
1579 1579
1580static struct hda_verb ad1981_init_verbs[] = { 1580static const struct hda_verb ad1981_init_verbs[] = {
1581 /* Front, HP, Mono; mute as default */ 1581 /* Front, HP, Mono; mute as default */
1582 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080}, 1582 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080},
1583 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080}, 1583 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080},
@@ -1625,7 +1625,7 @@ static struct hda_verb ad1981_init_verbs[] = {
1625}; 1625};
1626 1626
1627#ifdef CONFIG_SND_HDA_POWER_SAVE 1627#ifdef CONFIG_SND_HDA_POWER_SAVE
1628static struct hda_amp_list ad1981_loopbacks[] = { 1628static const struct hda_amp_list ad1981_loopbacks[] = {
1629 { 0x12, HDA_OUTPUT, 0 }, /* Front Mic */ 1629 { 0x12, HDA_OUTPUT, 0 }, /* Front Mic */
1630 { 0x13, HDA_OUTPUT, 0 }, /* Line */ 1630 { 0x13, HDA_OUTPUT, 0 }, /* Line */
1631 { 0x1b, HDA_OUTPUT, 0 }, /* Aux */ 1631 { 0x1b, HDA_OUTPUT, 0 }, /* Aux */
@@ -1645,7 +1645,7 @@ static struct hda_amp_list ad1981_loopbacks[] = {
1645#define AD1981_HP_EVENT 0x37 1645#define AD1981_HP_EVENT 0x37
1646#define AD1981_MIC_EVENT 0x38 1646#define AD1981_MIC_EVENT 0x38
1647 1647
1648static struct hda_verb ad1981_hp_init_verbs[] = { 1648static const struct hda_verb ad1981_hp_init_verbs[] = {
1649 {0x05, AC_VERB_SET_EAPD_BTLENABLE, 0x00 }, /* default off */ 1649 {0x05, AC_VERB_SET_EAPD_BTLENABLE, 0x00 }, /* default off */
1650 /* pin sensing on HP and Mic jacks */ 1650 /* pin sensing on HP and Mic jacks */
1651 {0x06, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1981_HP_EVENT}, 1651 {0x06, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1981_HP_EVENT},
@@ -1674,7 +1674,7 @@ static int ad1981_hp_master_sw_put(struct snd_kcontrol *kcontrol,
1674} 1674}
1675 1675
1676/* bind volumes of both NID 0x05 and 0x06 */ 1676/* bind volumes of both NID 0x05 and 0x06 */
1677static struct hda_bind_ctls ad1981_hp_bind_master_vol = { 1677static const struct hda_bind_ctls ad1981_hp_bind_master_vol = {
1678 .ops = &snd_hda_bind_vol, 1678 .ops = &snd_hda_bind_vol,
1679 .values = { 1679 .values = {
1680 HDA_COMPOSE_AMP_VAL(0x05, 3, 0, HDA_OUTPUT), 1680 HDA_COMPOSE_AMP_VAL(0x05, 3, 0, HDA_OUTPUT),
@@ -1696,12 +1696,12 @@ static void ad1981_hp_automute(struct hda_codec *codec)
1696/* toggle input of built-in and mic jack appropriately */ 1696/* toggle input of built-in and mic jack appropriately */
1697static void ad1981_hp_automic(struct hda_codec *codec) 1697static void ad1981_hp_automic(struct hda_codec *codec)
1698{ 1698{
1699 static struct hda_verb mic_jack_on[] = { 1699 static const struct hda_verb mic_jack_on[] = {
1700 {0x1f, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080}, 1700 {0x1f, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080},
1701 {0x1e, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, 1701 {0x1e, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
1702 {} 1702 {}
1703 }; 1703 };
1704 static struct hda_verb mic_jack_off[] = { 1704 static const struct hda_verb mic_jack_off[] = {
1705 {0x1e, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080}, 1705 {0x1e, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080},
1706 {0x1f, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, 1706 {0x1f, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
1707 {} 1707 {}
@@ -1730,7 +1730,7 @@ static void ad1981_hp_unsol_event(struct hda_codec *codec,
1730 } 1730 }
1731} 1731}
1732 1732
1733static struct hda_input_mux ad1981_hp_capture_source = { 1733static const struct hda_input_mux ad1981_hp_capture_source = {
1734 .num_items = 3, 1734 .num_items = 3,
1735 .items = { 1735 .items = {
1736 { "Mic", 0x0 }, 1736 { "Mic", 0x0 },
@@ -1739,7 +1739,7 @@ static struct hda_input_mux ad1981_hp_capture_source = {
1739 }, 1739 },
1740}; 1740};
1741 1741
1742static struct snd_kcontrol_new ad1981_hp_mixers[] = { 1742static const struct snd_kcontrol_new ad1981_hp_mixers[] = {
1743 HDA_BIND_VOL("Master Playback Volume", &ad1981_hp_bind_master_vol), 1743 HDA_BIND_VOL("Master Playback Volume", &ad1981_hp_bind_master_vol),
1744 { 1744 {
1745 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1745 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -1790,7 +1790,7 @@ static int ad1981_hp_init(struct hda_codec *codec)
1790} 1790}
1791 1791
1792/* configuration for Toshiba Laptops */ 1792/* configuration for Toshiba Laptops */
1793static struct hda_verb ad1981_toshiba_init_verbs[] = { 1793static const struct hda_verb ad1981_toshiba_init_verbs[] = {
1794 {0x05, AC_VERB_SET_EAPD_BTLENABLE, 0x01 }, /* default on */ 1794 {0x05, AC_VERB_SET_EAPD_BTLENABLE, 0x01 }, /* default on */
1795 /* pin sensing on HP and Mic jacks */ 1795 /* pin sensing on HP and Mic jacks */
1796 {0x06, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1981_HP_EVENT}, 1796 {0x06, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1981_HP_EVENT},
@@ -1798,14 +1798,14 @@ static struct hda_verb ad1981_toshiba_init_verbs[] = {
1798 {} 1798 {}
1799}; 1799};
1800 1800
1801static struct snd_kcontrol_new ad1981_toshiba_mixers[] = { 1801static const struct snd_kcontrol_new ad1981_toshiba_mixers[] = {
1802 HDA_CODEC_VOLUME("Amp Volume", 0x1a, 0x0, HDA_OUTPUT), 1802 HDA_CODEC_VOLUME("Amp Volume", 0x1a, 0x0, HDA_OUTPUT),
1803 HDA_CODEC_MUTE("Amp Switch", 0x1a, 0x0, HDA_OUTPUT), 1803 HDA_CODEC_MUTE("Amp Switch", 0x1a, 0x0, HDA_OUTPUT),
1804 { } 1804 { }
1805}; 1805};
1806 1806
1807/* configuration for Lenovo Thinkpad T60 */ 1807/* configuration for Lenovo Thinkpad T60 */
1808static struct snd_kcontrol_new ad1981_thinkpad_mixers[] = { 1808static const struct snd_kcontrol_new ad1981_thinkpad_mixers[] = {
1809 HDA_CODEC_VOLUME("Master Playback Volume", 0x05, 0x0, HDA_OUTPUT), 1809 HDA_CODEC_VOLUME("Master Playback Volume", 0x05, 0x0, HDA_OUTPUT),
1810 HDA_CODEC_MUTE("Master Playback Switch", 0x05, 0x0, HDA_OUTPUT), 1810 HDA_CODEC_MUTE("Master Playback Switch", 0x05, 0x0, HDA_OUTPUT),
1811 HDA_CODEC_VOLUME("PCM Playback Volume", 0x11, 0x0, HDA_OUTPUT), 1811 HDA_CODEC_VOLUME("PCM Playback Volume", 0x11, 0x0, HDA_OUTPUT),
@@ -1835,7 +1835,7 @@ static struct snd_kcontrol_new ad1981_thinkpad_mixers[] = {
1835 { } /* end */ 1835 { } /* end */
1836}; 1836};
1837 1837
1838static struct hda_input_mux ad1981_thinkpad_capture_source = { 1838static const struct hda_input_mux ad1981_thinkpad_capture_source = {
1839 .num_items = 3, 1839 .num_items = 3,
1840 .items = { 1840 .items = {
1841 { "Mic", 0x0 }, 1841 { "Mic", 0x0 },
@@ -1860,7 +1860,7 @@ static const char * const ad1981_models[AD1981_MODELS] = {
1860 [AD1981_TOSHIBA] = "toshiba" 1860 [AD1981_TOSHIBA] = "toshiba"
1861}; 1861};
1862 1862
1863static struct snd_pci_quirk ad1981_cfg_tbl[] = { 1863static const struct snd_pci_quirk ad1981_cfg_tbl[] = {
1864 SND_PCI_QUIRK(0x1014, 0x0597, "Lenovo Z60", AD1981_THINKPAD), 1864 SND_PCI_QUIRK(0x1014, 0x0597, "Lenovo Z60", AD1981_THINKPAD),
1865 SND_PCI_QUIRK(0x1014, 0x05b7, "Lenovo Z60m", AD1981_THINKPAD), 1865 SND_PCI_QUIRK(0x1014, 0x05b7, "Lenovo Z60m", AD1981_THINKPAD),
1866 /* All HP models */ 1866 /* All HP models */
@@ -2075,32 +2075,32 @@ enum {
2075 * mixers 2075 * mixers
2076 */ 2076 */
2077 2077
2078static hda_nid_t ad1988_6stack_dac_nids[4] = { 2078static const hda_nid_t ad1988_6stack_dac_nids[4] = {
2079 0x04, 0x06, 0x05, 0x0a 2079 0x04, 0x06, 0x05, 0x0a
2080}; 2080};
2081 2081
2082static hda_nid_t ad1988_3stack_dac_nids[3] = { 2082static const hda_nid_t ad1988_3stack_dac_nids[3] = {
2083 0x04, 0x05, 0x0a 2083 0x04, 0x05, 0x0a
2084}; 2084};
2085 2085
2086/* for AD1988A revision-2, DAC2-4 are swapped */ 2086/* for AD1988A revision-2, DAC2-4 are swapped */
2087static hda_nid_t ad1988_6stack_dac_nids_rev2[4] = { 2087static const hda_nid_t ad1988_6stack_dac_nids_rev2[4] = {
2088 0x04, 0x05, 0x0a, 0x06 2088 0x04, 0x05, 0x0a, 0x06
2089}; 2089};
2090 2090
2091static hda_nid_t ad1988_alt_dac_nid[1] = { 2091static const hda_nid_t ad1988_alt_dac_nid[1] = {
2092 0x03 2092 0x03
2093}; 2093};
2094 2094
2095static hda_nid_t ad1988_3stack_dac_nids_rev2[3] = { 2095static const hda_nid_t ad1988_3stack_dac_nids_rev2[3] = {
2096 0x04, 0x0a, 0x06 2096 0x04, 0x0a, 0x06
2097}; 2097};
2098 2098
2099static hda_nid_t ad1988_adc_nids[3] = { 2099static const hda_nid_t ad1988_adc_nids[3] = {
2100 0x08, 0x09, 0x0f 2100 0x08, 0x09, 0x0f
2101}; 2101};
2102 2102
2103static hda_nid_t ad1988_capsrc_nids[3] = { 2103static const hda_nid_t ad1988_capsrc_nids[3] = {
2104 0x0c, 0x0d, 0x0e 2104 0x0c, 0x0d, 0x0e
2105}; 2105};
2106 2106
@@ -2108,11 +2108,11 @@ static hda_nid_t ad1988_capsrc_nids[3] = {
2108#define AD1988_SPDIF_OUT_HDMI 0x0b 2108#define AD1988_SPDIF_OUT_HDMI 0x0b
2109#define AD1988_SPDIF_IN 0x07 2109#define AD1988_SPDIF_IN 0x07
2110 2110
2111static hda_nid_t ad1989b_slave_dig_outs[] = { 2111static const hda_nid_t ad1989b_slave_dig_outs[] = {
2112 AD1988_SPDIF_OUT, AD1988_SPDIF_OUT_HDMI, 0 2112 AD1988_SPDIF_OUT, AD1988_SPDIF_OUT_HDMI, 0
2113}; 2113};
2114 2114
2115static struct hda_input_mux ad1988_6stack_capture_source = { 2115static const struct hda_input_mux ad1988_6stack_capture_source = {
2116 .num_items = 5, 2116 .num_items = 5,
2117 .items = { 2117 .items = {
2118 { "Front Mic", 0x1 }, /* port-B */ 2118 { "Front Mic", 0x1 }, /* port-B */
@@ -2123,7 +2123,7 @@ static struct hda_input_mux ad1988_6stack_capture_source = {
2123 }, 2123 },
2124}; 2124};
2125 2125
2126static struct hda_input_mux ad1988_laptop_capture_source = { 2126static const struct hda_input_mux ad1988_laptop_capture_source = {
2127 .num_items = 3, 2127 .num_items = 3,
2128 .items = { 2128 .items = {
2129 { "Mic/Line", 0x1 }, /* port-B */ 2129 { "Mic/Line", 0x1 }, /* port-B */
@@ -2166,7 +2166,7 @@ static int ad198x_ch_mode_put(struct snd_kcontrol *kcontrol,
2166} 2166}
2167 2167
2168/* 6-stack mode */ 2168/* 6-stack mode */
2169static struct snd_kcontrol_new ad1988_6stack_mixers1[] = { 2169static const struct snd_kcontrol_new ad1988_6stack_mixers1[] = {
2170 HDA_CODEC_VOLUME("Front Playback Volume", 0x04, 0x0, HDA_OUTPUT), 2170 HDA_CODEC_VOLUME("Front Playback Volume", 0x04, 0x0, HDA_OUTPUT),
2171 HDA_CODEC_VOLUME("Surround Playback Volume", 0x06, 0x0, HDA_OUTPUT), 2171 HDA_CODEC_VOLUME("Surround Playback Volume", 0x06, 0x0, HDA_OUTPUT),
2172 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x05, 1, 0x0, HDA_OUTPUT), 2172 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x05, 1, 0x0, HDA_OUTPUT),
@@ -2175,7 +2175,7 @@ static struct snd_kcontrol_new ad1988_6stack_mixers1[] = {
2175 { } /* end */ 2175 { } /* end */
2176}; 2176};
2177 2177
2178static struct snd_kcontrol_new ad1988_6stack_mixers1_rev2[] = { 2178static const struct snd_kcontrol_new ad1988_6stack_mixers1_rev2[] = {
2179 HDA_CODEC_VOLUME("Front Playback Volume", 0x04, 0x0, HDA_OUTPUT), 2179 HDA_CODEC_VOLUME("Front Playback Volume", 0x04, 0x0, HDA_OUTPUT),
2180 HDA_CODEC_VOLUME("Surround Playback Volume", 0x05, 0x0, HDA_OUTPUT), 2180 HDA_CODEC_VOLUME("Surround Playback Volume", 0x05, 0x0, HDA_OUTPUT),
2181 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), 2181 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
@@ -2184,7 +2184,7 @@ static struct snd_kcontrol_new ad1988_6stack_mixers1_rev2[] = {
2184 { } /* end */ 2184 { } /* end */
2185}; 2185};
2186 2186
2187static struct snd_kcontrol_new ad1988_6stack_mixers2[] = { 2187static const struct snd_kcontrol_new ad1988_6stack_mixers2[] = {
2188 HDA_BIND_MUTE("Front Playback Switch", 0x29, 2, HDA_INPUT), 2188 HDA_BIND_MUTE("Front Playback Switch", 0x29, 2, HDA_INPUT),
2189 HDA_BIND_MUTE("Surround Playback Switch", 0x2a, 2, HDA_INPUT), 2189 HDA_BIND_MUTE("Surround Playback Switch", 0x2a, 2, HDA_INPUT),
2190 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x27, 1, 2, HDA_INPUT), 2190 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x27, 1, 2, HDA_INPUT),
@@ -2211,14 +2211,14 @@ static struct snd_kcontrol_new ad1988_6stack_mixers2[] = {
2211 { } /* end */ 2211 { } /* end */
2212}; 2212};
2213 2213
2214static struct snd_kcontrol_new ad1988_6stack_fp_mixers[] = { 2214static const struct snd_kcontrol_new ad1988_6stack_fp_mixers[] = {
2215 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), 2215 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
2216 2216
2217 { } /* end */ 2217 { } /* end */
2218}; 2218};
2219 2219
2220/* 3-stack mode */ 2220/* 3-stack mode */
2221static struct snd_kcontrol_new ad1988_3stack_mixers1[] = { 2221static const struct snd_kcontrol_new ad1988_3stack_mixers1[] = {
2222 HDA_CODEC_VOLUME("Front Playback Volume", 0x04, 0x0, HDA_OUTPUT), 2222 HDA_CODEC_VOLUME("Front Playback Volume", 0x04, 0x0, HDA_OUTPUT),
2223 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0a, 0x0, HDA_OUTPUT), 2223 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0a, 0x0, HDA_OUTPUT),
2224 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x05, 1, 0x0, HDA_OUTPUT), 2224 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x05, 1, 0x0, HDA_OUTPUT),
@@ -2226,7 +2226,7 @@ static struct snd_kcontrol_new ad1988_3stack_mixers1[] = {
2226 { } /* end */ 2226 { } /* end */
2227}; 2227};
2228 2228
2229static struct snd_kcontrol_new ad1988_3stack_mixers1_rev2[] = { 2229static const struct snd_kcontrol_new ad1988_3stack_mixers1_rev2[] = {
2230 HDA_CODEC_VOLUME("Front Playback Volume", 0x04, 0x0, HDA_OUTPUT), 2230 HDA_CODEC_VOLUME("Front Playback Volume", 0x04, 0x0, HDA_OUTPUT),
2231 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0a, 0x0, HDA_OUTPUT), 2231 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0a, 0x0, HDA_OUTPUT),
2232 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x06, 1, 0x0, HDA_OUTPUT), 2232 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x06, 1, 0x0, HDA_OUTPUT),
@@ -2234,7 +2234,7 @@ static struct snd_kcontrol_new ad1988_3stack_mixers1_rev2[] = {
2234 { } /* end */ 2234 { } /* end */
2235}; 2235};
2236 2236
2237static struct snd_kcontrol_new ad1988_3stack_mixers2[] = { 2237static const struct snd_kcontrol_new ad1988_3stack_mixers2[] = {
2238 HDA_BIND_MUTE("Front Playback Switch", 0x29, 2, HDA_INPUT), 2238 HDA_BIND_MUTE("Front Playback Switch", 0x29, 2, HDA_INPUT),
2239 HDA_BIND_MUTE("Surround Playback Switch", 0x2c, 2, HDA_INPUT), 2239 HDA_BIND_MUTE("Surround Playback Switch", 0x2c, 2, HDA_INPUT),
2240 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x26, 1, 2, HDA_INPUT), 2240 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x26, 1, 2, HDA_INPUT),
@@ -2268,7 +2268,7 @@ static struct snd_kcontrol_new ad1988_3stack_mixers2[] = {
2268}; 2268};
2269 2269
2270/* laptop mode */ 2270/* laptop mode */
2271static struct snd_kcontrol_new ad1988_laptop_mixers[] = { 2271static const struct snd_kcontrol_new ad1988_laptop_mixers[] = {
2272 HDA_CODEC_VOLUME("PCM Playback Volume", 0x04, 0x0, HDA_OUTPUT), 2272 HDA_CODEC_VOLUME("PCM Playback Volume", 0x04, 0x0, HDA_OUTPUT),
2273 HDA_CODEC_MUTE("PCM Playback Switch", 0x29, 0x0, HDA_INPUT), 2273 HDA_CODEC_MUTE("PCM Playback Switch", 0x29, 0x0, HDA_INPUT),
2274 HDA_BIND_MUTE("Mono Playback Switch", 0x1e, 2, HDA_INPUT), 2274 HDA_BIND_MUTE("Mono Playback Switch", 0x1e, 2, HDA_INPUT),
@@ -2299,7 +2299,7 @@ static struct snd_kcontrol_new ad1988_laptop_mixers[] = {
2299}; 2299};
2300 2300
2301/* capture */ 2301/* capture */
2302static struct snd_kcontrol_new ad1988_capture_mixers[] = { 2302static const struct snd_kcontrol_new ad1988_capture_mixers[] = {
2303 HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), 2303 HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT),
2304 HDA_CODEC_MUTE("Capture Switch", 0x0c, 0x0, HDA_OUTPUT), 2304 HDA_CODEC_MUTE("Capture Switch", 0x0c, 0x0, HDA_OUTPUT),
2305 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x0d, 0x0, HDA_OUTPUT), 2305 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x0d, 0x0, HDA_OUTPUT),
@@ -2324,7 +2324,7 @@ static struct snd_kcontrol_new ad1988_capture_mixers[] = {
2324static int ad1988_spdif_playback_source_info(struct snd_kcontrol *kcontrol, 2324static int ad1988_spdif_playback_source_info(struct snd_kcontrol *kcontrol,
2325 struct snd_ctl_elem_info *uinfo) 2325 struct snd_ctl_elem_info *uinfo)
2326{ 2326{
2327 static char *texts[] = { 2327 static const char * const texts[] = {
2328 "PCM", "ADC1", "ADC2", "ADC3" 2328 "PCM", "ADC1", "ADC2", "ADC3"
2329 }; 2329 };
2330 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 2330 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
@@ -2405,7 +2405,7 @@ static int ad1988_spdif_playback_source_put(struct snd_kcontrol *kcontrol,
2405 return change; 2405 return change;
2406} 2406}
2407 2407
2408static struct snd_kcontrol_new ad1988_spdif_out_mixers[] = { 2408static const struct snd_kcontrol_new ad1988_spdif_out_mixers[] = {
2409 HDA_CODEC_VOLUME("IEC958 Playback Volume", 0x1b, 0x0, HDA_OUTPUT), 2409 HDA_CODEC_VOLUME("IEC958 Playback Volume", 0x1b, 0x0, HDA_OUTPUT),
2410 { 2410 {
2411 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2411 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -2418,12 +2418,12 @@ static struct snd_kcontrol_new ad1988_spdif_out_mixers[] = {
2418 { } /* end */ 2418 { } /* end */
2419}; 2419};
2420 2420
2421static struct snd_kcontrol_new ad1988_spdif_in_mixers[] = { 2421static const struct snd_kcontrol_new ad1988_spdif_in_mixers[] = {
2422 HDA_CODEC_VOLUME("IEC958 Capture Volume", 0x1c, 0x0, HDA_INPUT), 2422 HDA_CODEC_VOLUME("IEC958 Capture Volume", 0x1c, 0x0, HDA_INPUT),
2423 { } /* end */ 2423 { } /* end */
2424}; 2424};
2425 2425
2426static struct snd_kcontrol_new ad1989_spdif_out_mixers[] = { 2426static const struct snd_kcontrol_new ad1989_spdif_out_mixers[] = {
2427 HDA_CODEC_VOLUME("IEC958 Playback Volume", 0x1b, 0x0, HDA_OUTPUT), 2427 HDA_CODEC_VOLUME("IEC958 Playback Volume", 0x1b, 0x0, HDA_OUTPUT),
2428 HDA_CODEC_VOLUME("HDMI Playback Volume", 0x1d, 0x0, HDA_OUTPUT), 2428 HDA_CODEC_VOLUME("HDMI Playback Volume", 0x1d, 0x0, HDA_OUTPUT),
2429 { } /* end */ 2429 { } /* end */
@@ -2436,7 +2436,7 @@ static struct snd_kcontrol_new ad1989_spdif_out_mixers[] = {
2436/* 2436/*
2437 * for 6-stack (+dig) 2437 * for 6-stack (+dig)
2438 */ 2438 */
2439static struct hda_verb ad1988_6stack_init_verbs[] = { 2439static const struct hda_verb ad1988_6stack_init_verbs[] = {
2440 /* Front, Surround, CLFE, side DAC; unmute as default */ 2440 /* Front, Surround, CLFE, side DAC; unmute as default */
2441 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 2441 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2442 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 2442 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
@@ -2496,7 +2496,7 @@ static struct hda_verb ad1988_6stack_init_verbs[] = {
2496 { } 2496 { }
2497}; 2497};
2498 2498
2499static struct hda_verb ad1988_6stack_fp_init_verbs[] = { 2499static const struct hda_verb ad1988_6stack_fp_init_verbs[] = {
2500 /* Headphone; unmute as default */ 2500 /* Headphone; unmute as default */
2501 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 2501 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2502 /* Port-A front headphon path */ 2502 /* Port-A front headphon path */
@@ -2509,7 +2509,7 @@ static struct hda_verb ad1988_6stack_fp_init_verbs[] = {
2509 { } 2509 { }
2510}; 2510};
2511 2511
2512static struct hda_verb ad1988_capture_init_verbs[] = { 2512static const struct hda_verb ad1988_capture_init_verbs[] = {
2513 /* mute analog mix */ 2513 /* mute analog mix */
2514 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 2514 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2515 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 2515 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
@@ -2527,7 +2527,7 @@ static struct hda_verb ad1988_capture_init_verbs[] = {
2527 { } 2527 { }
2528}; 2528};
2529 2529
2530static struct hda_verb ad1988_spdif_init_verbs[] = { 2530static const struct hda_verb ad1988_spdif_init_verbs[] = {
2531 /* SPDIF out sel */ 2531 /* SPDIF out sel */
2532 {0x02, AC_VERB_SET_CONNECT_SEL, 0x0}, /* PCM */ 2532 {0x02, AC_VERB_SET_CONNECT_SEL, 0x0}, /* PCM */
2533 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x0}, /* ADC1 */ 2533 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x0}, /* ADC1 */
@@ -2539,14 +2539,14 @@ static struct hda_verb ad1988_spdif_init_verbs[] = {
2539 { } 2539 { }
2540}; 2540};
2541 2541
2542static struct hda_verb ad1988_spdif_in_init_verbs[] = { 2542static const struct hda_verb ad1988_spdif_in_init_verbs[] = {
2543 /* unmute SPDIF input pin */ 2543 /* unmute SPDIF input pin */
2544 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 2544 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2545 { } 2545 { }
2546}; 2546};
2547 2547
2548/* AD1989 has no ADC -> SPDIF route */ 2548/* AD1989 has no ADC -> SPDIF route */
2549static struct hda_verb ad1989_spdif_init_verbs[] = { 2549static const struct hda_verb ad1989_spdif_init_verbs[] = {
2550 /* SPDIF-1 out pin */ 2550 /* SPDIF-1 out pin */
2551 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 2551 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2552 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x27}, /* 0dB */ 2552 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x27}, /* 0dB */
@@ -2559,7 +2559,7 @@ static struct hda_verb ad1989_spdif_init_verbs[] = {
2559/* 2559/*
2560 * verbs for 3stack (+dig) 2560 * verbs for 3stack (+dig)
2561 */ 2561 */
2562static struct hda_verb ad1988_3stack_ch2_init[] = { 2562static const struct hda_verb ad1988_3stack_ch2_init[] = {
2563 /* set port-C to line-in */ 2563 /* set port-C to line-in */
2564 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, 2564 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2565 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, 2565 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
@@ -2569,7 +2569,7 @@ static struct hda_verb ad1988_3stack_ch2_init[] = {
2569 { } /* end */ 2569 { } /* end */
2570}; 2570};
2571 2571
2572static struct hda_verb ad1988_3stack_ch6_init[] = { 2572static const struct hda_verb ad1988_3stack_ch6_init[] = {
2573 /* set port-C to surround out */ 2573 /* set port-C to surround out */
2574 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 2574 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2575 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, 2575 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
@@ -2579,12 +2579,12 @@ static struct hda_verb ad1988_3stack_ch6_init[] = {
2579 { } /* end */ 2579 { } /* end */
2580}; 2580};
2581 2581
2582static struct hda_channel_mode ad1988_3stack_modes[2] = { 2582static const struct hda_channel_mode ad1988_3stack_modes[2] = {
2583 { 2, ad1988_3stack_ch2_init }, 2583 { 2, ad1988_3stack_ch2_init },
2584 { 6, ad1988_3stack_ch6_init }, 2584 { 6, ad1988_3stack_ch6_init },
2585}; 2585};
2586 2586
2587static struct hda_verb ad1988_3stack_init_verbs[] = { 2587static const struct hda_verb ad1988_3stack_init_verbs[] = {
2588 /* Front, Surround, CLFE, side DAC; unmute as default */ 2588 /* Front, Surround, CLFE, side DAC; unmute as default */
2589 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 2589 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2590 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 2590 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
@@ -2644,13 +2644,13 @@ static struct hda_verb ad1988_3stack_init_verbs[] = {
2644/* 2644/*
2645 * verbs for laptop mode (+dig) 2645 * verbs for laptop mode (+dig)
2646 */ 2646 */
2647static struct hda_verb ad1988_laptop_hp_on[] = { 2647static const struct hda_verb ad1988_laptop_hp_on[] = {
2648 /* unmute port-A and mute port-D */ 2648 /* unmute port-A and mute port-D */
2649 { 0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, 2649 { 0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2650 { 0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, 2650 { 0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2651 { } /* end */ 2651 { } /* end */
2652}; 2652};
2653static struct hda_verb ad1988_laptop_hp_off[] = { 2653static const struct hda_verb ad1988_laptop_hp_off[] = {
2654 /* mute port-A and unmute port-D */ 2654 /* mute port-A and unmute port-D */
2655 { 0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, 2655 { 0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2656 { 0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, 2656 { 0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
@@ -2659,7 +2659,7 @@ static struct hda_verb ad1988_laptop_hp_off[] = {
2659 2659
2660#define AD1988_HP_EVENT 0x01 2660#define AD1988_HP_EVENT 0x01
2661 2661
2662static struct hda_verb ad1988_laptop_init_verbs[] = { 2662static const struct hda_verb ad1988_laptop_init_verbs[] = {
2663 /* Front, Surround, CLFE, side DAC; unmute as default */ 2663 /* Front, Surround, CLFE, side DAC; unmute as default */
2664 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 2664 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2665 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 2665 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
@@ -2723,7 +2723,7 @@ static void ad1988_laptop_unsol_event(struct hda_codec *codec, unsigned int res)
2723} 2723}
2724 2724
2725#ifdef CONFIG_SND_HDA_POWER_SAVE 2725#ifdef CONFIG_SND_HDA_POWER_SAVE
2726static struct hda_amp_list ad1988_loopbacks[] = { 2726static const struct hda_amp_list ad1988_loopbacks[] = {
2727 { 0x20, HDA_INPUT, 0 }, /* Front Mic */ 2727 { 0x20, HDA_INPUT, 0 }, /* Front Mic */
2728 { 0x20, HDA_INPUT, 1 }, /* Line */ 2728 { 0x20, HDA_INPUT, 1 }, /* Line */
2729 { 0x20, HDA_INPUT, 4 }, /* Mic */ 2729 { 0x20, HDA_INPUT, 4 }, /* Mic */
@@ -2741,7 +2741,7 @@ enum {
2741 AD_CTL_WIDGET_MUTE, 2741 AD_CTL_WIDGET_MUTE,
2742 AD_CTL_BIND_MUTE, 2742 AD_CTL_BIND_MUTE,
2743}; 2743};
2744static struct snd_kcontrol_new ad1988_control_templates[] = { 2744static const struct snd_kcontrol_new ad1988_control_templates[] = {
2745 HDA_CODEC_VOLUME(NULL, 0, 0, 0), 2745 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
2746 HDA_CODEC_MUTE(NULL, 0, 0, 0), 2746 HDA_CODEC_MUTE(NULL, 0, 0, 0),
2747 HDA_BIND_MUTE(NULL, 0, 0, 0), 2747 HDA_BIND_MUTE(NULL, 0, 0, 0),
@@ -2770,18 +2770,18 @@ static int add_control(struct ad198x_spec *spec, int type, const char *name,
2770#define AD1988_PIN_CD_NID 0x18 2770#define AD1988_PIN_CD_NID 0x18
2771#define AD1988_PIN_BEEP_NID 0x10 2771#define AD1988_PIN_BEEP_NID 0x10
2772 2772
2773static hda_nid_t ad1988_mixer_nids[8] = { 2773static const hda_nid_t ad1988_mixer_nids[8] = {
2774 /* A B C D E F G H */ 2774 /* A B C D E F G H */
2775 0x22, 0x2b, 0x2c, 0x29, 0x26, 0x2a, 0x27, 0x28 2775 0x22, 0x2b, 0x2c, 0x29, 0x26, 0x2a, 0x27, 0x28
2776}; 2776};
2777 2777
2778static inline hda_nid_t ad1988_idx_to_dac(struct hda_codec *codec, int idx) 2778static inline hda_nid_t ad1988_idx_to_dac(struct hda_codec *codec, int idx)
2779{ 2779{
2780 static hda_nid_t idx_to_dac[8] = { 2780 static const hda_nid_t idx_to_dac[8] = {
2781 /* A B C D E F G H */ 2781 /* A B C D E F G H */
2782 0x04, 0x06, 0x05, 0x04, 0x0a, 0x06, 0x05, 0x0a 2782 0x04, 0x06, 0x05, 0x04, 0x0a, 0x06, 0x05, 0x0a
2783 }; 2783 };
2784 static hda_nid_t idx_to_dac_rev2[8] = { 2784 static const hda_nid_t idx_to_dac_rev2[8] = {
2785 /* A B C D E F G H */ 2785 /* A B C D E F G H */
2786 0x04, 0x05, 0x0a, 0x04, 0x06, 0x05, 0x0a, 0x06 2786 0x04, 0x05, 0x0a, 0x04, 0x06, 0x05, 0x0a, 0x06
2787 }; 2787 };
@@ -2791,13 +2791,13 @@ static inline hda_nid_t ad1988_idx_to_dac(struct hda_codec *codec, int idx)
2791 return idx_to_dac[idx]; 2791 return idx_to_dac[idx];
2792} 2792}
2793 2793
2794static hda_nid_t ad1988_boost_nids[8] = { 2794static const hda_nid_t ad1988_boost_nids[8] = {
2795 0x38, 0x39, 0x3a, 0x3d, 0x3c, 0x3b, 0, 0 2795 0x38, 0x39, 0x3a, 0x3d, 0x3c, 0x3b, 0, 0
2796}; 2796};
2797 2797
2798static int ad1988_pin_idx(hda_nid_t nid) 2798static int ad1988_pin_idx(hda_nid_t nid)
2799{ 2799{
2800 static hda_nid_t ad1988_io_pins[8] = { 2800 static const hda_nid_t ad1988_io_pins[8] = {
2801 0x11, 0x14, 0x15, 0x12, 0x17, 0x16, 0x24, 0x25 2801 0x11, 0x14, 0x15, 0x12, 0x17, 0x16, 0x24, 0x25
2802 }; 2802 };
2803 int i; 2803 int i;
@@ -2809,7 +2809,7 @@ static int ad1988_pin_idx(hda_nid_t nid)
2809 2809
2810static int ad1988_pin_to_loopback_idx(hda_nid_t nid) 2810static int ad1988_pin_to_loopback_idx(hda_nid_t nid)
2811{ 2811{
2812 static int loopback_idx[8] = { 2812 static const int loopback_idx[8] = {
2813 2, 0, 1, 3, 4, 5, 1, 4 2813 2, 0, 1, 3, 4, 5, 1, 4
2814 }; 2814 };
2815 switch (nid) { 2815 switch (nid) {
@@ -2822,7 +2822,7 @@ static int ad1988_pin_to_loopback_idx(hda_nid_t nid)
2822 2822
2823static int ad1988_pin_to_adc_idx(hda_nid_t nid) 2823static int ad1988_pin_to_adc_idx(hda_nid_t nid)
2824{ 2824{
2825 static int adc_idx[8] = { 2825 static const int adc_idx[8] = {
2826 0, 1, 2, 8, 4, 3, 6, 7 2826 0, 1, 2, 8, 4, 3, 6, 7
2827 }; 2827 };
2828 switch (nid) { 2828 switch (nid) {
@@ -2845,7 +2845,7 @@ static int ad1988_auto_fill_dac_nids(struct hda_codec *codec,
2845 /* check the pins hardwired to audio widget */ 2845 /* check the pins hardwired to audio widget */
2846 for (i = 0; i < cfg->line_outs; i++) { 2846 for (i = 0; i < cfg->line_outs; i++) {
2847 idx = ad1988_pin_idx(cfg->line_out_pins[i]); 2847 idx = ad1988_pin_idx(cfg->line_out_pins[i]);
2848 spec->multiout.dac_nids[i] = ad1988_idx_to_dac(codec, idx); 2848 spec->private_dac_nids[i] = ad1988_idx_to_dac(codec, idx);
2849 } 2849 }
2850 spec->multiout.num_dacs = cfg->line_outs; 2850 spec->multiout.num_dacs = cfg->line_outs;
2851 return 0; 2851 return 0;
@@ -3070,6 +3070,7 @@ static void ad1988_auto_init_analog_input(struct hda_codec *codec)
3070 3070
3071 for (i = 0; i < cfg->num_inputs; i++) { 3071 for (i = 0; i < cfg->num_inputs; i++) {
3072 hda_nid_t nid = cfg->inputs[i].pin; 3072 hda_nid_t nid = cfg->inputs[i].pin;
3073 int type = cfg->inputs[i].type;
3073 switch (nid) { 3074 switch (nid) {
3074 case 0x15: /* port-C */ 3075 case 0x15: /* port-C */
3075 snd_hda_codec_write(codec, 0x33, 0, AC_VERB_SET_CONNECT_SEL, 0x0); 3076 snd_hda_codec_write(codec, 0x33, 0, AC_VERB_SET_CONNECT_SEL, 0x0);
@@ -3079,7 +3080,7 @@ static void ad1988_auto_init_analog_input(struct hda_codec *codec)
3079 break; 3080 break;
3080 } 3081 }
3081 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 3082 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3082 i == AUTO_PIN_MIC ? PIN_VREF80 : PIN_IN); 3083 type == AUTO_PIN_MIC ? PIN_VREF80 : PIN_IN);
3083 if (nid != AD1988_PIN_CD_NID) 3084 if (nid != AD1988_PIN_CD_NID)
3084 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, 3085 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
3085 AMP_OUT_MUTE); 3086 AMP_OUT_MUTE);
@@ -3154,7 +3155,7 @@ static const char * const ad1988_models[AD1988_MODEL_LAST] = {
3154 [AD1988_AUTO] = "auto", 3155 [AD1988_AUTO] = "auto",
3155}; 3156};
3156 3157
3157static struct snd_pci_quirk ad1988_cfg_tbl[] = { 3158static const struct snd_pci_quirk ad1988_cfg_tbl[] = {
3158 SND_PCI_QUIRK(0x1043, 0x81ec, "Asus P5B-DLX", AD1988_6STACK_DIG), 3159 SND_PCI_QUIRK(0x1043, 0x81ec, "Asus P5B-DLX", AD1988_6STACK_DIG),
3159 SND_PCI_QUIRK(0x1043, 0x81f6, "Asus M2N-SLI", AD1988_6STACK_DIG), 3160 SND_PCI_QUIRK(0x1043, 0x81f6, "Asus M2N-SLI", AD1988_6STACK_DIG),
3160 SND_PCI_QUIRK(0x1043, 0x8277, "Asus P5K-E/WIFI-AP", AD1988_6STACK_DIG), 3161 SND_PCI_QUIRK(0x1043, 0x8277, "Asus P5K-E/WIFI-AP", AD1988_6STACK_DIG),
@@ -3342,21 +3343,21 @@ static int patch_ad1988(struct hda_codec *codec)
3342 * but no build-up framework is given, so far. 3343 * but no build-up framework is given, so far.
3343 */ 3344 */
3344 3345
3345static hda_nid_t ad1884_dac_nids[1] = { 3346static const hda_nid_t ad1884_dac_nids[1] = {
3346 0x04, 3347 0x04,
3347}; 3348};
3348 3349
3349static hda_nid_t ad1884_adc_nids[2] = { 3350static const hda_nid_t ad1884_adc_nids[2] = {
3350 0x08, 0x09, 3351 0x08, 0x09,
3351}; 3352};
3352 3353
3353static hda_nid_t ad1884_capsrc_nids[2] = { 3354static const hda_nid_t ad1884_capsrc_nids[2] = {
3354 0x0c, 0x0d, 3355 0x0c, 0x0d,
3355}; 3356};
3356 3357
3357#define AD1884_SPDIF_OUT 0x02 3358#define AD1884_SPDIF_OUT 0x02
3358 3359
3359static struct hda_input_mux ad1884_capture_source = { 3360static const struct hda_input_mux ad1884_capture_source = {
3360 .num_items = 4, 3361 .num_items = 4,
3361 .items = { 3362 .items = {
3362 { "Front Mic", 0x0 }, 3363 { "Front Mic", 0x0 },
@@ -3366,7 +3367,7 @@ static struct hda_input_mux ad1884_capture_source = {
3366 }, 3367 },
3367}; 3368};
3368 3369
3369static struct snd_kcontrol_new ad1884_base_mixers[] = { 3370static const struct snd_kcontrol_new ad1884_base_mixers[] = {
3370 HDA_CODEC_VOLUME("PCM Playback Volume", 0x04, 0x0, HDA_OUTPUT), 3371 HDA_CODEC_VOLUME("PCM Playback Volume", 0x04, 0x0, HDA_OUTPUT),
3371 /* HDA_CODEC_VOLUME_IDX("PCM Playback Volume", 1, 0x03, 0x0, HDA_OUTPUT), */ 3372 /* HDA_CODEC_VOLUME_IDX("PCM Playback Volume", 1, 0x03, 0x0, HDA_OUTPUT), */
3372 HDA_CODEC_MUTE("Headphone Playback Switch", 0x11, 0x0, HDA_OUTPUT), 3373 HDA_CODEC_MUTE("Headphone Playback Switch", 0x11, 0x0, HDA_OUTPUT),
@@ -3410,7 +3411,7 @@ static struct snd_kcontrol_new ad1884_base_mixers[] = {
3410 { } /* end */ 3411 { } /* end */
3411}; 3412};
3412 3413
3413static struct snd_kcontrol_new ad1984_dmic_mixers[] = { 3414static const struct snd_kcontrol_new ad1984_dmic_mixers[] = {
3414 HDA_CODEC_VOLUME("Digital Mic Capture Volume", 0x05, 0x0, HDA_INPUT), 3415 HDA_CODEC_VOLUME("Digital Mic Capture Volume", 0x05, 0x0, HDA_INPUT),
3415 HDA_CODEC_MUTE("Digital Mic Capture Switch", 0x05, 0x0, HDA_INPUT), 3416 HDA_CODEC_MUTE("Digital Mic Capture Switch", 0x05, 0x0, HDA_INPUT),
3416 HDA_CODEC_VOLUME_IDX("Digital Mic Capture Volume", 1, 0x06, 0x0, 3417 HDA_CODEC_VOLUME_IDX("Digital Mic Capture Volume", 1, 0x06, 0x0,
@@ -3423,7 +3424,7 @@ static struct snd_kcontrol_new ad1984_dmic_mixers[] = {
3423/* 3424/*
3424 * initialization verbs 3425 * initialization verbs
3425 */ 3426 */
3426static struct hda_verb ad1884_init_verbs[] = { 3427static const struct hda_verb ad1884_init_verbs[] = {
3427 /* DACs; mute as default */ 3428 /* DACs; mute as default */
3428 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 3429 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3429 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 3430 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
@@ -3469,7 +3470,7 @@ static struct hda_verb ad1884_init_verbs[] = {
3469}; 3470};
3470 3471
3471#ifdef CONFIG_SND_HDA_POWER_SAVE 3472#ifdef CONFIG_SND_HDA_POWER_SAVE
3472static struct hda_amp_list ad1884_loopbacks[] = { 3473static const struct hda_amp_list ad1884_loopbacks[] = {
3473 { 0x20, HDA_INPUT, 0 }, /* Front Mic */ 3474 { 0x20, HDA_INPUT, 0 }, /* Front Mic */
3474 { 0x20, HDA_INPUT, 1 }, /* Mic */ 3475 { 0x20, HDA_INPUT, 1 }, /* Mic */
3475 { 0x20, HDA_INPUT, 2 }, /* CD */ 3476 { 0x20, HDA_INPUT, 2 }, /* CD */
@@ -3541,7 +3542,7 @@ static int patch_ad1884(struct hda_codec *codec)
3541/* 3542/*
3542 * Lenovo Thinkpad T61/X61 3543 * Lenovo Thinkpad T61/X61
3543 */ 3544 */
3544static struct hda_input_mux ad1984_thinkpad_capture_source = { 3545static const struct hda_input_mux ad1984_thinkpad_capture_source = {
3545 .num_items = 4, 3546 .num_items = 4,
3546 .items = { 3547 .items = {
3547 { "Mic", 0x0 }, 3548 { "Mic", 0x0 },
@@ -3555,7 +3556,7 @@ static struct hda_input_mux ad1984_thinkpad_capture_source = {
3555/* 3556/*
3556 * Dell Precision T3400 3557 * Dell Precision T3400
3557 */ 3558 */
3558static struct hda_input_mux ad1984_dell_desktop_capture_source = { 3559static const struct hda_input_mux ad1984_dell_desktop_capture_source = {
3559 .num_items = 3, 3560 .num_items = 3,
3560 .items = { 3561 .items = {
3561 { "Front Mic", 0x0 }, 3562 { "Front Mic", 0x0 },
@@ -3565,7 +3566,7 @@ static struct hda_input_mux ad1984_dell_desktop_capture_source = {
3565}; 3566};
3566 3567
3567 3568
3568static struct snd_kcontrol_new ad1984_thinkpad_mixers[] = { 3569static const struct snd_kcontrol_new ad1984_thinkpad_mixers[] = {
3569 HDA_CODEC_VOLUME("PCM Playback Volume", 0x04, 0x0, HDA_OUTPUT), 3570 HDA_CODEC_VOLUME("PCM Playback Volume", 0x04, 0x0, HDA_OUTPUT),
3570 /* HDA_CODEC_VOLUME_IDX("PCM Playback Volume", 1, 0x03, 0x0, HDA_OUTPUT), */ 3571 /* HDA_CODEC_VOLUME_IDX("PCM Playback Volume", 1, 0x03, 0x0, HDA_OUTPUT), */
3571 HDA_CODEC_MUTE("Headphone Playback Switch", 0x11, 0x0, HDA_OUTPUT), 3572 HDA_CODEC_MUTE("Headphone Playback Switch", 0x11, 0x0, HDA_OUTPUT),
@@ -3611,7 +3612,7 @@ static struct snd_kcontrol_new ad1984_thinkpad_mixers[] = {
3611}; 3612};
3612 3613
3613/* additional verbs */ 3614/* additional verbs */
3614static struct hda_verb ad1984_thinkpad_init_verbs[] = { 3615static const struct hda_verb ad1984_thinkpad_init_verbs[] = {
3615 /* Port-E (docking station mic) pin */ 3616 /* Port-E (docking station mic) pin */
3616 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 3617 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3617 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 3618 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
@@ -3629,7 +3630,7 @@ static struct hda_verb ad1984_thinkpad_init_verbs[] = {
3629/* 3630/*
3630 * Dell Precision T3400 3631 * Dell Precision T3400
3631 */ 3632 */
3632static struct snd_kcontrol_new ad1984_dell_desktop_mixers[] = { 3633static const struct snd_kcontrol_new ad1984_dell_desktop_mixers[] = {
3633 HDA_CODEC_VOLUME("PCM Playback Volume", 0x04, 0x0, HDA_OUTPUT), 3634 HDA_CODEC_VOLUME("PCM Playback Volume", 0x04, 0x0, HDA_OUTPUT),
3634 HDA_CODEC_MUTE("Headphone Playback Switch", 0x11, 0x0, HDA_OUTPUT), 3635 HDA_CODEC_MUTE("Headphone Playback Switch", 0x11, 0x0, HDA_OUTPUT),
3635 HDA_CODEC_MUTE("Speaker Playback Switch", 0x12, 0x0, HDA_OUTPUT), 3636 HDA_CODEC_MUTE("Speaker Playback Switch", 0x12, 0x0, HDA_OUTPUT),
@@ -3680,7 +3681,7 @@ static int ad1984_pcm_dmic_cleanup(struct hda_pcm_stream *hinfo,
3680 return 0; 3681 return 0;
3681} 3682}
3682 3683
3683static struct hda_pcm_stream ad1984_pcm_dmic_capture = { 3684static const struct hda_pcm_stream ad1984_pcm_dmic_capture = {
3684 .substreams = 2, 3685 .substreams = 2,
3685 .channels_min = 2, 3686 .channels_min = 2,
3686 .channels_max = 2, 3687 .channels_max = 2,
@@ -3722,7 +3723,7 @@ static const char * const ad1984_models[AD1984_MODELS] = {
3722 [AD1984_DELL_DESKTOP] = "dell_desktop", 3723 [AD1984_DELL_DESKTOP] = "dell_desktop",
3723}; 3724};
3724 3725
3725static struct snd_pci_quirk ad1984_cfg_tbl[] = { 3726static const struct snd_pci_quirk ad1984_cfg_tbl[] = {
3726 /* Lenovo Thinkpad T61/X61 */ 3727 /* Lenovo Thinkpad T61/X61 */
3727 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo Thinkpad", AD1984_THINKPAD), 3728 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo Thinkpad", AD1984_THINKPAD),
3728 SND_PCI_QUIRK(0x1028, 0x0214, "Dell T3400", AD1984_DELL_DESKTOP), 3729 SND_PCI_QUIRK(0x1028, 0x0214, "Dell T3400", AD1984_DELL_DESKTOP),
@@ -3787,7 +3788,7 @@ static int patch_ad1984(struct hda_codec *codec)
3787 * We share the single DAC for both HP and line-outs (see AD1884/1984). 3788 * We share the single DAC for both HP and line-outs (see AD1884/1984).
3788 */ 3789 */
3789 3790
3790static hda_nid_t ad1884a_dac_nids[1] = { 3791static const hda_nid_t ad1884a_dac_nids[1] = {
3791 0x03, 3792 0x03,
3792}; 3793};
3793 3794
@@ -3796,7 +3797,7 @@ static hda_nid_t ad1884a_dac_nids[1] = {
3796 3797
3797#define AD1884A_SPDIF_OUT 0x02 3798#define AD1884A_SPDIF_OUT 0x02
3798 3799
3799static struct hda_input_mux ad1884a_capture_source = { 3800static const struct hda_input_mux ad1884a_capture_source = {
3800 .num_items = 5, 3801 .num_items = 5,
3801 .items = { 3802 .items = {
3802 { "Front Mic", 0x0 }, 3803 { "Front Mic", 0x0 },
@@ -3807,7 +3808,7 @@ static struct hda_input_mux ad1884a_capture_source = {
3807 }, 3808 },
3808}; 3809};
3809 3810
3810static struct snd_kcontrol_new ad1884a_base_mixers[] = { 3811static const struct snd_kcontrol_new ad1884a_base_mixers[] = {
3811 HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT), 3812 HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT),
3812 HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT), 3813 HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT),
3813 HDA_CODEC_MUTE("Headphone Playback Switch", 0x11, 0x0, HDA_OUTPUT), 3814 HDA_CODEC_MUTE("Headphone Playback Switch", 0x11, 0x0, HDA_OUTPUT),
@@ -3859,7 +3860,7 @@ static struct snd_kcontrol_new ad1884a_base_mixers[] = {
3859/* 3860/*
3860 * initialization verbs 3861 * initialization verbs
3861 */ 3862 */
3862static struct hda_verb ad1884a_init_verbs[] = { 3863static const struct hda_verb ad1884a_init_verbs[] = {
3863 /* DACs; unmute as default */ 3864 /* DACs; unmute as default */
3864 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */ 3865 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */
3865 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */ 3866 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */
@@ -3914,7 +3915,7 @@ static struct hda_verb ad1884a_init_verbs[] = {
3914}; 3915};
3915 3916
3916#ifdef CONFIG_SND_HDA_POWER_SAVE 3917#ifdef CONFIG_SND_HDA_POWER_SAVE
3917static struct hda_amp_list ad1884a_loopbacks[] = { 3918static const struct hda_amp_list ad1884a_loopbacks[] = {
3918 { 0x20, HDA_INPUT, 0 }, /* Front Mic */ 3919 { 0x20, HDA_INPUT, 0 }, /* Front Mic */
3919 { 0x20, HDA_INPUT, 1 }, /* Mic */ 3920 { 0x20, HDA_INPUT, 1 }, /* Mic */
3920 { 0x20, HDA_INPUT, 2 }, /* CD */ 3921 { 0x20, HDA_INPUT, 2 }, /* CD */
@@ -3947,7 +3948,7 @@ static int ad1884a_mobile_master_sw_put(struct snd_kcontrol *kcontrol,
3947 return ret; 3948 return ret;
3948} 3949}
3949 3950
3950static struct snd_kcontrol_new ad1884a_laptop_mixers[] = { 3951static const struct snd_kcontrol_new ad1884a_laptop_mixers[] = {
3951 HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT), 3952 HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT),
3952 { 3953 {
3953 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 3954 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -3975,7 +3976,7 @@ static struct snd_kcontrol_new ad1884a_laptop_mixers[] = {
3975 { } /* end */ 3976 { } /* end */
3976}; 3977};
3977 3978
3978static struct snd_kcontrol_new ad1884a_mobile_mixers[] = { 3979static const struct snd_kcontrol_new ad1884a_mobile_mixers[] = {
3979 HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT), 3980 HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT),
3980 /*HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT),*/ 3981 /*HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT),*/
3981 { 3982 {
@@ -4095,7 +4096,7 @@ static int ad1884a_laptop_init(struct hda_codec *codec)
4095} 4096}
4096 4097
4097/* additional verbs for laptop model */ 4098/* additional verbs for laptop model */
4098static struct hda_verb ad1884a_laptop_verbs[] = { 4099static const struct hda_verb ad1884a_laptop_verbs[] = {
4099 /* Port-A (HP) pin - always unmuted */ 4100 /* Port-A (HP) pin - always unmuted */
4100 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 4101 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4101 /* Port-F (int speaker) mixer - route only from analog mixer */ 4102 /* Port-F (int speaker) mixer - route only from analog mixer */
@@ -4126,7 +4127,7 @@ static struct hda_verb ad1884a_laptop_verbs[] = {
4126 { } /* end */ 4127 { } /* end */
4127}; 4128};
4128 4129
4129static struct hda_verb ad1884a_mobile_verbs[] = { 4130static const struct hda_verb ad1884a_mobile_verbs[] = {
4130 /* DACs; unmute as default */ 4131 /* DACs; unmute as default */
4131 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */ 4132 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */
4132 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */ 4133 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */
@@ -4181,7 +4182,7 @@ static struct hda_verb ad1884a_mobile_verbs[] = {
4181 * 0x17 - built-in mic 4182 * 0x17 - built-in mic
4182 */ 4183 */
4183 4184
4184static struct hda_verb ad1984a_thinkpad_verbs[] = { 4185static const struct hda_verb ad1984a_thinkpad_verbs[] = {
4185 /* HP unmute */ 4186 /* HP unmute */
4186 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 4187 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4187 /* analog mix */ 4188 /* analog mix */
@@ -4198,7 +4199,7 @@ static struct hda_verb ad1984a_thinkpad_verbs[] = {
4198 { } /* end */ 4199 { } /* end */
4199}; 4200};
4200 4201
4201static struct snd_kcontrol_new ad1984a_thinkpad_mixers[] = { 4202static const struct snd_kcontrol_new ad1984a_thinkpad_mixers[] = {
4202 HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT), 4203 HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT),
4203 HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT), 4204 HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT),
4204 HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT), 4205 HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT),
@@ -4219,7 +4220,7 @@ static struct snd_kcontrol_new ad1984a_thinkpad_mixers[] = {
4219 { } /* end */ 4220 { } /* end */
4220}; 4221};
4221 4222
4222static struct hda_input_mux ad1984a_thinkpad_capture_source = { 4223static const struct hda_input_mux ad1984a_thinkpad_capture_source = {
4223 .num_items = 3, 4224 .num_items = 3,
4224 .items = { 4225 .items = {
4225 { "Mic", 0x0 }, 4226 { "Mic", 0x0 },
@@ -4262,7 +4263,7 @@ static int ad1984a_thinkpad_init(struct hda_codec *codec)
4262 * 0x15 - mic-in 4263 * 0x15 - mic-in
4263 */ 4264 */
4264 4265
4265static struct hda_verb ad1984a_precision_verbs[] = { 4266static const struct hda_verb ad1984a_precision_verbs[] = {
4266 /* Unmute main output path */ 4267 /* Unmute main output path */
4267 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */ 4268 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */
4268 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE + 0x1f}, /* 0dB */ 4269 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE + 0x1f}, /* 0dB */
@@ -4288,7 +4289,7 @@ static struct hda_verb ad1984a_precision_verbs[] = {
4288 { } /* end */ 4289 { } /* end */
4289}; 4290};
4290 4291
4291static struct snd_kcontrol_new ad1984a_precision_mixers[] = { 4292static const struct snd_kcontrol_new ad1984a_precision_mixers[] = {
4292 HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT), 4293 HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT),
4293 HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT), 4294 HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT),
4294 HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT), 4295 HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT),
@@ -4344,7 +4345,7 @@ static int ad1984a_precision_init(struct hda_codec *codec)
4344 * digital-mic (0x17) - Internal mic 4345 * digital-mic (0x17) - Internal mic
4345 */ 4346 */
4346 4347
4347static struct hda_verb ad1984a_touchsmart_verbs[] = { 4348static const struct hda_verb ad1984a_touchsmart_verbs[] = {
4348 /* DACs; unmute as default */ 4349 /* DACs; unmute as default */
4349 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */ 4350 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */
4350 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */ 4351 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */
@@ -4396,7 +4397,7 @@ static struct hda_verb ad1984a_touchsmart_verbs[] = {
4396 { } /* end */ 4397 { } /* end */
4397}; 4398};
4398 4399
4399static struct snd_kcontrol_new ad1984a_touchsmart_mixers[] = { 4400static const struct snd_kcontrol_new ad1984a_touchsmart_mixers[] = {
4400 HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT), 4401 HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT),
4401/* HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT),*/ 4402/* HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT),*/
4402 { 4403 {
@@ -4475,7 +4476,7 @@ static const char * const ad1884a_models[AD1884A_MODELS] = {
4475 [AD1984A_PRECISION] = "precision", 4476 [AD1984A_PRECISION] = "precision",
4476}; 4477};
4477 4478
4478static struct snd_pci_quirk ad1884a_cfg_tbl[] = { 4479static const struct snd_pci_quirk ad1884a_cfg_tbl[] = {
4479 SND_PCI_QUIRK(0x1028, 0x04ac, "Precision R5500", AD1984A_PRECISION), 4480 SND_PCI_QUIRK(0x1028, 0x04ac, "Precision R5500", AD1984A_PRECISION),
4480 SND_PCI_QUIRK(0x103c, 0x3030, "HP", AD1884A_MOBILE), 4481 SND_PCI_QUIRK(0x103c, 0x3030, "HP", AD1884A_MOBILE),
4481 SND_PCI_QUIRK(0x103c, 0x3037, "HP 2230s", AD1884A_LAPTOP), 4482 SND_PCI_QUIRK(0x103c, 0x3037, "HP 2230s", AD1884A_LAPTOP),
@@ -4614,22 +4615,22 @@ static int patch_ad1884a(struct hda_codec *codec)
4614 * port-G - rear clfe-out (6stack) 4615 * port-G - rear clfe-out (6stack)
4615 */ 4616 */
4616 4617
4617static hda_nid_t ad1882_dac_nids[3] = { 4618static const hda_nid_t ad1882_dac_nids[3] = {
4618 0x04, 0x03, 0x05 4619 0x04, 0x03, 0x05
4619}; 4620};
4620 4621
4621static hda_nid_t ad1882_adc_nids[2] = { 4622static const hda_nid_t ad1882_adc_nids[2] = {
4622 0x08, 0x09, 4623 0x08, 0x09,
4623}; 4624};
4624 4625
4625static hda_nid_t ad1882_capsrc_nids[2] = { 4626static const hda_nid_t ad1882_capsrc_nids[2] = {
4626 0x0c, 0x0d, 4627 0x0c, 0x0d,
4627}; 4628};
4628 4629
4629#define AD1882_SPDIF_OUT 0x02 4630#define AD1882_SPDIF_OUT 0x02
4630 4631
4631/* list: 0x11, 0x39, 0x3a, 0x18, 0x3c, 0x3b, 0x12, 0x20 */ 4632/* list: 0x11, 0x39, 0x3a, 0x18, 0x3c, 0x3b, 0x12, 0x20 */
4632static struct hda_input_mux ad1882_capture_source = { 4633static const struct hda_input_mux ad1882_capture_source = {
4633 .num_items = 5, 4634 .num_items = 5,
4634 .items = { 4635 .items = {
4635 { "Front Mic", 0x1 }, 4636 { "Front Mic", 0x1 },
@@ -4641,7 +4642,7 @@ static struct hda_input_mux ad1882_capture_source = {
4641}; 4642};
4642 4643
4643/* list: 0x11, 0x39, 0x3a, 0x3c, 0x18, 0x1f, 0x12, 0x20 */ 4644/* list: 0x11, 0x39, 0x3a, 0x3c, 0x18, 0x1f, 0x12, 0x20 */
4644static struct hda_input_mux ad1882a_capture_source = { 4645static const struct hda_input_mux ad1882a_capture_source = {
4645 .num_items = 5, 4646 .num_items = 5,
4646 .items = { 4647 .items = {
4647 { "Front Mic", 0x1 }, 4648 { "Front Mic", 0x1 },
@@ -4652,7 +4653,7 @@ static struct hda_input_mux ad1882a_capture_source = {
4652 }, 4653 },
4653}; 4654};
4654 4655
4655static struct snd_kcontrol_new ad1882_base_mixers[] = { 4656static const struct snd_kcontrol_new ad1882_base_mixers[] = {
4656 HDA_CODEC_VOLUME("Front Playback Volume", 0x04, 0x0, HDA_OUTPUT), 4657 HDA_CODEC_VOLUME("Front Playback Volume", 0x04, 0x0, HDA_OUTPUT),
4657 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), 4658 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
4658 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x05, 1, 0x0, HDA_OUTPUT), 4659 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x05, 1, 0x0, HDA_OUTPUT),
@@ -4694,7 +4695,7 @@ static struct snd_kcontrol_new ad1882_base_mixers[] = {
4694 { } /* end */ 4695 { } /* end */
4695}; 4696};
4696 4697
4697static struct snd_kcontrol_new ad1882_loopback_mixers[] = { 4698static const struct snd_kcontrol_new ad1882_loopback_mixers[] = {
4698 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x20, 0x00, HDA_INPUT), 4699 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x20, 0x00, HDA_INPUT),
4699 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x20, 0x00, HDA_INPUT), 4700 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x20, 0x00, HDA_INPUT),
4700 HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x01, HDA_INPUT), 4701 HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x01, HDA_INPUT),
@@ -4706,7 +4707,7 @@ static struct snd_kcontrol_new ad1882_loopback_mixers[] = {
4706 { } /* end */ 4707 { } /* end */
4707}; 4708};
4708 4709
4709static struct snd_kcontrol_new ad1882a_loopback_mixers[] = { 4710static const struct snd_kcontrol_new ad1882a_loopback_mixers[] = {
4710 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x20, 0x00, HDA_INPUT), 4711 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x20, 0x00, HDA_INPUT),
4711 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x20, 0x00, HDA_INPUT), 4712 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x20, 0x00, HDA_INPUT),
4712 HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x04, HDA_INPUT), 4713 HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x04, HDA_INPUT),
@@ -4719,7 +4720,7 @@ static struct snd_kcontrol_new ad1882a_loopback_mixers[] = {
4719 { } /* end */ 4720 { } /* end */
4720}; 4721};
4721 4722
4722static struct snd_kcontrol_new ad1882_3stack_mixers[] = { 4723static const struct snd_kcontrol_new ad1882_3stack_mixers[] = {
4723 HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT), 4724 HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4724 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x17, 1, 0x0, HDA_OUTPUT), 4725 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x17, 1, 0x0, HDA_OUTPUT),
4725 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x17, 2, 0x0, HDA_OUTPUT), 4726 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x17, 2, 0x0, HDA_OUTPUT),
@@ -4733,14 +4734,14 @@ static struct snd_kcontrol_new ad1882_3stack_mixers[] = {
4733 { } /* end */ 4734 { } /* end */
4734}; 4735};
4735 4736
4736static struct snd_kcontrol_new ad1882_6stack_mixers[] = { 4737static const struct snd_kcontrol_new ad1882_6stack_mixers[] = {
4737 HDA_CODEC_MUTE("Surround Playback Switch", 0x16, 0x0, HDA_OUTPUT), 4738 HDA_CODEC_MUTE("Surround Playback Switch", 0x16, 0x0, HDA_OUTPUT),
4738 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x24, 1, 0x0, HDA_OUTPUT), 4739 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x24, 1, 0x0, HDA_OUTPUT),
4739 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x24, 2, 0x0, HDA_OUTPUT), 4740 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x24, 2, 0x0, HDA_OUTPUT),
4740 { } /* end */ 4741 { } /* end */
4741}; 4742};
4742 4743
4743static struct hda_verb ad1882_ch2_init[] = { 4744static const struct hda_verb ad1882_ch2_init[] = {
4744 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 4745 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4745 {0x2c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 4746 {0x2c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4746 {0x2c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 4747 {0x2c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
@@ -4750,7 +4751,7 @@ static struct hda_verb ad1882_ch2_init[] = {
4750 { } /* end */ 4751 { } /* end */
4751}; 4752};
4752 4753
4753static struct hda_verb ad1882_ch4_init[] = { 4754static const struct hda_verb ad1882_ch4_init[] = {
4754 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 4755 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4755 {0x2c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 4756 {0x2c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4756 {0x2c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 4757 {0x2c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
@@ -4760,7 +4761,7 @@ static struct hda_verb ad1882_ch4_init[] = {
4760 { } /* end */ 4761 { } /* end */
4761}; 4762};
4762 4763
4763static struct hda_verb ad1882_ch6_init[] = { 4764static const struct hda_verb ad1882_ch6_init[] = {
4764 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 4765 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4765 {0x2c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 4766 {0x2c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4766 {0x2c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 4767 {0x2c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
@@ -4770,7 +4771,7 @@ static struct hda_verb ad1882_ch6_init[] = {
4770 { } /* end */ 4771 { } /* end */
4771}; 4772};
4772 4773
4773static struct hda_channel_mode ad1882_modes[3] = { 4774static const struct hda_channel_mode ad1882_modes[3] = {
4774 { 2, ad1882_ch2_init }, 4775 { 2, ad1882_ch2_init },
4775 { 4, ad1882_ch4_init }, 4776 { 4, ad1882_ch4_init },
4776 { 6, ad1882_ch6_init }, 4777 { 6, ad1882_ch6_init },
@@ -4779,7 +4780,7 @@ static struct hda_channel_mode ad1882_modes[3] = {
4779/* 4780/*
4780 * initialization verbs 4781 * initialization verbs
4781 */ 4782 */
4782static struct hda_verb ad1882_init_verbs[] = { 4783static const struct hda_verb ad1882_init_verbs[] = {
4783 /* DACs; mute as default */ 4784 /* DACs; mute as default */
4784 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 4785 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4785 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 4786 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
@@ -4848,7 +4849,7 @@ static struct hda_verb ad1882_init_verbs[] = {
4848}; 4849};
4849 4850
4850#ifdef CONFIG_SND_HDA_POWER_SAVE 4851#ifdef CONFIG_SND_HDA_POWER_SAVE
4851static struct hda_amp_list ad1882_loopbacks[] = { 4852static const struct hda_amp_list ad1882_loopbacks[] = {
4852 { 0x20, HDA_INPUT, 0 }, /* Front Mic */ 4853 { 0x20, HDA_INPUT, 0 }, /* Front Mic */
4853 { 0x20, HDA_INPUT, 1 }, /* Mic */ 4854 { 0x20, HDA_INPUT, 1 }, /* Mic */
4854 { 0x20, HDA_INPUT, 4 }, /* Line */ 4855 { 0x20, HDA_INPUT, 4 }, /* Line */
@@ -4945,7 +4946,7 @@ static int patch_ad1882(struct hda_codec *codec)
4945/* 4946/*
4946 * patch entries 4947 * patch entries
4947 */ 4948 */
4948static struct hda_codec_preset snd_hda_preset_analog[] = { 4949static const struct hda_codec_preset snd_hda_preset_analog[] = {
4949 { .id = 0x11d4184a, .name = "AD1884A", .patch = patch_ad1884a }, 4950 { .id = 0x11d4184a, .name = "AD1884A", .patch = patch_ad1884a },
4950 { .id = 0x11d41882, .name = "AD1882", .patch = patch_ad1882 }, 4951 { .id = 0x11d41882, .name = "AD1882", .patch = patch_ad1882 },
4951 { .id = 0x11d41883, .name = "AD1883", .patch = patch_ad1884a }, 4952 { .id = 0x11d41883, .name = "AD1883", .patch = patch_ad1884a },
diff --git a/sound/pci/hda/patch_ca0110.c b/sound/pci/hda/patch_ca0110.c
index 46c8bf48c31..61b92634b16 100644
--- a/sound/pci/hda/patch_ca0110.c
+++ b/sound/pci/hda/patch_ca0110.c
@@ -134,7 +134,7 @@ static int ca0110_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
134/* 134/*
135 */ 135 */
136 136
137static char *dirstr[2] = { "Playback", "Capture" }; 137static const char * const dirstr[2] = { "Playback", "Capture" };
138 138
139static int _add_switch(struct hda_codec *codec, hda_nid_t nid, const char *pfx, 139static int _add_switch(struct hda_codec *codec, hda_nid_t nid, const char *pfx,
140 int chan, int dir) 140 int chan, int dir)
@@ -171,7 +171,7 @@ static int ca0110_build_controls(struct hda_codec *codec)
171{ 171{
172 struct ca0110_spec *spec = codec->spec; 172 struct ca0110_spec *spec = codec->spec;
173 struct auto_pin_cfg *cfg = &spec->autocfg; 173 struct auto_pin_cfg *cfg = &spec->autocfg;
174 static char *prefix[AUTO_CFG_MAX_OUTS] = { 174 static const char * const prefix[AUTO_CFG_MAX_OUTS] = {
175 "Front", "Surround", NULL, "Side", "Multi" 175 "Front", "Surround", NULL, "Side", "Multi"
176 }; 176 };
177 hda_nid_t mutenid; 177 hda_nid_t mutenid;
@@ -259,7 +259,7 @@ static int ca0110_build_controls(struct hda_codec *codec)
259 259
260/* 260/*
261 */ 261 */
262static struct hda_pcm_stream ca0110_pcm_analog_playback = { 262static const struct hda_pcm_stream ca0110_pcm_analog_playback = {
263 .substreams = 1, 263 .substreams = 1,
264 .channels_min = 2, 264 .channels_min = 2,
265 .channels_max = 8, 265 .channels_max = 8,
@@ -270,7 +270,7 @@ static struct hda_pcm_stream ca0110_pcm_analog_playback = {
270 }, 270 },
271}; 271};
272 272
273static struct hda_pcm_stream ca0110_pcm_analog_capture = { 273static const struct hda_pcm_stream ca0110_pcm_analog_capture = {
274 .substreams = 1, 274 .substreams = 1,
275 .channels_min = 2, 275 .channels_min = 2,
276 .channels_max = 2, 276 .channels_max = 2,
@@ -280,7 +280,7 @@ static struct hda_pcm_stream ca0110_pcm_analog_capture = {
280 }, 280 },
281}; 281};
282 282
283static struct hda_pcm_stream ca0110_pcm_digital_playback = { 283static const struct hda_pcm_stream ca0110_pcm_digital_playback = {
284 .substreams = 1, 284 .substreams = 1,
285 .channels_min = 2, 285 .channels_min = 2,
286 .channels_max = 2, 286 .channels_max = 2,
@@ -291,7 +291,7 @@ static struct hda_pcm_stream ca0110_pcm_digital_playback = {
291 }, 291 },
292}; 292};
293 293
294static struct hda_pcm_stream ca0110_pcm_digital_capture = { 294static const struct hda_pcm_stream ca0110_pcm_digital_capture = {
295 .substreams = 1, 295 .substreams = 1,
296 .channels_min = 2, 296 .channels_min = 2,
297 .channels_max = 2, 297 .channels_max = 2,
@@ -389,7 +389,7 @@ static void ca0110_free(struct hda_codec *codec)
389 kfree(codec->spec); 389 kfree(codec->spec);
390} 390}
391 391
392static struct hda_codec_ops ca0110_patch_ops = { 392static const struct hda_codec_ops ca0110_patch_ops = {
393 .build_controls = ca0110_build_controls, 393 .build_controls = ca0110_build_controls,
394 .build_pcms = ca0110_build_pcms, 394 .build_pcms = ca0110_build_pcms,
395 .init = ca0110_init, 395 .init = ca0110_init,
@@ -539,7 +539,7 @@ static int patch_ca0110(struct hda_codec *codec)
539/* 539/*
540 * patch entries 540 * patch entries
541 */ 541 */
542static struct hda_codec_preset snd_hda_preset_ca0110[] = { 542static const struct hda_codec_preset snd_hda_preset_ca0110[] = {
543 { .id = 0x1102000a, .name = "CA0110-IBG", .patch = patch_ca0110 }, 543 { .id = 0x1102000a, .name = "CA0110-IBG", .patch = patch_ca0110 },
544 { .id = 0x1102000b, .name = "CA0110-IBG", .patch = patch_ca0110 }, 544 { .id = 0x1102000b, .name = "CA0110-IBG", .patch = patch_ca0110 },
545 { .id = 0x1102000d, .name = "SB0880 X-Fi", .patch = patch_ca0110 }, 545 { .id = 0x1102000d, .name = "SB0880 X-Fi", .patch = patch_ca0110 },
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
index 067982f4f18..26a1521045b 100644
--- a/sound/pci/hda/patch_cirrus.c
+++ b/sound/pci/hda/patch_cirrus.c
@@ -51,7 +51,7 @@ struct cs_spec {
51 unsigned int cur_adc_format; 51 unsigned int cur_adc_format;
52 hda_nid_t dig_in; 52 hda_nid_t dig_in;
53 53
54 struct hda_bind_ctls *capture_bind[2]; 54 const struct hda_bind_ctls *capture_bind[2];
55 55
56 unsigned int gpio_mask; 56 unsigned int gpio_mask;
57 unsigned int gpio_dir; 57 unsigned int gpio_dir;
@@ -231,7 +231,7 @@ static int cs_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
231 231
232/* 232/*
233 */ 233 */
234static struct hda_pcm_stream cs_pcm_analog_playback = { 234static const struct hda_pcm_stream cs_pcm_analog_playback = {
235 .substreams = 1, 235 .substreams = 1,
236 .channels_min = 2, 236 .channels_min = 2,
237 .channels_max = 2, 237 .channels_max = 2,
@@ -242,7 +242,7 @@ static struct hda_pcm_stream cs_pcm_analog_playback = {
242 }, 242 },
243}; 243};
244 244
245static struct hda_pcm_stream cs_pcm_analog_capture = { 245static const struct hda_pcm_stream cs_pcm_analog_capture = {
246 .substreams = 1, 246 .substreams = 1,
247 .channels_min = 2, 247 .channels_min = 2,
248 .channels_max = 2, 248 .channels_max = 2,
@@ -252,7 +252,7 @@ static struct hda_pcm_stream cs_pcm_analog_capture = {
252 }, 252 },
253}; 253};
254 254
255static struct hda_pcm_stream cs_pcm_digital_playback = { 255static const struct hda_pcm_stream cs_pcm_digital_playback = {
256 .substreams = 1, 256 .substreams = 1,
257 .channels_min = 2, 257 .channels_min = 2,
258 .channels_max = 2, 258 .channels_max = 2,
@@ -264,7 +264,7 @@ static struct hda_pcm_stream cs_pcm_digital_playback = {
264 }, 264 },
265}; 265};
266 266
267static struct hda_pcm_stream cs_pcm_digital_capture = { 267static const struct hda_pcm_stream cs_pcm_digital_capture = {
268 .substreams = 1, 268 .substreams = 1,
269 .channels_min = 2, 269 .channels_min = 2,
270 .channels_max = 2, 270 .channels_max = 2,
@@ -331,8 +331,8 @@ static int is_ext_mic(struct hda_codec *codec, unsigned int idx)
331 struct cs_spec *spec = codec->spec; 331 struct cs_spec *spec = codec->spec;
332 struct auto_pin_cfg *cfg = &spec->autocfg; 332 struct auto_pin_cfg *cfg = &spec->autocfg;
333 hda_nid_t pin = cfg->inputs[idx].pin; 333 hda_nid_t pin = cfg->inputs[idx].pin;
334 unsigned int val = snd_hda_query_pin_caps(codec, pin); 334 unsigned int val;
335 if (!(val & AC_PINCAP_PRES_DETECT)) 335 if (!is_jack_detectable(codec, pin))
336 return 0; 336 return 0;
337 val = snd_hda_codec_get_pincfg(codec, pin); 337 val = snd_hda_codec_get_pincfg(codec, pin);
338 return (snd_hda_get_input_pin_attr(val) != INPUT_PIN_ATTR_INT); 338 return (snd_hda_get_input_pin_attr(val) != INPUT_PIN_ATTR_INT);
@@ -349,8 +349,7 @@ static hda_nid_t get_adc(struct hda_codec *codec, hda_nid_t pin,
349 hda_nid_t pins[2]; 349 hda_nid_t pins[2];
350 unsigned int type; 350 unsigned int type;
351 int j, nums; 351 int j, nums;
352 type = (get_wcaps(codec, nid) & AC_WCAP_TYPE) 352 type = get_wcaps_type(get_wcaps(codec, nid));
353 >> AC_WCAP_TYPE_SHIFT;
354 if (type != AC_WID_AUD_IN) 353 if (type != AC_WID_AUD_IN)
355 continue; 354 continue;
356 nums = snd_hda_get_connections(codec, nid, pins, 355 nums = snd_hda_get_connections(codec, nid, pins,
@@ -559,10 +558,10 @@ static int add_output(struct hda_codec *codec, hda_nid_t dac, int idx,
559 const char *name; 558 const char *name;
560 int err, index; 559 int err, index;
561 struct snd_kcontrol *kctl; 560 struct snd_kcontrol *kctl;
562 static char *speakers[] = { 561 static const char * const speakers[] = {
563 "Front Speaker", "Surround Speaker", "Bass Speaker" 562 "Front Speaker", "Surround Speaker", "Bass Speaker"
564 }; 563 };
565 static char *line_outs[] = { 564 static const char * const line_outs[] = {
566 "Front Line-Out", "Surround Line-Out", "Bass Line-Out" 565 "Front Line-Out", "Surround Line-Out", "Bass Line-Out"
567 }; 566 };
568 567
@@ -642,7 +641,7 @@ static int build_output(struct hda_codec *codec)
642/* 641/*
643 */ 642 */
644 643
645static struct snd_kcontrol_new cs_capture_ctls[] = { 644static const struct snd_kcontrol_new cs_capture_ctls[] = {
646 HDA_BIND_SW("Capture Switch", 0), 645 HDA_BIND_SW("Capture Switch", 0),
647 HDA_BIND_VOL("Capture Volume", 0), 646 HDA_BIND_VOL("Capture Volume", 0),
648}; 647};
@@ -710,7 +709,7 @@ static int cs_capture_source_put(struct snd_kcontrol *kcontrol,
710 return change_cur_input(codec, idx, 0); 709 return change_cur_input(codec, idx, 0);
711} 710}
712 711
713static struct snd_kcontrol_new cs_capture_source = { 712static const struct snd_kcontrol_new cs_capture_source = {
714 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 713 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
715 .name = "Capture Source", 714 .name = "Capture Source",
716 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 715 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
@@ -719,7 +718,7 @@ static struct snd_kcontrol_new cs_capture_source = {
719 .put = cs_capture_source_put, 718 .put = cs_capture_source_put,
720}; 719};
721 720
722static struct hda_bind_ctls *make_bind_capture(struct hda_codec *codec, 721static const struct hda_bind_ctls *make_bind_capture(struct hda_codec *codec,
723 struct hda_ctl_ops *ops) 722 struct hda_ctl_ops *ops)
724{ 723{
725 struct cs_spec *spec = codec->spec; 724 struct cs_spec *spec = codec->spec;
@@ -847,15 +846,14 @@ static void cs_automute(struct hda_codec *codec)
847{ 846{
848 struct cs_spec *spec = codec->spec; 847 struct cs_spec *spec = codec->spec;
849 struct auto_pin_cfg *cfg = &spec->autocfg; 848 struct auto_pin_cfg *cfg = &spec->autocfg;
850 unsigned int caps, hp_present; 849 unsigned int hp_present;
851 hda_nid_t nid; 850 hda_nid_t nid;
852 int i; 851 int i;
853 852
854 hp_present = 0; 853 hp_present = 0;
855 for (i = 0; i < cfg->hp_outs; i++) { 854 for (i = 0; i < cfg->hp_outs; i++) {
856 nid = cfg->hp_pins[i]; 855 nid = cfg->hp_pins[i];
857 caps = snd_hda_query_pin_caps(codec, nid); 856 if (!is_jack_detectable(codec, nid))
858 if (!(caps & AC_PINCAP_PRES_DETECT))
859 continue; 857 continue;
860 hp_present = snd_hda_jack_detect(codec, nid); 858 hp_present = snd_hda_jack_detect(codec, nid);
861 if (hp_present) 859 if (hp_present)
@@ -924,7 +922,7 @@ static void init_output(struct hda_codec *codec)
924 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP); 922 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
925 if (!cfg->speaker_outs) 923 if (!cfg->speaker_outs)
926 continue; 924 continue;
927 if (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP) { 925 if (is_jack_detectable(codec, nid)) {
928 snd_hda_codec_write(codec, nid, 0, 926 snd_hda_codec_write(codec, nid, 0,
929 AC_VERB_SET_UNSOLICITED_ENABLE, 927 AC_VERB_SET_UNSOLICITED_ENABLE,
930 AC_USRSP_EN | HP_EVENT); 928 AC_USRSP_EN | HP_EVENT);
@@ -983,7 +981,7 @@ static void init_input(struct hda_codec *codec)
983 cs_vendor_coef_set(codec, IDX_ADC_CFG, coef); 981 cs_vendor_coef_set(codec, IDX_ADC_CFG, coef);
984} 982}
985 983
986static struct hda_verb cs_coef_init_verbs[] = { 984static const struct hda_verb cs_coef_init_verbs[] = {
987 {0x11, AC_VERB_SET_PROC_STATE, 1}, 985 {0x11, AC_VERB_SET_PROC_STATE, 1},
988 {0x11, AC_VERB_SET_COEF_INDEX, IDX_DAC_CFG}, 986 {0x11, AC_VERB_SET_COEF_INDEX, IDX_DAC_CFG},
989 {0x11, AC_VERB_SET_PROC_COEF, 987 {0x11, AC_VERB_SET_PROC_COEF,
@@ -1017,7 +1015,7 @@ static struct hda_verb cs_coef_init_verbs[] = {
1017 * blocks, which will alleviate the issue. 1015 * blocks, which will alleviate the issue.
1018 */ 1016 */
1019 1017
1020static struct hda_verb cs_errata_init_verbs[] = { 1018static const struct hda_verb cs_errata_init_verbs[] = {
1021 {0x01, AC_VERB_SET_POWER_STATE, 0x00}, /* AFG: D0 */ 1019 {0x01, AC_VERB_SET_POWER_STATE, 0x00}, /* AFG: D0 */
1022 {0x11, AC_VERB_SET_PROC_STATE, 0x01}, /* VPW: processing on */ 1020 {0x11, AC_VERB_SET_PROC_STATE, 0x01}, /* VPW: processing on */
1023 1021
@@ -1126,7 +1124,7 @@ static void cs_unsol_event(struct hda_codec *codec, unsigned int res)
1126 } 1124 }
1127} 1125}
1128 1126
1129static struct hda_codec_ops cs_patch_ops = { 1127static const struct hda_codec_ops cs_patch_ops = {
1130 .build_controls = cs_build_controls, 1128 .build_controls = cs_build_controls,
1131 .build_pcms = cs_build_pcms, 1129 .build_pcms = cs_build_pcms,
1132 .init = cs_init, 1130 .init = cs_init,
@@ -1166,7 +1164,7 @@ static const char * const cs420x_models[CS420X_MODELS] = {
1166}; 1164};
1167 1165
1168 1166
1169static struct snd_pci_quirk cs420x_cfg_tbl[] = { 1167static const struct snd_pci_quirk cs420x_cfg_tbl[] = {
1170 SND_PCI_QUIRK(0x10de, 0x0ac0, "MacBookPro 5,3", CS420X_MBP53), 1168 SND_PCI_QUIRK(0x10de, 0x0ac0, "MacBookPro 5,3", CS420X_MBP53),
1171 SND_PCI_QUIRK(0x10de, 0x0d94, "MacBookAir 3,1(2)", CS420X_MBP55), 1169 SND_PCI_QUIRK(0x10de, 0x0d94, "MacBookAir 3,1(2)", CS420X_MBP55),
1172 SND_PCI_QUIRK(0x10de, 0xcb79, "MacBookPro 5,5", CS420X_MBP55), 1170 SND_PCI_QUIRK(0x10de, 0xcb79, "MacBookPro 5,5", CS420X_MBP55),
@@ -1180,7 +1178,7 @@ struct cs_pincfg {
1180 u32 val; 1178 u32 val;
1181}; 1179};
1182 1180
1183static struct cs_pincfg mbp53_pincfgs[] = { 1181static const struct cs_pincfg mbp53_pincfgs[] = {
1184 { 0x09, 0x012b4050 }, 1182 { 0x09, 0x012b4050 },
1185 { 0x0a, 0x90100141 }, 1183 { 0x0a, 0x90100141 },
1186 { 0x0b, 0x90100140 }, 1184 { 0x0b, 0x90100140 },
@@ -1194,7 +1192,7 @@ static struct cs_pincfg mbp53_pincfgs[] = {
1194 {} /* terminator */ 1192 {} /* terminator */
1195}; 1193};
1196 1194
1197static struct cs_pincfg mbp55_pincfgs[] = { 1195static const struct cs_pincfg mbp55_pincfgs[] = {
1198 { 0x09, 0x012b4030 }, 1196 { 0x09, 0x012b4030 },
1199 { 0x0a, 0x90100121 }, 1197 { 0x0a, 0x90100121 },
1200 { 0x0b, 0x90100120 }, 1198 { 0x0b, 0x90100120 },
@@ -1208,7 +1206,7 @@ static struct cs_pincfg mbp55_pincfgs[] = {
1208 {} /* terminator */ 1206 {} /* terminator */
1209}; 1207};
1210 1208
1211static struct cs_pincfg imac27_pincfgs[] = { 1209static const struct cs_pincfg imac27_pincfgs[] = {
1212 { 0x09, 0x012b4050 }, 1210 { 0x09, 0x012b4050 },
1213 { 0x0a, 0x90100140 }, 1211 { 0x0a, 0x90100140 },
1214 { 0x0b, 0x90100142 }, 1212 { 0x0b, 0x90100142 },
@@ -1222,7 +1220,7 @@ static struct cs_pincfg imac27_pincfgs[] = {
1222 {} /* terminator */ 1220 {} /* terminator */
1223}; 1221};
1224 1222
1225static struct cs_pincfg *cs_pincfgs[CS420X_MODELS] = { 1223static const struct cs_pincfg *cs_pincfgs[CS420X_MODELS] = {
1226 [CS420X_MBP53] = mbp53_pincfgs, 1224 [CS420X_MBP53] = mbp53_pincfgs,
1227 [CS420X_MBP55] = mbp55_pincfgs, 1225 [CS420X_MBP55] = mbp55_pincfgs,
1228 [CS420X_IMAC27] = imac27_pincfgs, 1226 [CS420X_IMAC27] = imac27_pincfgs,
@@ -1283,7 +1281,7 @@ static int patch_cs420x(struct hda_codec *codec)
1283/* 1281/*
1284 * patch entries 1282 * patch entries
1285 */ 1283 */
1286static struct hda_codec_preset snd_hda_preset_cirrus[] = { 1284static const struct hda_codec_preset snd_hda_preset_cirrus[] = {
1287 { .id = 0x10134206, .name = "CS4206", .patch = patch_cs420x }, 1285 { .id = 0x10134206, .name = "CS4206", .patch = patch_cs420x },
1288 { .id = 0x10134207, .name = "CS4207", .patch = patch_cs420x }, 1286 { .id = 0x10134207, .name = "CS4207", .patch = patch_cs420x },
1289 {} /* terminator */ 1287 {} /* terminator */
diff --git a/sound/pci/hda/patch_cmedia.c b/sound/pci/hda/patch_cmedia.c
index 1f8bbcd0f80..ab3308daa96 100644
--- a/sound/pci/hda/patch_cmedia.c
+++ b/sound/pci/hda/patch_cmedia.c
@@ -53,7 +53,7 @@ struct cmi_spec {
53 int num_dacs; 53 int num_dacs;
54 54
55 /* capture */ 55 /* capture */
56 hda_nid_t *adc_nids; 56 const hda_nid_t *adc_nids;
57 hda_nid_t dig_in_nid; 57 hda_nid_t dig_in_nid;
58 58
59 /* capture source */ 59 /* capture source */
@@ -110,7 +110,7 @@ static int cmi_mux_enum_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v
110 */ 110 */
111 111
112/* 3-stack / 2 channel */ 112/* 3-stack / 2 channel */
113static struct hda_verb cmi9880_ch2_init[] = { 113static const struct hda_verb cmi9880_ch2_init[] = {
114 /* set line-in PIN for input */ 114 /* set line-in PIN for input */
115 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, 115 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
116 /* set mic PIN for input, also enable vref */ 116 /* set mic PIN for input, also enable vref */
@@ -121,7 +121,7 @@ static struct hda_verb cmi9880_ch2_init[] = {
121}; 121};
122 122
123/* 3-stack / 6 channel */ 123/* 3-stack / 6 channel */
124static struct hda_verb cmi9880_ch6_init[] = { 124static const struct hda_verb cmi9880_ch6_init[] = {
125 /* set line-in PIN for output */ 125 /* set line-in PIN for output */
126 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 126 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
127 /* set mic PIN for output */ 127 /* set mic PIN for output */
@@ -132,7 +132,7 @@ static struct hda_verb cmi9880_ch6_init[] = {
132}; 132};
133 133
134/* 3-stack+front / 8 channel */ 134/* 3-stack+front / 8 channel */
135static struct hda_verb cmi9880_ch8_init[] = { 135static const struct hda_verb cmi9880_ch8_init[] = {
136 /* set line-in PIN for output */ 136 /* set line-in PIN for output */
137 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 137 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
138 /* set mic PIN for output */ 138 /* set mic PIN for output */
@@ -142,7 +142,7 @@ static struct hda_verb cmi9880_ch8_init[] = {
142 {} 142 {}
143}; 143};
144 144
145static struct hda_channel_mode cmi9880_channel_modes[3] = { 145static const struct hda_channel_mode cmi9880_channel_modes[3] = {
146 { 2, cmi9880_ch2_init }, 146 { 2, cmi9880_ch2_init },
147 { 6, cmi9880_ch6_init }, 147 { 6, cmi9880_ch6_init },
148 { 8, cmi9880_ch8_init }, 148 { 8, cmi9880_ch8_init },
@@ -174,7 +174,7 @@ static int cmi_ch_mode_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_va
174 174
175/* 175/*
176 */ 176 */
177static struct snd_kcontrol_new cmi9880_basic_mixer[] = { 177static const struct snd_kcontrol_new cmi9880_basic_mixer[] = {
178 /* CMI9880 has no playback volumes! */ 178 /* CMI9880 has no playback volumes! */
179 HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT), /* front */ 179 HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT), /* front */
180 HDA_CODEC_MUTE("Surround Playback Switch", 0x04, 0x0, HDA_OUTPUT), 180 HDA_CODEC_MUTE("Surround Playback Switch", 0x04, 0x0, HDA_OUTPUT),
@@ -205,7 +205,7 @@ static struct snd_kcontrol_new cmi9880_basic_mixer[] = {
205/* 205/*
206 * shared I/O pins 206 * shared I/O pins
207 */ 207 */
208static struct snd_kcontrol_new cmi9880_ch_mode_mixer[] = { 208static const struct snd_kcontrol_new cmi9880_ch_mode_mixer[] = {
209 { 209 {
210 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 210 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
211 .name = "Channel Mode", 211 .name = "Channel Mode",
@@ -219,7 +219,7 @@ static struct snd_kcontrol_new cmi9880_ch_mode_mixer[] = {
219/* AUD-in selections: 219/* AUD-in selections:
220 * 0x0b 0x0c 0x0d 0x0e 0x0f 0x10 0x11 0x1f 0x20 220 * 0x0b 0x0c 0x0d 0x0e 0x0f 0x10 0x11 0x1f 0x20
221 */ 221 */
222static struct hda_input_mux cmi9880_basic_mux = { 222static const struct hda_input_mux cmi9880_basic_mux = {
223 .num_items = 4, 223 .num_items = 4,
224 .items = { 224 .items = {
225 { "Front Mic", 0x5 }, 225 { "Front Mic", 0x5 },
@@ -229,7 +229,7 @@ static struct hda_input_mux cmi9880_basic_mux = {
229 } 229 }
230}; 230};
231 231
232static struct hda_input_mux cmi9880_no_line_mux = { 232static const struct hda_input_mux cmi9880_no_line_mux = {
233 .num_items = 3, 233 .num_items = 3,
234 .items = { 234 .items = {
235 { "Front Mic", 0x5 }, 235 { "Front Mic", 0x5 },
@@ -239,11 +239,11 @@ static struct hda_input_mux cmi9880_no_line_mux = {
239}; 239};
240 240
241/* front, rear, clfe, rear_surr */ 241/* front, rear, clfe, rear_surr */
242static hda_nid_t cmi9880_dac_nids[4] = { 242static const hda_nid_t cmi9880_dac_nids[4] = {
243 0x03, 0x04, 0x05, 0x06 243 0x03, 0x04, 0x05, 0x06
244}; 244};
245/* ADC0, ADC1 */ 245/* ADC0, ADC1 */
246static hda_nid_t cmi9880_adc_nids[2] = { 246static const hda_nid_t cmi9880_adc_nids[2] = {
247 0x08, 0x09 247 0x08, 0x09
248}; 248};
249 249
@@ -252,7 +252,7 @@ static hda_nid_t cmi9880_adc_nids[2] = {
252 252
253/* 253/*
254 */ 254 */
255static struct hda_verb cmi9880_basic_init[] = { 255static const struct hda_verb cmi9880_basic_init[] = {
256 /* port-D for line out (rear panel) */ 256 /* port-D for line out (rear panel) */
257 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, 257 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
258 /* port-E for HP out (front panel) */ 258 /* port-E for HP out (front panel) */
@@ -281,7 +281,7 @@ static struct hda_verb cmi9880_basic_init[] = {
281 {} /* terminator */ 281 {} /* terminator */
282}; 282};
283 283
284static struct hda_verb cmi9880_allout_init[] = { 284static const struct hda_verb cmi9880_allout_init[] = {
285 /* port-D for line out (rear panel) */ 285 /* port-D for line out (rear panel) */
286 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, 286 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
287 /* port-E for HP out (front panel) */ 287 /* port-E for HP out (front panel) */
@@ -528,7 +528,7 @@ static int cmi9880_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
528 528
529/* 529/*
530 */ 530 */
531static struct hda_pcm_stream cmi9880_pcm_analog_playback = { 531static const struct hda_pcm_stream cmi9880_pcm_analog_playback = {
532 .substreams = 1, 532 .substreams = 1,
533 .channels_min = 2, 533 .channels_min = 2,
534 .channels_max = 8, 534 .channels_max = 8,
@@ -540,7 +540,7 @@ static struct hda_pcm_stream cmi9880_pcm_analog_playback = {
540 }, 540 },
541}; 541};
542 542
543static struct hda_pcm_stream cmi9880_pcm_analog_capture = { 543static const struct hda_pcm_stream cmi9880_pcm_analog_capture = {
544 .substreams = 2, 544 .substreams = 2,
545 .channels_min = 2, 545 .channels_min = 2,
546 .channels_max = 2, 546 .channels_max = 2,
@@ -551,7 +551,7 @@ static struct hda_pcm_stream cmi9880_pcm_analog_capture = {
551 }, 551 },
552}; 552};
553 553
554static struct hda_pcm_stream cmi9880_pcm_digital_playback = { 554static const struct hda_pcm_stream cmi9880_pcm_digital_playback = {
555 .substreams = 1, 555 .substreams = 1,
556 .channels_min = 2, 556 .channels_min = 2,
557 .channels_max = 2, 557 .channels_max = 2,
@@ -563,7 +563,7 @@ static struct hda_pcm_stream cmi9880_pcm_digital_playback = {
563 }, 563 },
564}; 564};
565 565
566static struct hda_pcm_stream cmi9880_pcm_digital_capture = { 566static const struct hda_pcm_stream cmi9880_pcm_digital_capture = {
567 .substreams = 1, 567 .substreams = 1,
568 .channels_min = 2, 568 .channels_min = 2,
569 .channels_max = 2, 569 .channels_max = 2,
@@ -617,14 +617,14 @@ static const char * const cmi9880_models[CMI_MODELS] = {
617 [CMI_AUTO] = "auto", 617 [CMI_AUTO] = "auto",
618}; 618};
619 619
620static struct snd_pci_quirk cmi9880_cfg_tbl[] = { 620static const struct snd_pci_quirk cmi9880_cfg_tbl[] = {
621 SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", CMI_FULL_DIG), 621 SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", CMI_FULL_DIG),
622 SND_PCI_QUIRK(0x1854, 0x002b, "LG LS75", CMI_MINIMAL), 622 SND_PCI_QUIRK(0x1854, 0x002b, "LG LS75", CMI_MINIMAL),
623 SND_PCI_QUIRK(0x1854, 0x0032, "LG", CMI_FULL_DIG), 623 SND_PCI_QUIRK(0x1854, 0x0032, "LG", CMI_FULL_DIG),
624 {} /* terminator */ 624 {} /* terminator */
625}; 625};
626 626
627static struct hda_codec_ops cmi9880_patch_ops = { 627static const struct hda_codec_ops cmi9880_patch_ops = {
628 .build_controls = cmi9880_build_controls, 628 .build_controls = cmi9880_build_controls,
629 .build_pcms = cmi9880_build_pcms, 629 .build_pcms = cmi9880_build_pcms,
630 .init = cmi9880_init, 630 .init = cmi9880_init,
@@ -745,7 +745,7 @@ static int patch_cmi9880(struct hda_codec *codec)
745/* 745/*
746 * patch entries 746 * patch entries
747 */ 747 */
748static struct hda_codec_preset snd_hda_preset_cmedia[] = { 748static const struct hda_codec_preset snd_hda_preset_cmedia[] = {
749 { .id = 0x13f69880, .name = "CMI9880", .patch = patch_cmi9880 }, 749 { .id = 0x13f69880, .name = "CMI9880", .patch = patch_cmi9880 },
750 { .id = 0x434d4980, .name = "CMI9880", .patch = patch_cmi9880 }, 750 { .id = 0x434d4980, .name = "CMI9880", .patch = patch_cmi9880 },
751 {} /* terminator */ 751 {} /* terminator */
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index ad97d937d3a..4f37477d3c7 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -39,6 +39,7 @@
39 39
40#define CONEXANT_HP_EVENT 0x37 40#define CONEXANT_HP_EVENT 0x37
41#define CONEXANT_MIC_EVENT 0x38 41#define CONEXANT_MIC_EVENT 0x38
42#define CONEXANT_LINE_EVENT 0x39
42 43
43/* Conexant 5051 specific */ 44/* Conexant 5051 specific */
44 45
@@ -55,9 +56,16 @@ struct pin_dac_pair {
55 int type; 56 int type;
56}; 57};
57 58
59struct imux_info {
60 hda_nid_t pin; /* input pin NID */
61 hda_nid_t adc; /* connected ADC NID */
62 hda_nid_t boost; /* optional boost volume NID */
63 int index; /* corresponding to autocfg.input */
64};
65
58struct conexant_spec { 66struct conexant_spec {
59 67
60 struct snd_kcontrol_new *mixers[5]; 68 const struct snd_kcontrol_new *mixers[5];
61 int num_mixers; 69 int num_mixers;
62 hda_nid_t vmaster_nid; 70 hda_nid_t vmaster_nid;
63 71
@@ -74,14 +82,17 @@ struct conexant_spec {
74 */ 82 */
75 unsigned int cur_eapd; 83 unsigned int cur_eapd;
76 unsigned int hp_present; 84 unsigned int hp_present;
85 unsigned int line_present;
77 unsigned int auto_mic; 86 unsigned int auto_mic;
78 int auto_mic_ext; /* autocfg.inputs[] index for ext mic */ 87 int auto_mic_ext; /* imux_pins[] index for ext mic */
88 int auto_mic_dock; /* imux_pins[] index for dock mic */
89 int auto_mic_int; /* imux_pins[] index for int mic */
79 unsigned int need_dac_fix; 90 unsigned int need_dac_fix;
80 hda_nid_t slave_dig_outs[2]; 91 hda_nid_t slave_dig_outs[2];
81 92
82 /* capture */ 93 /* capture */
83 unsigned int num_adc_nids; 94 unsigned int num_adc_nids;
84 hda_nid_t *adc_nids; 95 const hda_nid_t *adc_nids;
85 hda_nid_t dig_in_nid; /* digital-in NID; optional */ 96 hda_nid_t dig_in_nid; /* digital-in NID; optional */
86 97
87 unsigned int cur_adc_idx; 98 unsigned int cur_adc_idx;
@@ -89,9 +100,11 @@ struct conexant_spec {
89 unsigned int cur_adc_stream_tag; 100 unsigned int cur_adc_stream_tag;
90 unsigned int cur_adc_format; 101 unsigned int cur_adc_format;
91 102
103 const struct hda_pcm_stream *capture_stream;
104
92 /* capture source */ 105 /* capture source */
93 const struct hda_input_mux *input_mux; 106 const struct hda_input_mux *input_mux;
94 hda_nid_t *capsrc_nids; 107 const hda_nid_t *capsrc_nids;
95 unsigned int cur_mux[3]; 108 unsigned int cur_mux[3];
96 109
97 /* channel model */ 110 /* channel model */
@@ -106,12 +119,17 @@ struct conexant_spec {
106 /* dynamic controls, init_verbs and input_mux */ 119 /* dynamic controls, init_verbs and input_mux */
107 struct auto_pin_cfg autocfg; 120 struct auto_pin_cfg autocfg;
108 struct hda_input_mux private_imux; 121 struct hda_input_mux private_imux;
122 struct imux_info imux_info[HDA_MAX_NUM_INPUTS];
123 hda_nid_t private_adc_nids[HDA_MAX_NUM_INPUTS];
109 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; 124 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
110 struct pin_dac_pair dac_info[8]; 125 struct pin_dac_pair dac_info[8];
111 int dac_info_filled; 126 int dac_info_filled;
112 127
113 unsigned int port_d_mode; 128 unsigned int port_d_mode;
114 unsigned int auto_mute:1; /* used in auto-parser */ 129 unsigned int auto_mute:1; /* used in auto-parser */
130 unsigned int detect_line:1; /* Line-out detection enabled */
131 unsigned int automute_lines:1; /* automute line-out as well */
132 unsigned int automute_hp_lo:1; /* both HP and LO available */
115 unsigned int dell_automute:1; 133 unsigned int dell_automute:1;
116 unsigned int dell_vostro:1; 134 unsigned int dell_vostro:1;
117 unsigned int ideapad:1; 135 unsigned int ideapad:1;
@@ -119,6 +137,8 @@ struct conexant_spec {
119 unsigned int hp_laptop:1; 137 unsigned int hp_laptop:1;
120 unsigned int asus:1; 138 unsigned int asus:1;
121 139
140 unsigned int adc_switching:1;
141
122 unsigned int ext_mic_present; 142 unsigned int ext_mic_present;
123 unsigned int recording; 143 unsigned int recording;
124 void (*capture_prepare)(struct hda_codec *codec); 144 void (*capture_prepare)(struct hda_codec *codec);
@@ -227,7 +247,7 @@ static int conexant_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
227 247
228 248
229 249
230static struct hda_pcm_stream conexant_pcm_analog_playback = { 250static const struct hda_pcm_stream conexant_pcm_analog_playback = {
231 .substreams = 1, 251 .substreams = 1,
232 .channels_min = 2, 252 .channels_min = 2,
233 .channels_max = 2, 253 .channels_max = 2,
@@ -239,7 +259,7 @@ static struct hda_pcm_stream conexant_pcm_analog_playback = {
239 }, 259 },
240}; 260};
241 261
242static struct hda_pcm_stream conexant_pcm_analog_capture = { 262static const struct hda_pcm_stream conexant_pcm_analog_capture = {
243 .substreams = 1, 263 .substreams = 1,
244 .channels_min = 2, 264 .channels_min = 2,
245 .channels_max = 2, 265 .channels_max = 2,
@@ -251,7 +271,7 @@ static struct hda_pcm_stream conexant_pcm_analog_capture = {
251}; 271};
252 272
253 273
254static struct hda_pcm_stream conexant_pcm_digital_playback = { 274static const struct hda_pcm_stream conexant_pcm_digital_playback = {
255 .substreams = 1, 275 .substreams = 1,
256 .channels_min = 2, 276 .channels_min = 2,
257 .channels_max = 2, 277 .channels_max = 2,
@@ -263,7 +283,7 @@ static struct hda_pcm_stream conexant_pcm_digital_playback = {
263 }, 283 },
264}; 284};
265 285
266static struct hda_pcm_stream conexant_pcm_digital_capture = { 286static const struct hda_pcm_stream conexant_pcm_digital_capture = {
267 .substreams = 1, 287 .substreams = 1,
268 .channels_min = 2, 288 .channels_min = 2,
269 .channels_max = 2, 289 .channels_max = 2,
@@ -294,7 +314,7 @@ static int cx5051_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
294 return 0; 314 return 0;
295} 315}
296 316
297static struct hda_pcm_stream cx5051_pcm_analog_capture = { 317static const struct hda_pcm_stream cx5051_pcm_analog_capture = {
298 .substreams = 1, 318 .substreams = 1,
299 .channels_min = 2, 319 .channels_min = 2,
300 .channels_max = 2, 320 .channels_max = 2,
@@ -319,13 +339,19 @@ static int conexant_build_pcms(struct hda_codec *codec)
319 spec->multiout.max_channels; 339 spec->multiout.max_channels;
320 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 340 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
321 spec->multiout.dac_nids[0]; 341 spec->multiout.dac_nids[0];
322 if (codec->vendor_id == 0x14f15051) 342 if (spec->capture_stream)
323 info->stream[SNDRV_PCM_STREAM_CAPTURE] = 343 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *spec->capture_stream;
324 cx5051_pcm_analog_capture; 344 else {
325 else 345 if (codec->vendor_id == 0x14f15051)
326 info->stream[SNDRV_PCM_STREAM_CAPTURE] = 346 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
327 conexant_pcm_analog_capture; 347 cx5051_pcm_analog_capture;
328 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adc_nids; 348 else {
349 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
350 conexant_pcm_analog_capture;
351 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
352 spec->num_adc_nids;
353 }
354 }
329 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; 355 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
330 356
331 if (spec->multiout.dig_out_nid) { 357 if (spec->multiout.dig_out_nid) {
@@ -433,7 +459,7 @@ static void conexant_free(struct hda_codec *codec)
433 kfree(codec->spec); 459 kfree(codec->spec);
434} 460}
435 461
436static struct snd_kcontrol_new cxt_capture_mixers[] = { 462static const struct snd_kcontrol_new cxt_capture_mixers[] = {
437 { 463 {
438 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 464 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
439 .name = "Capture Source", 465 .name = "Capture Source",
@@ -446,7 +472,7 @@ static struct snd_kcontrol_new cxt_capture_mixers[] = {
446 472
447#ifdef CONFIG_SND_HDA_INPUT_BEEP 473#ifdef CONFIG_SND_HDA_INPUT_BEEP
448/* additional beep mixers; the actual parameters are overwritten at build */ 474/* additional beep mixers; the actual parameters are overwritten at build */
449static struct snd_kcontrol_new cxt_beep_mixer[] = { 475static const struct snd_kcontrol_new cxt_beep_mixer[] = {
450 HDA_CODEC_VOLUME_MONO("Beep Playback Volume", 0, 1, 0, HDA_OUTPUT), 476 HDA_CODEC_VOLUME_MONO("Beep Playback Volume", 0, 1, 0, HDA_OUTPUT),
451 HDA_CODEC_MUTE_BEEP_MONO("Beep Playback Switch", 0, 1, 0, HDA_OUTPUT), 477 HDA_CODEC_MUTE_BEEP_MONO("Beep Playback Switch", 0, 1, 0, HDA_OUTPUT),
452 { } /* end */ 478 { } /* end */
@@ -456,12 +482,18 @@ static struct snd_kcontrol_new cxt_beep_mixer[] = {
456static const char * const slave_vols[] = { 482static const char * const slave_vols[] = {
457 "Headphone Playback Volume", 483 "Headphone Playback Volume",
458 "Speaker Playback Volume", 484 "Speaker Playback Volume",
485 "Front Playback Volume",
486 "Surround Playback Volume",
487 "CLFE Playback Volume",
459 NULL 488 NULL
460}; 489};
461 490
462static const char * const slave_sws[] = { 491static const char * const slave_sws[] = {
463 "Headphone Playback Switch", 492 "Headphone Playback Switch",
464 "Speaker Playback Switch", 493 "Speaker Playback Switch",
494 "Front Playback Switch",
495 "Surround Playback Switch",
496 "CLFE Playback Switch",
465 NULL 497 NULL
466}; 498};
467 499
@@ -521,7 +553,7 @@ static int conexant_build_controls(struct hda_codec *codec)
521#ifdef CONFIG_SND_HDA_INPUT_BEEP 553#ifdef CONFIG_SND_HDA_INPUT_BEEP
522 /* create beep controls if needed */ 554 /* create beep controls if needed */
523 if (spec->beep_amp) { 555 if (spec->beep_amp) {
524 struct snd_kcontrol_new *knew; 556 const struct snd_kcontrol_new *knew;
525 for (knew = cxt_beep_mixer; knew->name; knew++) { 557 for (knew = cxt_beep_mixer; knew->name; knew++) {
526 struct snd_kcontrol *kctl; 558 struct snd_kcontrol *kctl;
527 kctl = snd_ctl_new1(knew, codec); 559 kctl = snd_ctl_new1(knew, codec);
@@ -546,7 +578,7 @@ static int conexant_suspend(struct hda_codec *codec, pm_message_t state)
546} 578}
547#endif 579#endif
548 580
549static struct hda_codec_ops conexant_patch_ops = { 581static const struct hda_codec_ops conexant_patch_ops = {
550 .build_controls = conexant_build_controls, 582 .build_controls = conexant_build_controls,
551 .build_pcms = conexant_build_pcms, 583 .build_pcms = conexant_build_pcms,
552 .init = conexant_init, 584 .init = conexant_init,
@@ -564,6 +596,7 @@ static struct hda_codec_ops conexant_patch_ops = {
564#define set_beep_amp(spec, nid, idx, dir) /* NOP */ 596#define set_beep_amp(spec, nid, idx, dir) /* NOP */
565#endif 597#endif
566 598
599static int patch_conexant_auto(struct hda_codec *codec);
567/* 600/*
568 * EAPD control 601 * EAPD control
569 * the private value = nid | (invert << 8) 602 * the private value = nid | (invert << 8)
@@ -662,16 +695,16 @@ static int conexant_ch_mode_put(struct snd_kcontrol *kcontrol,
662 695
663/* Conexant 5045 specific */ 696/* Conexant 5045 specific */
664 697
665static hda_nid_t cxt5045_dac_nids[1] = { 0x19 }; 698static const hda_nid_t cxt5045_dac_nids[1] = { 0x19 };
666static hda_nid_t cxt5045_adc_nids[1] = { 0x1a }; 699static const hda_nid_t cxt5045_adc_nids[1] = { 0x1a };
667static hda_nid_t cxt5045_capsrc_nids[1] = { 0x1a }; 700static const hda_nid_t cxt5045_capsrc_nids[1] = { 0x1a };
668#define CXT5045_SPDIF_OUT 0x18 701#define CXT5045_SPDIF_OUT 0x18
669 702
670static struct hda_channel_mode cxt5045_modes[1] = { 703static const struct hda_channel_mode cxt5045_modes[1] = {
671 { 2, NULL }, 704 { 2, NULL },
672}; 705};
673 706
674static struct hda_input_mux cxt5045_capture_source = { 707static const struct hda_input_mux cxt5045_capture_source = {
675 .num_items = 2, 708 .num_items = 2,
676 .items = { 709 .items = {
677 { "IntMic", 0x1 }, 710 { "IntMic", 0x1 },
@@ -679,7 +712,7 @@ static struct hda_input_mux cxt5045_capture_source = {
679 } 712 }
680}; 713};
681 714
682static struct hda_input_mux cxt5045_capture_source_benq = { 715static const struct hda_input_mux cxt5045_capture_source_benq = {
683 .num_items = 5, 716 .num_items = 5,
684 .items = { 717 .items = {
685 { "IntMic", 0x1 }, 718 { "IntMic", 0x1 },
@@ -690,7 +723,7 @@ static struct hda_input_mux cxt5045_capture_source_benq = {
690 } 723 }
691}; 724};
692 725
693static struct hda_input_mux cxt5045_capture_source_hp530 = { 726static const struct hda_input_mux cxt5045_capture_source_hp530 = {
694 .num_items = 2, 727 .num_items = 2,
695 .items = { 728 .items = {
696 { "ExtMic", 0x1 }, 729 { "ExtMic", 0x1 },
@@ -723,7 +756,7 @@ static int cxt5045_hp_master_sw_put(struct snd_kcontrol *kcontrol,
723} 756}
724 757
725/* bind volumes of both NID 0x10 and 0x11 */ 758/* bind volumes of both NID 0x10 and 0x11 */
726static struct hda_bind_ctls cxt5045_hp_bind_master_vol = { 759static const struct hda_bind_ctls cxt5045_hp_bind_master_vol = {
727 .ops = &snd_hda_bind_vol, 760 .ops = &snd_hda_bind_vol,
728 .values = { 761 .values = {
729 HDA_COMPOSE_AMP_VAL(0x10, 3, 0, HDA_OUTPUT), 762 HDA_COMPOSE_AMP_VAL(0x10, 3, 0, HDA_OUTPUT),
@@ -735,12 +768,12 @@ static struct hda_bind_ctls cxt5045_hp_bind_master_vol = {
735/* toggle input of built-in and mic jack appropriately */ 768/* toggle input of built-in and mic jack appropriately */
736static void cxt5045_hp_automic(struct hda_codec *codec) 769static void cxt5045_hp_automic(struct hda_codec *codec)
737{ 770{
738 static struct hda_verb mic_jack_on[] = { 771 static const struct hda_verb mic_jack_on[] = {
739 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080}, 772 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080},
740 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, 773 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
741 {} 774 {}
742 }; 775 };
743 static struct hda_verb mic_jack_off[] = { 776 static const struct hda_verb mic_jack_off[] = {
744 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080}, 777 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080},
745 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, 778 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
746 {} 779 {}
@@ -784,7 +817,7 @@ static void cxt5045_hp_unsol_event(struct hda_codec *codec,
784 } 817 }
785} 818}
786 819
787static struct snd_kcontrol_new cxt5045_mixers[] = { 820static const struct snd_kcontrol_new cxt5045_mixers[] = {
788 HDA_CODEC_VOLUME("Internal Mic Capture Volume", 0x1a, 0x01, HDA_INPUT), 821 HDA_CODEC_VOLUME("Internal Mic Capture Volume", 0x1a, 0x01, HDA_INPUT),
789 HDA_CODEC_MUTE("Internal Mic Capture Switch", 0x1a, 0x01, HDA_INPUT), 822 HDA_CODEC_MUTE("Internal Mic Capture Switch", 0x1a, 0x01, HDA_INPUT),
790 HDA_CODEC_VOLUME("Mic Capture Volume", 0x1a, 0x02, HDA_INPUT), 823 HDA_CODEC_VOLUME("Mic Capture Volume", 0x1a, 0x02, HDA_INPUT),
@@ -808,7 +841,7 @@ static struct snd_kcontrol_new cxt5045_mixers[] = {
808 {} 841 {}
809}; 842};
810 843
811static struct snd_kcontrol_new cxt5045_benq_mixers[] = { 844static const struct snd_kcontrol_new cxt5045_benq_mixers[] = {
812 HDA_CODEC_VOLUME("CD Capture Volume", 0x1a, 0x04, HDA_INPUT), 845 HDA_CODEC_VOLUME("CD Capture Volume", 0x1a, 0x04, HDA_INPUT),
813 HDA_CODEC_MUTE("CD Capture Switch", 0x1a, 0x04, HDA_INPUT), 846 HDA_CODEC_MUTE("CD Capture Switch", 0x1a, 0x04, HDA_INPUT),
814 HDA_CODEC_VOLUME("CD Playback Volume", 0x17, 0x4, HDA_INPUT), 847 HDA_CODEC_VOLUME("CD Playback Volume", 0x17, 0x4, HDA_INPUT),
@@ -825,7 +858,7 @@ static struct snd_kcontrol_new cxt5045_benq_mixers[] = {
825 {} 858 {}
826}; 859};
827 860
828static struct snd_kcontrol_new cxt5045_mixers_hp530[] = { 861static const struct snd_kcontrol_new cxt5045_mixers_hp530[] = {
829 HDA_CODEC_VOLUME("Internal Mic Capture Volume", 0x1a, 0x02, HDA_INPUT), 862 HDA_CODEC_VOLUME("Internal Mic Capture Volume", 0x1a, 0x02, HDA_INPUT),
830 HDA_CODEC_MUTE("Internal Mic Capture Switch", 0x1a, 0x02, HDA_INPUT), 863 HDA_CODEC_MUTE("Internal Mic Capture Switch", 0x1a, 0x02, HDA_INPUT),
831 HDA_CODEC_VOLUME("Mic Capture Volume", 0x1a, 0x01, HDA_INPUT), 864 HDA_CODEC_VOLUME("Mic Capture Volume", 0x1a, 0x01, HDA_INPUT),
@@ -849,7 +882,7 @@ static struct snd_kcontrol_new cxt5045_mixers_hp530[] = {
849 {} 882 {}
850}; 883};
851 884
852static struct hda_verb cxt5045_init_verbs[] = { 885static const struct hda_verb cxt5045_init_verbs[] = {
853 /* Line in, Mic */ 886 /* Line in, Mic */
854 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN|AC_PINCTL_VREF_80 }, 887 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN|AC_PINCTL_VREF_80 },
855 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN|AC_PINCTL_VREF_80 }, 888 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN|AC_PINCTL_VREF_80 },
@@ -875,7 +908,7 @@ static struct hda_verb cxt5045_init_verbs[] = {
875 { } /* end */ 908 { } /* end */
876}; 909};
877 910
878static struct hda_verb cxt5045_benq_init_verbs[] = { 911static const struct hda_verb cxt5045_benq_init_verbs[] = {
879 /* Internal Mic, Mic */ 912 /* Internal Mic, Mic */
880 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN|AC_PINCTL_VREF_80 }, 913 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN|AC_PINCTL_VREF_80 },
881 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN|AC_PINCTL_VREF_80 }, 914 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN|AC_PINCTL_VREF_80 },
@@ -901,13 +934,13 @@ static struct hda_verb cxt5045_benq_init_verbs[] = {
901 { } /* end */ 934 { } /* end */
902}; 935};
903 936
904static struct hda_verb cxt5045_hp_sense_init_verbs[] = { 937static const struct hda_verb cxt5045_hp_sense_init_verbs[] = {
905 /* pin sensing on HP jack */ 938 /* pin sensing on HP jack */
906 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | CONEXANT_HP_EVENT}, 939 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | CONEXANT_HP_EVENT},
907 { } /* end */ 940 { } /* end */
908}; 941};
909 942
910static struct hda_verb cxt5045_mic_sense_init_verbs[] = { 943static const struct hda_verb cxt5045_mic_sense_init_verbs[] = {
911 /* pin sensing on HP jack */ 944 /* pin sensing on HP jack */
912 {0x12, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | CONEXANT_MIC_EVENT}, 945 {0x12, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | CONEXANT_MIC_EVENT},
913 { } /* end */ 946 { } /* end */
@@ -917,7 +950,7 @@ static struct hda_verb cxt5045_mic_sense_init_verbs[] = {
917/* Test configuration for debugging, modelled after the ALC260 test 950/* Test configuration for debugging, modelled after the ALC260 test
918 * configuration. 951 * configuration.
919 */ 952 */
920static struct hda_input_mux cxt5045_test_capture_source = { 953static const struct hda_input_mux cxt5045_test_capture_source = {
921 .num_items = 5, 954 .num_items = 5,
922 .items = { 955 .items = {
923 { "MIXER", 0x0 }, 956 { "MIXER", 0x0 },
@@ -928,7 +961,7 @@ static struct hda_input_mux cxt5045_test_capture_source = {
928 }, 961 },
929}; 962};
930 963
931static struct snd_kcontrol_new cxt5045_test_mixer[] = { 964static const struct snd_kcontrol_new cxt5045_test_mixer[] = {
932 965
933 /* Output controls */ 966 /* Output controls */
934 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x10, 0x0, HDA_OUTPUT), 967 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x10, 0x0, HDA_OUTPUT),
@@ -978,7 +1011,7 @@ static struct snd_kcontrol_new cxt5045_test_mixer[] = {
978 { } /* end */ 1011 { } /* end */
979}; 1012};
980 1013
981static struct hda_verb cxt5045_test_init_verbs[] = { 1014static const struct hda_verb cxt5045_test_init_verbs[] = {
982 /* Set connections */ 1015 /* Set connections */
983 { 0x10, AC_VERB_SET_CONNECT_SEL, 0x0 }, 1016 { 0x10, AC_VERB_SET_CONNECT_SEL, 0x0 },
984 { 0x11, AC_VERB_SET_CONNECT_SEL, 0x0 }, 1017 { 0x11, AC_VERB_SET_CONNECT_SEL, 0x0 },
@@ -1047,6 +1080,7 @@ enum {
1047#ifdef CONFIG_SND_DEBUG 1080#ifdef CONFIG_SND_DEBUG
1048 CXT5045_TEST, 1081 CXT5045_TEST,
1049#endif 1082#endif
1083 CXT5045_AUTO,
1050 CXT5045_MODELS 1084 CXT5045_MODELS
1051}; 1085};
1052 1086
@@ -1059,9 +1093,10 @@ static const char * const cxt5045_models[CXT5045_MODELS] = {
1059#ifdef CONFIG_SND_DEBUG 1093#ifdef CONFIG_SND_DEBUG
1060 [CXT5045_TEST] = "test", 1094 [CXT5045_TEST] = "test",
1061#endif 1095#endif
1096 [CXT5045_AUTO] = "auto",
1062}; 1097};
1063 1098
1064static struct snd_pci_quirk cxt5045_cfg_tbl[] = { 1099static const struct snd_pci_quirk cxt5045_cfg_tbl[] = {
1065 SND_PCI_QUIRK(0x103c, 0x30d5, "HP 530", CXT5045_LAPTOP_HP530), 1100 SND_PCI_QUIRK(0x103c, 0x30d5, "HP 530", CXT5045_LAPTOP_HP530),
1066 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP DV Series", 1101 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP DV Series",
1067 CXT5045_LAPTOP_HPSENSE), 1102 CXT5045_LAPTOP_HPSENSE),
@@ -1085,6 +1120,16 @@ static int patch_cxt5045(struct hda_codec *codec)
1085 struct conexant_spec *spec; 1120 struct conexant_spec *spec;
1086 int board_config; 1121 int board_config;
1087 1122
1123 board_config = snd_hda_check_board_config(codec, CXT5045_MODELS,
1124 cxt5045_models,
1125 cxt5045_cfg_tbl);
1126#if 0 /* use the old method just for safety */
1127 if (board_config < 0)
1128 board_config = CXT5045_AUTO;
1129#endif
1130 if (board_config == CXT5045_AUTO)
1131 return patch_conexant_auto(codec);
1132
1088 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 1133 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1089 if (!spec) 1134 if (!spec)
1090 return -ENOMEM; 1135 return -ENOMEM;
@@ -1111,9 +1156,6 @@ static int patch_cxt5045(struct hda_codec *codec)
1111 1156
1112 codec->patch_ops = conexant_patch_ops; 1157 codec->patch_ops = conexant_patch_ops;
1113 1158
1114 board_config = snd_hda_check_board_config(codec, CXT5045_MODELS,
1115 cxt5045_models,
1116 cxt5045_cfg_tbl);
1117 switch (board_config) { 1159 switch (board_config) {
1118 case CXT5045_LAPTOP_HPSENSE: 1160 case CXT5045_LAPTOP_HPSENSE:
1119 codec->patch_ops.unsol_event = cxt5045_hp_unsol_event; 1161 codec->patch_ops.unsol_event = cxt5045_hp_unsol_event;
@@ -1196,15 +1238,15 @@ static int patch_cxt5045(struct hda_codec *codec)
1196/* Conexant 5047 specific */ 1238/* Conexant 5047 specific */
1197#define CXT5047_SPDIF_OUT 0x11 1239#define CXT5047_SPDIF_OUT 0x11
1198 1240
1199static hda_nid_t cxt5047_dac_nids[1] = { 0x10 }; /* 0x1c */ 1241static const hda_nid_t cxt5047_dac_nids[1] = { 0x10 }; /* 0x1c */
1200static hda_nid_t cxt5047_adc_nids[1] = { 0x12 }; 1242static const hda_nid_t cxt5047_adc_nids[1] = { 0x12 };
1201static hda_nid_t cxt5047_capsrc_nids[1] = { 0x1a }; 1243static const hda_nid_t cxt5047_capsrc_nids[1] = { 0x1a };
1202 1244
1203static struct hda_channel_mode cxt5047_modes[1] = { 1245static const struct hda_channel_mode cxt5047_modes[1] = {
1204 { 2, NULL }, 1246 { 2, NULL },
1205}; 1247};
1206 1248
1207static struct hda_input_mux cxt5047_toshiba_capture_source = { 1249static const struct hda_input_mux cxt5047_toshiba_capture_source = {
1208 .num_items = 2, 1250 .num_items = 2,
1209 .items = { 1251 .items = {
1210 { "ExtMic", 0x2 }, 1252 { "ExtMic", 0x2 },
@@ -1256,12 +1298,12 @@ static void cxt5047_hp_automute(struct hda_codec *codec)
1256/* toggle input of built-in and mic jack appropriately */ 1298/* toggle input of built-in and mic jack appropriately */
1257static void cxt5047_hp_automic(struct hda_codec *codec) 1299static void cxt5047_hp_automic(struct hda_codec *codec)
1258{ 1300{
1259 static struct hda_verb mic_jack_on[] = { 1301 static const struct hda_verb mic_jack_on[] = {
1260 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 1302 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1261 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1303 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1262 {} 1304 {}
1263 }; 1305 };
1264 static struct hda_verb mic_jack_off[] = { 1306 static const struct hda_verb mic_jack_off[] = {
1265 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 1307 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1266 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1308 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1267 {} 1309 {}
@@ -1289,7 +1331,7 @@ static void cxt5047_hp_unsol_event(struct hda_codec *codec,
1289 } 1331 }
1290} 1332}
1291 1333
1292static struct snd_kcontrol_new cxt5047_base_mixers[] = { 1334static const struct snd_kcontrol_new cxt5047_base_mixers[] = {
1293 HDA_CODEC_VOLUME("Mic Playback Volume", 0x19, 0x02, HDA_INPUT), 1335 HDA_CODEC_VOLUME("Mic Playback Volume", 0x19, 0x02, HDA_INPUT),
1294 HDA_CODEC_MUTE("Mic Playback Switch", 0x19, 0x02, HDA_INPUT), 1336 HDA_CODEC_MUTE("Mic Playback Switch", 0x19, 0x02, HDA_INPUT),
1295 HDA_CODEC_VOLUME("Mic Boost Volume", 0x1a, 0x0, HDA_OUTPUT), 1337 HDA_CODEC_VOLUME("Mic Boost Volume", 0x1a, 0x0, HDA_OUTPUT),
@@ -1309,19 +1351,19 @@ static struct snd_kcontrol_new cxt5047_base_mixers[] = {
1309 {} 1351 {}
1310}; 1352};
1311 1353
1312static struct snd_kcontrol_new cxt5047_hp_spk_mixers[] = { 1354static const struct snd_kcontrol_new cxt5047_hp_spk_mixers[] = {
1313 /* See the note in cxt5047_hp_master_sw_put */ 1355 /* See the note in cxt5047_hp_master_sw_put */
1314 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x1d, 0x01, HDA_OUTPUT), 1356 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x1d, 0x01, HDA_OUTPUT),
1315 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x13, 0x00, HDA_OUTPUT), 1357 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x13, 0x00, HDA_OUTPUT),
1316 {} 1358 {}
1317}; 1359};
1318 1360
1319static struct snd_kcontrol_new cxt5047_hp_only_mixers[] = { 1361static const struct snd_kcontrol_new cxt5047_hp_only_mixers[] = {
1320 HDA_CODEC_VOLUME("Master Playback Volume", 0x13, 0x00, HDA_OUTPUT), 1362 HDA_CODEC_VOLUME("Master Playback Volume", 0x13, 0x00, HDA_OUTPUT),
1321 { } /* end */ 1363 { } /* end */
1322}; 1364};
1323 1365
1324static struct hda_verb cxt5047_init_verbs[] = { 1366static const struct hda_verb cxt5047_init_verbs[] = {
1325 /* Line in, Mic, Built-in Mic */ 1367 /* Line in, Mic, Built-in Mic */
1326 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, 1368 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1327 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN|AC_PINCTL_VREF_50 }, 1369 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN|AC_PINCTL_VREF_50 },
@@ -1348,7 +1390,7 @@ static struct hda_verb cxt5047_init_verbs[] = {
1348}; 1390};
1349 1391
1350/* configuration for Toshiba Laptops */ 1392/* configuration for Toshiba Laptops */
1351static struct hda_verb cxt5047_toshiba_init_verbs[] = { 1393static const struct hda_verb cxt5047_toshiba_init_verbs[] = {
1352 {0x13, AC_VERB_SET_EAPD_BTLENABLE, 0x0}, /* default off */ 1394 {0x13, AC_VERB_SET_EAPD_BTLENABLE, 0x0}, /* default off */
1353 {} 1395 {}
1354}; 1396};
@@ -1357,7 +1399,7 @@ static struct hda_verb cxt5047_toshiba_init_verbs[] = {
1357 * configuration. 1399 * configuration.
1358 */ 1400 */
1359#ifdef CONFIG_SND_DEBUG 1401#ifdef CONFIG_SND_DEBUG
1360static struct hda_input_mux cxt5047_test_capture_source = { 1402static const struct hda_input_mux cxt5047_test_capture_source = {
1361 .num_items = 4, 1403 .num_items = 4,
1362 .items = { 1404 .items = {
1363 { "LINE1 pin", 0x0 }, 1405 { "LINE1 pin", 0x0 },
@@ -1367,7 +1409,7 @@ static struct hda_input_mux cxt5047_test_capture_source = {
1367 }, 1409 },
1368}; 1410};
1369 1411
1370static struct snd_kcontrol_new cxt5047_test_mixer[] = { 1412static const struct snd_kcontrol_new cxt5047_test_mixer[] = {
1371 1413
1372 /* Output only controls */ 1414 /* Output only controls */
1373 HDA_CODEC_VOLUME("OutAmp-1 Volume", 0x10, 0x0, HDA_OUTPUT), 1415 HDA_CODEC_VOLUME("OutAmp-1 Volume", 0x10, 0x0, HDA_OUTPUT),
@@ -1420,7 +1462,7 @@ static struct snd_kcontrol_new cxt5047_test_mixer[] = {
1420 { } /* end */ 1462 { } /* end */
1421}; 1463};
1422 1464
1423static struct hda_verb cxt5047_test_init_verbs[] = { 1465static const struct hda_verb cxt5047_test_init_verbs[] = {
1424 /* Enable retasking pins as output, initially without power amp */ 1466 /* Enable retasking pins as output, initially without power amp */
1425 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1467 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1426 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1468 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
@@ -1492,6 +1534,7 @@ enum {
1492#ifdef CONFIG_SND_DEBUG 1534#ifdef CONFIG_SND_DEBUG
1493 CXT5047_TEST, 1535 CXT5047_TEST,
1494#endif 1536#endif
1537 CXT5047_AUTO,
1495 CXT5047_MODELS 1538 CXT5047_MODELS
1496}; 1539};
1497 1540
@@ -1502,9 +1545,10 @@ static const char * const cxt5047_models[CXT5047_MODELS] = {
1502#ifdef CONFIG_SND_DEBUG 1545#ifdef CONFIG_SND_DEBUG
1503 [CXT5047_TEST] = "test", 1546 [CXT5047_TEST] = "test",
1504#endif 1547#endif
1548 [CXT5047_AUTO] = "auto",
1505}; 1549};
1506 1550
1507static struct snd_pci_quirk cxt5047_cfg_tbl[] = { 1551static const struct snd_pci_quirk cxt5047_cfg_tbl[] = {
1508 SND_PCI_QUIRK(0x103c, 0x30a5, "HP DV5200T/DV8000T", CXT5047_LAPTOP_HP), 1552 SND_PCI_QUIRK(0x103c, 0x30a5, "HP DV5200T/DV8000T", CXT5047_LAPTOP_HP),
1509 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP DV Series", 1553 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP DV Series",
1510 CXT5047_LAPTOP), 1554 CXT5047_LAPTOP),
@@ -1517,6 +1561,16 @@ static int patch_cxt5047(struct hda_codec *codec)
1517 struct conexant_spec *spec; 1561 struct conexant_spec *spec;
1518 int board_config; 1562 int board_config;
1519 1563
1564 board_config = snd_hda_check_board_config(codec, CXT5047_MODELS,
1565 cxt5047_models,
1566 cxt5047_cfg_tbl);
1567#if 0 /* not enabled as default, as BIOS often broken for this codec */
1568 if (board_config < 0)
1569 board_config = CXT5047_AUTO;
1570#endif
1571 if (board_config == CXT5047_AUTO)
1572 return patch_conexant_auto(codec);
1573
1520 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 1574 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1521 if (!spec) 1575 if (!spec)
1522 return -ENOMEM; 1576 return -ENOMEM;
@@ -1540,9 +1594,6 @@ static int patch_cxt5047(struct hda_codec *codec)
1540 1594
1541 codec->patch_ops = conexant_patch_ops; 1595 codec->patch_ops = conexant_patch_ops;
1542 1596
1543 board_config = snd_hda_check_board_config(codec, CXT5047_MODELS,
1544 cxt5047_models,
1545 cxt5047_cfg_tbl);
1546 switch (board_config) { 1597 switch (board_config) {
1547 case CXT5047_LAPTOP: 1598 case CXT5047_LAPTOP:
1548 spec->num_mixers = 2; 1599 spec->num_mixers = 2;
@@ -1591,10 +1642,10 @@ static int patch_cxt5047(struct hda_codec *codec)
1591} 1642}
1592 1643
1593/* Conexant 5051 specific */ 1644/* Conexant 5051 specific */
1594static hda_nid_t cxt5051_dac_nids[1] = { 0x10 }; 1645static const hda_nid_t cxt5051_dac_nids[1] = { 0x10 };
1595static hda_nid_t cxt5051_adc_nids[2] = { 0x14, 0x15 }; 1646static const hda_nid_t cxt5051_adc_nids[2] = { 0x14, 0x15 };
1596 1647
1597static struct hda_channel_mode cxt5051_modes[1] = { 1648static const struct hda_channel_mode cxt5051_modes[1] = {
1598 { 2, NULL }, 1649 { 2, NULL },
1599}; 1650};
1600 1651
@@ -1696,7 +1747,7 @@ static void cxt5051_hp_unsol_event(struct hda_codec *codec,
1696 snd_hda_input_jack_report(codec, nid); 1747 snd_hda_input_jack_report(codec, nid);
1697} 1748}
1698 1749
1699static struct snd_kcontrol_new cxt5051_playback_mixers[] = { 1750static const struct snd_kcontrol_new cxt5051_playback_mixers[] = {
1700 HDA_CODEC_VOLUME("Master Playback Volume", 0x10, 0x00, HDA_OUTPUT), 1751 HDA_CODEC_VOLUME("Master Playback Volume", 0x10, 0x00, HDA_OUTPUT),
1701 { 1752 {
1702 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1753 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -1709,7 +1760,7 @@ static struct snd_kcontrol_new cxt5051_playback_mixers[] = {
1709 {} 1760 {}
1710}; 1761};
1711 1762
1712static struct snd_kcontrol_new cxt5051_capture_mixers[] = { 1763static const struct snd_kcontrol_new cxt5051_capture_mixers[] = {
1713 HDA_CODEC_VOLUME("Internal Mic Volume", 0x14, 0x00, HDA_INPUT), 1764 HDA_CODEC_VOLUME("Internal Mic Volume", 0x14, 0x00, HDA_INPUT),
1714 HDA_CODEC_MUTE("Internal Mic Switch", 0x14, 0x00, HDA_INPUT), 1765 HDA_CODEC_MUTE("Internal Mic Switch", 0x14, 0x00, HDA_INPUT),
1715 HDA_CODEC_VOLUME("Mic Volume", 0x14, 0x01, HDA_INPUT), 1766 HDA_CODEC_VOLUME("Mic Volume", 0x14, 0x01, HDA_INPUT),
@@ -1719,7 +1770,7 @@ static struct snd_kcontrol_new cxt5051_capture_mixers[] = {
1719 {} 1770 {}
1720}; 1771};
1721 1772
1722static struct snd_kcontrol_new cxt5051_hp_mixers[] = { 1773static const struct snd_kcontrol_new cxt5051_hp_mixers[] = {
1723 HDA_CODEC_VOLUME("Internal Mic Volume", 0x14, 0x00, HDA_INPUT), 1774 HDA_CODEC_VOLUME("Internal Mic Volume", 0x14, 0x00, HDA_INPUT),
1724 HDA_CODEC_MUTE("Internal Mic Switch", 0x14, 0x00, HDA_INPUT), 1775 HDA_CODEC_MUTE("Internal Mic Switch", 0x14, 0x00, HDA_INPUT),
1725 HDA_CODEC_VOLUME("Mic Volume", 0x15, 0x00, HDA_INPUT), 1776 HDA_CODEC_VOLUME("Mic Volume", 0x15, 0x00, HDA_INPUT),
@@ -1727,19 +1778,19 @@ static struct snd_kcontrol_new cxt5051_hp_mixers[] = {
1727 {} 1778 {}
1728}; 1779};
1729 1780
1730static struct snd_kcontrol_new cxt5051_hp_dv6736_mixers[] = { 1781static const struct snd_kcontrol_new cxt5051_hp_dv6736_mixers[] = {
1731 HDA_CODEC_VOLUME("Capture Volume", 0x14, 0x00, HDA_INPUT), 1782 HDA_CODEC_VOLUME("Capture Volume", 0x14, 0x00, HDA_INPUT),
1732 HDA_CODEC_MUTE("Capture Switch", 0x14, 0x00, HDA_INPUT), 1783 HDA_CODEC_MUTE("Capture Switch", 0x14, 0x00, HDA_INPUT),
1733 {} 1784 {}
1734}; 1785};
1735 1786
1736static struct snd_kcontrol_new cxt5051_f700_mixers[] = { 1787static const struct snd_kcontrol_new cxt5051_f700_mixers[] = {
1737 HDA_CODEC_VOLUME("Capture Volume", 0x14, 0x01, HDA_INPUT), 1788 HDA_CODEC_VOLUME("Capture Volume", 0x14, 0x01, HDA_INPUT),
1738 HDA_CODEC_MUTE("Capture Switch", 0x14, 0x01, HDA_INPUT), 1789 HDA_CODEC_MUTE("Capture Switch", 0x14, 0x01, HDA_INPUT),
1739 {} 1790 {}
1740}; 1791};
1741 1792
1742static struct snd_kcontrol_new cxt5051_toshiba_mixers[] = { 1793static const struct snd_kcontrol_new cxt5051_toshiba_mixers[] = {
1743 HDA_CODEC_VOLUME("Internal Mic Volume", 0x14, 0x00, HDA_INPUT), 1794 HDA_CODEC_VOLUME("Internal Mic Volume", 0x14, 0x00, HDA_INPUT),
1744 HDA_CODEC_MUTE("Internal Mic Switch", 0x14, 0x00, HDA_INPUT), 1795 HDA_CODEC_MUTE("Internal Mic Switch", 0x14, 0x00, HDA_INPUT),
1745 HDA_CODEC_VOLUME("Mic Volume", 0x14, 0x01, HDA_INPUT), 1796 HDA_CODEC_VOLUME("Mic Volume", 0x14, 0x01, HDA_INPUT),
@@ -1747,7 +1798,7 @@ static struct snd_kcontrol_new cxt5051_toshiba_mixers[] = {
1747 {} 1798 {}
1748}; 1799};
1749 1800
1750static struct hda_verb cxt5051_init_verbs[] = { 1801static const struct hda_verb cxt5051_init_verbs[] = {
1751 /* Line in, Mic */ 1802 /* Line in, Mic */
1752 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03}, 1803 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03},
1753 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1804 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
@@ -1776,7 +1827,7 @@ static struct hda_verb cxt5051_init_verbs[] = {
1776 { } /* end */ 1827 { } /* end */
1777}; 1828};
1778 1829
1779static struct hda_verb cxt5051_hp_dv6736_init_verbs[] = { 1830static const struct hda_verb cxt5051_hp_dv6736_init_verbs[] = {
1780 /* Line in, Mic */ 1831 /* Line in, Mic */
1781 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03}, 1832 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03},
1782 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1833 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
@@ -1801,7 +1852,7 @@ static struct hda_verb cxt5051_hp_dv6736_init_verbs[] = {
1801 { } /* end */ 1852 { } /* end */
1802}; 1853};
1803 1854
1804static struct hda_verb cxt5051_lenovo_x200_init_verbs[] = { 1855static const struct hda_verb cxt5051_lenovo_x200_init_verbs[] = {
1805 /* Line in, Mic */ 1856 /* Line in, Mic */
1806 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03}, 1857 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03},
1807 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1858 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
@@ -1834,7 +1885,7 @@ static struct hda_verb cxt5051_lenovo_x200_init_verbs[] = {
1834 { } /* end */ 1885 { } /* end */
1835}; 1886};
1836 1887
1837static struct hda_verb cxt5051_f700_init_verbs[] = { 1888static const struct hda_verb cxt5051_f700_init_verbs[] = {
1838 /* Line in, Mic */ 1889 /* Line in, Mic */
1839 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03}, 1890 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03},
1840 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1891 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
@@ -1869,7 +1920,7 @@ static void cxt5051_init_mic_port(struct hda_codec *codec, hda_nid_t nid,
1869 snd_hda_input_jack_report(codec, nid); 1920 snd_hda_input_jack_report(codec, nid);
1870} 1921}
1871 1922
1872static struct hda_verb cxt5051_ideapad_init_verbs[] = { 1923static const struct hda_verb cxt5051_ideapad_init_verbs[] = {
1873 /* Subwoofer */ 1924 /* Subwoofer */
1874 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1925 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1875 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, 1926 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
@@ -1906,6 +1957,7 @@ enum {
1906 CXT5051_F700, /* HP Compaq Presario F700 */ 1957 CXT5051_F700, /* HP Compaq Presario F700 */
1907 CXT5051_TOSHIBA, /* Toshiba M300 & co */ 1958 CXT5051_TOSHIBA, /* Toshiba M300 & co */
1908 CXT5051_IDEAPAD, /* Lenovo IdeaPad Y430 */ 1959 CXT5051_IDEAPAD, /* Lenovo IdeaPad Y430 */
1960 CXT5051_AUTO, /* auto-parser */
1909 CXT5051_MODELS 1961 CXT5051_MODELS
1910}; 1962};
1911 1963
@@ -1917,9 +1969,10 @@ static const char *const cxt5051_models[CXT5051_MODELS] = {
1917 [CXT5051_F700] = "hp-700", 1969 [CXT5051_F700] = "hp-700",
1918 [CXT5051_TOSHIBA] = "toshiba", 1970 [CXT5051_TOSHIBA] = "toshiba",
1919 [CXT5051_IDEAPAD] = "ideapad", 1971 [CXT5051_IDEAPAD] = "ideapad",
1972 [CXT5051_AUTO] = "auto",
1920}; 1973};
1921 1974
1922static struct snd_pci_quirk cxt5051_cfg_tbl[] = { 1975static const struct snd_pci_quirk cxt5051_cfg_tbl[] = {
1923 SND_PCI_QUIRK(0x103c, 0x30cf, "HP DV6736", CXT5051_HP_DV6736), 1976 SND_PCI_QUIRK(0x103c, 0x30cf, "HP DV6736", CXT5051_HP_DV6736),
1924 SND_PCI_QUIRK(0x103c, 0x360b, "Compaq Presario CQ60", CXT5051_HP), 1977 SND_PCI_QUIRK(0x103c, 0x360b, "Compaq Presario CQ60", CXT5051_HP),
1925 SND_PCI_QUIRK(0x103c, 0x30ea, "Compaq Presario F700", CXT5051_F700), 1978 SND_PCI_QUIRK(0x103c, 0x30ea, "Compaq Presario F700", CXT5051_F700),
@@ -1937,6 +1990,16 @@ static int patch_cxt5051(struct hda_codec *codec)
1937 struct conexant_spec *spec; 1990 struct conexant_spec *spec;
1938 int board_config; 1991 int board_config;
1939 1992
1993 board_config = snd_hda_check_board_config(codec, CXT5051_MODELS,
1994 cxt5051_models,
1995 cxt5051_cfg_tbl);
1996#if 0 /* use the old method just for safety */
1997 if (board_config < 0)
1998 board_config = CXT5051_AUTO;
1999#endif
2000 if (board_config == CXT5051_AUTO)
2001 return patch_conexant_auto(codec);
2002
1940 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 2003 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1941 if (!spec) 2004 if (!spec)
1942 return -ENOMEM; 2005 return -ENOMEM;
@@ -1967,9 +2030,6 @@ static int patch_cxt5051(struct hda_codec *codec)
1967 2030
1968 codec->patch_ops.unsol_event = cxt5051_hp_unsol_event; 2031 codec->patch_ops.unsol_event = cxt5051_hp_unsol_event;
1969 2032
1970 board_config = snd_hda_check_board_config(codec, CXT5051_MODELS,
1971 cxt5051_models,
1972 cxt5051_cfg_tbl);
1973 spec->auto_mic = AUTO_MIC_PORTB | AUTO_MIC_PORTC; 2033 spec->auto_mic = AUTO_MIC_PORTB | AUTO_MIC_PORTC;
1974 switch (board_config) { 2034 switch (board_config) {
1975 case CXT5051_HP: 2035 case CXT5051_HP:
@@ -2011,17 +2071,17 @@ static int patch_cxt5051(struct hda_codec *codec)
2011 2071
2012/* Conexant 5066 specific */ 2072/* Conexant 5066 specific */
2013 2073
2014static hda_nid_t cxt5066_dac_nids[1] = { 0x10 }; 2074static const hda_nid_t cxt5066_dac_nids[1] = { 0x10 };
2015static hda_nid_t cxt5066_adc_nids[3] = { 0x14, 0x15, 0x16 }; 2075static const hda_nid_t cxt5066_adc_nids[3] = { 0x14, 0x15, 0x16 };
2016static hda_nid_t cxt5066_capsrc_nids[1] = { 0x17 }; 2076static const hda_nid_t cxt5066_capsrc_nids[1] = { 0x17 };
2017static hda_nid_t cxt5066_digout_pin_nids[2] = { 0x20, 0x22 }; 2077static const hda_nid_t cxt5066_digout_pin_nids[2] = { 0x20, 0x22 };
2018 2078
2019/* OLPC's microphone port is DC coupled for use with external sensors, 2079/* OLPC's microphone port is DC coupled for use with external sensors,
2020 * therefore we use a 50% mic bias in order to center the input signal with 2080 * therefore we use a 50% mic bias in order to center the input signal with
2021 * the DC input range of the codec. */ 2081 * the DC input range of the codec. */
2022#define CXT5066_OLPC_EXT_MIC_BIAS PIN_VREF50 2082#define CXT5066_OLPC_EXT_MIC_BIAS PIN_VREF50
2023 2083
2024static struct hda_channel_mode cxt5066_modes[1] = { 2084static const struct hda_channel_mode cxt5066_modes[1] = {
2025 { 2, NULL }, 2085 { 2, NULL },
2026}; 2086};
2027 2087
@@ -2176,7 +2236,7 @@ static void cxt5066_vostro_automic(struct hda_codec *codec)
2176 {0x23, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, 2236 {0x23, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
2177 {} 2237 {}
2178 }; 2238 };
2179 static struct hda_verb ext_mic_absent[] = { 2239 static const struct hda_verb ext_mic_absent[] = {
2180 /* enable internal mic, port C */ 2240 /* enable internal mic, port C */
2181 {0x23, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 2241 {0x23, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2182 2242
@@ -2209,7 +2269,7 @@ static void cxt5066_ideapad_automic(struct hda_codec *codec)
2209 {0x23, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, 2269 {0x23, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
2210 {} 2270 {}
2211 }; 2271 };
2212 static struct hda_verb ext_mic_absent[] = { 2272 static const struct hda_verb ext_mic_absent[] = {
2213 {0x14, AC_VERB_SET_CONNECT_SEL, 2}, 2273 {0x14, AC_VERB_SET_CONNECT_SEL, 2},
2214 {0x23, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 2274 {0x23, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2215 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, 2275 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
@@ -2257,7 +2317,7 @@ static void cxt5066_thinkpad_automic(struct hda_codec *codec)
2257{ 2317{
2258 unsigned int ext_present, dock_present; 2318 unsigned int ext_present, dock_present;
2259 2319
2260 static struct hda_verb ext_mic_present[] = { 2320 static const struct hda_verb ext_mic_present[] = {
2261 {0x14, AC_VERB_SET_CONNECT_SEL, 0}, 2321 {0x14, AC_VERB_SET_CONNECT_SEL, 0},
2262 {0x17, AC_VERB_SET_CONNECT_SEL, 1}, 2322 {0x17, AC_VERB_SET_CONNECT_SEL, 1},
2263 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 2323 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
@@ -2265,7 +2325,7 @@ static void cxt5066_thinkpad_automic(struct hda_codec *codec)
2265 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, 2325 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
2266 {} 2326 {}
2267 }; 2327 };
2268 static struct hda_verb dock_mic_present[] = { 2328 static const struct hda_verb dock_mic_present[] = {
2269 {0x14, AC_VERB_SET_CONNECT_SEL, 0}, 2329 {0x14, AC_VERB_SET_CONNECT_SEL, 0},
2270 {0x17, AC_VERB_SET_CONNECT_SEL, 0}, 2330 {0x17, AC_VERB_SET_CONNECT_SEL, 0},
2271 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 2331 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
@@ -2273,7 +2333,7 @@ static void cxt5066_thinkpad_automic(struct hda_codec *codec)
2273 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, 2333 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
2274 {} 2334 {}
2275 }; 2335 };
2276 static struct hda_verb ext_mic_absent[] = { 2336 static const struct hda_verb ext_mic_absent[] = {
2277 {0x14, AC_VERB_SET_CONNECT_SEL, 2}, 2337 {0x14, AC_VERB_SET_CONNECT_SEL, 2},
2278 {0x23, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 2338 {0x23, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2279 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, 2339 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
@@ -2537,7 +2597,7 @@ static void cxt5066_olpc_capture_cleanup(struct hda_codec *codec)
2537} 2597}
2538 2598
2539static void conexant_check_dig_outs(struct hda_codec *codec, 2599static void conexant_check_dig_outs(struct hda_codec *codec,
2540 hda_nid_t *dig_pins, 2600 const hda_nid_t *dig_pins,
2541 int num_pins) 2601 int num_pins)
2542{ 2602{
2543 struct conexant_spec *spec = codec->spec; 2603 struct conexant_spec *spec = codec->spec;
@@ -2557,7 +2617,7 @@ static void conexant_check_dig_outs(struct hda_codec *codec,
2557 } 2617 }
2558} 2618}
2559 2619
2560static struct hda_input_mux cxt5066_capture_source = { 2620static const struct hda_input_mux cxt5066_capture_source = {
2561 .num_items = 4, 2621 .num_items = 4,
2562 .items = { 2622 .items = {
2563 { "Mic B", 0 }, 2623 { "Mic B", 0 },
@@ -2567,7 +2627,7 @@ static struct hda_input_mux cxt5066_capture_source = {
2567 }, 2627 },
2568}; 2628};
2569 2629
2570static struct hda_bind_ctls cxt5066_bind_capture_vol_others = { 2630static const struct hda_bind_ctls cxt5066_bind_capture_vol_others = {
2571 .ops = &snd_hda_bind_vol, 2631 .ops = &snd_hda_bind_vol,
2572 .values = { 2632 .values = {
2573 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_INPUT), 2633 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_INPUT),
@@ -2576,7 +2636,7 @@ static struct hda_bind_ctls cxt5066_bind_capture_vol_others = {
2576 }, 2636 },
2577}; 2637};
2578 2638
2579static struct hda_bind_ctls cxt5066_bind_capture_sw_others = { 2639static const struct hda_bind_ctls cxt5066_bind_capture_sw_others = {
2580 .ops = &snd_hda_bind_sw, 2640 .ops = &snd_hda_bind_sw,
2581 .values = { 2641 .values = {
2582 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_INPUT), 2642 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_INPUT),
@@ -2585,12 +2645,12 @@ static struct hda_bind_ctls cxt5066_bind_capture_sw_others = {
2585 }, 2645 },
2586}; 2646};
2587 2647
2588static struct snd_kcontrol_new cxt5066_mixer_master[] = { 2648static const struct snd_kcontrol_new cxt5066_mixer_master[] = {
2589 HDA_CODEC_VOLUME("Master Playback Volume", 0x10, 0x00, HDA_OUTPUT), 2649 HDA_CODEC_VOLUME("Master Playback Volume", 0x10, 0x00, HDA_OUTPUT),
2590 {} 2650 {}
2591}; 2651};
2592 2652
2593static struct snd_kcontrol_new cxt5066_mixer_master_olpc[] = { 2653static const struct snd_kcontrol_new cxt5066_mixer_master_olpc[] = {
2594 { 2654 {
2595 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2655 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2596 .name = "Master Playback Volume", 2656 .name = "Master Playback Volume",
@@ -2609,7 +2669,7 @@ static struct snd_kcontrol_new cxt5066_mixer_master_olpc[] = {
2609 {} 2669 {}
2610}; 2670};
2611 2671
2612static struct snd_kcontrol_new cxt5066_mixer_olpc_dc[] = { 2672static const struct snd_kcontrol_new cxt5066_mixer_olpc_dc[] = {
2613 { 2673 {
2614 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2674 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2615 .name = "DC Mode Enable Switch", 2675 .name = "DC Mode Enable Switch",
@@ -2627,7 +2687,7 @@ static struct snd_kcontrol_new cxt5066_mixer_olpc_dc[] = {
2627 {} 2687 {}
2628}; 2688};
2629 2689
2630static struct snd_kcontrol_new cxt5066_mixers[] = { 2690static const struct snd_kcontrol_new cxt5066_mixers[] = {
2631 { 2691 {
2632 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2692 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2633 .name = "Master Playback Switch", 2693 .name = "Master Playback Switch",
@@ -2650,7 +2710,7 @@ static struct snd_kcontrol_new cxt5066_mixers[] = {
2650 {} 2710 {}
2651}; 2711};
2652 2712
2653static struct snd_kcontrol_new cxt5066_vostro_mixers[] = { 2713static const struct snd_kcontrol_new cxt5066_vostro_mixers[] = {
2654 { 2714 {
2655 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2715 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2656 .name = "Internal Mic Boost Capture Enum", 2716 .name = "Internal Mic Boost Capture Enum",
@@ -2662,7 +2722,7 @@ static struct snd_kcontrol_new cxt5066_vostro_mixers[] = {
2662 {} 2722 {}
2663}; 2723};
2664 2724
2665static struct hda_verb cxt5066_init_verbs[] = { 2725static const struct hda_verb cxt5066_init_verbs[] = {
2666 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port B */ 2726 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port B */
2667 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port C */ 2727 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port C */
2668 {0x1e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Port F */ 2728 {0x1e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Port F */
@@ -2717,7 +2777,7 @@ static struct hda_verb cxt5066_init_verbs[] = {
2717 { } /* end */ 2777 { } /* end */
2718}; 2778};
2719 2779
2720static struct hda_verb cxt5066_init_verbs_olpc[] = { 2780static const struct hda_verb cxt5066_init_verbs_olpc[] = {
2721 /* Port A: headphones */ 2781 /* Port A: headphones */
2722 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 2782 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2723 {0x19, AC_VERB_SET_CONNECT_SEL, 0x00}, /* DAC1 */ 2783 {0x19, AC_VERB_SET_CONNECT_SEL, 0x00}, /* DAC1 */
@@ -2778,7 +2838,7 @@ static struct hda_verb cxt5066_init_verbs_olpc[] = {
2778 { } /* end */ 2838 { } /* end */
2779}; 2839};
2780 2840
2781static struct hda_verb cxt5066_init_verbs_vostro[] = { 2841static const struct hda_verb cxt5066_init_verbs_vostro[] = {
2782 /* Port A: headphones */ 2842 /* Port A: headphones */
2783 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, 2843 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
2784 {0x19, AC_VERB_SET_CONNECT_SEL, 0x00}, /* DAC1 */ 2844 {0x19, AC_VERB_SET_CONNECT_SEL, 0x00}, /* DAC1 */
@@ -2839,7 +2899,7 @@ static struct hda_verb cxt5066_init_verbs_vostro[] = {
2839 { } /* end */ 2899 { } /* end */
2840}; 2900};
2841 2901
2842static struct hda_verb cxt5066_init_verbs_ideapad[] = { 2902static const struct hda_verb cxt5066_init_verbs_ideapad[] = {
2843 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port B */ 2903 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port B */
2844 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port C */ 2904 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port C */
2845 {0x1e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Port F */ 2905 {0x1e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Port F */
@@ -2889,7 +2949,7 @@ static struct hda_verb cxt5066_init_verbs_ideapad[] = {
2889 { } /* end */ 2949 { } /* end */
2890}; 2950};
2891 2951
2892static struct hda_verb cxt5066_init_verbs_thinkpad[] = { 2952static const struct hda_verb cxt5066_init_verbs_thinkpad[] = {
2893 {0x1e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Port F */ 2953 {0x1e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Port F */
2894 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Port E */ 2954 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Port E */
2895 2955
@@ -2947,13 +3007,13 @@ static struct hda_verb cxt5066_init_verbs_thinkpad[] = {
2947 { } /* end */ 3007 { } /* end */
2948}; 3008};
2949 3009
2950static struct hda_verb cxt5066_init_verbs_portd_lo[] = { 3010static const struct hda_verb cxt5066_init_verbs_portd_lo[] = {
2951 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 3011 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2952 { } /* end */ 3012 { } /* end */
2953}; 3013};
2954 3014
2955 3015
2956static struct hda_verb cxt5066_init_verbs_hp_laptop[] = { 3016static const struct hda_verb cxt5066_init_verbs_hp_laptop[] = {
2957 {0x14, AC_VERB_SET_CONNECT_SEL, 0x0}, 3017 {0x14, AC_VERB_SET_CONNECT_SEL, 0x0},
2958 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | CONEXANT_HP_EVENT}, 3018 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | CONEXANT_HP_EVENT},
2959 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | CONEXANT_MIC_EVENT}, 3019 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | CONEXANT_MIC_EVENT},
@@ -2997,6 +3057,7 @@ enum {
2997 CXT5066_THINKPAD, /* Lenovo ThinkPad T410s, others? */ 3057 CXT5066_THINKPAD, /* Lenovo ThinkPad T410s, others? */
2998 CXT5066_ASUS, /* Asus K52JU, Lenovo G560 - Int mic at 0x1a and Ext mic at 0x1b */ 3058 CXT5066_ASUS, /* Asus K52JU, Lenovo G560 - Int mic at 0x1a and Ext mic at 0x1b */
2999 CXT5066_HP_LAPTOP, /* HP Laptop */ 3059 CXT5066_HP_LAPTOP, /* HP Laptop */
3060 CXT5066_AUTO, /* BIOS auto-parser */
3000 CXT5066_MODELS 3061 CXT5066_MODELS
3001}; 3062};
3002 3063
@@ -3009,9 +3070,10 @@ static const char * const cxt5066_models[CXT5066_MODELS] = {
3009 [CXT5066_THINKPAD] = "thinkpad", 3070 [CXT5066_THINKPAD] = "thinkpad",
3010 [CXT5066_ASUS] = "asus", 3071 [CXT5066_ASUS] = "asus",
3011 [CXT5066_HP_LAPTOP] = "hp-laptop", 3072 [CXT5066_HP_LAPTOP] = "hp-laptop",
3073 [CXT5066_AUTO] = "auto",
3012}; 3074};
3013 3075
3014static struct snd_pci_quirk cxt5066_cfg_tbl[] = { 3076static const struct snd_pci_quirk cxt5066_cfg_tbl[] = {
3015 SND_PCI_QUIRK_MASK(0x1025, 0xff00, 0x0400, "Acer", CXT5066_IDEAPAD), 3077 SND_PCI_QUIRK_MASK(0x1025, 0xff00, 0x0400, "Acer", CXT5066_IDEAPAD),
3016 SND_PCI_QUIRK(0x1028, 0x02d8, "Dell Vostro", CXT5066_DELL_VOSTRO), 3078 SND_PCI_QUIRK(0x1028, 0x02d8, "Dell Vostro", CXT5066_DELL_VOSTRO),
3017 SND_PCI_QUIRK(0x1028, 0x02f5, "Dell Vostro 320", CXT5066_IDEAPAD), 3079 SND_PCI_QUIRK(0x1028, 0x02f5, "Dell Vostro 320", CXT5066_IDEAPAD),
@@ -3046,6 +3108,15 @@ static int patch_cxt5066(struct hda_codec *codec)
3046 struct conexant_spec *spec; 3108 struct conexant_spec *spec;
3047 int board_config; 3109 int board_config;
3048 3110
3111 board_config = snd_hda_check_board_config(codec, CXT5066_MODELS,
3112 cxt5066_models, cxt5066_cfg_tbl);
3113#if 0 /* use the old method just for safety */
3114 if (board_config < 0)
3115 board_config = CXT5066_AUTO;
3116#endif
3117 if (board_config == CXT5066_AUTO)
3118 return patch_conexant_auto(codec);
3119
3049 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 3120 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3050 if (!spec) 3121 if (!spec)
3051 return -ENOMEM; 3122 return -ENOMEM;
@@ -3076,8 +3147,6 @@ static int patch_cxt5066(struct hda_codec *codec)
3076 3147
3077 set_beep_amp(spec, 0x13, 0, HDA_OUTPUT); 3148 set_beep_amp(spec, 0x13, 0, HDA_OUTPUT);
3078 3149
3079 board_config = snd_hda_check_board_config(codec, CXT5066_MODELS,
3080 cxt5066_models, cxt5066_cfg_tbl);
3081 switch (board_config) { 3150 switch (board_config) {
3082 default: 3151 default:
3083 case CXT5066_LAPTOP: 3152 case CXT5066_LAPTOP:
@@ -3195,7 +3264,45 @@ static int patch_cxt5066(struct hda_codec *codec)
3195 * Automatic parser for CX20641 & co 3264 * Automatic parser for CX20641 & co
3196 */ 3265 */
3197 3266
3198static hda_nid_t cx_auto_adc_nids[] = { 0x14 }; 3267static int cx_auto_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3268 struct hda_codec *codec,
3269 unsigned int stream_tag,
3270 unsigned int format,
3271 struct snd_pcm_substream *substream)
3272{
3273 struct conexant_spec *spec = codec->spec;
3274 hda_nid_t adc = spec->imux_info[spec->cur_mux[0]].adc;
3275 if (spec->adc_switching) {
3276 spec->cur_adc = adc;
3277 spec->cur_adc_stream_tag = stream_tag;
3278 spec->cur_adc_format = format;
3279 }
3280 snd_hda_codec_setup_stream(codec, adc, stream_tag, 0, format);
3281 return 0;
3282}
3283
3284static int cx_auto_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3285 struct hda_codec *codec,
3286 struct snd_pcm_substream *substream)
3287{
3288 struct conexant_spec *spec = codec->spec;
3289 snd_hda_codec_cleanup_stream(codec, spec->cur_adc);
3290 spec->cur_adc = 0;
3291 return 0;
3292}
3293
3294static const struct hda_pcm_stream cx_auto_pcm_analog_capture = {
3295 .substreams = 1,
3296 .channels_min = 2,
3297 .channels_max = 2,
3298 .nid = 0, /* fill later */
3299 .ops = {
3300 .prepare = cx_auto_capture_pcm_prepare,
3301 .cleanup = cx_auto_capture_pcm_cleanup
3302 },
3303};
3304
3305static const hda_nid_t cx_auto_adc_nids[] = { 0x14 };
3199 3306
3200/* get the connection index of @nid in the widget @mux */ 3307/* get the connection index of @nid in the widget @mux */
3201static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, 3308static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
@@ -3320,61 +3427,339 @@ static void cx_auto_parse_output(struct hda_codec *codec)
3320 spec->multiout.dac_nids = spec->private_dac_nids; 3427 spec->multiout.dac_nids = spec->private_dac_nids;
3321 spec->multiout.max_channels = spec->multiout.num_dacs * 2; 3428 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
3322 3429
3323 if (cfg->hp_outs > 0) 3430 for (i = 0; i < cfg->hp_outs; i++) {
3324 spec->auto_mute = 1; 3431 if (is_jack_detectable(codec, cfg->hp_pins[i])) {
3432 spec->auto_mute = 1;
3433 break;
3434 }
3435 }
3436 if (spec->auto_mute && cfg->line_out_pins[0] &&
3437 cfg->line_out_pins[0] != cfg->hp_pins[0] &&
3438 cfg->line_out_pins[0] != cfg->speaker_pins[0]) {
3439 for (i = 0; i < cfg->line_outs; i++) {
3440 if (is_jack_detectable(codec, cfg->line_out_pins[i])) {
3441 spec->detect_line = 1;
3442 break;
3443 }
3444 }
3445 spec->automute_lines = spec->detect_line;
3446 }
3447
3325 spec->vmaster_nid = spec->private_dac_nids[0]; 3448 spec->vmaster_nid = spec->private_dac_nids[0];
3326} 3449}
3327 3450
3451static void cx_auto_turn_eapd(struct hda_codec *codec, int num_pins,
3452 hda_nid_t *pins, bool on);
3453
3454static void do_automute(struct hda_codec *codec, int num_pins,
3455 hda_nid_t *pins, bool on)
3456{
3457 int i;
3458 for (i = 0; i < num_pins; i++)
3459 snd_hda_codec_write(codec, pins[i], 0,
3460 AC_VERB_SET_PIN_WIDGET_CONTROL,
3461 on ? PIN_OUT : 0);
3462 cx_auto_turn_eapd(codec, num_pins, pins, on);
3463}
3464
3465static int detect_jacks(struct hda_codec *codec, int num_pins, hda_nid_t *pins)
3466{
3467 int i, present = 0;
3468
3469 for (i = 0; i < num_pins; i++) {
3470 hda_nid_t nid = pins[i];
3471 if (!nid || !is_jack_detectable(codec, nid))
3472 break;
3473 snd_hda_input_jack_report(codec, nid);
3474 present |= snd_hda_jack_detect(codec, nid);
3475 }
3476 return present;
3477}
3478
3328/* auto-mute/unmute speaker and line outs according to headphone jack */ 3479/* auto-mute/unmute speaker and line outs according to headphone jack */
3480static void cx_auto_update_speakers(struct hda_codec *codec)
3481{
3482 struct conexant_spec *spec = codec->spec;
3483 struct auto_pin_cfg *cfg = &spec->autocfg;
3484 int on;
3485
3486 if (!spec->auto_mute)
3487 on = 0;
3488 else
3489 on = spec->hp_present | spec->line_present;
3490 cx_auto_turn_eapd(codec, cfg->hp_outs, cfg->hp_pins, on);
3491 do_automute(codec, cfg->speaker_outs, cfg->speaker_pins, !on);
3492
3493 /* toggle line-out mutes if needed, too */
3494 /* if LO is a copy of either HP or Speaker, don't need to handle it */
3495 if (cfg->line_out_pins[0] == cfg->hp_pins[0] ||
3496 cfg->line_out_pins[0] == cfg->speaker_pins[0])
3497 return;
3498 if (!spec->automute_lines || !spec->auto_mute)
3499 on = 0;
3500 else
3501 on = spec->hp_present;
3502 do_automute(codec, cfg->line_outs, cfg->line_out_pins, !on);
3503}
3504
3329static void cx_auto_hp_automute(struct hda_codec *codec) 3505static void cx_auto_hp_automute(struct hda_codec *codec)
3330{ 3506{
3331 struct conexant_spec *spec = codec->spec; 3507 struct conexant_spec *spec = codec->spec;
3332 struct auto_pin_cfg *cfg = &spec->autocfg; 3508 struct auto_pin_cfg *cfg = &spec->autocfg;
3333 int i, present;
3334 3509
3335 if (!spec->auto_mute) 3510 if (!spec->auto_mute)
3336 return; 3511 return;
3337 present = 0; 3512 spec->hp_present = detect_jacks(codec, cfg->hp_outs, cfg->hp_pins);
3338 for (i = 0; i < cfg->hp_outs; i++) { 3513 cx_auto_update_speakers(codec);
3339 if (snd_hda_jack_detect(codec, cfg->hp_pins[i])) { 3514}
3340 present = 1; 3515
3341 break; 3516static void cx_auto_line_automute(struct hda_codec *codec)
3342 } 3517{
3518 struct conexant_spec *spec = codec->spec;
3519 struct auto_pin_cfg *cfg = &spec->autocfg;
3520
3521 if (!spec->auto_mute || !spec->detect_line)
3522 return;
3523 spec->line_present = detect_jacks(codec, cfg->line_outs,
3524 cfg->line_out_pins);
3525 cx_auto_update_speakers(codec);
3526}
3527
3528static int cx_automute_mode_info(struct snd_kcontrol *kcontrol,
3529 struct snd_ctl_elem_info *uinfo)
3530{
3531 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3532 struct conexant_spec *spec = codec->spec;
3533 static const char * const texts2[] = {
3534 "Disabled", "Enabled"
3535 };
3536 static const char * const texts3[] = {
3537 "Disabled", "Speaker Only", "Line-Out+Speaker"
3538 };
3539 const char * const *texts;
3540
3541 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3542 uinfo->count = 1;
3543 if (spec->automute_hp_lo) {
3544 uinfo->value.enumerated.items = 3;
3545 texts = texts3;
3546 } else {
3547 uinfo->value.enumerated.items = 2;
3548 texts = texts2;
3343 } 3549 }
3344 for (i = 0; i < cfg->line_outs; i++) { 3550 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
3345 snd_hda_codec_write(codec, cfg->line_out_pins[i], 0, 3551 uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
3346 AC_VERB_SET_PIN_WIDGET_CONTROL, 3552 strcpy(uinfo->value.enumerated.name,
3347 present ? 0 : PIN_OUT); 3553 texts[uinfo->value.enumerated.item]);
3554 return 0;
3555}
3556
3557static int cx_automute_mode_get(struct snd_kcontrol *kcontrol,
3558 struct snd_ctl_elem_value *ucontrol)
3559{
3560 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3561 struct conexant_spec *spec = codec->spec;
3562 unsigned int val;
3563 if (!spec->auto_mute)
3564 val = 0;
3565 else if (!spec->automute_lines)
3566 val = 1;
3567 else
3568 val = 2;
3569 ucontrol->value.enumerated.item[0] = val;
3570 return 0;
3571}
3572
3573static int cx_automute_mode_put(struct snd_kcontrol *kcontrol,
3574 struct snd_ctl_elem_value *ucontrol)
3575{
3576 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3577 struct conexant_spec *spec = codec->spec;
3578
3579 switch (ucontrol->value.enumerated.item[0]) {
3580 case 0:
3581 if (!spec->auto_mute)
3582 return 0;
3583 spec->auto_mute = 0;
3584 break;
3585 case 1:
3586 if (spec->auto_mute && !spec->automute_lines)
3587 return 0;
3588 spec->auto_mute = 1;
3589 spec->automute_lines = 0;
3590 break;
3591 case 2:
3592 if (!spec->automute_hp_lo)
3593 return -EINVAL;
3594 if (spec->auto_mute && spec->automute_lines)
3595 return 0;
3596 spec->auto_mute = 1;
3597 spec->automute_lines = 1;
3598 break;
3599 default:
3600 return -EINVAL;
3348 } 3601 }
3349 for (i = 0; !present && i < cfg->line_outs; i++) 3602 cx_auto_update_speakers(codec);
3350 if (snd_hda_jack_detect(codec, cfg->line_out_pins[i])) 3603 return 1;
3351 present = 1; 3604}
3352 for (i = 0; i < cfg->speaker_outs; i++) { 3605
3353 snd_hda_codec_write(codec, cfg->speaker_pins[i], 0, 3606static const struct snd_kcontrol_new cx_automute_mode_enum[] = {
3354 AC_VERB_SET_PIN_WIDGET_CONTROL, 3607 {
3355 present ? 0 : PIN_OUT); 3608 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3609 .name = "Auto-Mute Mode",
3610 .info = cx_automute_mode_info,
3611 .get = cx_automute_mode_get,
3612 .put = cx_automute_mode_put,
3613 },
3614 { }
3615};
3616
3617static int cx_auto_mux_enum_info(struct snd_kcontrol *kcontrol,
3618 struct snd_ctl_elem_info *uinfo)
3619{
3620 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3621 struct conexant_spec *spec = codec->spec;
3622
3623 return snd_hda_input_mux_info(&spec->private_imux, uinfo);
3624}
3625
3626static int cx_auto_mux_enum_get(struct snd_kcontrol *kcontrol,
3627 struct snd_ctl_elem_value *ucontrol)
3628{
3629 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3630 struct conexant_spec *spec = codec->spec;
3631
3632 ucontrol->value.enumerated.item[0] = spec->cur_mux[0];
3633 return 0;
3634}
3635
3636/* look for the route the given pin from mux and return the index;
3637 * if do_select is set, actually select the route.
3638 */
3639static int __select_input_connection(struct hda_codec *codec, hda_nid_t mux,
3640 hda_nid_t pin, hda_nid_t *srcp,
3641 bool do_select, int depth)
3642{
3643 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
3644 int i, nums;
3645
3646 switch (get_wcaps_type(get_wcaps(codec, mux))) {
3647 case AC_WID_AUD_IN:
3648 case AC_WID_AUD_SEL:
3649 case AC_WID_AUD_MIX:
3650 break;
3651 default:
3652 return -1;
3356 } 3653 }
3654
3655 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
3656 for (i = 0; i < nums; i++)
3657 if (conn[i] == pin) {
3658 if (do_select)
3659 snd_hda_codec_write(codec, mux, 0,
3660 AC_VERB_SET_CONNECT_SEL, i);
3661 if (srcp)
3662 *srcp = mux;
3663 return i;
3664 }
3665 depth++;
3666 if (depth == 2)
3667 return -1;
3668 for (i = 0; i < nums; i++) {
3669 int ret = __select_input_connection(codec, conn[i], pin, srcp,
3670 do_select, depth);
3671 if (ret >= 0) {
3672 if (do_select)
3673 snd_hda_codec_write(codec, mux, 0,
3674 AC_VERB_SET_CONNECT_SEL, i);
3675 return i;
3676 }
3677 }
3678 return -1;
3679}
3680
3681static void select_input_connection(struct hda_codec *codec, hda_nid_t mux,
3682 hda_nid_t pin)
3683{
3684 __select_input_connection(codec, mux, pin, NULL, true, 0);
3685}
3686
3687static int get_input_connection(struct hda_codec *codec, hda_nid_t mux,
3688 hda_nid_t pin)
3689{
3690 return __select_input_connection(codec, mux, pin, NULL, false, 0);
3691}
3692
3693static int cx_auto_mux_enum_update(struct hda_codec *codec,
3694 const struct hda_input_mux *imux,
3695 unsigned int idx)
3696{
3697 struct conexant_spec *spec = codec->spec;
3698 hda_nid_t adc;
3699
3700 if (!imux->num_items)
3701 return 0;
3702 if (idx >= imux->num_items)
3703 idx = imux->num_items - 1;
3704 if (spec->cur_mux[0] == idx)
3705 return 0;
3706 adc = spec->imux_info[idx].adc;
3707 select_input_connection(codec, spec->imux_info[idx].adc,
3708 spec->imux_info[idx].pin);
3709 if (spec->cur_adc && spec->cur_adc != adc) {
3710 /* stream is running, let's swap the current ADC */
3711 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1);
3712 spec->cur_adc = adc;
3713 snd_hda_codec_setup_stream(codec, adc,
3714 spec->cur_adc_stream_tag, 0,
3715 spec->cur_adc_format);
3716 }
3717 spec->cur_mux[0] = idx;
3718 return 1;
3719}
3720
3721static int cx_auto_mux_enum_put(struct snd_kcontrol *kcontrol,
3722 struct snd_ctl_elem_value *ucontrol)
3723{
3724 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3725 struct conexant_spec *spec = codec->spec;
3726
3727 return cx_auto_mux_enum_update(codec, &spec->private_imux,
3728 ucontrol->value.enumerated.item[0]);
3729}
3730
3731static const struct snd_kcontrol_new cx_auto_capture_mixers[] = {
3732 {
3733 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3734 .name = "Capture Source",
3735 .info = cx_auto_mux_enum_info,
3736 .get = cx_auto_mux_enum_get,
3737 .put = cx_auto_mux_enum_put
3738 },
3739 {}
3740};
3741
3742static bool select_automic(struct hda_codec *codec, int idx, bool detect)
3743{
3744 struct conexant_spec *spec = codec->spec;
3745 if (idx < 0)
3746 return false;
3747 if (detect && !snd_hda_jack_detect(codec, spec->imux_info[idx].pin))
3748 return false;
3749 cx_auto_mux_enum_update(codec, &spec->private_imux, idx);
3750 return true;
3357} 3751}
3358 3752
3359/* automatic switch internal and external mic */ 3753/* automatic switch internal and external mic */
3360static void cx_auto_automic(struct hda_codec *codec) 3754static void cx_auto_automic(struct hda_codec *codec)
3361{ 3755{
3362 struct conexant_spec *spec = codec->spec; 3756 struct conexant_spec *spec = codec->spec;
3363 struct auto_pin_cfg *cfg = &spec->autocfg;
3364 struct hda_input_mux *imux = &spec->private_imux;
3365 int ext_idx = spec->auto_mic_ext;
3366 3757
3367 if (!spec->auto_mic) 3758 if (!spec->auto_mic)
3368 return; 3759 return;
3369 if (snd_hda_jack_detect(codec, cfg->inputs[ext_idx].pin)) { 3760 if (!select_automic(codec, spec->auto_mic_ext, true))
3370 snd_hda_codec_write(codec, spec->adc_nids[0], 0, 3761 if (!select_automic(codec, spec->auto_mic_dock, true))
3371 AC_VERB_SET_CONNECT_SEL, 3762 select_automic(codec, spec->auto_mic_int, false);
3372 imux->items[ext_idx].index);
3373 } else {
3374 snd_hda_codec_write(codec, spec->adc_nids[0], 0,
3375 AC_VERB_SET_CONNECT_SEL,
3376 imux->items[!ext_idx].index);
3377 }
3378} 3763}
3379 3764
3380static void cx_auto_unsol_event(struct hda_codec *codec, unsigned int res) 3765static void cx_auto_unsol_event(struct hda_codec *codec, unsigned int res)
@@ -3383,7 +3768,9 @@ static void cx_auto_unsol_event(struct hda_codec *codec, unsigned int res)
3383 switch (res >> 26) { 3768 switch (res >> 26) {
3384 case CONEXANT_HP_EVENT: 3769 case CONEXANT_HP_EVENT:
3385 cx_auto_hp_automute(codec); 3770 cx_auto_hp_automute(codec);
3386 snd_hda_input_jack_report(codec, nid); 3771 break;
3772 case CONEXANT_LINE_EVENT:
3773 cx_auto_line_automute(codec);
3387 break; 3774 break;
3388 case CONEXANT_MIC_EVENT: 3775 case CONEXANT_MIC_EVENT:
3389 cx_auto_automic(codec); 3776 cx_auto_automic(codec);
@@ -3392,43 +3779,45 @@ static void cx_auto_unsol_event(struct hda_codec *codec, unsigned int res)
3392 } 3779 }
3393} 3780}
3394 3781
3395/* return true if it's an internal-mic pin */
3396static int is_int_mic(struct hda_codec *codec, hda_nid_t pin)
3397{
3398 unsigned int def_conf = snd_hda_codec_get_pincfg(codec, pin);
3399 return get_defcfg_device(def_conf) == AC_JACK_MIC_IN &&
3400 snd_hda_get_input_pin_attr(def_conf) == INPUT_PIN_ATTR_INT;
3401}
3402
3403/* return true if it's an external-mic pin */
3404static int is_ext_mic(struct hda_codec *codec, hda_nid_t pin)
3405{
3406 unsigned int def_conf = snd_hda_codec_get_pincfg(codec, pin);
3407 return get_defcfg_device(def_conf) == AC_JACK_MIC_IN &&
3408 snd_hda_get_input_pin_attr(def_conf) >= INPUT_PIN_ATTR_NORMAL &&
3409 (snd_hda_query_pin_caps(codec, pin) & AC_PINCAP_PRES_DETECT);
3410}
3411
3412/* check whether the pin config is suitable for auto-mic switching; 3782/* check whether the pin config is suitable for auto-mic switching;
3413 * auto-mic is enabled only when one int-mic and one-ext mic exist 3783 * auto-mic is enabled only when one int-mic and one ext- and/or
3784 * one dock-mic exist
3414 */ 3785 */
3415static void cx_auto_check_auto_mic(struct hda_codec *codec) 3786static void cx_auto_check_auto_mic(struct hda_codec *codec)
3416{ 3787{
3417 struct conexant_spec *spec = codec->spec; 3788 struct conexant_spec *spec = codec->spec;
3418 struct auto_pin_cfg *cfg = &spec->autocfg; 3789 int pset[INPUT_PIN_ATTR_NORMAL + 1];
3790 int i;
3419 3791
3420 if (is_ext_mic(codec, cfg->inputs[0].pin) && 3792 for (i = 0; i < INPUT_PIN_ATTR_NORMAL; i++)
3421 is_int_mic(codec, cfg->inputs[1].pin)) { 3793 pset[i] = -1;
3422 spec->auto_mic = 1; 3794 for (i = 0; i < spec->private_imux.num_items; i++) {
3423 spec->auto_mic_ext = 1; 3795 hda_nid_t pin = spec->imux_info[i].pin;
3424 return; 3796 unsigned int def_conf = snd_hda_codec_get_pincfg(codec, pin);
3425 } 3797 int type, attr;
3426 if (is_int_mic(codec, cfg->inputs[1].pin) && 3798 attr = snd_hda_get_input_pin_attr(def_conf);
3427 is_ext_mic(codec, cfg->inputs[0].pin)) { 3799 if (attr == INPUT_PIN_ATTR_UNUSED)
3428 spec->auto_mic = 1; 3800 return; /* invalid entry */
3429 spec->auto_mic_ext = 0; 3801 if (attr > INPUT_PIN_ATTR_NORMAL)
3430 return; 3802 attr = INPUT_PIN_ATTR_NORMAL;
3803 if (attr != INPUT_PIN_ATTR_INT &&
3804 !is_jack_detectable(codec, pin))
3805 return; /* non-detectable pin */
3806 type = get_defcfg_device(def_conf);
3807 if (type != AC_JACK_MIC_IN &&
3808 (attr != INPUT_PIN_ATTR_DOCK || type != AC_JACK_LINE_IN))
3809 return; /* no valid input type */
3810 if (pset[attr] >= 0)
3811 return; /* already occupied */
3812 pset[attr] = i;
3431 } 3813 }
3814 if (pset[INPUT_PIN_ATTR_INT] < 0 ||
3815 (pset[INPUT_PIN_ATTR_NORMAL] < 0 && pset[INPUT_PIN_ATTR_DOCK]))
3816 return; /* no input to switch*/
3817 spec->auto_mic = 1;
3818 spec->auto_mic_ext = pset[INPUT_PIN_ATTR_NORMAL];
3819 spec->auto_mic_dock = pset[INPUT_PIN_ATTR_DOCK];
3820 spec->auto_mic_int = pset[INPUT_PIN_ATTR_INT];
3432} 3821}
3433 3822
3434static void cx_auto_parse_input(struct hda_codec *codec) 3823static void cx_auto_parse_input(struct hda_codec *codec)
@@ -3436,22 +3825,37 @@ static void cx_auto_parse_input(struct hda_codec *codec)
3436 struct conexant_spec *spec = codec->spec; 3825 struct conexant_spec *spec = codec->spec;
3437 struct auto_pin_cfg *cfg = &spec->autocfg; 3826 struct auto_pin_cfg *cfg = &spec->autocfg;
3438 struct hda_input_mux *imux; 3827 struct hda_input_mux *imux;
3439 int i; 3828 int i, j;
3440 3829
3441 imux = &spec->private_imux; 3830 imux = &spec->private_imux;
3442 for (i = 0; i < cfg->num_inputs; i++) { 3831 for (i = 0; i < cfg->num_inputs; i++) {
3443 int idx = get_connection_index(codec, spec->adc_nids[0], 3832 for (j = 0; j < spec->num_adc_nids; j++) {
3444 cfg->inputs[i].pin); 3833 hda_nid_t adc = spec->adc_nids[j];
3445 if (idx >= 0) { 3834 int idx = get_input_connection(codec, adc,
3446 const char *label; 3835 cfg->inputs[i].pin);
3447 label = hda_get_autocfg_input_label(codec, cfg, i); 3836 if (idx >= 0) {
3448 snd_hda_add_imux_item(imux, label, idx, NULL); 3837 const char *label;
3838 label = hda_get_autocfg_input_label(codec, cfg, i);
3839 spec->imux_info[imux->num_items].index = i;
3840 spec->imux_info[imux->num_items].boost = 0;
3841 spec->imux_info[imux->num_items].adc = adc;
3842 spec->imux_info[imux->num_items].pin =
3843 cfg->inputs[i].pin;
3844 snd_hda_add_imux_item(imux, label, idx, NULL);
3845 break;
3846 }
3449 } 3847 }
3450 } 3848 }
3451 if (imux->num_items == 2 && cfg->num_inputs == 2) 3849 if (imux->num_items >= 2 && cfg->num_inputs == imux->num_items)
3452 cx_auto_check_auto_mic(codec); 3850 cx_auto_check_auto_mic(codec);
3453 if (imux->num_items > 1 && !spec->auto_mic) 3851 if (imux->num_items > 1 && !spec->auto_mic) {
3454 spec->input_mux = imux; 3852 for (i = 1; i < imux->num_items; i++) {
3853 if (spec->imux_info[i].adc != spec->imux_info[0].adc) {
3854 spec->adc_switching = 1;
3855 break;
3856 }
3857 }
3858 }
3455} 3859}
3456 3860
3457/* get digital-input audio widget corresponding to the given pin */ 3861/* get digital-input audio widget corresponding to the given pin */
@@ -3517,14 +3921,15 @@ static int cx_auto_parse_auto_config(struct hda_codec *codec)
3517 return 0; 3921 return 0;
3518} 3922}
3519 3923
3520static void cx_auto_turn_on_eapd(struct hda_codec *codec, int num_pins, 3924static void cx_auto_turn_eapd(struct hda_codec *codec, int num_pins,
3521 hda_nid_t *pins) 3925 hda_nid_t *pins, bool on)
3522{ 3926{
3523 int i; 3927 int i;
3524 for (i = 0; i < num_pins; i++) { 3928 for (i = 0; i < num_pins; i++) {
3525 if (snd_hda_query_pin_caps(codec, pins[i]) & AC_PINCAP_EAPD) 3929 if (snd_hda_query_pin_caps(codec, pins[i]) & AC_PINCAP_EAPD)
3526 snd_hda_codec_write(codec, pins[i], 0, 3930 snd_hda_codec_write(codec, pins[i], 0,
3527 AC_VERB_SET_EAPD_BTLENABLE, 0x02); 3931 AC_VERB_SET_EAPD_BTLENABLE,
3932 on ? 0x02 : 0);
3528 } 3933 }
3529} 3934}
3530 3935
@@ -3537,6 +3942,34 @@ static void select_connection(struct hda_codec *codec, hda_nid_t pin,
3537 AC_VERB_SET_CONNECT_SEL, idx); 3942 AC_VERB_SET_CONNECT_SEL, idx);
3538} 3943}
3539 3944
3945static void mute_outputs(struct hda_codec *codec, int num_nids,
3946 const hda_nid_t *nids)
3947{
3948 int i, val;
3949
3950 for (i = 0; i < num_nids; i++) {
3951 hda_nid_t nid = nids[i];
3952 if (!(get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
3953 continue;
3954 if (query_amp_caps(codec, nid, HDA_OUTPUT) & AC_AMPCAP_MUTE)
3955 val = AMP_OUT_MUTE;
3956 else
3957 val = AMP_OUT_ZERO;
3958 snd_hda_codec_write(codec, nid, 0,
3959 AC_VERB_SET_AMP_GAIN_MUTE, val);
3960 }
3961}
3962
3963static void enable_unsol_pins(struct hda_codec *codec, int num_pins,
3964 hda_nid_t *pins, unsigned int tag)
3965{
3966 int i;
3967 for (i = 0; i < num_pins; i++)
3968 snd_hda_codec_write(codec, pins[i], 0,
3969 AC_VERB_SET_UNSOLICITED_ENABLE,
3970 AC_USRSP_EN | tag);
3971}
3972
3540static void cx_auto_init_output(struct hda_codec *codec) 3973static void cx_auto_init_output(struct hda_codec *codec)
3541{ 3974{
3542 struct conexant_spec *spec = codec->spec; 3975 struct conexant_spec *spec = codec->spec;
@@ -3544,51 +3977,53 @@ static void cx_auto_init_output(struct hda_codec *codec)
3544 hda_nid_t nid; 3977 hda_nid_t nid;
3545 int i; 3978 int i;
3546 3979
3547 for (i = 0; i < spec->multiout.num_dacs; i++) 3980 mute_outputs(codec, spec->multiout.num_dacs, spec->multiout.dac_nids);
3548 snd_hda_codec_write(codec, spec->multiout.dac_nids[i], 0,
3549 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3550
3551 for (i = 0; i < cfg->hp_outs; i++) 3981 for (i = 0; i < cfg->hp_outs; i++)
3552 snd_hda_codec_write(codec, cfg->hp_pins[i], 0, 3982 snd_hda_codec_write(codec, cfg->hp_pins[i], 0,
3553 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP); 3983 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
3554 if (spec->auto_mute) { 3984 mute_outputs(codec, cfg->hp_outs, cfg->hp_pins);
3555 for (i = 0; i < cfg->hp_outs; i++) { 3985 mute_outputs(codec, cfg->line_outs, cfg->line_out_pins);
3556 snd_hda_codec_write(codec, cfg->hp_pins[i], 0, 3986 mute_outputs(codec, cfg->speaker_outs, cfg->speaker_pins);
3557 AC_VERB_SET_UNSOLICITED_ENABLE,
3558 AC_USRSP_EN | CONEXANT_HP_EVENT);
3559 }
3560 cx_auto_hp_automute(codec);
3561 } else {
3562 for (i = 0; i < cfg->line_outs; i++)
3563 snd_hda_codec_write(codec, cfg->line_out_pins[i], 0,
3564 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3565 for (i = 0; i < cfg->speaker_outs; i++)
3566 snd_hda_codec_write(codec, cfg->speaker_pins[i], 0,
3567 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3568 }
3569
3570 for (i = 0; i < spec->dac_info_filled; i++) { 3987 for (i = 0; i < spec->dac_info_filled; i++) {
3571 nid = spec->dac_info[i].dac; 3988 nid = spec->dac_info[i].dac;
3572 if (!nid) 3989 if (!nid)
3573 nid = spec->multiout.dac_nids[0]; 3990 nid = spec->multiout.dac_nids[0];
3574 select_connection(codec, spec->dac_info[i].pin, nid); 3991 select_connection(codec, spec->dac_info[i].pin, nid);
3575 } 3992 }
3576 3993 if (spec->auto_mute) {
3577 /* turn on EAPD */ 3994 enable_unsol_pins(codec, cfg->hp_outs, cfg->hp_pins,
3578 cx_auto_turn_on_eapd(codec, cfg->line_outs, cfg->line_out_pins); 3995 CONEXANT_HP_EVENT);
3579 cx_auto_turn_on_eapd(codec, cfg->hp_outs, cfg->hp_pins); 3996 spec->hp_present = detect_jacks(codec, cfg->hp_outs,
3580 cx_auto_turn_on_eapd(codec, cfg->speaker_outs, cfg->speaker_pins); 3997 cfg->hp_pins);
3998 if (spec->detect_line) {
3999 enable_unsol_pins(codec, cfg->line_outs,
4000 cfg->line_out_pins,
4001 CONEXANT_LINE_EVENT);
4002 spec->line_present =
4003 detect_jacks(codec, cfg->line_outs,
4004 cfg->line_out_pins);
4005 }
4006 }
4007 cx_auto_update_speakers(codec);
3581} 4008}
3582 4009
3583static void cx_auto_init_input(struct hda_codec *codec) 4010static void cx_auto_init_input(struct hda_codec *codec)
3584{ 4011{
3585 struct conexant_spec *spec = codec->spec; 4012 struct conexant_spec *spec = codec->spec;
3586 struct auto_pin_cfg *cfg = &spec->autocfg; 4013 struct auto_pin_cfg *cfg = &spec->autocfg;
3587 int i; 4014 int i, val;
3588 4015
3589 for (i = 0; i < spec->num_adc_nids; i++) 4016 for (i = 0; i < spec->num_adc_nids; i++) {
3590 snd_hda_codec_write(codec, spec->adc_nids[i], 0, 4017 hda_nid_t nid = spec->adc_nids[i];
3591 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)); 4018 if (!(get_wcaps(codec, nid) & AC_WCAP_IN_AMP))
4019 continue;
4020 if (query_amp_caps(codec, nid, HDA_INPUT) & AC_AMPCAP_MUTE)
4021 val = AMP_IN_MUTE(0);
4022 else
4023 val = AMP_IN_UNMUTE(0);
4024 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4025 val);
4026 }
3592 4027
3593 for (i = 0; i < cfg->num_inputs; i++) { 4028 for (i = 0; i < cfg->num_inputs; i++) {
3594 unsigned int type; 4029 unsigned int type;
@@ -3601,17 +4036,22 @@ static void cx_auto_init_input(struct hda_codec *codec)
3601 } 4036 }
3602 4037
3603 if (spec->auto_mic) { 4038 if (spec->auto_mic) {
3604 int ext_idx = spec->auto_mic_ext; 4039 if (spec->auto_mic_ext >= 0) {
3605 snd_hda_codec_write(codec, cfg->inputs[ext_idx].pin, 0, 4040 snd_hda_codec_write(codec,
3606 AC_VERB_SET_UNSOLICITED_ENABLE, 4041 cfg->inputs[spec->auto_mic_ext].pin, 0,
3607 AC_USRSP_EN | CONEXANT_MIC_EVENT); 4042 AC_VERB_SET_UNSOLICITED_ENABLE,
4043 AC_USRSP_EN | CONEXANT_MIC_EVENT);
4044 }
4045 if (spec->auto_mic_dock >= 0) {
4046 snd_hda_codec_write(codec,
4047 cfg->inputs[spec->auto_mic_dock].pin, 0,
4048 AC_VERB_SET_UNSOLICITED_ENABLE,
4049 AC_USRSP_EN | CONEXANT_MIC_EVENT);
4050 }
3608 cx_auto_automic(codec); 4051 cx_auto_automic(codec);
3609 } else { 4052 } else {
3610 for (i = 0; i < spec->num_adc_nids; i++) { 4053 select_input_connection(codec, spec->imux_info[0].adc,
3611 snd_hda_codec_write(codec, spec->adc_nids[i], 0, 4054 spec->imux_info[0].pin);
3612 AC_VERB_SET_CONNECT_SEL,
3613 spec->private_imux.items[0].index);
3614 }
3615 } 4055 }
3616} 4056}
3617 4057
@@ -3646,7 +4086,7 @@ static int cx_auto_add_volume_idx(struct hda_codec *codec, const char *basename,
3646 HDA_CODEC_VOLUME(name, 0, 0, 0), 4086 HDA_CODEC_VOLUME(name, 0, 0, 0),
3647 HDA_CODEC_MUTE(name, 0, 0, 0), 4087 HDA_CODEC_MUTE(name, 0, 0, 0),
3648 }; 4088 };
3649 static char *sfx[2] = { "Volume", "Switch" }; 4089 static const char * const sfx[2] = { "Volume", "Switch" };
3650 int i, err; 4090 int i, err;
3651 4091
3652 for (i = 0; i < 2; i++) { 4092 for (i = 0; i < 2; i++) {
@@ -3674,6 +4114,19 @@ static int cx_auto_add_volume_idx(struct hda_codec *codec, const char *basename,
3674#define cx_auto_add_pb_volume(codec, nid, str, idx) \ 4114#define cx_auto_add_pb_volume(codec, nid, str, idx) \
3675 cx_auto_add_volume(codec, str, " Playback", idx, nid, HDA_OUTPUT) 4115 cx_auto_add_volume(codec, str, " Playback", idx, nid, HDA_OUTPUT)
3676 4116
4117static int try_add_pb_volume(struct hda_codec *codec, hda_nid_t dac,
4118 hda_nid_t pin, const char *name, int idx)
4119{
4120 unsigned int caps;
4121 caps = query_amp_caps(codec, dac, HDA_OUTPUT);
4122 if (caps & AC_AMPCAP_NUM_STEPS)
4123 return cx_auto_add_pb_volume(codec, dac, name, idx);
4124 caps = query_amp_caps(codec, pin, HDA_OUTPUT);
4125 if (caps & AC_AMPCAP_NUM_STEPS)
4126 return cx_auto_add_pb_volume(codec, pin, name, idx);
4127 return 0;
4128}
4129
3677static int cx_auto_build_output_controls(struct hda_codec *codec) 4130static int cx_auto_build_output_controls(struct hda_codec *codec)
3678{ 4131{
3679 struct conexant_spec *spec = codec->spec; 4132 struct conexant_spec *spec = codec->spec;
@@ -3682,8 +4135,10 @@ static int cx_auto_build_output_controls(struct hda_codec *codec)
3682 static const char * const texts[3] = { "Front", "Surround", "CLFE" }; 4135 static const char * const texts[3] = { "Front", "Surround", "CLFE" };
3683 4136
3684 if (spec->dac_info_filled == 1) 4137 if (spec->dac_info_filled == 1)
3685 return cx_auto_add_pb_volume(codec, spec->dac_info[0].dac, 4138 return try_add_pb_volume(codec, spec->dac_info[0].dac,
3686 "Master", 0); 4139 spec->dac_info[0].pin,
4140 "Master", 0);
4141
3687 for (i = 0; i < spec->dac_info_filled; i++) { 4142 for (i = 0; i < spec->dac_info_filled; i++) {
3688 const char *label; 4143 const char *label;
3689 int idx, type; 4144 int idx, type;
@@ -3707,74 +4162,123 @@ static int cx_auto_build_output_controls(struct hda_codec *codec)
3707 idx = num_spk++; 4162 idx = num_spk++;
3708 break; 4163 break;
3709 } 4164 }
3710 err = cx_auto_add_pb_volume(codec, spec->dac_info[i].dac, 4165 err = try_add_pb_volume(codec, spec->dac_info[i].dac,
3711 label, idx); 4166 spec->dac_info[i].pin,
4167 label, idx);
4168 if (err < 0)
4169 return err;
4170 }
4171
4172 if (spec->auto_mute) {
4173 err = snd_hda_add_new_ctls(codec, cx_automute_mode_enum);
3712 if (err < 0) 4174 if (err < 0)
3713 return err; 4175 return err;
3714 } 4176 }
4177
4178 return 0;
4179}
4180
4181static int cx_auto_add_capture_volume(struct hda_codec *codec, hda_nid_t nid,
4182 const char *label, const char *pfx,
4183 int cidx)
4184{
4185 struct conexant_spec *spec = codec->spec;
4186 int i;
4187
4188 for (i = 0; i < spec->num_adc_nids; i++) {
4189 hda_nid_t adc_nid = spec->adc_nids[i];
4190 int idx = get_input_connection(codec, adc_nid, nid);
4191 if (idx < 0)
4192 continue;
4193 return cx_auto_add_volume_idx(codec, label, pfx,
4194 cidx, adc_nid, HDA_INPUT, idx);
4195 }
4196 return 0;
4197}
4198
4199static int cx_auto_add_boost_volume(struct hda_codec *codec, int idx,
4200 const char *label, int cidx)
4201{
4202 struct conexant_spec *spec = codec->spec;
4203 hda_nid_t mux, nid;
4204 int i, con;
4205
4206 nid = spec->imux_info[idx].pin;
4207 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
4208 return cx_auto_add_volume(codec, label, " Boost", cidx,
4209 nid, HDA_INPUT);
4210 con = __select_input_connection(codec, spec->imux_info[idx].adc, nid,
4211 &mux, false, 0);
4212 if (con < 0)
4213 return 0;
4214 for (i = 0; i < idx; i++) {
4215 if (spec->imux_info[i].boost == mux)
4216 return 0; /* already present */
4217 }
4218
4219 if (get_wcaps(codec, mux) & AC_WCAP_OUT_AMP) {
4220 spec->imux_info[idx].boost = mux;
4221 return cx_auto_add_volume(codec, label, " Boost", 0,
4222 mux, HDA_OUTPUT);
4223 }
3715 return 0; 4224 return 0;
3716} 4225}
3717 4226
3718static int cx_auto_build_input_controls(struct hda_codec *codec) 4227static int cx_auto_build_input_controls(struct hda_codec *codec)
3719{ 4228{
3720 struct conexant_spec *spec = codec->spec; 4229 struct conexant_spec *spec = codec->spec;
3721 struct auto_pin_cfg *cfg = &spec->autocfg; 4230 struct hda_input_mux *imux = &spec->private_imux;
3722 static const char *prev_label; 4231 const char *prev_label;
3723 int i, err, cidx, conn_len; 4232 int input_conn[HDA_MAX_NUM_INPUTS];
3724 hda_nid_t conn[HDA_MAX_CONNECTIONS]; 4233 int i, err, cidx;
3725 4234 int multi_connection;
3726 int multi_adc_volume = 0; /* If the ADC nid has several input volumes */ 4235
3727 int adc_nid = spec->adc_nids[0]; 4236 multi_connection = 0;
3728 4237 for (i = 0; i < imux->num_items; i++) {
3729 conn_len = snd_hda_get_connections(codec, adc_nid, conn, 4238 cidx = get_input_connection(codec, spec->imux_info[i].adc,
3730 HDA_MAX_CONNECTIONS); 4239 spec->imux_info[i].pin);
3731 if (conn_len < 0) 4240 input_conn[i] = (spec->imux_info[i].adc << 8) | cidx;
3732 return conn_len; 4241 if (i > 0 && input_conn[i] != input_conn[0])
3733 4242 multi_connection = 1;
3734 multi_adc_volume = cfg->num_inputs > 1 && conn_len > 1;
3735 if (!multi_adc_volume) {
3736 err = cx_auto_add_volume(codec, "Capture", "", 0, adc_nid,
3737 HDA_INPUT);
3738 if (err < 0)
3739 return err;
3740 } 4243 }
3741 4244
3742 prev_label = NULL; 4245 prev_label = NULL;
3743 cidx = 0; 4246 cidx = 0;
3744 for (i = 0; i < cfg->num_inputs; i++) { 4247 for (i = 0; i < imux->num_items; i++) {
3745 hda_nid_t nid = cfg->inputs[i].pin; 4248 hda_nid_t nid = spec->imux_info[i].pin;
3746 const char *label; 4249 const char *label;
3747 int j;
3748 int pin_amp = get_wcaps(codec, nid) & AC_WCAP_IN_AMP;
3749 if (!pin_amp && !multi_adc_volume)
3750 continue;
3751 4250
3752 label = hda_get_autocfg_input_label(codec, cfg, i); 4251 label = hda_get_autocfg_input_label(codec, &spec->autocfg,
4252 spec->imux_info[i].index);
3753 if (label == prev_label) 4253 if (label == prev_label)
3754 cidx++; 4254 cidx++;
3755 else 4255 else
3756 cidx = 0; 4256 cidx = 0;
3757 prev_label = label; 4257 prev_label = label;
3758 4258
3759 if (pin_amp) { 4259 err = cx_auto_add_boost_volume(codec, i, label, cidx);
3760 err = cx_auto_add_volume(codec, label, " Boost", cidx, 4260 if (err < 0)
3761 nid, HDA_INPUT); 4261 return err;
3762 if (err < 0)
3763 return err;
3764 }
3765 4262
3766 if (!multi_adc_volume) 4263 if (!multi_connection) {
3767 continue; 4264 if (i > 0)
3768 for (j = 0; j < conn_len; j++) { 4265 continue;
3769 if (conn[j] == nid) { 4266 err = cx_auto_add_capture_volume(codec, nid,
3770 err = cx_auto_add_volume_idx(codec, label, 4267 "Capture", "", cidx);
3771 " Capture", cidx, adc_nid, HDA_INPUT, j); 4268 } else {
3772 if (err < 0) 4269 err = cx_auto_add_capture_volume(codec, nid,
3773 return err; 4270 label, " Capture", cidx);
3774 break;
3775 }
3776 } 4271 }
4272 if (err < 0)
4273 return err;
3777 } 4274 }
4275
4276 if (spec->private_imux.num_items > 1 && !spec->auto_mic) {
4277 err = snd_hda_add_new_ctls(codec, cx_auto_capture_mixers);
4278 if (err < 0)
4279 return err;
4280 }
4281
3778 return 0; 4282 return 0;
3779} 4283}
3780 4284
@@ -3791,7 +4295,29 @@ static int cx_auto_build_controls(struct hda_codec *codec)
3791 return conexant_build_controls(codec); 4295 return conexant_build_controls(codec);
3792} 4296}
3793 4297
3794static struct hda_codec_ops cx_auto_patch_ops = { 4298static int cx_auto_search_adcs(struct hda_codec *codec)
4299{
4300 struct conexant_spec *spec = codec->spec;
4301 hda_nid_t nid, end_nid;
4302
4303 end_nid = codec->start_nid + codec->num_nodes;
4304 for (nid = codec->start_nid; nid < end_nid; nid++) {
4305 unsigned int caps = get_wcaps(codec, nid);
4306 if (get_wcaps_type(caps) != AC_WID_AUD_IN)
4307 continue;
4308 if (caps & AC_WCAP_DIGITAL)
4309 continue;
4310 if (snd_BUG_ON(spec->num_adc_nids >=
4311 ARRAY_SIZE(spec->private_adc_nids)))
4312 break;
4313 spec->private_adc_nids[spec->num_adc_nids++] = nid;
4314 }
4315 spec->adc_nids = spec->private_adc_nids;
4316 return 0;
4317}
4318
4319
4320static const struct hda_codec_ops cx_auto_patch_ops = {
3795 .build_controls = cx_auto_build_controls, 4321 .build_controls = cx_auto_build_controls,
3796 .build_pcms = conexant_build_pcms, 4322 .build_pcms = conexant_build_pcms,
3797 .init = cx_auto_init, 4323 .init = cx_auto_init,
@@ -3808,19 +4334,24 @@ static int patch_conexant_auto(struct hda_codec *codec)
3808 struct conexant_spec *spec; 4334 struct conexant_spec *spec;
3809 int err; 4335 int err;
3810 4336
4337 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
4338 codec->chip_name);
4339
3811 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 4340 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3812 if (!spec) 4341 if (!spec)
3813 return -ENOMEM; 4342 return -ENOMEM;
3814 codec->spec = spec; 4343 codec->spec = spec;
3815 spec->adc_nids = cx_auto_adc_nids; 4344 codec->pin_amp_workaround = 1;
3816 spec->num_adc_nids = ARRAY_SIZE(cx_auto_adc_nids); 4345 err = cx_auto_search_adcs(codec);
3817 spec->capsrc_nids = spec->adc_nids; 4346 if (err < 0)
4347 return err;
3818 err = cx_auto_parse_auto_config(codec); 4348 err = cx_auto_parse_auto_config(codec);
3819 if (err < 0) { 4349 if (err < 0) {
3820 kfree(codec->spec); 4350 kfree(codec->spec);
3821 codec->spec = NULL; 4351 codec->spec = NULL;
3822 return err; 4352 return err;
3823 } 4353 }
4354 spec->capture_stream = &cx_auto_pcm_analog_capture;
3824 codec->patch_ops = cx_auto_patch_ops; 4355 codec->patch_ops = cx_auto_patch_ops;
3825 if (spec->beep_amp) 4356 if (spec->beep_amp)
3826 snd_hda_attach_beep_device(codec, spec->beep_amp); 4357 snd_hda_attach_beep_device(codec, spec->beep_amp);
@@ -3830,7 +4361,7 @@ static int patch_conexant_auto(struct hda_codec *codec)
3830/* 4361/*
3831 */ 4362 */
3832 4363
3833static struct hda_codec_preset snd_hda_preset_conexant[] = { 4364static const struct hda_codec_preset snd_hda_preset_conexant[] = {
3834 { .id = 0x14f15045, .name = "CX20549 (Venice)", 4365 { .id = 0x14f15045, .name = "CX20549 (Venice)",
3835 .patch = patch_cxt5045 }, 4366 .patch = patch_cxt5045 },
3836 { .id = 0x14f15047, .name = "CX20551 (Waikiki)", 4367 { .id = 0x14f15047, .name = "CX20551 (Waikiki)",
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 715615a88a8..32290187322 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -33,6 +33,7 @@
33#include <linux/slab.h> 33#include <linux/slab.h>
34#include <linux/moduleparam.h> 34#include <linux/moduleparam.h>
35#include <sound/core.h> 35#include <sound/core.h>
36#include <sound/jack.h>
36#include "hda_codec.h" 37#include "hda_codec.h"
37#include "hda_local.h" 38#include "hda_local.h"
38 39
@@ -76,7 +77,7 @@ struct hdmi_spec {
76 * ati/nvhdmi specific 77 * ati/nvhdmi specific
77 */ 78 */
78 struct hda_multi_out multiout; 79 struct hda_multi_out multiout;
79 struct hda_pcm_stream *pcm_playback; 80 const struct hda_pcm_stream *pcm_playback;
80 81
81 /* misc flags */ 82 /* misc flags */
82 /* PD bit indicates only the update, not the current state */ 83 /* PD bit indicates only the update, not the current state */
@@ -720,6 +721,8 @@ static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res)
720 &spec->sink_eld[index]); 721 &spec->sink_eld[index]);
721 /* TODO: do real things about ELD */ 722 /* TODO: do real things about ELD */
722 } 723 }
724
725 snd_hda_input_jack_report(codec, tag);
723} 726}
724 727
725static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res) 728static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res)
@@ -912,6 +915,7 @@ static void hdmi_present_sense(struct hda_codec *codec, hda_nid_t pin_nid,
912static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid) 915static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid)
913{ 916{
914 struct hdmi_spec *spec = codec->spec; 917 struct hdmi_spec *spec = codec->spec;
918 int err;
915 919
916 if (spec->num_pins >= MAX_HDMI_PINS) { 920 if (spec->num_pins >= MAX_HDMI_PINS) {
917 snd_printk(KERN_WARNING 921 snd_printk(KERN_WARNING
@@ -919,6 +923,12 @@ static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid)
919 return -E2BIG; 923 return -E2BIG;
920 } 924 }
921 925
926 err = snd_hda_input_jack_add(codec, pin_nid,
927 SND_JACK_VIDEOOUT, NULL);
928 if (err < 0)
929 return err;
930 snd_hda_input_jack_report(codec, pin_nid);
931
922 hdmi_present_sense(codec, pin_nid, &spec->sink_eld[spec->num_pins]); 932 hdmi_present_sense(codec, pin_nid, &spec->sink_eld[spec->num_pins]);
923 933
924 spec->pin[spec->num_pins] = pin_nid; 934 spec->pin[spec->num_pins] = pin_nid;
@@ -1044,7 +1054,7 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
1044 return hdmi_setup_stream(codec, hinfo->nid, stream_tag, format); 1054 return hdmi_setup_stream(codec, hinfo->nid, stream_tag, format);
1045} 1055}
1046 1056
1047static struct hda_pcm_stream generic_hdmi_pcm_playback = { 1057static const struct hda_pcm_stream generic_hdmi_pcm_playback = {
1048 .substreams = 1, 1058 .substreams = 1,
1049 .channels_min = 2, 1059 .channels_min = 2,
1050 .ops = { 1060 .ops = {
@@ -1120,11 +1130,12 @@ static void generic_hdmi_free(struct hda_codec *codec)
1120 1130
1121 for (i = 0; i < spec->num_pins; i++) 1131 for (i = 0; i < spec->num_pins; i++)
1122 snd_hda_eld_proc_free(codec, &spec->sink_eld[i]); 1132 snd_hda_eld_proc_free(codec, &spec->sink_eld[i]);
1133 snd_hda_input_jack_free(codec);
1123 1134
1124 kfree(spec); 1135 kfree(spec);
1125} 1136}
1126 1137
1127static struct hda_codec_ops generic_hdmi_patch_ops = { 1138static const struct hda_codec_ops generic_hdmi_patch_ops = {
1128 .init = generic_hdmi_init, 1139 .init = generic_hdmi_init,
1129 .free = generic_hdmi_free, 1140 .free = generic_hdmi_free,
1130 .build_pcms = generic_hdmi_build_pcms, 1141 .build_pcms = generic_hdmi_build_pcms,
@@ -1169,12 +1180,12 @@ static int patch_generic_hdmi(struct hda_codec *codec)
1169#define nvhdmi_master_con_nid_7x 0x04 1180#define nvhdmi_master_con_nid_7x 0x04
1170#define nvhdmi_master_pin_nid_7x 0x05 1181#define nvhdmi_master_pin_nid_7x 0x05
1171 1182
1172static hda_nid_t nvhdmi_con_nids_7x[4] = { 1183static const hda_nid_t nvhdmi_con_nids_7x[4] = {
1173 /*front, rear, clfe, rear_surr */ 1184 /*front, rear, clfe, rear_surr */
1174 0x6, 0x8, 0xa, 0xc, 1185 0x6, 0x8, 0xa, 0xc,
1175}; 1186};
1176 1187
1177static struct hda_verb nvhdmi_basic_init_7x[] = { 1188static const struct hda_verb nvhdmi_basic_init_7x[] = {
1178 /* set audio protect on */ 1189 /* set audio protect on */
1179 { 0x1, Nv_VERB_SET_Audio_Protection_On, 0x1}, 1190 { 0x1, Nv_VERB_SET_Audio_Protection_On, 0x1},
1180 /* enable digital output on pin widget */ 1191 /* enable digital output on pin widget */
@@ -1435,7 +1446,7 @@ static int nvhdmi_8ch_7x_pcm_prepare(struct hda_pcm_stream *hinfo,
1435 return 0; 1446 return 0;
1436} 1447}
1437 1448
1438static struct hda_pcm_stream nvhdmi_pcm_playback_8ch_7x = { 1449static const struct hda_pcm_stream nvhdmi_pcm_playback_8ch_7x = {
1439 .substreams = 1, 1450 .substreams = 1,
1440 .channels_min = 2, 1451 .channels_min = 2,
1441 .channels_max = 8, 1452 .channels_max = 8,
@@ -1450,7 +1461,7 @@ static struct hda_pcm_stream nvhdmi_pcm_playback_8ch_7x = {
1450 }, 1461 },
1451}; 1462};
1452 1463
1453static struct hda_pcm_stream nvhdmi_pcm_playback_2ch = { 1464static const struct hda_pcm_stream nvhdmi_pcm_playback_2ch = {
1454 .substreams = 1, 1465 .substreams = 1,
1455 .channels_min = 2, 1466 .channels_min = 2,
1456 .channels_max = 2, 1467 .channels_max = 2,
@@ -1465,14 +1476,14 @@ static struct hda_pcm_stream nvhdmi_pcm_playback_2ch = {
1465 }, 1476 },
1466}; 1477};
1467 1478
1468static struct hda_codec_ops nvhdmi_patch_ops_8ch_7x = { 1479static const struct hda_codec_ops nvhdmi_patch_ops_8ch_7x = {
1469 .build_controls = generic_hdmi_build_controls, 1480 .build_controls = generic_hdmi_build_controls,
1470 .build_pcms = generic_hdmi_build_pcms, 1481 .build_pcms = generic_hdmi_build_pcms,
1471 .init = nvhdmi_7x_init, 1482 .init = nvhdmi_7x_init,
1472 .free = generic_hdmi_free, 1483 .free = generic_hdmi_free,
1473}; 1484};
1474 1485
1475static struct hda_codec_ops nvhdmi_patch_ops_2ch = { 1486static const struct hda_codec_ops nvhdmi_patch_ops_2ch = {
1476 .build_controls = generic_hdmi_build_controls, 1487 .build_controls = generic_hdmi_build_controls,
1477 .build_pcms = generic_hdmi_build_pcms, 1488 .build_pcms = generic_hdmi_build_pcms,
1478 .init = nvhdmi_7x_init, 1489 .init = nvhdmi_7x_init,
@@ -1568,7 +1579,7 @@ static int atihdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
1568 return 0; 1579 return 0;
1569} 1580}
1570 1581
1571static struct hda_pcm_stream atihdmi_pcm_digital_playback = { 1582static const struct hda_pcm_stream atihdmi_pcm_digital_playback = {
1572 .substreams = 1, 1583 .substreams = 1,
1573 .channels_min = 2, 1584 .channels_min = 2,
1574 .channels_max = 2, 1585 .channels_max = 2,
@@ -1580,7 +1591,7 @@ static struct hda_pcm_stream atihdmi_pcm_digital_playback = {
1580 }, 1591 },
1581}; 1592};
1582 1593
1583static struct hda_verb atihdmi_basic_init[] = { 1594static const struct hda_verb atihdmi_basic_init[] = {
1584 /* enable digital output on pin widget */ 1595 /* enable digital output on pin widget */
1585 { 0x03, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 1596 { 0x03, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1586 {} /* terminator */ 1597 {} /* terminator */
@@ -1599,7 +1610,7 @@ static int atihdmi_init(struct hda_codec *codec)
1599 return 0; 1610 return 0;
1600} 1611}
1601 1612
1602static struct hda_codec_ops atihdmi_patch_ops = { 1613static const struct hda_codec_ops atihdmi_patch_ops = {
1603 .build_controls = generic_hdmi_build_controls, 1614 .build_controls = generic_hdmi_build_controls,
1604 .build_pcms = generic_hdmi_build_pcms, 1615 .build_pcms = generic_hdmi_build_pcms,
1605 .init = atihdmi_init, 1616 .init = atihdmi_init,
@@ -1634,7 +1645,7 @@ static int patch_atihdmi(struct hda_codec *codec)
1634/* 1645/*
1635 * patch entries 1646 * patch entries
1636 */ 1647 */
1637static struct hda_codec_preset snd_hda_preset_hdmi[] = { 1648static const struct hda_codec_preset snd_hda_preset_hdmi[] = {
1638{ .id = 0x1002793c, .name = "RS600 HDMI", .patch = patch_atihdmi }, 1649{ .id = 0x1002793c, .name = "RS600 HDMI", .patch = patch_atihdmi },
1639{ .id = 0x10027919, .name = "RS600 HDMI", .patch = patch_atihdmi }, 1650{ .id = 0x10027919, .name = "RS600 HDMI", .patch = patch_atihdmi },
1640{ .id = 0x1002791a, .name = "RS690/780 HDMI", .patch = patch_atihdmi }, 1651{ .id = 0x1002791a, .name = "RS690/780 HDMI", .patch = patch_atihdmi },
@@ -1677,6 +1688,7 @@ static struct hda_codec_preset snd_hda_preset_hdmi[] = {
1677{ .id = 0x80862803, .name = "Eaglelake HDMI", .patch = patch_generic_hdmi }, 1688{ .id = 0x80862803, .name = "Eaglelake HDMI", .patch = patch_generic_hdmi },
1678{ .id = 0x80862804, .name = "IbexPeak HDMI", .patch = patch_generic_hdmi }, 1689{ .id = 0x80862804, .name = "IbexPeak HDMI", .patch = patch_generic_hdmi },
1679{ .id = 0x80862805, .name = "CougarPoint HDMI", .patch = patch_generic_hdmi }, 1690{ .id = 0x80862805, .name = "CougarPoint HDMI", .patch = patch_generic_hdmi },
1691{ .id = 0x80862806, .name = "PantherPoint HDMI", .patch = patch_generic_hdmi },
1680{ .id = 0x808629fb, .name = "Crestline HDMI", .patch = patch_generic_hdmi }, 1692{ .id = 0x808629fb, .name = "Crestline HDMI", .patch = patch_generic_hdmi },
1681{} /* terminator */ 1693{} /* terminator */
1682}; 1694};
@@ -1722,6 +1734,7 @@ MODULE_ALIAS("snd-hda-codec-id:80862802");
1722MODULE_ALIAS("snd-hda-codec-id:80862803"); 1734MODULE_ALIAS("snd-hda-codec-id:80862803");
1723MODULE_ALIAS("snd-hda-codec-id:80862804"); 1735MODULE_ALIAS("snd-hda-codec-id:80862804");
1724MODULE_ALIAS("snd-hda-codec-id:80862805"); 1736MODULE_ALIAS("snd-hda-codec-id:80862805");
1737MODULE_ALIAS("snd-hda-codec-id:80862806");
1725MODULE_ALIAS("snd-hda-codec-id:808629fb"); 1738MODULE_ALIAS("snd-hda-codec-id:808629fb");
1726 1739
1727MODULE_LICENSE("GPL"); 1740MODULE_LICENSE("GPL");
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index c82979a8cd0..7a4e10002f5 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -299,11 +299,23 @@ struct alc_customize_define {
299 299
300struct alc_fixup; 300struct alc_fixup;
301 301
302struct alc_multi_io {
303 hda_nid_t pin; /* multi-io widget pin NID */
304 hda_nid_t dac; /* DAC to be connected */
305 unsigned int ctl_in; /* cached input-pin control value */
306};
307
308enum {
309 ALC_AUTOMUTE_PIN, /* change the pin control */
310 ALC_AUTOMUTE_AMP, /* mute/unmute the pin AMP */
311 ALC_AUTOMUTE_MIXER, /* mute/unmute mixer widget AMP */
312};
313
302struct alc_spec { 314struct alc_spec {
303 /* codec parameterization */ 315 /* codec parameterization */
304 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ 316 const struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
305 unsigned int num_mixers; 317 unsigned int num_mixers;
306 struct snd_kcontrol_new *cap_mixer; /* capture mixer */ 318 const struct snd_kcontrol_new *cap_mixer; /* capture mixer */
307 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ 319 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
308 320
309 const struct hda_verb *init_verbs[10]; /* initialization verbs 321 const struct hda_verb *init_verbs[10]; /* initialization verbs
@@ -313,14 +325,14 @@ struct alc_spec {
313 unsigned int num_init_verbs; 325 unsigned int num_init_verbs;
314 326
315 char stream_name_analog[32]; /* analog PCM stream */ 327 char stream_name_analog[32]; /* analog PCM stream */
316 struct hda_pcm_stream *stream_analog_playback; 328 const struct hda_pcm_stream *stream_analog_playback;
317 struct hda_pcm_stream *stream_analog_capture; 329 const struct hda_pcm_stream *stream_analog_capture;
318 struct hda_pcm_stream *stream_analog_alt_playback; 330 const struct hda_pcm_stream *stream_analog_alt_playback;
319 struct hda_pcm_stream *stream_analog_alt_capture; 331 const struct hda_pcm_stream *stream_analog_alt_capture;
320 332
321 char stream_name_digital[32]; /* digital PCM stream */ 333 char stream_name_digital[32]; /* digital PCM stream */
322 struct hda_pcm_stream *stream_digital_playback; 334 const struct hda_pcm_stream *stream_digital_playback;
323 struct hda_pcm_stream *stream_digital_capture; 335 const struct hda_pcm_stream *stream_digital_capture;
324 336
325 /* playback */ 337 /* playback */
326 struct hda_multi_out multiout; /* playback set-up 338 struct hda_multi_out multiout; /* playback set-up
@@ -333,8 +345,8 @@ struct alc_spec {
333 345
334 /* capture */ 346 /* capture */
335 unsigned int num_adc_nids; 347 unsigned int num_adc_nids;
336 hda_nid_t *adc_nids; 348 const hda_nid_t *adc_nids;
337 hda_nid_t *capsrc_nids; 349 const hda_nid_t *capsrc_nids;
338 hda_nid_t dig_in_nid; /* digital-in NID; optional */ 350 hda_nid_t dig_in_nid; /* digital-in NID; optional */
339 351
340 /* capture setup for dynamic dual-adc switch */ 352 /* capture setup for dynamic dual-adc switch */
@@ -348,6 +360,7 @@ struct alc_spec {
348 const struct hda_input_mux *input_mux; 360 const struct hda_input_mux *input_mux;
349 unsigned int cur_mux[3]; 361 unsigned int cur_mux[3];
350 struct alc_mic_route ext_mic; 362 struct alc_mic_route ext_mic;
363 struct alc_mic_route dock_mic;
351 struct alc_mic_route int_mic; 364 struct alc_mic_route int_mic;
352 365
353 /* channel model */ 366 /* channel model */
@@ -375,17 +388,27 @@ struct alc_spec {
375#ifdef CONFIG_SND_HDA_POWER_SAVE 388#ifdef CONFIG_SND_HDA_POWER_SAVE
376 void (*power_hook)(struct hda_codec *codec); 389 void (*power_hook)(struct hda_codec *codec);
377#endif 390#endif
391 void (*shutup)(struct hda_codec *codec);
378 392
379 /* for pin sensing */ 393 /* for pin sensing */
380 unsigned int sense_updated: 1;
381 unsigned int jack_present: 1; 394 unsigned int jack_present: 1;
382 unsigned int master_sw: 1; 395 unsigned int line_jack_present:1;
396 unsigned int master_mute:1;
383 unsigned int auto_mic:1; 397 unsigned int auto_mic:1;
398 unsigned int automute:1; /* HP automute enabled */
399 unsigned int detect_line:1; /* Line-out detection enabled */
400 unsigned int automute_lines:1; /* automute line-out as well */
401 unsigned int automute_hp_lo:1; /* both HP and LO available */
384 402
385 /* other flags */ 403 /* other flags */
386 unsigned int no_analog :1; /* digital I/O only */ 404 unsigned int no_analog :1; /* digital I/O only */
387 unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */ 405 unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */
388 unsigned int single_input_src:1; 406 unsigned int single_input_src:1;
407
408 /* auto-mute control */
409 int automute_mode;
410 hda_nid_t automute_mixer_nid[AUTO_CFG_MAX_OUTS];
411
389 int init_amp; 412 int init_amp;
390 int codec_variant; /* flag for other variants */ 413 int codec_variant; /* flag for other variants */
391 414
@@ -403,25 +426,29 @@ struct alc_spec {
403 int fixup_id; 426 int fixup_id;
404 const struct alc_fixup *fixup_list; 427 const struct alc_fixup *fixup_list;
405 const char *fixup_name; 428 const char *fixup_name;
429
430 /* multi-io */
431 int multi_ios;
432 struct alc_multi_io multi_io[4];
406}; 433};
407 434
408/* 435/*
409 * configuration template - to be copied to the spec instance 436 * configuration template - to be copied to the spec instance
410 */ 437 */
411struct alc_config_preset { 438struct alc_config_preset {
412 struct snd_kcontrol_new *mixers[5]; /* should be identical size 439 const struct snd_kcontrol_new *mixers[5]; /* should be identical size
413 * with spec 440 * with spec
414 */ 441 */
415 struct snd_kcontrol_new *cap_mixer; /* capture mixer */ 442 const struct snd_kcontrol_new *cap_mixer; /* capture mixer */
416 const struct hda_verb *init_verbs[5]; 443 const struct hda_verb *init_verbs[5];
417 unsigned int num_dacs; 444 unsigned int num_dacs;
418 hda_nid_t *dac_nids; 445 const hda_nid_t *dac_nids;
419 hda_nid_t dig_out_nid; /* optional */ 446 hda_nid_t dig_out_nid; /* optional */
420 hda_nid_t hp_nid; /* optional */ 447 hda_nid_t hp_nid; /* optional */
421 hda_nid_t *slave_dig_outs; 448 const hda_nid_t *slave_dig_outs;
422 unsigned int num_adc_nids; 449 unsigned int num_adc_nids;
423 hda_nid_t *adc_nids; 450 const hda_nid_t *adc_nids;
424 hda_nid_t *capsrc_nids; 451 const hda_nid_t *capsrc_nids;
425 hda_nid_t dig_in_nid; 452 hda_nid_t dig_in_nid;
426 unsigned int num_channel_mode; 453 unsigned int num_channel_mode;
427 const struct hda_channel_mode *channel_mode; 454 const struct hda_channel_mode *channel_mode;
@@ -433,7 +460,7 @@ struct alc_config_preset {
433 void (*setup)(struct hda_codec *); 460 void (*setup)(struct hda_codec *);
434 void (*init_hook)(struct hda_codec *); 461 void (*init_hook)(struct hda_codec *);
435#ifdef CONFIG_SND_HDA_POWER_SAVE 462#ifdef CONFIG_SND_HDA_POWER_SAVE
436 struct hda_amp_list *loopbacks; 463 const struct hda_amp_list *loopbacks;
437 void (*power_hook)(struct hda_codec *codec); 464 void (*power_hook)(struct hda_codec *codec);
438#endif 465#endif
439}; 466};
@@ -560,11 +587,11 @@ static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
560 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of 587 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
561 * March 2006. 588 * March 2006.
562 */ 589 */
563static char *alc_pin_mode_names[] = { 590static const char * const alc_pin_mode_names[] = {
564 "Mic 50pc bias", "Mic 80pc bias", 591 "Mic 50pc bias", "Mic 80pc bias",
565 "Line in", "Line out", "Headphone out", 592 "Line in", "Line out", "Headphone out",
566}; 593};
567static unsigned char alc_pin_mode_values[] = { 594static const unsigned char alc_pin_mode_values[] = {
568 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, 595 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
569}; 596};
570/* The control can present all 5 options, or it can limit the options based 597/* The control can present all 5 options, or it can limit the options based
@@ -583,7 +610,7 @@ static unsigned char alc_pin_mode_values[] = {
583/* Info about the pin modes supported by the different pin direction modes. 610/* Info about the pin modes supported by the different pin direction modes.
584 * For each direction the minimum and maximum values are given. 611 * For each direction the minimum and maximum values are given.
585 */ 612 */
586static signed char alc_pin_mode_dir_info[5][2] = { 613static const signed char alc_pin_mode_dir_info[5][2] = {
587 { 0, 2 }, /* ALC_PIN_DIR_IN */ 614 { 0, 2 }, /* ALC_PIN_DIR_IN */
588 { 3, 4 }, /* ALC_PIN_DIR_OUT */ 615 { 3, 4 }, /* ALC_PIN_DIR_OUT */
589 { 0, 4 }, /* ALC_PIN_DIR_INOUT */ 616 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
@@ -900,7 +927,7 @@ static void alc_fixup_autocfg_pin_nums(struct hda_codec *codec)
900 927
901/* 928/*
902 */ 929 */
903static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) 930static void add_mixer(struct alc_spec *spec, const struct snd_kcontrol_new *mix)
904{ 931{
905 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) 932 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
906 return; 933 return;
@@ -971,21 +998,21 @@ static void setup_preset(struct hda_codec *codec,
971} 998}
972 999
973/* Enable GPIO mask and set output */ 1000/* Enable GPIO mask and set output */
974static struct hda_verb alc_gpio1_init_verbs[] = { 1001static const struct hda_verb alc_gpio1_init_verbs[] = {
975 {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, 1002 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
976 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, 1003 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
977 {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, 1004 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
978 { } 1005 { }
979}; 1006};
980 1007
981static struct hda_verb alc_gpio2_init_verbs[] = { 1008static const struct hda_verb alc_gpio2_init_verbs[] = {
982 {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, 1009 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
983 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, 1010 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
984 {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, 1011 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
985 { } 1012 { }
986}; 1013};
987 1014
988static struct hda_verb alc_gpio3_init_verbs[] = { 1015static const struct hda_verb alc_gpio3_init_verbs[] = {
989 {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, 1016 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
990 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, 1017 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
991 {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, 1018 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
@@ -1031,6 +1058,7 @@ static int alc_init_jacks(struct hda_codec *codec)
1031 int err; 1058 int err;
1032 unsigned int hp_nid = spec->autocfg.hp_pins[0]; 1059 unsigned int hp_nid = spec->autocfg.hp_pins[0];
1033 unsigned int mic_nid = spec->ext_mic.pin; 1060 unsigned int mic_nid = spec->ext_mic.pin;
1061 unsigned int dock_nid = spec->dock_mic.pin;
1034 1062
1035 if (hp_nid) { 1063 if (hp_nid) {
1036 err = snd_hda_input_jack_add(codec, hp_nid, 1064 err = snd_hda_input_jack_add(codec, hp_nid,
@@ -1047,46 +1075,116 @@ static int alc_init_jacks(struct hda_codec *codec)
1047 return err; 1075 return err;
1048 snd_hda_input_jack_report(codec, mic_nid); 1076 snd_hda_input_jack_report(codec, mic_nid);
1049 } 1077 }
1078 if (dock_nid) {
1079 err = snd_hda_input_jack_add(codec, dock_nid,
1080 SND_JACK_MICROPHONE, NULL);
1081 if (err < 0)
1082 return err;
1083 snd_hda_input_jack_report(codec, dock_nid);
1084 }
1050#endif /* CONFIG_SND_HDA_INPUT_JACK */ 1085#endif /* CONFIG_SND_HDA_INPUT_JACK */
1051 return 0; 1086 return 0;
1052} 1087}
1053 1088
1054static void alc_automute_speaker(struct hda_codec *codec, int pinctl) 1089static int detect_jacks(struct hda_codec *codec, int num_pins, hda_nid_t *pins)
1055{ 1090{
1056 struct alc_spec *spec = codec->spec; 1091 int i, present = 0;
1057 unsigned int mute;
1058 hda_nid_t nid;
1059 int i;
1060 1092
1061 spec->jack_present = 0; 1093 for (i = 0; i < num_pins; i++) {
1062 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { 1094 hda_nid_t nid = pins[i];
1063 nid = spec->autocfg.hp_pins[i];
1064 if (!nid) 1095 if (!nid)
1065 break; 1096 break;
1066 snd_hda_input_jack_report(codec, nid); 1097 snd_hda_input_jack_report(codec, nid);
1067 spec->jack_present |= snd_hda_jack_detect(codec, nid); 1098 present |= snd_hda_jack_detect(codec, nid);
1068 } 1099 }
1100 return present;
1101}
1102
1103static void do_automute(struct hda_codec *codec, int num_pins, hda_nid_t *pins,
1104 bool mute, bool hp_out)
1105{
1106 struct alc_spec *spec = codec->spec;
1107 unsigned int mute_bits = mute ? HDA_AMP_MUTE : 0;
1108 unsigned int pin_bits = mute ? 0 : (hp_out ? PIN_HP : PIN_OUT);
1109 int i;
1069 1110
1070 mute = spec->jack_present ? HDA_AMP_MUTE : 0; 1111 for (i = 0; i < num_pins; i++) {
1071 /* Toggle internal speakers muting */ 1112 hda_nid_t nid = pins[i];
1072 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1073 nid = spec->autocfg.speaker_pins[i];
1074 if (!nid) 1113 if (!nid)
1075 break; 1114 break;
1076 if (pinctl) { 1115 switch (spec->automute_mode) {
1116 case ALC_AUTOMUTE_PIN:
1077 snd_hda_codec_write(codec, nid, 0, 1117 snd_hda_codec_write(codec, nid, 0,
1078 AC_VERB_SET_PIN_WIDGET_CONTROL, 1118 AC_VERB_SET_PIN_WIDGET_CONTROL,
1079 spec->jack_present ? 0 : PIN_OUT); 1119 pin_bits);
1080 } else { 1120 break;
1121 case ALC_AUTOMUTE_AMP:
1081 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, 1122 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1082 HDA_AMP_MUTE, mute); 1123 HDA_AMP_MUTE, mute_bits);
1124 break;
1125 case ALC_AUTOMUTE_MIXER:
1126 nid = spec->automute_mixer_nid[i];
1127 if (!nid)
1128 break;
1129 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
1130 HDA_AMP_MUTE, mute_bits);
1131 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 1,
1132 HDA_AMP_MUTE, mute_bits);
1133 break;
1083 } 1134 }
1084 } 1135 }
1085} 1136}
1086 1137
1087static void alc_automute_pin(struct hda_codec *codec) 1138/* Toggle internal speakers muting */
1139static void update_speakers(struct hda_codec *codec)
1140{
1141 struct alc_spec *spec = codec->spec;
1142 int on;
1143
1144 if (!spec->automute)
1145 on = 0;
1146 else
1147 on = spec->jack_present | spec->line_jack_present;
1148 on |= spec->master_mute;
1149 do_automute(codec, ARRAY_SIZE(spec->autocfg.speaker_pins),
1150 spec->autocfg.speaker_pins, on, false);
1151
1152 /* toggle line-out mutes if needed, too */
1153 /* if LO is a copy of either HP or Speaker, don't need to handle it */
1154 if (spec->autocfg.line_out_pins[0] == spec->autocfg.hp_pins[0] ||
1155 spec->autocfg.line_out_pins[0] == spec->autocfg.speaker_pins[0])
1156 return;
1157 if (!spec->automute_lines || !spec->automute)
1158 on = 0;
1159 else
1160 on = spec->jack_present;
1161 on |= spec->master_mute;
1162 do_automute(codec, ARRAY_SIZE(spec->autocfg.line_out_pins),
1163 spec->autocfg.line_out_pins, on, false);
1164}
1165
1166static void alc_hp_automute(struct hda_codec *codec)
1088{ 1167{
1089 alc_automute_speaker(codec, 1); 1168 struct alc_spec *spec = codec->spec;
1169
1170 if (!spec->automute)
1171 return;
1172 spec->jack_present =
1173 detect_jacks(codec, ARRAY_SIZE(spec->autocfg.hp_pins),
1174 spec->autocfg.hp_pins);
1175 update_speakers(codec);
1176}
1177
1178static void alc_line_automute(struct hda_codec *codec)
1179{
1180 struct alc_spec *spec = codec->spec;
1181
1182 if (!spec->automute || !spec->detect_line)
1183 return;
1184 spec->line_jack_present =
1185 detect_jacks(codec, ARRAY_SIZE(spec->autocfg.line_out_pins),
1186 spec->autocfg.line_out_pins);
1187 update_speakers(codec);
1090} 1188}
1091 1189
1092static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, 1190static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
@@ -1128,7 +1226,7 @@ static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec)
1128static void alc_mic_automute(struct hda_codec *codec) 1226static void alc_mic_automute(struct hda_codec *codec)
1129{ 1227{
1130 struct alc_spec *spec = codec->spec; 1228 struct alc_spec *spec = codec->spec;
1131 struct alc_mic_route *dead, *alive; 1229 struct alc_mic_route *dead1, *dead2, *alive;
1132 unsigned int present, type; 1230 unsigned int present, type;
1133 hda_nid_t cap_nid; 1231 hda_nid_t cap_nid;
1134 1232
@@ -1146,13 +1244,24 @@ static void alc_mic_automute(struct hda_codec *codec)
1146 1244
1147 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; 1245 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1148 1246
1247 alive = &spec->int_mic;
1248 dead1 = &spec->ext_mic;
1249 dead2 = &spec->dock_mic;
1250
1149 present = snd_hda_jack_detect(codec, spec->ext_mic.pin); 1251 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1150 if (present) { 1252 if (present) {
1151 alive = &spec->ext_mic; 1253 alive = &spec->ext_mic;
1152 dead = &spec->int_mic; 1254 dead1 = &spec->int_mic;
1153 } else { 1255 dead2 = &spec->dock_mic;
1154 alive = &spec->int_mic; 1256 }
1155 dead = &spec->ext_mic; 1257 if (!present && spec->dock_mic.pin > 0) {
1258 present = snd_hda_jack_detect(codec, spec->dock_mic.pin);
1259 if (present) {
1260 alive = &spec->dock_mic;
1261 dead1 = &spec->int_mic;
1262 dead2 = &spec->ext_mic;
1263 }
1264 snd_hda_input_jack_report(codec, spec->dock_mic.pin);
1156 } 1265 }
1157 1266
1158 type = get_wcaps_type(get_wcaps(codec, cap_nid)); 1267 type = get_wcaps_type(get_wcaps(codec, cap_nid));
@@ -1161,9 +1270,14 @@ static void alc_mic_automute(struct hda_codec *codec)
1161 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, 1270 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1162 alive->mux_idx, 1271 alive->mux_idx,
1163 HDA_AMP_MUTE, 0); 1272 HDA_AMP_MUTE, 0);
1164 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, 1273 if (dead1->pin > 0)
1165 dead->mux_idx, 1274 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1166 HDA_AMP_MUTE, HDA_AMP_MUTE); 1275 dead1->mux_idx,
1276 HDA_AMP_MUTE, HDA_AMP_MUTE);
1277 if (dead2->pin > 0)
1278 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1279 dead2->mux_idx,
1280 HDA_AMP_MUTE, HDA_AMP_MUTE);
1167 } else { 1281 } else {
1168 /* MUX style (e.g. ALC880) */ 1282 /* MUX style (e.g. ALC880) */
1169 snd_hda_codec_write_cache(codec, cap_nid, 0, 1283 snd_hda_codec_write_cache(codec, cap_nid, 0,
@@ -1184,7 +1298,10 @@ static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1184 res >>= 26; 1298 res >>= 26;
1185 switch (res) { 1299 switch (res) {
1186 case ALC880_HP_EVENT: 1300 case ALC880_HP_EVENT:
1187 alc_automute_pin(codec); 1301 alc_hp_automute(codec);
1302 break;
1303 case ALC880_FRONT_EVENT:
1304 alc_line_automute(codec);
1188 break; 1305 break;
1189 case ALC880_MIC_EVENT: 1306 case ALC880_MIC_EVENT:
1190 alc_mic_automute(codec); 1307 alc_mic_automute(codec);
@@ -1194,7 +1311,8 @@ static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1194 1311
1195static void alc_inithook(struct hda_codec *codec) 1312static void alc_inithook(struct hda_codec *codec)
1196{ 1313{
1197 alc_automute_pin(codec); 1314 alc_hp_automute(codec);
1315 alc_line_automute(codec);
1198 alc_mic_automute(codec); 1316 alc_mic_automute(codec);
1199} 1317}
1200 1318
@@ -1236,6 +1354,43 @@ static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
1236 on ? 2 : 0); 1354 on ? 2 : 0);
1237} 1355}
1238 1356
1357/* turn on/off EAPD controls of the codec */
1358static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
1359{
1360 /* We currently only handle front, HP */
1361 switch (codec->vendor_id) {
1362 case 0x10ec0260:
1363 set_eapd(codec, 0x0f, on);
1364 set_eapd(codec, 0x10, on);
1365 break;
1366 case 0x10ec0262:
1367 case 0x10ec0267:
1368 case 0x10ec0268:
1369 case 0x10ec0269:
1370 case 0x10ec0270:
1371 case 0x10ec0272:
1372 case 0x10ec0660:
1373 case 0x10ec0662:
1374 case 0x10ec0663:
1375 case 0x10ec0665:
1376 case 0x10ec0862:
1377 case 0x10ec0889:
1378 case 0x10ec0892:
1379 set_eapd(codec, 0x14, on);
1380 set_eapd(codec, 0x15, on);
1381 break;
1382 }
1383}
1384
1385/* generic shutup callback;
1386 * just turning off EPAD and a little pause for avoiding pop-noise
1387 */
1388static void alc_eapd_shutup(struct hda_codec *codec)
1389{
1390 alc_auto_setup_eapd(codec, false);
1391 msleep(200);
1392}
1393
1239static void alc_auto_init_amp(struct hda_codec *codec, int type) 1394static void alc_auto_init_amp(struct hda_codec *codec, int type)
1240{ 1395{
1241 unsigned int tmp; 1396 unsigned int tmp;
@@ -1251,27 +1406,7 @@ static void alc_auto_init_amp(struct hda_codec *codec, int type)
1251 snd_hda_sequence_write(codec, alc_gpio3_init_verbs); 1406 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1252 break; 1407 break;
1253 case ALC_INIT_DEFAULT: 1408 case ALC_INIT_DEFAULT:
1254 switch (codec->vendor_id) { 1409 alc_auto_setup_eapd(codec, true);
1255 case 0x10ec0260:
1256 set_eapd(codec, 0x0f, 1);
1257 set_eapd(codec, 0x10, 1);
1258 break;
1259 case 0x10ec0262:
1260 case 0x10ec0267:
1261 case 0x10ec0268:
1262 case 0x10ec0269:
1263 case 0x10ec0270:
1264 case 0x10ec0272:
1265 case 0x10ec0660:
1266 case 0x10ec0662:
1267 case 0x10ec0663:
1268 case 0x10ec0665:
1269 case 0x10ec0862:
1270 case 0x10ec0889:
1271 set_eapd(codec, 0x14, 1);
1272 set_eapd(codec, 0x15, 1);
1273 break;
1274 }
1275 switch (codec->vendor_id) { 1410 switch (codec->vendor_id) {
1276 case 0x10ec0260: 1411 case 0x10ec0260:
1277 snd_hda_codec_write(codec, 0x1a, 0, 1412 snd_hda_codec_write(codec, 0x1a, 0,
@@ -1315,20 +1450,128 @@ static void alc_auto_init_amp(struct hda_codec *codec, int type)
1315 } 1450 }
1316} 1451}
1317 1452
1453static int alc_automute_mode_info(struct snd_kcontrol *kcontrol,
1454 struct snd_ctl_elem_info *uinfo)
1455{
1456 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1457 struct alc_spec *spec = codec->spec;
1458 static const char * const texts2[] = {
1459 "Disabled", "Enabled"
1460 };
1461 static const char * const texts3[] = {
1462 "Disabled", "Speaker Only", "Line-Out+Speaker"
1463 };
1464 const char * const *texts;
1465
1466 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
1467 uinfo->count = 1;
1468 if (spec->automute_hp_lo) {
1469 uinfo->value.enumerated.items = 3;
1470 texts = texts3;
1471 } else {
1472 uinfo->value.enumerated.items = 2;
1473 texts = texts2;
1474 }
1475 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
1476 uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
1477 strcpy(uinfo->value.enumerated.name,
1478 texts[uinfo->value.enumerated.item]);
1479 return 0;
1480}
1481
1482static int alc_automute_mode_get(struct snd_kcontrol *kcontrol,
1483 struct snd_ctl_elem_value *ucontrol)
1484{
1485 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1486 struct alc_spec *spec = codec->spec;
1487 unsigned int val;
1488 if (!spec->automute)
1489 val = 0;
1490 else if (!spec->automute_lines)
1491 val = 1;
1492 else
1493 val = 2;
1494 ucontrol->value.enumerated.item[0] = val;
1495 return 0;
1496}
1497
1498static int alc_automute_mode_put(struct snd_kcontrol *kcontrol,
1499 struct snd_ctl_elem_value *ucontrol)
1500{
1501 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1502 struct alc_spec *spec = codec->spec;
1503
1504 switch (ucontrol->value.enumerated.item[0]) {
1505 case 0:
1506 if (!spec->automute)
1507 return 0;
1508 spec->automute = 0;
1509 break;
1510 case 1:
1511 if (spec->automute && !spec->automute_lines)
1512 return 0;
1513 spec->automute = 1;
1514 spec->automute_lines = 0;
1515 break;
1516 case 2:
1517 if (!spec->automute_hp_lo)
1518 return -EINVAL;
1519 if (spec->automute && spec->automute_lines)
1520 return 0;
1521 spec->automute = 1;
1522 spec->automute_lines = 1;
1523 break;
1524 default:
1525 return -EINVAL;
1526 }
1527 update_speakers(codec);
1528 return 1;
1529}
1530
1531static const struct snd_kcontrol_new alc_automute_mode_enum = {
1532 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1533 .name = "Auto-Mute Mode",
1534 .info = alc_automute_mode_info,
1535 .get = alc_automute_mode_get,
1536 .put = alc_automute_mode_put,
1537};
1538
1539static struct snd_kcontrol_new *alc_kcontrol_new(struct alc_spec *spec);
1540
1541static int alc_add_automute_mode_enum(struct hda_codec *codec)
1542{
1543 struct alc_spec *spec = codec->spec;
1544 struct snd_kcontrol_new *knew;
1545
1546 knew = alc_kcontrol_new(spec);
1547 if (!knew)
1548 return -ENOMEM;
1549 *knew = alc_automute_mode_enum;
1550 knew->name = kstrdup("Auto-Mute Mode", GFP_KERNEL);
1551 if (!knew->name)
1552 return -ENOMEM;
1553 return 0;
1554}
1555
1318static void alc_init_auto_hp(struct hda_codec *codec) 1556static void alc_init_auto_hp(struct hda_codec *codec)
1319{ 1557{
1320 struct alc_spec *spec = codec->spec; 1558 struct alc_spec *spec = codec->spec;
1321 struct auto_pin_cfg *cfg = &spec->autocfg; 1559 struct auto_pin_cfg *cfg = &spec->autocfg;
1560 int present = 0;
1322 int i; 1561 int i;
1323 1562
1324 if (!cfg->hp_pins[0]) { 1563 if (cfg->hp_pins[0])
1325 if (cfg->line_out_type != AUTO_PIN_HP_OUT) 1564 present++;
1326 return; 1565 if (cfg->line_out_pins[0])
1327 } 1566 present++;
1567 if (cfg->speaker_pins[0])
1568 present++;
1569 if (present < 2) /* need two different output types */
1570 return;
1571 if (present == 3)
1572 spec->automute_hp_lo = 1; /* both HP and LO automute */
1328 1573
1329 if (!cfg->speaker_pins[0]) { 1574 if (!cfg->speaker_pins[0]) {
1330 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT)
1331 return;
1332 memcpy(cfg->speaker_pins, cfg->line_out_pins, 1575 memcpy(cfg->speaker_pins, cfg->line_out_pins,
1333 sizeof(cfg->speaker_pins)); 1576 sizeof(cfg->speaker_pins));
1334 cfg->speaker_outs = cfg->line_outs; 1577 cfg->speaker_outs = cfg->line_outs;
@@ -1341,28 +1584,49 @@ static void alc_init_auto_hp(struct hda_codec *codec)
1341 } 1584 }
1342 1585
1343 for (i = 0; i < cfg->hp_outs; i++) { 1586 for (i = 0; i < cfg->hp_outs; i++) {
1587 hda_nid_t nid = cfg->hp_pins[i];
1588 if (!is_jack_detectable(codec, nid))
1589 continue;
1344 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", 1590 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1345 cfg->hp_pins[i]); 1591 nid);
1346 snd_hda_codec_write_cache(codec, cfg->hp_pins[i], 0, 1592 snd_hda_codec_write_cache(codec, nid, 0,
1347 AC_VERB_SET_UNSOLICITED_ENABLE, 1593 AC_VERB_SET_UNSOLICITED_ENABLE,
1348 AC_USRSP_EN | ALC880_HP_EVENT); 1594 AC_USRSP_EN | ALC880_HP_EVENT);
1595 spec->automute = 1;
1596 spec->automute_mode = ALC_AUTOMUTE_PIN;
1597 }
1598 if (spec->automute && cfg->line_out_pins[0] &&
1599 cfg->line_out_pins[0] != cfg->hp_pins[0] &&
1600 cfg->line_out_pins[0] != cfg->speaker_pins[0]) {
1601 for (i = 0; i < cfg->line_outs; i++) {
1602 hda_nid_t nid = cfg->line_out_pins[i];
1603 if (!is_jack_detectable(codec, nid))
1604 continue;
1605 snd_printdd("realtek: Enable Line-Out auto-muting "
1606 "on NID 0x%x\n", nid);
1607 snd_hda_codec_write_cache(codec, nid, 0,
1608 AC_VERB_SET_UNSOLICITED_ENABLE,
1609 AC_USRSP_EN | ALC880_FRONT_EVENT);
1610 spec->detect_line = 1;
1611 }
1612 spec->automute_lines = spec->detect_line;
1613 }
1614
1615 if (spec->automute) {
1616 /* create a control for automute mode */
1617 alc_add_automute_mode_enum(codec);
1618 spec->unsol_event = alc_sku_unsol_event;
1349 } 1619 }
1350 spec->unsol_event = alc_sku_unsol_event;
1351} 1620}
1352 1621
1353static void alc_init_auto_mic(struct hda_codec *codec) 1622static void alc_init_auto_mic(struct hda_codec *codec)
1354{ 1623{
1355 struct alc_spec *spec = codec->spec; 1624 struct alc_spec *spec = codec->spec;
1356 struct auto_pin_cfg *cfg = &spec->autocfg; 1625 struct auto_pin_cfg *cfg = &spec->autocfg;
1357 hda_nid_t fixed, ext; 1626 hda_nid_t fixed, ext, dock;
1358 int i; 1627 int i;
1359 1628
1360 /* there must be only two mic inputs exclusively */ 1629 fixed = ext = dock = 0;
1361 for (i = 0; i < cfg->num_inputs; i++)
1362 if (cfg->inputs[i].type >= AUTO_PIN_LINE_IN)
1363 return;
1364
1365 fixed = ext = 0;
1366 for (i = 0; i < cfg->num_inputs; i++) { 1630 for (i = 0; i < cfg->num_inputs; i++) {
1367 hda_nid_t nid = cfg->inputs[i].pin; 1631 hda_nid_t nid = cfg->inputs[i].pin;
1368 unsigned int defcfg; 1632 unsigned int defcfg;
@@ -1371,26 +1635,45 @@ static void alc_init_auto_mic(struct hda_codec *codec)
1371 case INPUT_PIN_ATTR_INT: 1635 case INPUT_PIN_ATTR_INT:
1372 if (fixed) 1636 if (fixed)
1373 return; /* already occupied */ 1637 return; /* already occupied */
1638 if (cfg->inputs[i].type != AUTO_PIN_MIC)
1639 return; /* invalid type */
1374 fixed = nid; 1640 fixed = nid;
1375 break; 1641 break;
1376 case INPUT_PIN_ATTR_UNUSED: 1642 case INPUT_PIN_ATTR_UNUSED:
1377 return; /* invalid entry */ 1643 return; /* invalid entry */
1644 case INPUT_PIN_ATTR_DOCK:
1645 if (dock)
1646 return; /* already occupied */
1647 if (cfg->inputs[i].type > AUTO_PIN_LINE_IN)
1648 return; /* invalid type */
1649 dock = nid;
1650 break;
1378 default: 1651 default:
1379 if (ext) 1652 if (ext)
1380 return; /* already occupied */ 1653 return; /* already occupied */
1654 if (cfg->inputs[i].type != AUTO_PIN_MIC)
1655 return; /* invalid type */
1381 ext = nid; 1656 ext = nid;
1382 break; 1657 break;
1383 } 1658 }
1384 } 1659 }
1660 if (!ext && dock) {
1661 ext = dock;
1662 dock = 0;
1663 }
1385 if (!ext || !fixed) 1664 if (!ext || !fixed)
1386 return; 1665 return;
1387 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) 1666 if (!is_jack_detectable(codec, ext))
1667 return; /* no unsol support */
1668 if (dock && !is_jack_detectable(codec, dock))
1388 return; /* no unsol support */ 1669 return; /* no unsol support */
1389 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", 1670 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x/0x%x\n",
1390 ext, fixed); 1671 ext, fixed, dock);
1391 spec->ext_mic.pin = ext; 1672 spec->ext_mic.pin = ext;
1673 spec->dock_mic.pin = dock;
1392 spec->int_mic.pin = fixed; 1674 spec->int_mic.pin = fixed;
1393 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ 1675 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1676 spec->dock_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1394 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ 1677 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1395 spec->auto_mic = 1; 1678 spec->auto_mic = 1;
1396 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, 1679 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
@@ -1583,9 +1866,6 @@ do_sku:
1583 return 1; 1866 return 1;
1584 spec->autocfg.hp_pins[0] = nid; 1867 spec->autocfg.hp_pins[0] = nid;
1585 } 1868 }
1586
1587 alc_init_auto_hp(codec);
1588 alc_init_auto_mic(codec);
1589 return 1; 1869 return 1;
1590} 1870}
1591 1871
@@ -1598,9 +1878,10 @@ static void alc_ssid_check(struct hda_codec *codec,
1598 snd_printd("realtek: " 1878 snd_printd("realtek: "
1599 "Enable default setup for auto mode as fallback\n"); 1879 "Enable default setup for auto mode as fallback\n");
1600 spec->init_amp = ALC_INIT_DEFAULT; 1880 spec->init_amp = ALC_INIT_DEFAULT;
1601 alc_init_auto_hp(codec);
1602 alc_init_auto_mic(codec);
1603 } 1881 }
1882
1883 alc_init_auto_hp(codec);
1884 alc_init_auto_mic(codec);
1604} 1885}
1605 1886
1606/* 1887/*
@@ -1842,7 +2123,7 @@ static void alc_auto_parse_digital(struct hda_codec *codec)
1842/* 2123/*
1843 * 2ch mode 2124 * 2ch mode
1844 */ 2125 */
1845static struct hda_verb alc888_4ST_ch2_intel_init[] = { 2126static const struct hda_verb alc888_4ST_ch2_intel_init[] = {
1846/* Mic-in jack as mic in */ 2127/* Mic-in jack as mic in */
1847 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, 2128 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1848 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, 2129 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
@@ -1857,7 +2138,7 @@ static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1857/* 2138/*
1858 * 4ch mode 2139 * 4ch mode
1859 */ 2140 */
1860static struct hda_verb alc888_4ST_ch4_intel_init[] = { 2141static const struct hda_verb alc888_4ST_ch4_intel_init[] = {
1861/* Mic-in jack as mic in */ 2142/* Mic-in jack as mic in */
1862 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, 2143 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1863 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, 2144 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
@@ -1872,7 +2153,7 @@ static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1872/* 2153/*
1873 * 6ch mode 2154 * 6ch mode
1874 */ 2155 */
1875static struct hda_verb alc888_4ST_ch6_intel_init[] = { 2156static const struct hda_verb alc888_4ST_ch6_intel_init[] = {
1876/* Mic-in jack as CLFE */ 2157/* Mic-in jack as CLFE */
1877 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 2158 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1878 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, 2159 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
@@ -1887,7 +2168,7 @@ static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1887/* 2168/*
1888 * 8ch mode 2169 * 8ch mode
1889 */ 2170 */
1890static struct hda_verb alc888_4ST_ch8_intel_init[] = { 2171static const struct hda_verb alc888_4ST_ch8_intel_init[] = {
1891/* Mic-in jack as CLFE */ 2172/* Mic-in jack as CLFE */
1892 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 2173 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1893 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, 2174 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
@@ -1899,7 +2180,7 @@ static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1899 { } /* end */ 2180 { } /* end */
1900}; 2181};
1901 2182
1902static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { 2183static const struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1903 { 2, alc888_4ST_ch2_intel_init }, 2184 { 2, alc888_4ST_ch2_intel_init },
1904 { 4, alc888_4ST_ch4_intel_init }, 2185 { 4, alc888_4ST_ch4_intel_init },
1905 { 6, alc888_4ST_ch6_intel_init }, 2186 { 6, alc888_4ST_ch6_intel_init },
@@ -1910,7 +2191,7 @@ static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1910 * ALC888 Fujitsu Siemens Amillo xa3530 2191 * ALC888 Fujitsu Siemens Amillo xa3530
1911 */ 2192 */
1912 2193
1913static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { 2194static const struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1914/* Front Mic: set to PIN_IN (empty by default) */ 2195/* Front Mic: set to PIN_IN (empty by default) */
1915 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 2196 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1916/* Connect Internal HP to Front */ 2197/* Connect Internal HP to Front */
@@ -1943,22 +2224,6 @@ static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1943 {} 2224 {}
1944}; 2225};
1945 2226
1946static void alc_automute_amp(struct hda_codec *codec)
1947{
1948 alc_automute_speaker(codec, 0);
1949}
1950
1951static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1952 unsigned int res)
1953{
1954 if (codec->vendor_id == 0x10ec0880)
1955 res >>= 28;
1956 else
1957 res >>= 26;
1958 if (res == ALC880_HP_EVENT)
1959 alc_automute_amp(codec);
1960}
1961
1962static void alc889_automute_setup(struct hda_codec *codec) 2227static void alc889_automute_setup(struct hda_codec *codec)
1963{ 2228{
1964 struct alc_spec *spec = codec->spec; 2229 struct alc_spec *spec = codec->spec;
@@ -1969,12 +2234,14 @@ static void alc889_automute_setup(struct hda_codec *codec)
1969 spec->autocfg.speaker_pins[2] = 0x17; 2234 spec->autocfg.speaker_pins[2] = 0x17;
1970 spec->autocfg.speaker_pins[3] = 0x19; 2235 spec->autocfg.speaker_pins[3] = 0x19;
1971 spec->autocfg.speaker_pins[4] = 0x1a; 2236 spec->autocfg.speaker_pins[4] = 0x1a;
2237 spec->automute = 1;
2238 spec->automute_mode = ALC_AUTOMUTE_AMP;
1972} 2239}
1973 2240
1974static void alc889_intel_init_hook(struct hda_codec *codec) 2241static void alc889_intel_init_hook(struct hda_codec *codec)
1975{ 2242{
1976 alc889_coef_init(codec); 2243 alc889_coef_init(codec);
1977 alc_automute_amp(codec); 2244 alc_hp_automute(codec);
1978} 2245}
1979 2246
1980static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) 2247static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
@@ -1985,13 +2252,15 @@ static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1985 spec->autocfg.hp_pins[1] = 0x1b; /* hp */ 2252 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1986 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ 2253 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1987 spec->autocfg.speaker_pins[1] = 0x15; /* bass */ 2254 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
2255 spec->automute = 1;
2256 spec->automute_mode = ALC_AUTOMUTE_AMP;
1988} 2257}
1989 2258
1990/* 2259/*
1991 * ALC888 Acer Aspire 4930G model 2260 * ALC888 Acer Aspire 4930G model
1992 */ 2261 */
1993 2262
1994static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { 2263static const struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1995/* Front Mic: set to PIN_IN (empty by default) */ 2264/* Front Mic: set to PIN_IN (empty by default) */
1996 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 2265 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1997/* Unselect Front Mic by default in input mixer 3 */ 2266/* Unselect Front Mic by default in input mixer 3 */
@@ -2014,7 +2283,7 @@ static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
2014 * ALC888 Acer Aspire 6530G model 2283 * ALC888 Acer Aspire 6530G model
2015 */ 2284 */
2016 2285
2017static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { 2286static const struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
2018/* Route to built-in subwoofer as well as speakers */ 2287/* Route to built-in subwoofer as well as speakers */
2019 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 2288 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2020 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 2289 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
@@ -2044,7 +2313,7 @@ static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
2044 *ALC888 Acer Aspire 7730G model 2313 *ALC888 Acer Aspire 7730G model
2045 */ 2314 */
2046 2315
2047static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { 2316static const struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
2048/* Bias voltage on for external mic port */ 2317/* Bias voltage on for external mic port */
2049 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, 2318 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
2050/* Front Mic: set to PIN_IN (empty by default) */ 2319/* Front Mic: set to PIN_IN (empty by default) */
@@ -2074,7 +2343,7 @@ static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
2074 * ALC889 Acer Aspire 8930G model 2343 * ALC889 Acer Aspire 8930G model
2075 */ 2344 */
2076 2345
2077static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { 2346static const struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
2078/* Front Mic: set to PIN_IN (empty by default) */ 2347/* Front Mic: set to PIN_IN (empty by default) */
2079 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 2348 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2080/* Unselect Front Mic by default in input mixer 3 */ 2349/* Unselect Front Mic by default in input mixer 3 */
@@ -2120,7 +2389,7 @@ static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
2120 { } 2389 { }
2121}; 2390};
2122 2391
2123static struct hda_input_mux alc888_2_capture_sources[2] = { 2392static const struct hda_input_mux alc888_2_capture_sources[2] = {
2124 /* Front mic only available on one ADC */ 2393 /* Front mic only available on one ADC */
2125 { 2394 {
2126 .num_items = 4, 2395 .num_items = 4,
@@ -2141,7 +2410,7 @@ static struct hda_input_mux alc888_2_capture_sources[2] = {
2141 } 2410 }
2142}; 2411};
2143 2412
2144static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { 2413static const struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
2145 /* Interal mic only available on one ADC */ 2414 /* Interal mic only available on one ADC */
2146 { 2415 {
2147 .num_items = 5, 2416 .num_items = 5,
@@ -2164,7 +2433,7 @@ static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
2164 } 2433 }
2165}; 2434};
2166 2435
2167static struct hda_input_mux alc889_capture_sources[3] = { 2436static const struct hda_input_mux alc889_capture_sources[3] = {
2168 /* Digital mic only available on first "ADC" */ 2437 /* Digital mic only available on first "ADC" */
2169 { 2438 {
2170 .num_items = 5, 2439 .num_items = 5,
@@ -2196,7 +2465,7 @@ static struct hda_input_mux alc889_capture_sources[3] = {
2196 } 2465 }
2197}; 2466};
2198 2467
2199static struct snd_kcontrol_new alc888_base_mixer[] = { 2468static const struct snd_kcontrol_new alc888_base_mixer[] = {
2200 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 2469 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2201 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 2470 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2202 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 2471 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
@@ -2218,7 +2487,7 @@ static struct snd_kcontrol_new alc888_base_mixer[] = {
2218 { } /* end */ 2487 { } /* end */
2219}; 2488};
2220 2489
2221static struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = { 2490static const struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = {
2222 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 2491 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2223 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 2492 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2224 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 2493 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
@@ -2240,7 +2509,7 @@ static struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = {
2240 { } /* end */ 2509 { } /* end */
2241}; 2510};
2242 2511
2243static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { 2512static const struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
2244 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 2513 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2245 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 2514 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2246 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 2515 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
@@ -2267,6 +2536,8 @@ static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
2267 spec->autocfg.speaker_pins[0] = 0x14; 2536 spec->autocfg.speaker_pins[0] = 0x14;
2268 spec->autocfg.speaker_pins[1] = 0x16; 2537 spec->autocfg.speaker_pins[1] = 0x16;
2269 spec->autocfg.speaker_pins[2] = 0x17; 2538 spec->autocfg.speaker_pins[2] = 0x17;
2539 spec->automute = 1;
2540 spec->automute_mode = ALC_AUTOMUTE_AMP;
2270} 2541}
2271 2542
2272static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) 2543static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
@@ -2277,6 +2548,8 @@ static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
2277 spec->autocfg.speaker_pins[0] = 0x14; 2548 spec->autocfg.speaker_pins[0] = 0x14;
2278 spec->autocfg.speaker_pins[1] = 0x16; 2549 spec->autocfg.speaker_pins[1] = 0x16;
2279 spec->autocfg.speaker_pins[2] = 0x17; 2550 spec->autocfg.speaker_pins[2] = 0x17;
2551 spec->automute = 1;
2552 spec->automute_mode = ALC_AUTOMUTE_AMP;
2280} 2553}
2281 2554
2282static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec) 2555static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec)
@@ -2287,6 +2560,8 @@ static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec)
2287 spec->autocfg.speaker_pins[0] = 0x14; 2560 spec->autocfg.speaker_pins[0] = 0x14;
2288 spec->autocfg.speaker_pins[1] = 0x16; 2561 spec->autocfg.speaker_pins[1] = 0x16;
2289 spec->autocfg.speaker_pins[2] = 0x17; 2562 spec->autocfg.speaker_pins[2] = 0x17;
2563 spec->automute = 1;
2564 spec->automute_mode = ALC_AUTOMUTE_AMP;
2290} 2565}
2291 2566
2292static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) 2567static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
@@ -2297,6 +2572,8 @@ static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
2297 spec->autocfg.speaker_pins[0] = 0x14; 2572 spec->autocfg.speaker_pins[0] = 0x14;
2298 spec->autocfg.speaker_pins[1] = 0x16; 2573 spec->autocfg.speaker_pins[1] = 0x16;
2299 spec->autocfg.speaker_pins[2] = 0x1b; 2574 spec->autocfg.speaker_pins[2] = 0x1b;
2575 spec->automute = 1;
2576 spec->automute_mode = ALC_AUTOMUTE_AMP;
2300} 2577}
2301 2578
2302/* 2579/*
@@ -2307,12 +2584,12 @@ static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
2307 * F-Mic = 0x1b, HP = 0x19 2584 * F-Mic = 0x1b, HP = 0x19
2308 */ 2585 */
2309 2586
2310static hda_nid_t alc880_dac_nids[4] = { 2587static const hda_nid_t alc880_dac_nids[4] = {
2311 /* front, rear, clfe, rear_surr */ 2588 /* front, rear, clfe, rear_surr */
2312 0x02, 0x05, 0x04, 0x03 2589 0x02, 0x05, 0x04, 0x03
2313}; 2590};
2314 2591
2315static hda_nid_t alc880_adc_nids[3] = { 2592static const hda_nid_t alc880_adc_nids[3] = {
2316 /* ADC0-2 */ 2593 /* ADC0-2 */
2317 0x07, 0x08, 0x09, 2594 0x07, 0x08, 0x09,
2318}; 2595};
@@ -2321,7 +2598,7 @@ static hda_nid_t alc880_adc_nids[3] = {
2321 * but it shows zero connection in the real implementation on some devices. 2598 * but it shows zero connection in the real implementation on some devices.
2322 * Note: this is a 915GAV bug, fixed on 915GLV 2599 * Note: this is a 915GAV bug, fixed on 915GLV
2323 */ 2600 */
2324static hda_nid_t alc880_adc_nids_alt[2] = { 2601static const hda_nid_t alc880_adc_nids_alt[2] = {
2325 /* ADC1-2 */ 2602 /* ADC1-2 */
2326 0x08, 0x09, 2603 0x08, 0x09,
2327}; 2604};
@@ -2329,7 +2606,7 @@ static hda_nid_t alc880_adc_nids_alt[2] = {
2329#define ALC880_DIGOUT_NID 0x06 2606#define ALC880_DIGOUT_NID 0x06
2330#define ALC880_DIGIN_NID 0x0a 2607#define ALC880_DIGIN_NID 0x0a
2331 2608
2332static struct hda_input_mux alc880_capture_source = { 2609static const struct hda_input_mux alc880_capture_source = {
2333 .num_items = 4, 2610 .num_items = 4,
2334 .items = { 2611 .items = {
2335 { "Mic", 0x0 }, 2612 { "Mic", 0x0 },
@@ -2341,7 +2618,7 @@ static struct hda_input_mux alc880_capture_source = {
2341 2618
2342/* channel source setting (2/6 channel selection for 3-stack) */ 2619/* channel source setting (2/6 channel selection for 3-stack) */
2343/* 2ch mode */ 2620/* 2ch mode */
2344static struct hda_verb alc880_threestack_ch2_init[] = { 2621static const struct hda_verb alc880_threestack_ch2_init[] = {
2345 /* set line-in to input, mute it */ 2622 /* set line-in to input, mute it */
2346 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, 2623 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2347 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, 2624 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
@@ -2352,7 +2629,7 @@ static struct hda_verb alc880_threestack_ch2_init[] = {
2352}; 2629};
2353 2630
2354/* 6ch mode */ 2631/* 6ch mode */
2355static struct hda_verb alc880_threestack_ch6_init[] = { 2632static const struct hda_verb alc880_threestack_ch6_init[] = {
2356 /* set line-in to output, unmute it */ 2633 /* set line-in to output, unmute it */
2357 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 2634 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2358 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, 2635 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
@@ -2362,12 +2639,12 @@ static struct hda_verb alc880_threestack_ch6_init[] = {
2362 { } /* end */ 2639 { } /* end */
2363}; 2640};
2364 2641
2365static struct hda_channel_mode alc880_threestack_modes[2] = { 2642static const struct hda_channel_mode alc880_threestack_modes[2] = {
2366 { 2, alc880_threestack_ch2_init }, 2643 { 2, alc880_threestack_ch2_init },
2367 { 6, alc880_threestack_ch6_init }, 2644 { 6, alc880_threestack_ch6_init },
2368}; 2645};
2369 2646
2370static struct snd_kcontrol_new alc880_three_stack_mixer[] = { 2647static const struct snd_kcontrol_new alc880_three_stack_mixer[] = {
2371 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 2648 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2372 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 2649 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2373 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), 2650 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
@@ -2512,14 +2789,14 @@ static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2512 } 2789 }
2513 2790
2514#define DEFINE_CAPMIX(num) \ 2791#define DEFINE_CAPMIX(num) \
2515static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ 2792static const struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2516 _DEFINE_CAPMIX(num), \ 2793 _DEFINE_CAPMIX(num), \
2517 _DEFINE_CAPSRC(num), \ 2794 _DEFINE_CAPSRC(num), \
2518 { } /* end */ \ 2795 { } /* end */ \
2519} 2796}
2520 2797
2521#define DEFINE_CAPMIX_NOSRC(num) \ 2798#define DEFINE_CAPMIX_NOSRC(num) \
2522static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ 2799static const struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2523 _DEFINE_CAPMIX(num), \ 2800 _DEFINE_CAPMIX(num), \
2524 { } /* end */ \ 2801 { } /* end */ \
2525} 2802}
@@ -2542,7 +2819,7 @@ DEFINE_CAPMIX_NOSRC(3);
2542 */ 2819 */
2543 2820
2544/* additional mixers to alc880_three_stack_mixer */ 2821/* additional mixers to alc880_three_stack_mixer */
2545static struct snd_kcontrol_new alc880_five_stack_mixer[] = { 2822static const struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2546 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 2823 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2547 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), 2824 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2548 { } /* end */ 2825 { } /* end */
@@ -2550,7 +2827,7 @@ static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2550 2827
2551/* channel source setting (6/8 channel selection for 5-stack) */ 2828/* channel source setting (6/8 channel selection for 5-stack) */
2552/* 6ch mode */ 2829/* 6ch mode */
2553static struct hda_verb alc880_fivestack_ch6_init[] = { 2830static const struct hda_verb alc880_fivestack_ch6_init[] = {
2554 /* set line-in to input, mute it */ 2831 /* set line-in to input, mute it */
2555 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, 2832 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2556 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, 2833 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
@@ -2558,14 +2835,14 @@ static struct hda_verb alc880_fivestack_ch6_init[] = {
2558}; 2835};
2559 2836
2560/* 8ch mode */ 2837/* 8ch mode */
2561static struct hda_verb alc880_fivestack_ch8_init[] = { 2838static const struct hda_verb alc880_fivestack_ch8_init[] = {
2562 /* set line-in to output, unmute it */ 2839 /* set line-in to output, unmute it */
2563 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 2840 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2564 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, 2841 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2565 { } /* end */ 2842 { } /* end */
2566}; 2843};
2567 2844
2568static struct hda_channel_mode alc880_fivestack_modes[2] = { 2845static const struct hda_channel_mode alc880_fivestack_modes[2] = {
2569 { 6, alc880_fivestack_ch6_init }, 2846 { 6, alc880_fivestack_ch6_init },
2570 { 8, alc880_fivestack_ch8_init }, 2847 { 8, alc880_fivestack_ch8_init },
2571}; 2848};
@@ -2580,12 +2857,12 @@ static struct hda_channel_mode alc880_fivestack_modes[2] = {
2580 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b 2857 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2581 */ 2858 */
2582 2859
2583static hda_nid_t alc880_6st_dac_nids[4] = { 2860static const hda_nid_t alc880_6st_dac_nids[4] = {
2584 /* front, rear, clfe, rear_surr */ 2861 /* front, rear, clfe, rear_surr */
2585 0x02, 0x03, 0x04, 0x05 2862 0x02, 0x03, 0x04, 0x05
2586}; 2863};
2587 2864
2588static struct hda_input_mux alc880_6stack_capture_source = { 2865static const struct hda_input_mux alc880_6stack_capture_source = {
2589 .num_items = 4, 2866 .num_items = 4,
2590 .items = { 2867 .items = {
2591 { "Mic", 0x0 }, 2868 { "Mic", 0x0 },
@@ -2596,11 +2873,11 @@ static struct hda_input_mux alc880_6stack_capture_source = {
2596}; 2873};
2597 2874
2598/* fixed 8-channels */ 2875/* fixed 8-channels */
2599static struct hda_channel_mode alc880_sixstack_modes[1] = { 2876static const struct hda_channel_mode alc880_sixstack_modes[1] = {
2600 { 8, NULL }, 2877 { 8, NULL },
2601}; 2878};
2602 2879
2603static struct snd_kcontrol_new alc880_six_stack_mixer[] = { 2880static const struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2604 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 2881 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2605 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 2882 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2606 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 2883 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
@@ -2655,18 +2932,18 @@ static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2655 * haven't setup any initialization verbs for these yet... 2932 * haven't setup any initialization verbs for these yet...
2656 */ 2933 */
2657 2934
2658static hda_nid_t alc880_w810_dac_nids[3] = { 2935static const hda_nid_t alc880_w810_dac_nids[3] = {
2659 /* front, rear/surround, clfe */ 2936 /* front, rear/surround, clfe */
2660 0x02, 0x03, 0x04 2937 0x02, 0x03, 0x04
2661}; 2938};
2662 2939
2663/* fixed 6 channels */ 2940/* fixed 6 channels */
2664static struct hda_channel_mode alc880_w810_modes[1] = { 2941static const struct hda_channel_mode alc880_w810_modes[1] = {
2665 { 6, NULL } 2942 { 6, NULL }
2666}; 2943};
2667 2944
2668/* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ 2945/* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2669static struct snd_kcontrol_new alc880_w810_base_mixer[] = { 2946static const struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2670 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 2947 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2671 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 2948 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2672 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 2949 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
@@ -2688,17 +2965,17 @@ static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2688 * Line = 0x1a 2965 * Line = 0x1a
2689 */ 2966 */
2690 2967
2691static hda_nid_t alc880_z71v_dac_nids[1] = { 2968static const hda_nid_t alc880_z71v_dac_nids[1] = {
2692 0x02 2969 0x02
2693}; 2970};
2694#define ALC880_Z71V_HP_DAC 0x03 2971#define ALC880_Z71V_HP_DAC 0x03
2695 2972
2696/* fixed 2 channels */ 2973/* fixed 2 channels */
2697static struct hda_channel_mode alc880_2_jack_modes[1] = { 2974static const struct hda_channel_mode alc880_2_jack_modes[1] = {
2698 { 2, NULL } 2975 { 2, NULL }
2699}; 2976};
2700 2977
2701static struct snd_kcontrol_new alc880_z71v_mixer[] = { 2978static const struct snd_kcontrol_new alc880_z71v_mixer[] = {
2702 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 2979 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2703 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 2980 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2704 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 2981 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
@@ -2718,12 +2995,12 @@ static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2718 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 2995 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2719 */ 2996 */
2720 2997
2721static hda_nid_t alc880_f1734_dac_nids[1] = { 2998static const hda_nid_t alc880_f1734_dac_nids[1] = {
2722 0x03 2999 0x03
2723}; 3000};
2724#define ALC880_F1734_HP_DAC 0x02 3001#define ALC880_F1734_HP_DAC 0x02
2725 3002
2726static struct snd_kcontrol_new alc880_f1734_mixer[] = { 3003static const struct snd_kcontrol_new alc880_f1734_mixer[] = {
2727 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 3004 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2728 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), 3005 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2729 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 3006 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
@@ -2735,7 +3012,7 @@ static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2735 { } /* end */ 3012 { } /* end */
2736}; 3013};
2737 3014
2738static struct hda_input_mux alc880_f1734_capture_source = { 3015static const struct hda_input_mux alc880_f1734_capture_source = {
2739 .num_items = 2, 3016 .num_items = 2,
2740 .items = { 3017 .items = {
2741 { "Mic", 0x1 }, 3018 { "Mic", 0x1 },
@@ -2755,7 +3032,7 @@ static struct hda_input_mux alc880_f1734_capture_source = {
2755#define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ 3032#define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2756#define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ 3033#define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2757 3034
2758static struct snd_kcontrol_new alc880_asus_mixer[] = { 3035static const struct snd_kcontrol_new alc880_asus_mixer[] = {
2759 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 3036 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2760 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 3037 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2761 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 3038 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
@@ -2789,14 +3066,14 @@ static struct snd_kcontrol_new alc880_asus_mixer[] = {
2789 */ 3066 */
2790 3067
2791/* additional mixers to alc880_asus_mixer */ 3068/* additional mixers to alc880_asus_mixer */
2792static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { 3069static const struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2793 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), 3070 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2794 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), 3071 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2795 { } /* end */ 3072 { } /* end */
2796}; 3073};
2797 3074
2798/* TCL S700 */ 3075/* TCL S700 */
2799static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { 3076static const struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2800 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 3077 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2801 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 3078 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2802 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), 3079 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
@@ -2810,7 +3087,7 @@ static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2810}; 3087};
2811 3088
2812/* Uniwill */ 3089/* Uniwill */
2813static struct snd_kcontrol_new alc880_uniwill_mixer[] = { 3090static const struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2814 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 3091 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2815 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), 3092 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2816 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 3093 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
@@ -2837,7 +3114,7 @@ static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2837 { } /* end */ 3114 { } /* end */
2838}; 3115};
2839 3116
2840static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { 3117static const struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2841 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 3118 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2842 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), 3119 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2843 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 3120 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
@@ -2851,7 +3128,7 @@ static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2851 { } /* end */ 3128 { } /* end */
2852}; 3129};
2853 3130
2854static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { 3131static const struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2855 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 3132 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2856 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), 3133 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2857 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 3134 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
@@ -2878,7 +3155,6 @@ static const char * const alc_slave_vols[] = {
2878 "Speaker Playback Volume", 3155 "Speaker Playback Volume",
2879 "Mono Playback Volume", 3156 "Mono Playback Volume",
2880 "Line-Out Playback Volume", 3157 "Line-Out Playback Volume",
2881 "PCM Playback Volume",
2882 NULL, 3158 NULL,
2883}; 3159};
2884 3160
@@ -2893,7 +3169,6 @@ static const char * const alc_slave_sws[] = {
2893 "Mono Playback Switch", 3169 "Mono Playback Switch",
2894 "IEC958 Playback Switch", 3170 "IEC958 Playback Switch",
2895 "Line-Out Playback Switch", 3171 "Line-Out Playback Switch",
2896 "PCM Playback Switch",
2897 NULL, 3172 NULL,
2898}; 3173};
2899 3174
@@ -2914,7 +3189,7 @@ static void alc_free_kctls(struct hda_codec *codec);
2914 3189
2915#ifdef CONFIG_SND_HDA_INPUT_BEEP 3190#ifdef CONFIG_SND_HDA_INPUT_BEEP
2916/* additional beep mixers; the actual parameters are overwritten at build */ 3191/* additional beep mixers; the actual parameters are overwritten at build */
2917static struct snd_kcontrol_new alc_beep_mixer[] = { 3192static const struct snd_kcontrol_new alc_beep_mixer[] = {
2918 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), 3193 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2919 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), 3194 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2920 { } /* end */ 3195 { } /* end */
@@ -2925,7 +3200,7 @@ static int alc_build_controls(struct hda_codec *codec)
2925{ 3200{
2926 struct alc_spec *spec = codec->spec; 3201 struct alc_spec *spec = codec->spec;
2927 struct snd_kcontrol *kctl = NULL; 3202 struct snd_kcontrol *kctl = NULL;
2928 struct snd_kcontrol_new *knew; 3203 const struct snd_kcontrol_new *knew;
2929 int i, j, err; 3204 int i, j, err;
2930 unsigned int u; 3205 unsigned int u;
2931 hda_nid_t nid; 3206 hda_nid_t nid;
@@ -2962,7 +3237,7 @@ static int alc_build_controls(struct hda_codec *codec)
2962#ifdef CONFIG_SND_HDA_INPUT_BEEP 3237#ifdef CONFIG_SND_HDA_INPUT_BEEP
2963 /* create beep controls if needed */ 3238 /* create beep controls if needed */
2964 if (spec->beep_amp) { 3239 if (spec->beep_amp) {
2965 struct snd_kcontrol_new *knew; 3240 const struct snd_kcontrol_new *knew;
2966 for (knew = alc_beep_mixer; knew->name; knew++) { 3241 for (knew = alc_beep_mixer; knew->name; knew++) {
2967 struct snd_kcontrol *kctl; 3242 struct snd_kcontrol *kctl;
2968 kctl = snd_ctl_new1(knew, codec); 3243 kctl = snd_ctl_new1(knew, codec);
@@ -3001,7 +3276,7 @@ static int alc_build_controls(struct hda_codec *codec)
3001 if (!kctl) 3276 if (!kctl)
3002 kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); 3277 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
3003 for (i = 0; kctl && i < kctl->count; i++) { 3278 for (i = 0; kctl && i < kctl->count; i++) {
3004 hda_nid_t *nids = spec->capsrc_nids; 3279 const hda_nid_t *nids = spec->capsrc_nids;
3005 if (!nids) 3280 if (!nids)
3006 nids = spec->adc_nids; 3281 nids = spec->adc_nids;
3007 err = snd_hda_add_nid(codec, kctl, i, nids[i]); 3282 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
@@ -3079,7 +3354,7 @@ static int alc_build_controls(struct hda_codec *codec)
3079/* 3354/*
3080 * generic initialization of ADC, input mixers and output mixers 3355 * generic initialization of ADC, input mixers and output mixers
3081 */ 3356 */
3082static struct hda_verb alc880_volume_init_verbs[] = { 3357static const struct hda_verb alc880_volume_init_verbs[] = {
3083 /* 3358 /*
3084 * Unmute ADC0-2 and set the default input to mic-in 3359 * Unmute ADC0-2 and set the default input to mic-in
3085 */ 3360 */
@@ -3130,7 +3405,7 @@ static struct hda_verb alc880_volume_init_verbs[] = {
3130 * 3-stack pin configuration: 3405 * 3-stack pin configuration:
3131 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b 3406 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
3132 */ 3407 */
3133static struct hda_verb alc880_pin_3stack_init_verbs[] = { 3408static const struct hda_verb alc880_pin_3stack_init_verbs[] = {
3134 /* 3409 /*
3135 * preset connection lists of input pins 3410 * preset connection lists of input pins
3136 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround 3411 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
@@ -3168,7 +3443,7 @@ static struct hda_verb alc880_pin_3stack_init_verbs[] = {
3168 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, 3443 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
3169 * line-in/side = 0x1a, f-mic = 0x1b 3444 * line-in/side = 0x1a, f-mic = 0x1b
3170 */ 3445 */
3171static struct hda_verb alc880_pin_5stack_init_verbs[] = { 3446static const struct hda_verb alc880_pin_5stack_init_verbs[] = {
3172 /* 3447 /*
3173 * preset connection lists of input pins 3448 * preset connection lists of input pins
3174 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround 3449 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
@@ -3212,7 +3487,7 @@ static struct hda_verb alc880_pin_5stack_init_verbs[] = {
3212 * W810 pin configuration: 3487 * W810 pin configuration:
3213 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b 3488 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
3214 */ 3489 */
3215static struct hda_verb alc880_pin_w810_init_verbs[] = { 3490static const struct hda_verb alc880_pin_w810_init_verbs[] = {
3216 /* hphone/speaker input selector: front DAC */ 3491 /* hphone/speaker input selector: front DAC */
3217 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, 3492 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
3218 3493
@@ -3233,7 +3508,7 @@ static struct hda_verb alc880_pin_w810_init_verbs[] = {
3233 * Z71V pin configuration: 3508 * Z71V pin configuration:
3234 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) 3509 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
3235 */ 3510 */
3236static struct hda_verb alc880_pin_z71v_init_verbs[] = { 3511static const struct hda_verb alc880_pin_z71v_init_verbs[] = {
3237 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 3512 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3238 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 3513 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3239 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 3514 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
@@ -3252,7 +3527,7 @@ static struct hda_verb alc880_pin_z71v_init_verbs[] = {
3252 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, 3527 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
3253 * f-mic = 0x19, line = 0x1a, HP = 0x1b 3528 * f-mic = 0x19, line = 0x1a, HP = 0x1b
3254 */ 3529 */
3255static struct hda_verb alc880_pin_6stack_init_verbs[] = { 3530static const struct hda_verb alc880_pin_6stack_init_verbs[] = {
3256 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ 3531 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3257 3532
3258 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 3533 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
@@ -3282,7 +3557,7 @@ static struct hda_verb alc880_pin_6stack_init_verbs[] = {
3282 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, 3557 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
3283 * line = 0x1a 3558 * line = 0x1a
3284 */ 3559 */
3285static struct hda_verb alc880_uniwill_init_verbs[] = { 3560static const struct hda_verb alc880_uniwill_init_verbs[] = {
3286 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ 3561 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3287 3562
3288 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 3563 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
@@ -3320,7 +3595,7 @@ static struct hda_verb alc880_uniwill_init_verbs[] = {
3320* Uniwill P53 3595* Uniwill P53
3321* HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, 3596* HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
3322 */ 3597 */
3323static struct hda_verb alc880_uniwill_p53_init_verbs[] = { 3598static const struct hda_verb alc880_uniwill_p53_init_verbs[] = {
3324 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ 3599 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3325 3600
3326 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 3601 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
@@ -3349,7 +3624,7 @@ static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
3349 { } 3624 { }
3350}; 3625};
3351 3626
3352static struct hda_verb alc880_beep_init_verbs[] = { 3627static const struct hda_verb alc880_beep_init_verbs[] = {
3353 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, 3628 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
3354 { } 3629 { }
3355}; 3630};
@@ -3372,11 +3647,13 @@ static void alc880_uniwill_setup(struct hda_codec *codec)
3372 spec->autocfg.hp_pins[0] = 0x14; 3647 spec->autocfg.hp_pins[0] = 0x14;
3373 spec->autocfg.speaker_pins[0] = 0x15; 3648 spec->autocfg.speaker_pins[0] = 0x15;
3374 spec->autocfg.speaker_pins[0] = 0x16; 3649 spec->autocfg.speaker_pins[0] = 0x16;
3650 spec->automute = 1;
3651 spec->automute_mode = ALC_AUTOMUTE_AMP;
3375} 3652}
3376 3653
3377static void alc880_uniwill_init_hook(struct hda_codec *codec) 3654static void alc880_uniwill_init_hook(struct hda_codec *codec)
3378{ 3655{
3379 alc_automute_amp(codec); 3656 alc_hp_automute(codec);
3380 alc88x_simple_mic_automute(codec); 3657 alc88x_simple_mic_automute(codec);
3381} 3658}
3382 3659
@@ -3391,7 +3668,7 @@ static void alc880_uniwill_unsol_event(struct hda_codec *codec,
3391 alc88x_simple_mic_automute(codec); 3668 alc88x_simple_mic_automute(codec);
3392 break; 3669 break;
3393 default: 3670 default:
3394 alc_automute_amp_unsol_event(codec, res); 3671 alc_sku_unsol_event(codec, res);
3395 break; 3672 break;
3396 } 3673 }
3397} 3674}
@@ -3402,6 +3679,8 @@ static void alc880_uniwill_p53_setup(struct hda_codec *codec)
3402 3679
3403 spec->autocfg.hp_pins[0] = 0x14; 3680 spec->autocfg.hp_pins[0] = 0x14;
3404 spec->autocfg.speaker_pins[0] = 0x15; 3681 spec->autocfg.speaker_pins[0] = 0x15;
3682 spec->automute = 1;
3683 spec->automute_mode = ALC_AUTOMUTE_AMP;
3405} 3684}
3406 3685
3407static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) 3686static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
@@ -3426,14 +3705,14 @@ static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
3426 if ((res >> 28) == ALC880_DCVOL_EVENT) 3705 if ((res >> 28) == ALC880_DCVOL_EVENT)
3427 alc880_uniwill_p53_dcvol_automute(codec); 3706 alc880_uniwill_p53_dcvol_automute(codec);
3428 else 3707 else
3429 alc_automute_amp_unsol_event(codec, res); 3708 alc_sku_unsol_event(codec, res);
3430} 3709}
3431 3710
3432/* 3711/*
3433 * F1734 pin configuration: 3712 * F1734 pin configuration:
3434 * HP = 0x14, speaker-out = 0x15, mic = 0x18 3713 * HP = 0x14, speaker-out = 0x15, mic = 0x18
3435 */ 3714 */
3436static struct hda_verb alc880_pin_f1734_init_verbs[] = { 3715static const struct hda_verb alc880_pin_f1734_init_verbs[] = {
3437 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, 3716 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
3438 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, 3717 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3439 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, 3718 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
@@ -3465,7 +3744,7 @@ static struct hda_verb alc880_pin_f1734_init_verbs[] = {
3465 * ASUS pin configuration: 3744 * ASUS pin configuration:
3466 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a 3745 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3467 */ 3746 */
3468static struct hda_verb alc880_pin_asus_init_verbs[] = { 3747static const struct hda_verb alc880_pin_asus_init_verbs[] = {
3469 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, 3748 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3470 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, 3749 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3471 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, 3750 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
@@ -3499,7 +3778,7 @@ static struct hda_verb alc880_pin_asus_init_verbs[] = {
3499#define alc880_gpio3_init_verbs alc_gpio3_init_verbs 3778#define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3500 3779
3501/* Clevo m520g init */ 3780/* Clevo m520g init */
3502static struct hda_verb alc880_pin_clevo_init_verbs[] = { 3781static const struct hda_verb alc880_pin_clevo_init_verbs[] = {
3503 /* headphone output */ 3782 /* headphone output */
3504 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, 3783 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3505 /* line-out */ 3784 /* line-out */
@@ -3527,7 +3806,7 @@ static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3527 { } 3806 { }
3528}; 3807};
3529 3808
3530static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { 3809static const struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3531 /* change to EAPD mode */ 3810 /* change to EAPD mode */
3532 {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, 3811 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3533 {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, 3812 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
@@ -3565,12 +3844,12 @@ static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3565 */ 3844 */
3566 3845
3567/* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ 3846/* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3568static hda_nid_t alc880_lg_dac_nids[3] = { 3847static const hda_nid_t alc880_lg_dac_nids[3] = {
3569 0x05, 0x02, 0x03 3848 0x05, 0x02, 0x03
3570}; 3849};
3571 3850
3572/* seems analog CD is not working */ 3851/* seems analog CD is not working */
3573static struct hda_input_mux alc880_lg_capture_source = { 3852static const struct hda_input_mux alc880_lg_capture_source = {
3574 .num_items = 3, 3853 .num_items = 3,
3575 .items = { 3854 .items = {
3576 { "Mic", 0x1 }, 3855 { "Mic", 0x1 },
@@ -3580,34 +3859,34 @@ static struct hda_input_mux alc880_lg_capture_source = {
3580}; 3859};
3581 3860
3582/* 2,4,6 channel modes */ 3861/* 2,4,6 channel modes */
3583static struct hda_verb alc880_lg_ch2_init[] = { 3862static const struct hda_verb alc880_lg_ch2_init[] = {
3584 /* set line-in and mic-in to input */ 3863 /* set line-in and mic-in to input */
3585 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, 3864 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3586 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, 3865 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3587 { } 3866 { }
3588}; 3867};
3589 3868
3590static struct hda_verb alc880_lg_ch4_init[] = { 3869static const struct hda_verb alc880_lg_ch4_init[] = {
3591 /* set line-in to out and mic-in to input */ 3870 /* set line-in to out and mic-in to input */
3592 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, 3871 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3593 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, 3872 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3594 { } 3873 { }
3595}; 3874};
3596 3875
3597static struct hda_verb alc880_lg_ch6_init[] = { 3876static const struct hda_verb alc880_lg_ch6_init[] = {
3598 /* set line-in and mic-in to output */ 3877 /* set line-in and mic-in to output */
3599 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, 3878 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3600 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, 3879 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3601 { } 3880 { }
3602}; 3881};
3603 3882
3604static struct hda_channel_mode alc880_lg_ch_modes[3] = { 3883static const struct hda_channel_mode alc880_lg_ch_modes[3] = {
3605 { 2, alc880_lg_ch2_init }, 3884 { 2, alc880_lg_ch2_init },
3606 { 4, alc880_lg_ch4_init }, 3885 { 4, alc880_lg_ch4_init },
3607 { 6, alc880_lg_ch6_init }, 3886 { 6, alc880_lg_ch6_init },
3608}; 3887};
3609 3888
3610static struct snd_kcontrol_new alc880_lg_mixer[] = { 3889static const struct snd_kcontrol_new alc880_lg_mixer[] = {
3611 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), 3890 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3612 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), 3891 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3613 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 3892 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
@@ -3632,7 +3911,7 @@ static struct snd_kcontrol_new alc880_lg_mixer[] = {
3632 { } /* end */ 3911 { } /* end */
3633}; 3912};
3634 3913
3635static struct hda_verb alc880_lg_init_verbs[] = { 3914static const struct hda_verb alc880_lg_init_verbs[] = {
3636 /* set capture source to mic-in */ 3915 /* set capture source to mic-in */
3637 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 3916 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3638 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 3917 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
@@ -3670,6 +3949,8 @@ static void alc880_lg_setup(struct hda_codec *codec)
3670 3949
3671 spec->autocfg.hp_pins[0] = 0x1b; 3950 spec->autocfg.hp_pins[0] = 0x1b;
3672 spec->autocfg.speaker_pins[0] = 0x17; 3951 spec->autocfg.speaker_pins[0] = 0x17;
3952 spec->automute = 1;
3953 spec->automute_mode = ALC_AUTOMUTE_AMP;
3673} 3954}
3674 3955
3675/* 3956/*
@@ -3684,7 +3965,7 @@ static void alc880_lg_setup(struct hda_codec *codec)
3684 * SPDIF-Out: 0x1e 3965 * SPDIF-Out: 0x1e
3685 */ 3966 */
3686 3967
3687static struct hda_input_mux alc880_lg_lw_capture_source = { 3968static const struct hda_input_mux alc880_lg_lw_capture_source = {
3688 .num_items = 3, 3969 .num_items = 3,
3689 .items = { 3970 .items = {
3690 { "Mic", 0x0 }, 3971 { "Mic", 0x0 },
@@ -3695,7 +3976,7 @@ static struct hda_input_mux alc880_lg_lw_capture_source = {
3695 3976
3696#define alc880_lg_lw_modes alc880_threestack_modes 3977#define alc880_lg_lw_modes alc880_threestack_modes
3697 3978
3698static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { 3979static const struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3699 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 3980 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3700 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 3981 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3701 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), 3982 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
@@ -3720,7 +4001,7 @@ static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3720 { } /* end */ 4001 { } /* end */
3721}; 4002};
3722 4003
3723static struct hda_verb alc880_lg_lw_init_verbs[] = { 4004static const struct hda_verb alc880_lg_lw_init_verbs[] = {
3724 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ 4005 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3725 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ 4006 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3726 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ 4007 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
@@ -3754,9 +4035,11 @@ static void alc880_lg_lw_setup(struct hda_codec *codec)
3754 4035
3755 spec->autocfg.hp_pins[0] = 0x1b; 4036 spec->autocfg.hp_pins[0] = 0x1b;
3756 spec->autocfg.speaker_pins[0] = 0x14; 4037 spec->autocfg.speaker_pins[0] = 0x14;
4038 spec->automute = 1;
4039 spec->automute_mode = ALC_AUTOMUTE_AMP;
3757} 4040}
3758 4041
3759static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { 4042static const struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3760 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 4043 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3761 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), 4044 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3762 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 4045 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
@@ -3766,7 +4049,7 @@ static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3766 { } /* end */ 4049 { } /* end */
3767}; 4050};
3768 4051
3769static struct hda_input_mux alc880_medion_rim_capture_source = { 4052static const struct hda_input_mux alc880_medion_rim_capture_source = {
3770 .num_items = 2, 4053 .num_items = 2,
3771 .items = { 4054 .items = {
3772 { "Mic", 0x0 }, 4055 { "Mic", 0x0 },
@@ -3774,7 +4057,7 @@ static struct hda_input_mux alc880_medion_rim_capture_source = {
3774 }, 4057 },
3775}; 4058};
3776 4059
3777static struct hda_verb alc880_medion_rim_init_verbs[] = { 4060static const struct hda_verb alc880_medion_rim_init_verbs[] = {
3778 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ 4061 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3779 4062
3780 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 4063 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
@@ -3801,7 +4084,7 @@ static struct hda_verb alc880_medion_rim_init_verbs[] = {
3801static void alc880_medion_rim_automute(struct hda_codec *codec) 4084static void alc880_medion_rim_automute(struct hda_codec *codec)
3802{ 4085{
3803 struct alc_spec *spec = codec->spec; 4086 struct alc_spec *spec = codec->spec;
3804 alc_automute_amp(codec); 4087 alc_hp_automute(codec);
3805 /* toggle EAPD */ 4088 /* toggle EAPD */
3806 if (spec->jack_present) 4089 if (spec->jack_present)
3807 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); 4090 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
@@ -3825,10 +4108,12 @@ static void alc880_medion_rim_setup(struct hda_codec *codec)
3825 4108
3826 spec->autocfg.hp_pins[0] = 0x14; 4109 spec->autocfg.hp_pins[0] = 0x14;
3827 spec->autocfg.speaker_pins[0] = 0x1b; 4110 spec->autocfg.speaker_pins[0] = 0x1b;
4111 spec->automute = 1;
4112 spec->automute_mode = ALC_AUTOMUTE_AMP;
3828} 4113}
3829 4114
3830#ifdef CONFIG_SND_HDA_POWER_SAVE 4115#ifdef CONFIG_SND_HDA_POWER_SAVE
3831static struct hda_amp_list alc880_loopbacks[] = { 4116static const struct hda_amp_list alc880_loopbacks[] = {
3832 { 0x0b, HDA_INPUT, 0 }, 4117 { 0x0b, HDA_INPUT, 0 },
3833 { 0x0b, HDA_INPUT, 1 }, 4118 { 0x0b, HDA_INPUT, 1 },
3834 { 0x0b, HDA_INPUT, 2 }, 4119 { 0x0b, HDA_INPUT, 2 },
@@ -3837,7 +4122,7 @@ static struct hda_amp_list alc880_loopbacks[] = {
3837 { } /* end */ 4122 { } /* end */
3838}; 4123};
3839 4124
3840static struct hda_amp_list alc880_lg_loopbacks[] = { 4125static const struct hda_amp_list alc880_lg_loopbacks[] = {
3841 { 0x0b, HDA_INPUT, 1 }, 4126 { 0x0b, HDA_INPUT, 1 },
3842 { 0x0b, HDA_INPUT, 6 }, 4127 { 0x0b, HDA_INPUT, 6 },
3843 { 0x0b, HDA_INPUT, 7 }, 4128 { 0x0b, HDA_INPUT, 7 },
@@ -4009,7 +4294,7 @@ static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
4009 return 0; 4294 return 0;
4010} 4295}
4011 4296
4012static struct hda_pcm_stream dualmic_pcm_analog_capture = { 4297static const struct hda_pcm_stream dualmic_pcm_analog_capture = {
4013 .substreams = 1, 4298 .substreams = 1,
4014 .channels_min = 2, 4299 .channels_min = 2,
4015 .channels_max = 2, 4300 .channels_max = 2,
@@ -4022,7 +4307,7 @@ static struct hda_pcm_stream dualmic_pcm_analog_capture = {
4022 4307
4023/* 4308/*
4024 */ 4309 */
4025static struct hda_pcm_stream alc880_pcm_analog_playback = { 4310static const struct hda_pcm_stream alc880_pcm_analog_playback = {
4026 .substreams = 1, 4311 .substreams = 1,
4027 .channels_min = 2, 4312 .channels_min = 2,
4028 .channels_max = 8, 4313 .channels_max = 8,
@@ -4034,21 +4319,21 @@ static struct hda_pcm_stream alc880_pcm_analog_playback = {
4034 }, 4319 },
4035}; 4320};
4036 4321
4037static struct hda_pcm_stream alc880_pcm_analog_capture = { 4322static const struct hda_pcm_stream alc880_pcm_analog_capture = {
4038 .substreams = 1, 4323 .substreams = 1,
4039 .channels_min = 2, 4324 .channels_min = 2,
4040 .channels_max = 2, 4325 .channels_max = 2,
4041 /* NID is set in alc_build_pcms */ 4326 /* NID is set in alc_build_pcms */
4042}; 4327};
4043 4328
4044static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { 4329static const struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
4045 .substreams = 1, 4330 .substreams = 1,
4046 .channels_min = 2, 4331 .channels_min = 2,
4047 .channels_max = 2, 4332 .channels_max = 2,
4048 /* NID is set in alc_build_pcms */ 4333 /* NID is set in alc_build_pcms */
4049}; 4334};
4050 4335
4051static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { 4336static const struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
4052 .substreams = 2, /* can be overridden */ 4337 .substreams = 2, /* can be overridden */
4053 .channels_min = 2, 4338 .channels_min = 2,
4054 .channels_max = 2, 4339 .channels_max = 2,
@@ -4059,7 +4344,7 @@ static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
4059 }, 4344 },
4060}; 4345};
4061 4346
4062static struct hda_pcm_stream alc880_pcm_digital_playback = { 4347static const struct hda_pcm_stream alc880_pcm_digital_playback = {
4063 .substreams = 1, 4348 .substreams = 1,
4064 .channels_min = 2, 4349 .channels_min = 2,
4065 .channels_max = 2, 4350 .channels_max = 2,
@@ -4072,7 +4357,7 @@ static struct hda_pcm_stream alc880_pcm_digital_playback = {
4072 }, 4357 },
4073}; 4358};
4074 4359
4075static struct hda_pcm_stream alc880_pcm_digital_capture = { 4360static const struct hda_pcm_stream alc880_pcm_digital_capture = {
4076 .substreams = 1, 4361 .substreams = 1,
4077 .channels_min = 2, 4362 .channels_min = 2,
4078 .channels_max = 2, 4363 .channels_max = 2,
@@ -4080,7 +4365,7 @@ static struct hda_pcm_stream alc880_pcm_digital_capture = {
4080}; 4365};
4081 4366
4082/* Used by alc_build_pcms to flag that a PCM has no playback stream */ 4367/* Used by alc_build_pcms to flag that a PCM has no playback stream */
4083static struct hda_pcm_stream alc_pcm_null_stream = { 4368static const struct hda_pcm_stream alc_pcm_null_stream = {
4084 .substreams = 0, 4369 .substreams = 0,
4085 .channels_min = 0, 4370 .channels_min = 0,
4086 .channels_max = 0, 4371 .channels_max = 0,
@@ -4174,7 +4459,7 @@ static int alc_build_pcms(struct hda_codec *codec)
4174 alc_pcm_null_stream; 4459 alc_pcm_null_stream;
4175 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; 4460 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
4176 } 4461 }
4177 if (spec->num_adc_nids > 1) { 4462 if (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture) {
4178 info->stream[SNDRV_PCM_STREAM_CAPTURE] = 4463 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
4179 *spec->stream_analog_alt_capture; 4464 *spec->stream_analog_alt_capture;
4180 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 4465 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
@@ -4193,6 +4478,10 @@ static int alc_build_pcms(struct hda_codec *codec)
4193 4478
4194static inline void alc_shutup(struct hda_codec *codec) 4479static inline void alc_shutup(struct hda_codec *codec)
4195{ 4480{
4481 struct alc_spec *spec = codec->spec;
4482
4483 if (spec && spec->shutup)
4484 spec->shutup(codec);
4196 snd_hda_shutup_pins(codec); 4485 snd_hda_shutup_pins(codec);
4197} 4486}
4198 4487
@@ -4226,28 +4515,7 @@ static void alc_free(struct hda_codec *codec)
4226#ifdef CONFIG_SND_HDA_POWER_SAVE 4515#ifdef CONFIG_SND_HDA_POWER_SAVE
4227static void alc_power_eapd(struct hda_codec *codec) 4516static void alc_power_eapd(struct hda_codec *codec)
4228{ 4517{
4229 /* We currently only handle front, HP */ 4518 alc_auto_setup_eapd(codec, false);
4230 switch (codec->vendor_id) {
4231 case 0x10ec0260:
4232 set_eapd(codec, 0x0f, 0);
4233 set_eapd(codec, 0x10, 0);
4234 break;
4235 case 0x10ec0262:
4236 case 0x10ec0267:
4237 case 0x10ec0268:
4238 case 0x10ec0269:
4239 case 0x10ec0270:
4240 case 0x10ec0272:
4241 case 0x10ec0660:
4242 case 0x10ec0662:
4243 case 0x10ec0663:
4244 case 0x10ec0665:
4245 case 0x10ec0862:
4246 case 0x10ec0889:
4247 set_eapd(codec, 0x14, 0);
4248 set_eapd(codec, 0x15, 0);
4249 break;
4250 }
4251} 4519}
4252 4520
4253static int alc_suspend(struct hda_codec *codec, pm_message_t state) 4521static int alc_suspend(struct hda_codec *codec, pm_message_t state)
@@ -4263,6 +4531,7 @@ static int alc_suspend(struct hda_codec *codec, pm_message_t state)
4263#ifdef SND_HDA_NEEDS_RESUME 4531#ifdef SND_HDA_NEEDS_RESUME
4264static int alc_resume(struct hda_codec *codec) 4532static int alc_resume(struct hda_codec *codec)
4265{ 4533{
4534 msleep(150); /* to avoid pop noise */
4266 codec->patch_ops.init(codec); 4535 codec->patch_ops.init(codec);
4267 snd_hda_codec_resume_amp(codec); 4536 snd_hda_codec_resume_amp(codec);
4268 snd_hda_codec_resume_cache(codec); 4537 snd_hda_codec_resume_cache(codec);
@@ -4273,7 +4542,7 @@ static int alc_resume(struct hda_codec *codec)
4273 4542
4274/* 4543/*
4275 */ 4544 */
4276static struct hda_codec_ops alc_patch_ops = { 4545static const struct hda_codec_ops alc_patch_ops = {
4277 .build_controls = alc_build_controls, 4546 .build_controls = alc_build_controls,
4278 .build_pcms = alc_build_pcms, 4547 .build_pcms = alc_build_pcms,
4279 .init = alc_init, 4548 .init = alc_init,
@@ -4308,11 +4577,11 @@ static int alc_codec_rename(struct hda_codec *codec, const char *name)
4308 * enum controls. 4577 * enum controls.
4309 */ 4578 */
4310#ifdef CONFIG_SND_DEBUG 4579#ifdef CONFIG_SND_DEBUG
4311static hda_nid_t alc880_test_dac_nids[4] = { 4580static const hda_nid_t alc880_test_dac_nids[4] = {
4312 0x02, 0x03, 0x04, 0x05 4581 0x02, 0x03, 0x04, 0x05
4313}; 4582};
4314 4583
4315static struct hda_input_mux alc880_test_capture_source = { 4584static const struct hda_input_mux alc880_test_capture_source = {
4316 .num_items = 7, 4585 .num_items = 7,
4317 .items = { 4586 .items = {
4318 { "In-1", 0x0 }, 4587 { "In-1", 0x0 },
@@ -4325,7 +4594,7 @@ static struct hda_input_mux alc880_test_capture_source = {
4325 }, 4594 },
4326}; 4595};
4327 4596
4328static struct hda_channel_mode alc880_test_modes[4] = { 4597static const struct hda_channel_mode alc880_test_modes[4] = {
4329 { 2, NULL }, 4598 { 2, NULL },
4330 { 4, NULL }, 4599 { 4, NULL },
4331 { 6, NULL }, 4600 { 6, NULL },
@@ -4335,7 +4604,7 @@ static struct hda_channel_mode alc880_test_modes[4] = {
4335static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, 4604static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
4336 struct snd_ctl_elem_info *uinfo) 4605 struct snd_ctl_elem_info *uinfo)
4337{ 4606{
4338 static char *texts[] = { 4607 static const char * const texts[] = {
4339 "N/A", "Line Out", "HP Out", 4608 "N/A", "Line Out", "HP Out",
4340 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" 4609 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
4341 }; 4610 };
@@ -4380,7 +4649,7 @@ static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
4380{ 4649{
4381 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 4650 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4382 hda_nid_t nid = (hda_nid_t)kcontrol->private_value; 4651 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4383 static unsigned int ctls[] = { 4652 static const unsigned int ctls[] = {
4384 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, 4653 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
4385 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, 4654 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
4386 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, 4655 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
@@ -4410,7 +4679,7 @@ static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
4410static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, 4679static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
4411 struct snd_ctl_elem_info *uinfo) 4680 struct snd_ctl_elem_info *uinfo)
4412{ 4681{
4413 static char *texts[] = { 4682 static const char * const texts[] = {
4414 "Front", "Surround", "CLFE", "Side" 4683 "Front", "Surround", "CLFE", "Side"
4415 }; 4684 };
4416 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 4685 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
@@ -4471,7 +4740,7 @@ static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
4471 .private_value = nid \ 4740 .private_value = nid \
4472 } 4741 }
4473 4742
4474static struct snd_kcontrol_new alc880_test_mixer[] = { 4743static const struct snd_kcontrol_new alc880_test_mixer[] = {
4475 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 4744 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4476 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 4745 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
4477 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), 4746 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
@@ -4512,7 +4781,7 @@ static struct snd_kcontrol_new alc880_test_mixer[] = {
4512 { } /* end */ 4781 { } /* end */
4513}; 4782};
4514 4783
4515static struct hda_verb alc880_test_init_verbs[] = { 4784static const struct hda_verb alc880_test_init_verbs[] = {
4516 /* Unmute inputs of 0x0c - 0x0f */ 4785 /* Unmute inputs of 0x0c - 0x0f */
4517 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 4786 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4518 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 4787 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
@@ -4596,7 +4865,7 @@ static const char * const alc880_models[ALC880_MODEL_LAST] = {
4596 [ALC880_AUTO] = "auto", 4865 [ALC880_AUTO] = "auto",
4597}; 4866};
4598 4867
4599static struct snd_pci_quirk alc880_cfg_tbl[] = { 4868static const struct snd_pci_quirk alc880_cfg_tbl[] = {
4600 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), 4869 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4601 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), 4870 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4602 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), 4871 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
@@ -4676,7 +4945,7 @@ static struct snd_pci_quirk alc880_cfg_tbl[] = {
4676/* 4945/*
4677 * ALC880 codec presets 4946 * ALC880 codec presets
4678 */ 4947 */
4679static struct alc_config_preset alc880_presets[] = { 4948static const struct alc_config_preset alc880_presets[] = {
4680 [ALC880_3ST] = { 4949 [ALC880_3ST] = {
4681 .mixers = { alc880_three_stack_mixer }, 4950 .mixers = { alc880_three_stack_mixer },
4682 .init_verbs = { alc880_volume_init_verbs, 4951 .init_verbs = { alc880_volume_init_verbs,
@@ -4794,7 +5063,7 @@ static struct alc_config_preset alc880_presets[] = {
4794 .input_mux = &alc880_f1734_capture_source, 5063 .input_mux = &alc880_f1734_capture_source,
4795 .unsol_event = alc880_uniwill_p53_unsol_event, 5064 .unsol_event = alc880_uniwill_p53_unsol_event,
4796 .setup = alc880_uniwill_p53_setup, 5065 .setup = alc880_uniwill_p53_setup,
4797 .init_hook = alc_automute_amp, 5066 .init_hook = alc_hp_automute,
4798 }, 5067 },
4799 [ALC880_ASUS] = { 5068 [ALC880_ASUS] = {
4800 .mixers = { alc880_asus_mixer }, 5069 .mixers = { alc880_asus_mixer },
@@ -4885,7 +5154,7 @@ static struct alc_config_preset alc880_presets[] = {
4885 .input_mux = &alc880_capture_source, 5154 .input_mux = &alc880_capture_source,
4886 .unsol_event = alc880_uniwill_p53_unsol_event, 5155 .unsol_event = alc880_uniwill_p53_unsol_event,
4887 .setup = alc880_uniwill_p53_setup, 5156 .setup = alc880_uniwill_p53_setup,
4888 .init_hook = alc_automute_amp, 5157 .init_hook = alc_hp_automute,
4889 }, 5158 },
4890 [ALC880_FUJITSU] = { 5159 [ALC880_FUJITSU] = {
4891 .mixers = { alc880_fujitsu_mixer }, 5160 .mixers = { alc880_fujitsu_mixer },
@@ -4900,7 +5169,7 @@ static struct alc_config_preset alc880_presets[] = {
4900 .input_mux = &alc880_capture_source, 5169 .input_mux = &alc880_capture_source,
4901 .unsol_event = alc880_uniwill_p53_unsol_event, 5170 .unsol_event = alc880_uniwill_p53_unsol_event,
4902 .setup = alc880_uniwill_p53_setup, 5171 .setup = alc880_uniwill_p53_setup,
4903 .init_hook = alc_automute_amp, 5172 .init_hook = alc_hp_automute,
4904 }, 5173 },
4905 [ALC880_CLEVO] = { 5174 [ALC880_CLEVO] = {
4906 .mixers = { alc880_three_stack_mixer }, 5175 .mixers = { alc880_three_stack_mixer },
@@ -4925,9 +5194,9 @@ static struct alc_config_preset alc880_presets[] = {
4925 .channel_mode = alc880_lg_ch_modes, 5194 .channel_mode = alc880_lg_ch_modes,
4926 .need_dac_fix = 1, 5195 .need_dac_fix = 1,
4927 .input_mux = &alc880_lg_capture_source, 5196 .input_mux = &alc880_lg_capture_source,
4928 .unsol_event = alc_automute_amp_unsol_event, 5197 .unsol_event = alc_sku_unsol_event,
4929 .setup = alc880_lg_setup, 5198 .setup = alc880_lg_setup,
4930 .init_hook = alc_automute_amp, 5199 .init_hook = alc_hp_automute,
4931#ifdef CONFIG_SND_HDA_POWER_SAVE 5200#ifdef CONFIG_SND_HDA_POWER_SAVE
4932 .loopbacks = alc880_lg_loopbacks, 5201 .loopbacks = alc880_lg_loopbacks,
4933#endif 5202#endif
@@ -4942,9 +5211,9 @@ static struct alc_config_preset alc880_presets[] = {
4942 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), 5211 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4943 .channel_mode = alc880_lg_lw_modes, 5212 .channel_mode = alc880_lg_lw_modes,
4944 .input_mux = &alc880_lg_lw_capture_source, 5213 .input_mux = &alc880_lg_lw_capture_source,
4945 .unsol_event = alc_automute_amp_unsol_event, 5214 .unsol_event = alc_sku_unsol_event,
4946 .setup = alc880_lg_lw_setup, 5215 .setup = alc880_lg_lw_setup,
4947 .init_hook = alc_automute_amp, 5216 .init_hook = alc_hp_automute,
4948 }, 5217 },
4949 [ALC880_MEDION_RIM] = { 5218 [ALC880_MEDION_RIM] = {
4950 .mixers = { alc880_medion_rim_mixer }, 5219 .mixers = { alc880_medion_rim_mixer },
@@ -4984,20 +5253,25 @@ enum {
4984 ALC_CTL_WIDGET_MUTE, 5253 ALC_CTL_WIDGET_MUTE,
4985 ALC_CTL_BIND_MUTE, 5254 ALC_CTL_BIND_MUTE,
4986}; 5255};
4987static struct snd_kcontrol_new alc880_control_templates[] = { 5256static const struct snd_kcontrol_new alc880_control_templates[] = {
4988 HDA_CODEC_VOLUME(NULL, 0, 0, 0), 5257 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4989 HDA_CODEC_MUTE(NULL, 0, 0, 0), 5258 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4990 HDA_BIND_MUTE(NULL, 0, 0, 0), 5259 HDA_BIND_MUTE(NULL, 0, 0, 0),
4991}; 5260};
4992 5261
5262static struct snd_kcontrol_new *alc_kcontrol_new(struct alc_spec *spec)
5263{
5264 snd_array_init(&spec->kctls, sizeof(struct snd_kcontrol_new), 32);
5265 return snd_array_new(&spec->kctls);
5266}
5267
4993/* add dynamic controls */ 5268/* add dynamic controls */
4994static int add_control(struct alc_spec *spec, int type, const char *name, 5269static int add_control(struct alc_spec *spec, int type, const char *name,
4995 int cidx, unsigned long val) 5270 int cidx, unsigned long val)
4996{ 5271{
4997 struct snd_kcontrol_new *knew; 5272 struct snd_kcontrol_new *knew;
4998 5273
4999 snd_array_init(&spec->kctls, sizeof(*knew), 32); 5274 knew = alc_kcontrol_new(spec);
5000 knew = snd_array_new(&spec->kctls);
5001 if (!knew) 5275 if (!knew)
5002 return -ENOMEM; 5276 return -ENOMEM;
5003 *knew = alc880_control_templates[type]; 5277 *knew = alc880_control_templates[type];
@@ -5055,7 +5329,7 @@ static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
5055 nid = cfg->line_out_pins[i]; 5329 nid = cfg->line_out_pins[i];
5056 if (alc880_is_fixed_pin(nid)) { 5330 if (alc880_is_fixed_pin(nid)) {
5057 int idx = alc880_fixed_pin_idx(nid); 5331 int idx = alc880_fixed_pin_idx(nid);
5058 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); 5332 spec->private_dac_nids[i] = alc880_idx_to_dac(idx);
5059 assigned[idx] = 1; 5333 assigned[idx] = 1;
5060 } 5334 }
5061 } 5335 }
@@ -5067,7 +5341,7 @@ static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
5067 /* search for an empty channel */ 5341 /* search for an empty channel */
5068 for (j = 0; j < cfg->line_outs; j++) { 5342 for (j = 0; j < cfg->line_outs; j++) {
5069 if (!assigned[j]) { 5343 if (!assigned[j]) {
5070 spec->multiout.dac_nids[i] = 5344 spec->private_dac_nids[i] =
5071 alc880_idx_to_dac(j); 5345 alc880_idx_to_dac(j);
5072 assigned[j] = 1; 5346 assigned[j] = 1;
5073 break; 5347 break;
@@ -5078,10 +5352,13 @@ static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
5078 return 0; 5352 return 0;
5079} 5353}
5080 5354
5081static const char *alc_get_line_out_pfx(const struct auto_pin_cfg *cfg, 5355static const char *alc_get_line_out_pfx(struct alc_spec *spec,
5082 bool can_be_master) 5356 bool can_be_master)
5083{ 5357{
5084 if (!cfg->hp_outs && !cfg->speaker_outs && can_be_master) 5358 struct auto_pin_cfg *cfg = &spec->autocfg;
5359
5360 if (cfg->line_outs == 1 && !spec->multi_ios &&
5361 !cfg->hp_outs && !cfg->speaker_outs && can_be_master)
5085 return "Master"; 5362 return "Master";
5086 5363
5087 switch (cfg->line_out_type) { 5364 switch (cfg->line_out_type) {
@@ -5092,7 +5369,7 @@ static const char *alc_get_line_out_pfx(const struct auto_pin_cfg *cfg,
5092 case AUTO_PIN_HP_OUT: 5369 case AUTO_PIN_HP_OUT:
5093 return "Headphone"; 5370 return "Headphone";
5094 default: 5371 default:
5095 if (cfg->line_outs == 1) 5372 if (cfg->line_outs == 1 && !spec->multi_ios)
5096 return "PCM"; 5373 return "PCM";
5097 break; 5374 break;
5098 } 5375 }
@@ -5106,11 +5383,15 @@ static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
5106 static const char * const chname[4] = { 5383 static const char * const chname[4] = {
5107 "Front", "Surround", NULL /*CLFE*/, "Side" 5384 "Front", "Surround", NULL /*CLFE*/, "Side"
5108 }; 5385 };
5109 const char *pfx = alc_get_line_out_pfx(cfg, false); 5386 const char *pfx = alc_get_line_out_pfx(spec, false);
5110 hda_nid_t nid; 5387 hda_nid_t nid;
5111 int i, err; 5388 int i, err, noutputs;
5112 5389
5113 for (i = 0; i < cfg->line_outs; i++) { 5390 noutputs = cfg->line_outs;
5391 if (spec->multi_ios > 0)
5392 noutputs += spec->multi_ios;
5393
5394 for (i = 0; i < noutputs; i++) {
5114 if (!spec->multiout.dac_nids[i]) 5395 if (!spec->multiout.dac_nids[i])
5115 continue; 5396 continue;
5116 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); 5397 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
@@ -5376,6 +5657,8 @@ static void alc880_auto_init_input_src(struct hda_codec *codec)
5376 } 5657 }
5377} 5658}
5378 5659
5660static int alc_auto_add_multi_channel_mode(struct hda_codec *codec);
5661
5379/* parse the BIOS configuration and set up the alc_spec */ 5662/* parse the BIOS configuration and set up the alc_spec */
5380/* return 1 if successful, 0 if the proper config is not found, 5663/* return 1 if successful, 0 if the proper config is not found,
5381 * or a negative error code 5664 * or a negative error code
@@ -5384,7 +5667,7 @@ static int alc880_parse_auto_config(struct hda_codec *codec)
5384{ 5667{
5385 struct alc_spec *spec = codec->spec; 5668 struct alc_spec *spec = codec->spec;
5386 int err; 5669 int err;
5387 static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; 5670 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
5388 5671
5389 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, 5672 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5390 alc880_ignore); 5673 alc880_ignore);
@@ -5396,6 +5679,9 @@ static int alc880_parse_auto_config(struct hda_codec *codec)
5396 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); 5679 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
5397 if (err < 0) 5680 if (err < 0)
5398 return err; 5681 return err;
5682 err = alc_auto_add_multi_channel_mode(codec);
5683 if (err < 0)
5684 return err;
5399 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); 5685 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
5400 if (err < 0) 5686 if (err < 0)
5401 return err; 5687 return err;
@@ -5467,6 +5753,12 @@ static void fixup_automic_adc(struct hda_codec *codec)
5467 spec->capsrc_nids += i; 5753 spec->capsrc_nids += i;
5468 spec->adc_nids += i; 5754 spec->adc_nids += i;
5469 spec->num_adc_nids = 1; 5755 spec->num_adc_nids = 1;
5756 /* optional dock-mic */
5757 eidx = get_connection_index(codec, cap, spec->dock_mic.pin);
5758 if (eidx < 0)
5759 spec->dock_mic.pin = 0;
5760 else
5761 spec->dock_mic.mux_idx = eidx;
5470 return; 5762 return;
5471 } 5763 }
5472 snd_printd(KERN_INFO "hda_codec: %s: " 5764 snd_printd(KERN_INFO "hda_codec: %s: "
@@ -5494,6 +5786,8 @@ static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin)
5494 struct alc_spec *spec = codec->spec; 5786 struct alc_spec *spec = codec->spec;
5495 int i; 5787 int i;
5496 5788
5789 if (!pin)
5790 return 0;
5497 for (i = 0; i < spec->num_adc_nids; i++) { 5791 for (i = 0; i < spec->num_adc_nids; i++) {
5498 hda_nid_t cap = spec->capsrc_nids ? 5792 hda_nid_t cap = spec->capsrc_nids ?
5499 spec->capsrc_nids[i] : spec->adc_nids[i]; 5793 spec->capsrc_nids[i] : spec->adc_nids[i];
@@ -5534,6 +5828,7 @@ static void fixup_dual_adc_switch(struct hda_codec *codec)
5534{ 5828{
5535 struct alc_spec *spec = codec->spec; 5829 struct alc_spec *spec = codec->spec;
5536 init_capsrc_for_pin(codec, spec->ext_mic.pin); 5830 init_capsrc_for_pin(codec, spec->ext_mic.pin);
5831 init_capsrc_for_pin(codec, spec->dock_mic.pin);
5537 init_capsrc_for_pin(codec, spec->int_mic.pin); 5832 init_capsrc_for_pin(codec, spec->int_mic.pin);
5538} 5833}
5539 5834
@@ -5550,7 +5845,7 @@ static void alc_init_special_input_src(struct hda_codec *codec)
5550static void set_capture_mixer(struct hda_codec *codec) 5845static void set_capture_mixer(struct hda_codec *codec)
5551{ 5846{
5552 struct alc_spec *spec = codec->spec; 5847 struct alc_spec *spec = codec->spec;
5553 static struct snd_kcontrol_new *caps[2][3] = { 5848 static const struct snd_kcontrol_new *caps[2][3] = {
5554 { alc_capture_mixer_nosrc1, 5849 { alc_capture_mixer_nosrc1,
5555 alc_capture_mixer_nosrc2, 5850 alc_capture_mixer_nosrc2,
5556 alc_capture_mixer_nosrc3 }, 5851 alc_capture_mixer_nosrc3 },
@@ -5576,7 +5871,7 @@ static void set_capture_mixer(struct hda_codec *codec)
5576} 5871}
5577 5872
5578/* fill adc_nids (and capsrc_nids) containing all active input pins */ 5873/* fill adc_nids (and capsrc_nids) containing all active input pins */
5579static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids, 5874static void fillup_priv_adc_nids(struct hda_codec *codec, const hda_nid_t *nids,
5580 int num_nids) 5875 int num_nids)
5581{ 5876{
5582 struct alc_spec *spec = codec->spec; 5877 struct alc_spec *spec = codec->spec;
@@ -5642,10 +5937,11 @@ static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids,
5642#define set_beep_amp(spec, nid, idx, dir) \ 5937#define set_beep_amp(spec, nid, idx, dir) \
5643 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) 5938 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5644 5939
5645static struct snd_pci_quirk beep_white_list[] = { 5940static const struct snd_pci_quirk beep_white_list[] = {
5646 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1), 5941 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
5647 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1), 5942 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
5648 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1), 5943 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
5944 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
5649 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1), 5945 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
5650 {} 5946 {}
5651}; 5947};
@@ -5753,17 +6049,17 @@ static int patch_alc880(struct hda_codec *codec)
5753 * ALC260 support 6049 * ALC260 support
5754 */ 6050 */
5755 6051
5756static hda_nid_t alc260_dac_nids[1] = { 6052static const hda_nid_t alc260_dac_nids[1] = {
5757 /* front */ 6053 /* front */
5758 0x02, 6054 0x02,
5759}; 6055};
5760 6056
5761static hda_nid_t alc260_adc_nids[1] = { 6057static const hda_nid_t alc260_adc_nids[1] = {
5762 /* ADC0 */ 6058 /* ADC0 */
5763 0x04, 6059 0x04,
5764}; 6060};
5765 6061
5766static hda_nid_t alc260_adc_nids_alt[1] = { 6062static const hda_nid_t alc260_adc_nids_alt[1] = {
5767 /* ADC1 */ 6063 /* ADC1 */
5768 0x05, 6064 0x05,
5769}; 6065};
@@ -5771,7 +6067,7 @@ static hda_nid_t alc260_adc_nids_alt[1] = {
5771/* NIDs used when simultaneous access to both ADCs makes sense. Note that 6067/* NIDs used when simultaneous access to both ADCs makes sense. Note that
5772 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. 6068 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5773 */ 6069 */
5774static hda_nid_t alc260_dual_adc_nids[2] = { 6070static const hda_nid_t alc260_dual_adc_nids[2] = {
5775 /* ADC0, ADC1 */ 6071 /* ADC0, ADC1 */
5776 0x04, 0x05 6072 0x04, 0x05
5777}; 6073};
@@ -5779,7 +6075,7 @@ static hda_nid_t alc260_dual_adc_nids[2] = {
5779#define ALC260_DIGOUT_NID 0x03 6075#define ALC260_DIGOUT_NID 0x03
5780#define ALC260_DIGIN_NID 0x06 6076#define ALC260_DIGIN_NID 0x06
5781 6077
5782static struct hda_input_mux alc260_capture_source = { 6078static const struct hda_input_mux alc260_capture_source = {
5783 .num_items = 4, 6079 .num_items = 4,
5784 .items = { 6080 .items = {
5785 { "Mic", 0x0 }, 6081 { "Mic", 0x0 },
@@ -5795,7 +6091,7 @@ static struct hda_input_mux alc260_capture_source = {
5795 * recording the mixer output on the second ADC (ADC0 doesn't have a 6091 * recording the mixer output on the second ADC (ADC0 doesn't have a
5796 * connection to the mixer output). 6092 * connection to the mixer output).
5797 */ 6093 */
5798static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { 6094static const struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5799 { 6095 {
5800 .num_items = 3, 6096 .num_items = 3,
5801 .items = { 6097 .items = {
@@ -5819,7 +6115,7 @@ static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5819/* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to 6115/* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5820 * the Fujitsu S702x, but jacks are marked differently. 6116 * the Fujitsu S702x, but jacks are marked differently.
5821 */ 6117 */
5822static struct hda_input_mux alc260_acer_capture_sources[2] = { 6118static const struct hda_input_mux alc260_acer_capture_sources[2] = {
5823 { 6119 {
5824 .num_items = 4, 6120 .num_items = 4,
5825 .items = { 6121 .items = {
@@ -5842,7 +6138,7 @@ static struct hda_input_mux alc260_acer_capture_sources[2] = {
5842}; 6138};
5843 6139
5844/* Maxdata Favorit 100XS */ 6140/* Maxdata Favorit 100XS */
5845static struct hda_input_mux alc260_favorit100_capture_sources[2] = { 6141static const struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5846 { 6142 {
5847 .num_items = 2, 6143 .num_items = 2,
5848 .items = { 6144 .items = {
@@ -5866,7 +6162,7 @@ static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5866 * element which allows changing the channel mode, so the verb list is 6162 * element which allows changing the channel mode, so the verb list is
5867 * never used. 6163 * never used.
5868 */ 6164 */
5869static struct hda_channel_mode alc260_modes[1] = { 6165static const struct hda_channel_mode alc260_modes[1] = {
5870 { 2, NULL }, 6166 { 2, NULL },
5871}; 6167};
5872 6168
@@ -5880,7 +6176,7 @@ static struct hda_channel_mode alc260_modes[1] = {
5880 * acer: acer + capture 6176 * acer: acer + capture
5881 */ 6177 */
5882 6178
5883static struct snd_kcontrol_new alc260_base_output_mixer[] = { 6179static const struct snd_kcontrol_new alc260_base_output_mixer[] = {
5884 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), 6180 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5885 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), 6181 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5886 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), 6182 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
@@ -5890,7 +6186,7 @@ static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5890 { } /* end */ 6186 { } /* end */
5891}; 6187};
5892 6188
5893static struct snd_kcontrol_new alc260_input_mixer[] = { 6189static const struct snd_kcontrol_new alc260_input_mixer[] = {
5894 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), 6190 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5895 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), 6191 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5896 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), 6192 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
@@ -5903,21 +6199,14 @@ static struct snd_kcontrol_new alc260_input_mixer[] = {
5903}; 6199};
5904 6200
5905/* update HP, line and mono out pins according to the master switch */ 6201/* update HP, line and mono out pins according to the master switch */
5906static void alc260_hp_master_update(struct hda_codec *codec, 6202static void alc260_hp_master_update(struct hda_codec *codec)
5907 hda_nid_t hp, hda_nid_t line,
5908 hda_nid_t mono)
5909{ 6203{
5910 struct alc_spec *spec = codec->spec; 6204 struct alc_spec *spec = codec->spec;
5911 unsigned int val = spec->master_sw ? PIN_HP : 0; 6205
5912 /* change HP and line-out pins */ 6206 /* change HP pins */
5913 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 6207 do_automute(codec, ARRAY_SIZE(spec->autocfg.hp_pins),
5914 val); 6208 spec->autocfg.hp_pins, spec->master_mute, true);
5915 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 6209 update_speakers(codec);
5916 val);
5917 /* mono (speaker) depending on the HP jack sense */
5918 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5919 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5920 val);
5921} 6210}
5922 6211
5923static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, 6212static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
@@ -5925,7 +6214,7 @@ static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5925{ 6214{
5926 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 6215 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5927 struct alc_spec *spec = codec->spec; 6216 struct alc_spec *spec = codec->spec;
5928 *ucontrol->value.integer.value = spec->master_sw; 6217 *ucontrol->value.integer.value = !spec->master_mute;
5929 return 0; 6218 return 0;
5930} 6219}
5931 6220
@@ -5934,20 +6223,16 @@ static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5934{ 6223{
5935 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 6224 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5936 struct alc_spec *spec = codec->spec; 6225 struct alc_spec *spec = codec->spec;
5937 int val = !!*ucontrol->value.integer.value; 6226 int val = !*ucontrol->value.integer.value;
5938 hda_nid_t hp, line, mono;
5939 6227
5940 if (val == spec->master_sw) 6228 if (val == spec->master_mute)
5941 return 0; 6229 return 0;
5942 spec->master_sw = val; 6230 spec->master_mute = val;
5943 hp = (kcontrol->private_value >> 16) & 0xff; 6231 alc260_hp_master_update(codec);
5944 line = (kcontrol->private_value >> 8) & 0xff;
5945 mono = kcontrol->private_value & 0xff;
5946 alc260_hp_master_update(codec, hp, line, mono);
5947 return 1; 6232 return 1;
5948} 6233}
5949 6234
5950static struct snd_kcontrol_new alc260_hp_output_mixer[] = { 6235static const struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5951 { 6236 {
5952 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 6237 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5953 .name = "Master Playback Switch", 6238 .name = "Master Playback Switch",
@@ -5955,7 +6240,6 @@ static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5955 .info = snd_ctl_boolean_mono_info, 6240 .info = snd_ctl_boolean_mono_info,
5956 .get = alc260_hp_master_sw_get, 6241 .get = alc260_hp_master_sw_get,
5957 .put = alc260_hp_master_sw_put, 6242 .put = alc260_hp_master_sw_put,
5958 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5959 }, 6243 },
5960 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), 6244 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5961 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), 6245 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
@@ -5967,26 +6251,23 @@ static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5967 { } /* end */ 6251 { } /* end */
5968}; 6252};
5969 6253
5970static struct hda_verb alc260_hp_unsol_verbs[] = { 6254static const struct hda_verb alc260_hp_unsol_verbs[] = {
5971 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, 6255 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5972 {}, 6256 {},
5973}; 6257};
5974 6258
5975static void alc260_hp_automute(struct hda_codec *codec) 6259static void alc260_hp_setup(struct hda_codec *codec)
5976{ 6260{
5977 struct alc_spec *spec = codec->spec; 6261 struct alc_spec *spec = codec->spec;
5978 6262
5979 spec->jack_present = snd_hda_jack_detect(codec, 0x10); 6263 spec->autocfg.hp_pins[0] = 0x0f;
5980 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); 6264 spec->autocfg.speaker_pins[0] = 0x10;
5981} 6265 spec->autocfg.speaker_pins[1] = 0x11;
5982 6266 spec->automute = 1;
5983static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) 6267 spec->automute_mode = ALC_AUTOMUTE_PIN;
5984{
5985 if ((res >> 26) == ALC880_HP_EVENT)
5986 alc260_hp_automute(codec);
5987} 6268}
5988 6269
5989static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { 6270static const struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5990 { 6271 {
5991 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 6272 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5992 .name = "Master Playback Switch", 6273 .name = "Master Playback Switch",
@@ -5994,7 +6275,6 @@ static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5994 .info = snd_ctl_boolean_mono_info, 6275 .info = snd_ctl_boolean_mono_info,
5995 .get = alc260_hp_master_sw_get, 6276 .get = alc260_hp_master_sw_get,
5996 .put = alc260_hp_master_sw_put, 6277 .put = alc260_hp_master_sw_put,
5997 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5998 }, 6278 },
5999 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), 6279 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6000 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), 6280 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
@@ -6007,7 +6287,18 @@ static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
6007 { } /* end */ 6287 { } /* end */
6008}; 6288};
6009 6289
6010static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { 6290static void alc260_hp_3013_setup(struct hda_codec *codec)
6291{
6292 struct alc_spec *spec = codec->spec;
6293
6294 spec->autocfg.hp_pins[0] = 0x15;
6295 spec->autocfg.speaker_pins[0] = 0x10;
6296 spec->autocfg.speaker_pins[1] = 0x11;
6297 spec->automute = 1;
6298 spec->automute_mode = ALC_AUTOMUTE_PIN;
6299}
6300
6301static const struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
6011 .ops = &snd_hda_bind_vol, 6302 .ops = &snd_hda_bind_vol,
6012 .values = { 6303 .values = {
6013 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), 6304 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
@@ -6017,7 +6308,7 @@ static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
6017 }, 6308 },
6018}; 6309};
6019 6310
6020static struct hda_bind_ctls alc260_dc7600_bind_switch = { 6311static const struct hda_bind_ctls alc260_dc7600_bind_switch = {
6021 .ops = &snd_hda_bind_sw, 6312 .ops = &snd_hda_bind_sw,
6022 .values = { 6313 .values = {
6023 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), 6314 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
@@ -6026,7 +6317,7 @@ static struct hda_bind_ctls alc260_dc7600_bind_switch = {
6026 }, 6317 },
6027}; 6318};
6028 6319
6029static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { 6320static const struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
6030 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), 6321 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
6031 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), 6322 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
6032 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), 6323 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
@@ -6034,49 +6325,27 @@ static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
6034 { } /* end */ 6325 { } /* end */
6035}; 6326};
6036 6327
6037static struct hda_verb alc260_hp_3013_unsol_verbs[] = { 6328static const struct hda_verb alc260_hp_3013_unsol_verbs[] = {
6038 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, 6329 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6039 {}, 6330 {},
6040}; 6331};
6041 6332
6042static void alc260_hp_3013_automute(struct hda_codec *codec) 6333static void alc260_hp_3012_setup(struct hda_codec *codec)
6043{ 6334{
6044 struct alc_spec *spec = codec->spec; 6335 struct alc_spec *spec = codec->spec;
6045 6336
6046 spec->jack_present = snd_hda_jack_detect(codec, 0x15); 6337 spec->autocfg.hp_pins[0] = 0x10;
6047 alc260_hp_master_update(codec, 0x15, 0x10, 0x11); 6338 spec->autocfg.speaker_pins[0] = 0x0f;
6048} 6339 spec->autocfg.speaker_pins[1] = 0x11;
6049 6340 spec->autocfg.speaker_pins[2] = 0x15;
6050static void alc260_hp_3013_unsol_event(struct hda_codec *codec, 6341 spec->automute = 1;
6051 unsigned int res) 6342 spec->automute_mode = ALC_AUTOMUTE_PIN;
6052{
6053 if ((res >> 26) == ALC880_HP_EVENT)
6054 alc260_hp_3013_automute(codec);
6055}
6056
6057static void alc260_hp_3012_automute(struct hda_codec *codec)
6058{
6059 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
6060
6061 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6062 bits);
6063 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6064 bits);
6065 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6066 bits);
6067}
6068
6069static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
6070 unsigned int res)
6071{
6072 if ((res >> 26) == ALC880_HP_EVENT)
6073 alc260_hp_3012_automute(codec);
6074} 6343}
6075 6344
6076/* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, 6345/* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
6077 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. 6346 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
6078 */ 6347 */
6079static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { 6348static const struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
6080 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), 6349 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6081 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), 6350 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
6082 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), 6351 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
@@ -6113,7 +6382,7 @@ static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
6113 * controls for such models. On models without a "mono speaker" the control 6382 * controls for such models. On models without a "mono speaker" the control
6114 * won't do anything. 6383 * won't do anything.
6115 */ 6384 */
6116static struct snd_kcontrol_new alc260_acer_mixer[] = { 6385static const struct snd_kcontrol_new alc260_acer_mixer[] = {
6117 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), 6386 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6118 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), 6387 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
6119 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), 6388 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
@@ -6134,7 +6403,7 @@ static struct snd_kcontrol_new alc260_acer_mixer[] = {
6134 6403
6135/* Maxdata Favorit 100XS: one output and one input (0x12) jack 6404/* Maxdata Favorit 100XS: one output and one input (0x12) jack
6136 */ 6405 */
6137static struct snd_kcontrol_new alc260_favorit100_mixer[] = { 6406static const struct snd_kcontrol_new alc260_favorit100_mixer[] = {
6138 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), 6407 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6139 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), 6408 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
6140 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), 6409 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
@@ -6147,7 +6416,7 @@ static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
6147/* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, 6416/* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
6148 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. 6417 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
6149 */ 6418 */
6150static struct snd_kcontrol_new alc260_will_mixer[] = { 6419static const struct snd_kcontrol_new alc260_will_mixer[] = {
6151 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), 6420 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6152 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), 6421 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
6153 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), 6422 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
@@ -6164,7 +6433,7 @@ static struct snd_kcontrol_new alc260_will_mixer[] = {
6164/* Replacer 672V ALC260 pin usage: Mic jack = 0x12, 6433/* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
6165 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. 6434 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
6166 */ 6435 */
6167static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { 6436static const struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
6168 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), 6437 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6169 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), 6438 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
6170 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), 6439 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
@@ -6181,7 +6450,7 @@ static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
6181/* 6450/*
6182 * initialization verbs 6451 * initialization verbs
6183 */ 6452 */
6184static struct hda_verb alc260_init_verbs[] = { 6453static const struct hda_verb alc260_init_verbs[] = {
6185 /* Line In pin widget for input */ 6454 /* Line In pin widget for input */
6186 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 6455 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6187 /* CD pin widget for input */ 6456 /* CD pin widget for input */
@@ -6245,7 +6514,7 @@ static struct hda_verb alc260_init_verbs[] = {
6245}; 6514};
6246 6515
6247#if 0 /* should be identical with alc260_init_verbs? */ 6516#if 0 /* should be identical with alc260_init_verbs? */
6248static struct hda_verb alc260_hp_init_verbs[] = { 6517static const struct hda_verb alc260_hp_init_verbs[] = {
6249 /* Headphone and output */ 6518 /* Headphone and output */
6250 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, 6519 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
6251 /* mono output */ 6520 /* mono output */
@@ -6295,7 +6564,7 @@ static struct hda_verb alc260_hp_init_verbs[] = {
6295}; 6564};
6296#endif 6565#endif
6297 6566
6298static struct hda_verb alc260_hp_3013_init_verbs[] = { 6567static const struct hda_verb alc260_hp_3013_init_verbs[] = {
6299 /* Line out and output */ 6568 /* Line out and output */
6300 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, 6569 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6301 /* mono output */ 6570 /* mono output */
@@ -6348,7 +6617,7 @@ static struct hda_verb alc260_hp_3013_init_verbs[] = {
6348 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD 6617 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
6349 * audio = 0x16, internal speaker = 0x10. 6618 * audio = 0x16, internal speaker = 0x10.
6350 */ 6619 */
6351static struct hda_verb alc260_fujitsu_init_verbs[] = { 6620static const struct hda_verb alc260_fujitsu_init_verbs[] = {
6352 /* Disable all GPIOs */ 6621 /* Disable all GPIOs */
6353 {0x01, AC_VERB_SET_GPIO_MASK, 0}, 6622 {0x01, AC_VERB_SET_GPIO_MASK, 0},
6354 /* Internal speaker is connected to headphone pin */ 6623 /* Internal speaker is connected to headphone pin */
@@ -6430,7 +6699,7 @@ static struct hda_verb alc260_fujitsu_init_verbs[] = {
6430/* Initialisation sequence for ALC260 as configured in Acer TravelMate and 6699/* Initialisation sequence for ALC260 as configured in Acer TravelMate and
6431 * similar laptops (adapted from Fujitsu init verbs). 6700 * similar laptops (adapted from Fujitsu init verbs).
6432 */ 6701 */
6433static struct hda_verb alc260_acer_init_verbs[] = { 6702static const struct hda_verb alc260_acer_init_verbs[] = {
6434 /* On TravelMate laptops, GPIO 0 enables the internal speaker and 6703 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
6435 * the headphone jack. Turn this on and rely on the standard mute 6704 * the headphone jack. Turn this on and rely on the standard mute
6436 * methods whenever the user wants to turn these outputs off. 6705 * methods whenever the user wants to turn these outputs off.
@@ -6518,7 +6787,7 @@ static struct hda_verb alc260_acer_init_verbs[] = {
6518/* Initialisation sequence for Maxdata Favorit 100XS 6787/* Initialisation sequence for Maxdata Favorit 100XS
6519 * (adapted from Acer init verbs). 6788 * (adapted from Acer init verbs).
6520 */ 6789 */
6521static struct hda_verb alc260_favorit100_init_verbs[] = { 6790static const struct hda_verb alc260_favorit100_init_verbs[] = {
6522 /* GPIO 0 enables the output jack. 6791 /* GPIO 0 enables the output jack.
6523 * Turn this on and rely on the standard mute 6792 * Turn this on and rely on the standard mute
6524 * methods whenever the user wants to turn these outputs off. 6793 * methods whenever the user wants to turn these outputs off.
@@ -6598,7 +6867,7 @@ static struct hda_verb alc260_favorit100_init_verbs[] = {
6598 { } 6867 { }
6599}; 6868};
6600 6869
6601static struct hda_verb alc260_will_verbs[] = { 6870static const struct hda_verb alc260_will_verbs[] = {
6602 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 6871 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6603 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, 6872 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
6604 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, 6873 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
@@ -6608,7 +6877,7 @@ static struct hda_verb alc260_will_verbs[] = {
6608 {} 6877 {}
6609}; 6878};
6610 6879
6611static struct hda_verb alc260_replacer_672v_verbs[] = { 6880static const struct hda_verb alc260_replacer_672v_verbs[] = {
6612 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, 6881 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6613 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, 6882 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6614 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, 6883 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
@@ -6650,7 +6919,7 @@ static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
6650 alc260_replacer_672v_automute(codec); 6919 alc260_replacer_672v_automute(codec);
6651} 6920}
6652 6921
6653static struct hda_verb alc260_hp_dc7600_verbs[] = { 6922static const struct hda_verb alc260_hp_dc7600_verbs[] = {
6654 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, 6923 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
6655 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, 6924 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6656 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 6925 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
@@ -6668,17 +6937,17 @@ static struct hda_verb alc260_hp_dc7600_verbs[] = {
6668 * configuration. 6937 * configuration.
6669 */ 6938 */
6670#ifdef CONFIG_SND_DEBUG 6939#ifdef CONFIG_SND_DEBUG
6671static hda_nid_t alc260_test_dac_nids[1] = { 6940static const hda_nid_t alc260_test_dac_nids[1] = {
6672 0x02, 6941 0x02,
6673}; 6942};
6674static hda_nid_t alc260_test_adc_nids[2] = { 6943static const hda_nid_t alc260_test_adc_nids[2] = {
6675 0x04, 0x05, 6944 0x04, 0x05,
6676}; 6945};
6677/* For testing the ALC260, each input MUX needs its own definition since 6946/* For testing the ALC260, each input MUX needs its own definition since
6678 * the signal assignments are different. This assumes that the first ADC 6947 * the signal assignments are different. This assumes that the first ADC
6679 * is NID 0x04. 6948 * is NID 0x04.
6680 */ 6949 */
6681static struct hda_input_mux alc260_test_capture_sources[2] = { 6950static const struct hda_input_mux alc260_test_capture_sources[2] = {
6682 { 6951 {
6683 .num_items = 7, 6952 .num_items = 7,
6684 .items = { 6953 .items = {
@@ -6705,7 +6974,7 @@ static struct hda_input_mux alc260_test_capture_sources[2] = {
6705 }, 6974 },
6706 }, 6975 },
6707}; 6976};
6708static struct snd_kcontrol_new alc260_test_mixer[] = { 6977static const struct snd_kcontrol_new alc260_test_mixer[] = {
6709 /* Output driver widgets */ 6978 /* Output driver widgets */
6710 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), 6979 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6711 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), 6980 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
@@ -6769,7 +7038,7 @@ static struct snd_kcontrol_new alc260_test_mixer[] = {
6769 7038
6770 { } /* end */ 7039 { } /* end */
6771}; 7040};
6772static struct hda_verb alc260_test_init_verbs[] = { 7041static const struct hda_verb alc260_test_init_verbs[] = {
6773 /* Enable all GPIOs as outputs with an initial value of 0 */ 7042 /* Enable all GPIOs as outputs with an initial value of 0 */
6774 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, 7043 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6775 {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, 7044 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
@@ -6907,7 +7176,7 @@ static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6907 7176
6908 spec->multiout.num_dacs = 1; 7177 spec->multiout.num_dacs = 1;
6909 spec->multiout.dac_nids = spec->private_dac_nids; 7178 spec->multiout.dac_nids = spec->private_dac_nids;
6910 spec->multiout.dac_nids[0] = 0x02; 7179 spec->private_dac_nids[0] = 0x02;
6911 7180
6912 nid = cfg->line_out_pins[0]; 7181 nid = cfg->line_out_pins[0];
6913 if (nid) { 7182 if (nid) {
@@ -7005,7 +7274,7 @@ static void alc260_auto_init_analog_input(struct hda_codec *codec)
7005/* 7274/*
7006 * generic initialization of ADC, input mixers and output mixers 7275 * generic initialization of ADC, input mixers and output mixers
7007 */ 7276 */
7008static struct hda_verb alc260_volume_init_verbs[] = { 7277static const struct hda_verb alc260_volume_init_verbs[] = {
7009 /* 7278 /*
7010 * Unmute ADC0-1 and set the default input to mic-in 7279 * Unmute ADC0-1 and set the default input to mic-in
7011 */ 7280 */
@@ -7050,7 +7319,7 @@ static int alc260_parse_auto_config(struct hda_codec *codec)
7050{ 7319{
7051 struct alc_spec *spec = codec->spec; 7320 struct alc_spec *spec = codec->spec;
7052 int err; 7321 int err;
7053 static hda_nid_t alc260_ignore[] = { 0x17, 0 }; 7322 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
7054 7323
7055 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, 7324 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
7056 alc260_ignore); 7325 alc260_ignore);
@@ -7095,7 +7364,7 @@ static void alc260_auto_init(struct hda_codec *codec)
7095} 7364}
7096 7365
7097#ifdef CONFIG_SND_HDA_POWER_SAVE 7366#ifdef CONFIG_SND_HDA_POWER_SAVE
7098static struct hda_amp_list alc260_loopbacks[] = { 7367static const struct hda_amp_list alc260_loopbacks[] = {
7099 { 0x07, HDA_INPUT, 0 }, 7368 { 0x07, HDA_INPUT, 0 },
7100 { 0x07, HDA_INPUT, 1 }, 7369 { 0x07, HDA_INPUT, 1 },
7101 { 0x07, HDA_INPUT, 2 }, 7370 { 0x07, HDA_INPUT, 2 },
@@ -7122,7 +7391,7 @@ static const struct alc_fixup alc260_fixups[] = {
7122 }, 7391 },
7123}; 7392};
7124 7393
7125static struct snd_pci_quirk alc260_fixup_tbl[] = { 7394static const struct snd_pci_quirk alc260_fixup_tbl[] = {
7126 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750), 7395 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750),
7127 {} 7396 {}
7128}; 7397};
@@ -7146,7 +7415,7 @@ static const char * const alc260_models[ALC260_MODEL_LAST] = {
7146 [ALC260_AUTO] = "auto", 7415 [ALC260_AUTO] = "auto",
7147}; 7416};
7148 7417
7149static struct snd_pci_quirk alc260_cfg_tbl[] = { 7418static const struct snd_pci_quirk alc260_cfg_tbl[] = {
7150 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), 7419 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
7151 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), 7420 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
7152 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), 7421 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
@@ -7170,7 +7439,7 @@ static struct snd_pci_quirk alc260_cfg_tbl[] = {
7170 {} 7439 {}
7171}; 7440};
7172 7441
7173static struct alc_config_preset alc260_presets[] = { 7442static const struct alc_config_preset alc260_presets[] = {
7174 [ALC260_BASIC] = { 7443 [ALC260_BASIC] = {
7175 .mixers = { alc260_base_output_mixer, 7444 .mixers = { alc260_base_output_mixer,
7176 alc260_input_mixer }, 7445 alc260_input_mixer },
@@ -7195,8 +7464,9 @@ static struct alc_config_preset alc260_presets[] = {
7195 .num_channel_mode = ARRAY_SIZE(alc260_modes), 7464 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7196 .channel_mode = alc260_modes, 7465 .channel_mode = alc260_modes,
7197 .input_mux = &alc260_capture_source, 7466 .input_mux = &alc260_capture_source,
7198 .unsol_event = alc260_hp_unsol_event, 7467 .unsol_event = alc_sku_unsol_event,
7199 .init_hook = alc260_hp_automute, 7468 .setup = alc260_hp_setup,
7469 .init_hook = alc_inithook,
7200 }, 7470 },
7201 [ALC260_HP_DC7600] = { 7471 [ALC260_HP_DC7600] = {
7202 .mixers = { alc260_hp_dc7600_mixer, 7472 .mixers = { alc260_hp_dc7600_mixer,
@@ -7210,8 +7480,9 @@ static struct alc_config_preset alc260_presets[] = {
7210 .num_channel_mode = ARRAY_SIZE(alc260_modes), 7480 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7211 .channel_mode = alc260_modes, 7481 .channel_mode = alc260_modes,
7212 .input_mux = &alc260_capture_source, 7482 .input_mux = &alc260_capture_source,
7213 .unsol_event = alc260_hp_3012_unsol_event, 7483 .unsol_event = alc_sku_unsol_event,
7214 .init_hook = alc260_hp_3012_automute, 7484 .setup = alc260_hp_3012_setup,
7485 .init_hook = alc_inithook,
7215 }, 7486 },
7216 [ALC260_HP_3013] = { 7487 [ALC260_HP_3013] = {
7217 .mixers = { alc260_hp_3013_mixer, 7488 .mixers = { alc260_hp_3013_mixer,
@@ -7225,8 +7496,9 @@ static struct alc_config_preset alc260_presets[] = {
7225 .num_channel_mode = ARRAY_SIZE(alc260_modes), 7496 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7226 .channel_mode = alc260_modes, 7497 .channel_mode = alc260_modes,
7227 .input_mux = &alc260_capture_source, 7498 .input_mux = &alc260_capture_source,
7228 .unsol_event = alc260_hp_3013_unsol_event, 7499 .unsol_event = alc_sku_unsol_event,
7229 .init_hook = alc260_hp_3013_automute, 7500 .setup = alc260_hp_3013_setup,
7501 .init_hook = alc_inithook,
7230 }, 7502 },
7231 [ALC260_FUJITSU_S702X] = { 7503 [ALC260_FUJITSU_S702X] = {
7232 .mixers = { alc260_fujitsu_mixer }, 7504 .mixers = { alc260_fujitsu_mixer },
@@ -7384,6 +7656,7 @@ static int patch_alc260(struct hda_codec *codec)
7384 codec->patch_ops = alc_patch_ops; 7656 codec->patch_ops = alc_patch_ops;
7385 if (board_config == ALC260_AUTO) 7657 if (board_config == ALC260_AUTO)
7386 spec->init_hook = alc260_auto_init; 7658 spec->init_hook = alc260_auto_init;
7659 spec->shutup = alc_eapd_shutup;
7387#ifdef CONFIG_SND_HDA_POWER_SAVE 7660#ifdef CONFIG_SND_HDA_POWER_SAVE
7388 if (!spec->loopback.amplist) 7661 if (!spec->loopback.amplist)
7389 spec->loopback.amplist = alc260_loopbacks; 7662 spec->loopback.amplist = alc260_loopbacks;
@@ -7411,12 +7684,12 @@ static int patch_alc260(struct hda_codec *codec)
7411#define ALC1200_DIGOUT_NID 0x10 7684#define ALC1200_DIGOUT_NID 0x10
7412 7685
7413 7686
7414static struct hda_channel_mode alc882_ch_modes[1] = { 7687static const struct hda_channel_mode alc882_ch_modes[1] = {
7415 { 8, NULL } 7688 { 8, NULL }
7416}; 7689};
7417 7690
7418/* DACs */ 7691/* DACs */
7419static hda_nid_t alc882_dac_nids[4] = { 7692static const hda_nid_t alc882_dac_nids[4] = {
7420 /* front, rear, clfe, rear_surr */ 7693 /* front, rear, clfe, rear_surr */
7421 0x02, 0x03, 0x04, 0x05 7694 0x02, 0x03, 0x04, 0x05
7422}; 7695};
@@ -7426,20 +7699,20 @@ static hda_nid_t alc882_dac_nids[4] = {
7426#define alc882_adc_nids alc880_adc_nids 7699#define alc882_adc_nids alc880_adc_nids
7427#define alc882_adc_nids_alt alc880_adc_nids_alt 7700#define alc882_adc_nids_alt alc880_adc_nids_alt
7428#define alc883_adc_nids alc882_adc_nids_alt 7701#define alc883_adc_nids alc882_adc_nids_alt
7429static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; 7702static const hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
7430static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; 7703static const hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
7431#define alc889_adc_nids alc880_adc_nids 7704#define alc889_adc_nids alc880_adc_nids
7432 7705
7433static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; 7706static const hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
7434static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; 7707static const hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
7435#define alc883_capsrc_nids alc882_capsrc_nids_alt 7708#define alc883_capsrc_nids alc882_capsrc_nids_alt
7436static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; 7709static const hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7437#define alc889_capsrc_nids alc882_capsrc_nids 7710#define alc889_capsrc_nids alc882_capsrc_nids
7438 7711
7439/* input MUX */ 7712/* input MUX */
7440/* FIXME: should be a matrix-type input source selection */ 7713/* FIXME: should be a matrix-type input source selection */
7441 7714
7442static struct hda_input_mux alc882_capture_source = { 7715static const struct hda_input_mux alc882_capture_source = {
7443 .num_items = 4, 7716 .num_items = 4,
7444 .items = { 7717 .items = {
7445 { "Mic", 0x0 }, 7718 { "Mic", 0x0 },
@@ -7451,7 +7724,7 @@ static struct hda_input_mux alc882_capture_source = {
7451 7724
7452#define alc883_capture_source alc882_capture_source 7725#define alc883_capture_source alc882_capture_source
7453 7726
7454static struct hda_input_mux alc889_capture_source = { 7727static const struct hda_input_mux alc889_capture_source = {
7455 .num_items = 3, 7728 .num_items = 3,
7456 .items = { 7729 .items = {
7457 { "Front Mic", 0x0 }, 7730 { "Front Mic", 0x0 },
@@ -7460,7 +7733,7 @@ static struct hda_input_mux alc889_capture_source = {
7460 }, 7733 },
7461}; 7734};
7462 7735
7463static struct hda_input_mux mb5_capture_source = { 7736static const struct hda_input_mux mb5_capture_source = {
7464 .num_items = 3, 7737 .num_items = 3,
7465 .items = { 7738 .items = {
7466 { "Mic", 0x1 }, 7739 { "Mic", 0x1 },
@@ -7469,7 +7742,7 @@ static struct hda_input_mux mb5_capture_source = {
7469 }, 7742 },
7470}; 7743};
7471 7744
7472static struct hda_input_mux macmini3_capture_source = { 7745static const struct hda_input_mux macmini3_capture_source = {
7473 .num_items = 2, 7746 .num_items = 2,
7474 .items = { 7747 .items = {
7475 { "Line", 0x2 }, 7748 { "Line", 0x2 },
@@ -7477,7 +7750,7 @@ static struct hda_input_mux macmini3_capture_source = {
7477 }, 7750 },
7478}; 7751};
7479 7752
7480static struct hda_input_mux alc883_3stack_6ch_intel = { 7753static const struct hda_input_mux alc883_3stack_6ch_intel = {
7481 .num_items = 4, 7754 .num_items = 4,
7482 .items = { 7755 .items = {
7483 { "Mic", 0x1 }, 7756 { "Mic", 0x1 },
@@ -7487,7 +7760,7 @@ static struct hda_input_mux alc883_3stack_6ch_intel = {
7487 }, 7760 },
7488}; 7761};
7489 7762
7490static struct hda_input_mux alc883_lenovo_101e_capture_source = { 7763static const struct hda_input_mux alc883_lenovo_101e_capture_source = {
7491 .num_items = 2, 7764 .num_items = 2,
7492 .items = { 7765 .items = {
7493 { "Mic", 0x1 }, 7766 { "Mic", 0x1 },
@@ -7495,7 +7768,7 @@ static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7495 }, 7768 },
7496}; 7769};
7497 7770
7498static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { 7771static const struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7499 .num_items = 4, 7772 .num_items = 4,
7500 .items = { 7773 .items = {
7501 { "Mic", 0x0 }, 7774 { "Mic", 0x0 },
@@ -7505,7 +7778,7 @@ static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7505 }, 7778 },
7506}; 7779};
7507 7780
7508static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { 7781static const struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7509 .num_items = 2, 7782 .num_items = 2,
7510 .items = { 7783 .items = {
7511 { "Mic", 0x0 }, 7784 { "Mic", 0x0 },
@@ -7513,7 +7786,7 @@ static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7513 }, 7786 },
7514}; 7787};
7515 7788
7516static struct hda_input_mux alc883_lenovo_sky_capture_source = { 7789static const struct hda_input_mux alc883_lenovo_sky_capture_source = {
7517 .num_items = 3, 7790 .num_items = 3,
7518 .items = { 7791 .items = {
7519 { "Mic", 0x0 }, 7792 { "Mic", 0x0 },
@@ -7522,7 +7795,7 @@ static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7522 }, 7795 },
7523}; 7796};
7524 7797
7525static struct hda_input_mux alc883_asus_eee1601_capture_source = { 7798static const struct hda_input_mux alc883_asus_eee1601_capture_source = {
7526 .num_items = 2, 7799 .num_items = 2,
7527 .items = { 7800 .items = {
7528 { "Mic", 0x0 }, 7801 { "Mic", 0x0 },
@@ -7530,7 +7803,7 @@ static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7530 }, 7803 },
7531}; 7804};
7532 7805
7533static struct hda_input_mux alc889A_mb31_capture_source = { 7806static const struct hda_input_mux alc889A_mb31_capture_source = {
7534 .num_items = 2, 7807 .num_items = 2,
7535 .items = { 7808 .items = {
7536 { "Mic", 0x0 }, 7809 { "Mic", 0x0 },
@@ -7541,7 +7814,7 @@ static struct hda_input_mux alc889A_mb31_capture_source = {
7541 }, 7814 },
7542}; 7815};
7543 7816
7544static struct hda_input_mux alc889A_imac91_capture_source = { 7817static const struct hda_input_mux alc889A_imac91_capture_source = {
7545 .num_items = 2, 7818 .num_items = 2,
7546 .items = { 7819 .items = {
7547 { "Mic", 0x01 }, 7820 { "Mic", 0x01 },
@@ -7552,14 +7825,14 @@ static struct hda_input_mux alc889A_imac91_capture_source = {
7552/* 7825/*
7553 * 2ch mode 7826 * 2ch mode
7554 */ 7827 */
7555static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { 7828static const struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7556 { 2, NULL } 7829 { 2, NULL }
7557}; 7830};
7558 7831
7559/* 7832/*
7560 * 2ch mode 7833 * 2ch mode
7561 */ 7834 */
7562static struct hda_verb alc882_3ST_ch2_init[] = { 7835static const struct hda_verb alc882_3ST_ch2_init[] = {
7563 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, 7836 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7564 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, 7837 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7565 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, 7838 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
@@ -7570,7 +7843,7 @@ static struct hda_verb alc882_3ST_ch2_init[] = {
7570/* 7843/*
7571 * 4ch mode 7844 * 4ch mode
7572 */ 7845 */
7573static struct hda_verb alc882_3ST_ch4_init[] = { 7846static const struct hda_verb alc882_3ST_ch4_init[] = {
7574 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, 7847 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7575 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, 7848 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7576 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 7849 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
@@ -7582,7 +7855,7 @@ static struct hda_verb alc882_3ST_ch4_init[] = {
7582/* 7855/*
7583 * 6ch mode 7856 * 6ch mode
7584 */ 7857 */
7585static struct hda_verb alc882_3ST_ch6_init[] = { 7858static const struct hda_verb alc882_3ST_ch6_init[] = {
7586 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 7859 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7587 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, 7860 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7588 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, 7861 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
@@ -7592,7 +7865,7 @@ static struct hda_verb alc882_3ST_ch6_init[] = {
7592 { } /* end */ 7865 { } /* end */
7593}; 7866};
7594 7867
7595static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { 7868static const struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
7596 { 2, alc882_3ST_ch2_init }, 7869 { 2, alc882_3ST_ch2_init },
7597 { 4, alc882_3ST_ch4_init }, 7870 { 4, alc882_3ST_ch4_init },
7598 { 6, alc882_3ST_ch6_init }, 7871 { 6, alc882_3ST_ch6_init },
@@ -7603,7 +7876,7 @@ static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
7603/* 7876/*
7604 * 2ch mode 7877 * 2ch mode
7605 */ 7878 */
7606static struct hda_verb alc883_3ST_ch2_clevo_init[] = { 7879static const struct hda_verb alc883_3ST_ch2_clevo_init[] = {
7607 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, 7880 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
7608 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, 7881 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7609 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, 7882 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
@@ -7615,7 +7888,7 @@ static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
7615/* 7888/*
7616 * 4ch mode 7889 * 4ch mode
7617 */ 7890 */
7618static struct hda_verb alc883_3ST_ch4_clevo_init[] = { 7891static const struct hda_verb alc883_3ST_ch4_clevo_init[] = {
7619 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 7892 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7620 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, 7893 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7621 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, 7894 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
@@ -7628,7 +7901,7 @@ static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
7628/* 7901/*
7629 * 6ch mode 7902 * 6ch mode
7630 */ 7903 */
7631static struct hda_verb alc883_3ST_ch6_clevo_init[] = { 7904static const struct hda_verb alc883_3ST_ch6_clevo_init[] = {
7632 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 7905 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7633 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 7906 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7634 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, 7907 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
@@ -7639,7 +7912,7 @@ static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
7639 { } /* end */ 7912 { } /* end */
7640}; 7913};
7641 7914
7642static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { 7915static const struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
7643 { 2, alc883_3ST_ch2_clevo_init }, 7916 { 2, alc883_3ST_ch2_clevo_init },
7644 { 4, alc883_3ST_ch4_clevo_init }, 7917 { 4, alc883_3ST_ch4_clevo_init },
7645 { 6, alc883_3ST_ch6_clevo_init }, 7918 { 6, alc883_3ST_ch6_clevo_init },
@@ -7649,7 +7922,7 @@ static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
7649/* 7922/*
7650 * 6ch mode 7923 * 6ch mode
7651 */ 7924 */
7652static struct hda_verb alc882_sixstack_ch6_init[] = { 7925static const struct hda_verb alc882_sixstack_ch6_init[] = {
7653 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, 7926 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7654 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 7927 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7655 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 7928 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
@@ -7660,7 +7933,7 @@ static struct hda_verb alc882_sixstack_ch6_init[] = {
7660/* 7933/*
7661 * 8ch mode 7934 * 8ch mode
7662 */ 7935 */
7663static struct hda_verb alc882_sixstack_ch8_init[] = { 7936static const struct hda_verb alc882_sixstack_ch8_init[] = {
7664 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 7937 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7665 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 7938 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7666 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 7939 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
@@ -7668,7 +7941,7 @@ static struct hda_verb alc882_sixstack_ch8_init[] = {
7668 { } /* end */ 7941 { } /* end */
7669}; 7942};
7670 7943
7671static struct hda_channel_mode alc882_sixstack_modes[2] = { 7944static const struct hda_channel_mode alc882_sixstack_modes[2] = {
7672 { 6, alc882_sixstack_ch6_init }, 7945 { 6, alc882_sixstack_ch6_init },
7673 { 8, alc882_sixstack_ch8_init }, 7946 { 8, alc882_sixstack_ch8_init },
7674}; 7947};
@@ -7676,7 +7949,7 @@ static struct hda_channel_mode alc882_sixstack_modes[2] = {
7676 7949
7677/* Macbook Air 2,1 */ 7950/* Macbook Air 2,1 */
7678 7951
7679static struct hda_channel_mode alc885_mba21_ch_modes[1] = { 7952static const struct hda_channel_mode alc885_mba21_ch_modes[1] = {
7680 { 2, NULL }, 7953 { 2, NULL },
7681}; 7954};
7682 7955
@@ -7687,7 +7960,7 @@ static struct hda_channel_mode alc885_mba21_ch_modes[1] = {
7687/* 7960/*
7688 * 2ch mode 7961 * 2ch mode
7689 */ 7962 */
7690static struct hda_verb alc885_mbp_ch2_init[] = { 7963static const struct hda_verb alc885_mbp_ch2_init[] = {
7691 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, 7964 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7692 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 7965 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7693 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 7966 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
@@ -7697,7 +7970,7 @@ static struct hda_verb alc885_mbp_ch2_init[] = {
7697/* 7970/*
7698 * 4ch mode 7971 * 4ch mode
7699 */ 7972 */
7700static struct hda_verb alc885_mbp_ch4_init[] = { 7973static const struct hda_verb alc885_mbp_ch4_init[] = {
7701 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 7974 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7702 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 7975 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7703 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, 7976 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
@@ -7706,7 +7979,7 @@ static struct hda_verb alc885_mbp_ch4_init[] = {
7706 { } /* end */ 7979 { } /* end */
7707}; 7980};
7708 7981
7709static struct hda_channel_mode alc885_mbp_4ch_modes[2] = { 7982static const struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
7710 { 2, alc885_mbp_ch2_init }, 7983 { 2, alc885_mbp_ch2_init },
7711 { 4, alc885_mbp_ch4_init }, 7984 { 4, alc885_mbp_ch4_init },
7712}; 7985};
@@ -7716,7 +7989,7 @@ static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
7716 * Speakers/Woofer/HP = Front 7989 * Speakers/Woofer/HP = Front
7717 * LineIn = Input 7990 * LineIn = Input
7718 */ 7991 */
7719static struct hda_verb alc885_mb5_ch2_init[] = { 7992static const struct hda_verb alc885_mb5_ch2_init[] = {
7720 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 7993 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7721 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 7994 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7722 { } /* end */ 7995 { } /* end */
@@ -7728,14 +8001,14 @@ static struct hda_verb alc885_mb5_ch2_init[] = {
7728 * Woofer = LFE 8001 * Woofer = LFE
7729 * LineIn = Surround 8002 * LineIn = Surround
7730 */ 8003 */
7731static struct hda_verb alc885_mb5_ch6_init[] = { 8004static const struct hda_verb alc885_mb5_ch6_init[] = {
7732 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 8005 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7733 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 8006 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7734 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, 8007 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7735 { } /* end */ 8008 { } /* end */
7736}; 8009};
7737 8010
7738static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { 8011static const struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
7739 { 2, alc885_mb5_ch2_init }, 8012 { 2, alc885_mb5_ch2_init },
7740 { 6, alc885_mb5_ch6_init }, 8013 { 6, alc885_mb5_ch6_init },
7741}; 8014};
@@ -7745,7 +8018,7 @@ static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
7745/* 8018/*
7746 * 2ch mode 8019 * 2ch mode
7747 */ 8020 */
7748static struct hda_verb alc883_4ST_ch2_init[] = { 8021static const struct hda_verb alc883_4ST_ch2_init[] = {
7749 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 8022 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7750 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, 8023 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7751 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, 8024 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
@@ -7758,7 +8031,7 @@ static struct hda_verb alc883_4ST_ch2_init[] = {
7758/* 8031/*
7759 * 4ch mode 8032 * 4ch mode
7760 */ 8033 */
7761static struct hda_verb alc883_4ST_ch4_init[] = { 8034static const struct hda_verb alc883_4ST_ch4_init[] = {
7762 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 8035 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7763 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, 8036 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7764 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, 8037 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
@@ -7772,7 +8045,7 @@ static struct hda_verb alc883_4ST_ch4_init[] = {
7772/* 8045/*
7773 * 6ch mode 8046 * 6ch mode
7774 */ 8047 */
7775static struct hda_verb alc883_4ST_ch6_init[] = { 8048static const struct hda_verb alc883_4ST_ch6_init[] = {
7776 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 8049 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7777 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, 8050 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7778 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 8051 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
@@ -7787,7 +8060,7 @@ static struct hda_verb alc883_4ST_ch6_init[] = {
7787/* 8060/*
7788 * 8ch mode 8061 * 8ch mode
7789 */ 8062 */
7790static struct hda_verb alc883_4ST_ch8_init[] = { 8063static const struct hda_verb alc883_4ST_ch8_init[] = {
7791 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 8064 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7792 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, 8065 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7793 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, 8066 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
@@ -7800,7 +8073,7 @@ static struct hda_verb alc883_4ST_ch8_init[] = {
7800 { } /* end */ 8073 { } /* end */
7801}; 8074};
7802 8075
7803static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { 8076static const struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7804 { 2, alc883_4ST_ch2_init }, 8077 { 2, alc883_4ST_ch2_init },
7805 { 4, alc883_4ST_ch4_init }, 8078 { 4, alc883_4ST_ch4_init },
7806 { 6, alc883_4ST_ch6_init }, 8079 { 6, alc883_4ST_ch6_init },
@@ -7811,7 +8084,7 @@ static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7811/* 8084/*
7812 * 2ch mode 8085 * 2ch mode
7813 */ 8086 */
7814static struct hda_verb alc883_3ST_ch2_intel_init[] = { 8087static const struct hda_verb alc883_3ST_ch2_intel_init[] = {
7815 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, 8088 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7816 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, 8089 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7817 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, 8090 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
@@ -7822,7 +8095,7 @@ static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7822/* 8095/*
7823 * 4ch mode 8096 * 4ch mode
7824 */ 8097 */
7825static struct hda_verb alc883_3ST_ch4_intel_init[] = { 8098static const struct hda_verb alc883_3ST_ch4_intel_init[] = {
7826 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, 8099 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7827 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, 8100 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7828 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 8101 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
@@ -7834,7 +8107,7 @@ static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7834/* 8107/*
7835 * 6ch mode 8108 * 6ch mode
7836 */ 8109 */
7837static struct hda_verb alc883_3ST_ch6_intel_init[] = { 8110static const struct hda_verb alc883_3ST_ch6_intel_init[] = {
7838 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 8111 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7839 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, 8112 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7840 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, 8113 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
@@ -7844,7 +8117,7 @@ static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7844 { } /* end */ 8117 { } /* end */
7845}; 8118};
7846 8119
7847static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { 8120static const struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7848 { 2, alc883_3ST_ch2_intel_init }, 8121 { 2, alc883_3ST_ch2_intel_init },
7849 { 4, alc883_3ST_ch4_intel_init }, 8122 { 4, alc883_3ST_ch4_intel_init },
7850 { 6, alc883_3ST_ch6_intel_init }, 8123 { 6, alc883_3ST_ch6_intel_init },
@@ -7853,7 +8126,7 @@ static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7853/* 8126/*
7854 * 2ch mode 8127 * 2ch mode
7855 */ 8128 */
7856static struct hda_verb alc889_ch2_intel_init[] = { 8129static const struct hda_verb alc889_ch2_intel_init[] = {
7857 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, 8130 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7858 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, 8131 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7859 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, 8132 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
@@ -7866,7 +8139,7 @@ static struct hda_verb alc889_ch2_intel_init[] = {
7866/* 8139/*
7867 * 6ch mode 8140 * 6ch mode
7868 */ 8141 */
7869static struct hda_verb alc889_ch6_intel_init[] = { 8142static const struct hda_verb alc889_ch6_intel_init[] = {
7870 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, 8143 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7871 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, 8144 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7872 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, 8145 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
@@ -7879,7 +8152,7 @@ static struct hda_verb alc889_ch6_intel_init[] = {
7879/* 8152/*
7880 * 8ch mode 8153 * 8ch mode
7881 */ 8154 */
7882static struct hda_verb alc889_ch8_intel_init[] = { 8155static const struct hda_verb alc889_ch8_intel_init[] = {
7883 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, 8156 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7884 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, 8157 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7885 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, 8158 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
@@ -7890,7 +8163,7 @@ static struct hda_verb alc889_ch8_intel_init[] = {
7890 { } /* end */ 8163 { } /* end */
7891}; 8164};
7892 8165
7893static struct hda_channel_mode alc889_8ch_intel_modes[3] = { 8166static const struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7894 { 2, alc889_ch2_intel_init }, 8167 { 2, alc889_ch2_intel_init },
7895 { 6, alc889_ch6_intel_init }, 8168 { 6, alc889_ch6_intel_init },
7896 { 8, alc889_ch8_intel_init }, 8169 { 8, alc889_ch8_intel_init },
@@ -7899,7 +8172,7 @@ static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7899/* 8172/*
7900 * 6ch mode 8173 * 6ch mode
7901 */ 8174 */
7902static struct hda_verb alc883_sixstack_ch6_init[] = { 8175static const struct hda_verb alc883_sixstack_ch6_init[] = {
7903 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, 8176 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7904 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 8177 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7905 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 8178 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
@@ -7910,7 +8183,7 @@ static struct hda_verb alc883_sixstack_ch6_init[] = {
7910/* 8183/*
7911 * 8ch mode 8184 * 8ch mode
7912 */ 8185 */
7913static struct hda_verb alc883_sixstack_ch8_init[] = { 8186static const struct hda_verb alc883_sixstack_ch8_init[] = {
7914 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 8187 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7915 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 8188 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7916 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 8189 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
@@ -7918,7 +8191,7 @@ static struct hda_verb alc883_sixstack_ch8_init[] = {
7918 { } /* end */ 8191 { } /* end */
7919}; 8192};
7920 8193
7921static struct hda_channel_mode alc883_sixstack_modes[2] = { 8194static const struct hda_channel_mode alc883_sixstack_modes[2] = {
7922 { 6, alc883_sixstack_ch6_init }, 8195 { 6, alc883_sixstack_ch6_init },
7923 { 8, alc883_sixstack_ch8_init }, 8196 { 8, alc883_sixstack_ch8_init },
7924}; 8197};
@@ -7927,7 +8200,7 @@ static struct hda_channel_mode alc883_sixstack_modes[2] = {
7927/* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 8200/* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7928 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b 8201 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7929 */ 8202 */
7930static struct snd_kcontrol_new alc882_base_mixer[] = { 8203static const struct snd_kcontrol_new alc882_base_mixer[] = {
7931 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 8204 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7932 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 8205 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7933 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 8206 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
@@ -7954,14 +8227,14 @@ static struct snd_kcontrol_new alc882_base_mixer[] = {
7954 8227
7955/* Macbook Air 2,1 same control for HP and internal Speaker */ 8228/* Macbook Air 2,1 same control for HP and internal Speaker */
7956 8229
7957static struct snd_kcontrol_new alc885_mba21_mixer[] = { 8230static const struct snd_kcontrol_new alc885_mba21_mixer[] = {
7958 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), 8231 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7959 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT), 8232 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
7960 { } 8233 { }
7961}; 8234};
7962 8235
7963 8236
7964static struct snd_kcontrol_new alc885_mbp3_mixer[] = { 8237static const struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7965 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), 8238 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7966 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), 8239 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7967 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), 8240 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
@@ -7976,7 +8249,7 @@ static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7976 { } /* end */ 8249 { } /* end */
7977}; 8250};
7978 8251
7979static struct snd_kcontrol_new alc885_mb5_mixer[] = { 8252static const struct snd_kcontrol_new alc885_mb5_mixer[] = {
7980 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), 8253 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7981 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), 8254 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7982 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), 8255 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
@@ -7994,7 +8267,7 @@ static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7994 { } /* end */ 8267 { } /* end */
7995}; 8268};
7996 8269
7997static struct snd_kcontrol_new alc885_macmini3_mixer[] = { 8270static const struct snd_kcontrol_new alc885_macmini3_mixer[] = {
7998 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), 8271 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7999 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), 8272 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8000 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), 8273 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
@@ -8009,14 +8282,14 @@ static struct snd_kcontrol_new alc885_macmini3_mixer[] = {
8009 { } /* end */ 8282 { } /* end */
8010}; 8283};
8011 8284
8012static struct snd_kcontrol_new alc885_imac91_mixer[] = { 8285static const struct snd_kcontrol_new alc885_imac91_mixer[] = {
8013 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), 8286 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8014 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), 8287 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
8015 { } /* end */ 8288 { } /* end */
8016}; 8289};
8017 8290
8018 8291
8019static struct snd_kcontrol_new alc882_w2jc_mixer[] = { 8292static const struct snd_kcontrol_new alc882_w2jc_mixer[] = {
8020 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 8293 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8021 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 8294 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8022 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 8295 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
@@ -8029,7 +8302,7 @@ static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
8029 { } /* end */ 8302 { } /* end */
8030}; 8303};
8031 8304
8032static struct snd_kcontrol_new alc882_targa_mixer[] = { 8305static const struct snd_kcontrol_new alc882_targa_mixer[] = {
8033 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 8306 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8034 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 8307 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8035 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 8308 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
@@ -8049,7 +8322,7 @@ static struct snd_kcontrol_new alc882_targa_mixer[] = {
8049/* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? 8322/* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
8050 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c 8323 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
8051 */ 8324 */
8052static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { 8325static const struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
8053 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 8326 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8054 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), 8327 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8055 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), 8328 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
@@ -8066,7 +8339,7 @@ static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
8066 { } /* end */ 8339 { } /* end */
8067}; 8340};
8068 8341
8069static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { 8342static const struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
8070 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 8343 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8071 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 8344 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8072 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), 8345 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
@@ -8080,7 +8353,7 @@ static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
8080 { } /* end */ 8353 { } /* end */
8081}; 8354};
8082 8355
8083static struct snd_kcontrol_new alc882_chmode_mixer[] = { 8356static const struct snd_kcontrol_new alc882_chmode_mixer[] = {
8084 { 8357 {
8085 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 8358 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8086 .name = "Channel Mode", 8359 .name = "Channel Mode",
@@ -8091,7 +8364,7 @@ static struct snd_kcontrol_new alc882_chmode_mixer[] = {
8091 { } /* end */ 8364 { } /* end */
8092}; 8365};
8093 8366
8094static struct hda_verb alc882_base_init_verbs[] = { 8367static const struct hda_verb alc882_base_init_verbs[] = {
8095 /* Front mixer: unmute input/output amp left and right (volume = 0) */ 8368 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8096 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 8369 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8097 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 8370 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
@@ -8153,7 +8426,7 @@ static struct hda_verb alc882_base_init_verbs[] = {
8153 { } 8426 { }
8154}; 8427};
8155 8428
8156static struct hda_verb alc882_adc1_init_verbs[] = { 8429static const struct hda_verb alc882_adc1_init_verbs[] = {
8157 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ 8430 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8158 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 8431 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8159 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, 8432 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
@@ -8165,26 +8438,26 @@ static struct hda_verb alc882_adc1_init_verbs[] = {
8165 { } 8438 { }
8166}; 8439};
8167 8440
8168static struct hda_verb alc882_eapd_verbs[] = { 8441static const struct hda_verb alc882_eapd_verbs[] = {
8169 /* change to EAPD mode */ 8442 /* change to EAPD mode */
8170 {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, 8443 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8171 {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, 8444 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
8172 { } 8445 { }
8173}; 8446};
8174 8447
8175static struct hda_verb alc889_eapd_verbs[] = { 8448static const struct hda_verb alc889_eapd_verbs[] = {
8176 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, 8449 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
8177 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, 8450 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
8178 { } 8451 { }
8179}; 8452};
8180 8453
8181static struct hda_verb alc_hp15_unsol_verbs[] = { 8454static const struct hda_verb alc_hp15_unsol_verbs[] = {
8182 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, 8455 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8183 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 8456 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8184 {} 8457 {}
8185}; 8458};
8186 8459
8187static struct hda_verb alc885_init_verbs[] = { 8460static const struct hda_verb alc885_init_verbs[] = {
8188 /* Front mixer: unmute input/output amp left and right (volume = 0) */ 8461 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8189 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 8462 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8190 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 8463 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
@@ -8243,7 +8516,7 @@ static struct hda_verb alc885_init_verbs[] = {
8243 { } 8516 { }
8244}; 8517};
8245 8518
8246static struct hda_verb alc885_init_input_verbs[] = { 8519static const struct hda_verb alc885_init_input_verbs[] = {
8247 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 8520 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8248 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 8521 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8249 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, 8522 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
@@ -8252,7 +8525,7 @@ static struct hda_verb alc885_init_input_verbs[] = {
8252 8525
8253 8526
8254/* Unmute Selector 24h and set the default input to front mic */ 8527/* Unmute Selector 24h and set the default input to front mic */
8255static struct hda_verb alc889_init_input_verbs[] = { 8528static const struct hda_verb alc889_init_input_verbs[] = {
8256 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, 8529 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
8257 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 8530 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8258 { } 8531 { }
@@ -8262,7 +8535,7 @@ static struct hda_verb alc889_init_input_verbs[] = {
8262#define alc883_init_verbs alc882_base_init_verbs 8535#define alc883_init_verbs alc882_base_init_verbs
8263 8536
8264/* Mac Pro test */ 8537/* Mac Pro test */
8265static struct snd_kcontrol_new alc882_macpro_mixer[] = { 8538static const struct snd_kcontrol_new alc882_macpro_mixer[] = {
8266 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 8539 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8267 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 8540 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8268 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), 8541 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
@@ -8275,7 +8548,7 @@ static struct snd_kcontrol_new alc882_macpro_mixer[] = {
8275 { } /* end */ 8548 { } /* end */
8276}; 8549};
8277 8550
8278static struct hda_verb alc882_macpro_init_verbs[] = { 8551static const struct hda_verb alc882_macpro_init_verbs[] = {
8279 /* Front mixer: unmute input/output amp left and right (volume = 0) */ 8552 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8280 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 8553 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8281 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 8554 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
@@ -8327,7 +8600,7 @@ static struct hda_verb alc882_macpro_init_verbs[] = {
8327}; 8600};
8328 8601
8329/* Macbook 5,1 */ 8602/* Macbook 5,1 */
8330static struct hda_verb alc885_mb5_init_verbs[] = { 8603static const struct hda_verb alc885_mb5_init_verbs[] = {
8331 /* DACs */ 8604 /* DACs */
8332 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 8605 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8333 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 8606 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
@@ -8376,7 +8649,7 @@ static struct hda_verb alc885_mb5_init_verbs[] = {
8376}; 8649};
8377 8650
8378/* Macmini 3,1 */ 8651/* Macmini 3,1 */
8379static struct hda_verb alc885_macmini3_init_verbs[] = { 8652static const struct hda_verb alc885_macmini3_init_verbs[] = {
8380 /* DACs */ 8653 /* DACs */
8381 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 8654 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8382 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 8655 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
@@ -8423,7 +8696,7 @@ static struct hda_verb alc885_macmini3_init_verbs[] = {
8423}; 8696};
8424 8697
8425 8698
8426static struct hda_verb alc885_mba21_init_verbs[] = { 8699static const struct hda_verb alc885_mba21_init_verbs[] = {
8427 /*Internal and HP Speaker Mixer*/ 8700 /*Internal and HP Speaker Mixer*/
8428 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 8701 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8429 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 8702 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
@@ -8446,7 +8719,7 @@ static struct hda_verb alc885_mba21_init_verbs[] = {
8446 8719
8447 8720
8448/* Macbook Pro rev3 */ 8721/* Macbook Pro rev3 */
8449static struct hda_verb alc885_mbp3_init_verbs[] = { 8722static const struct hda_verb alc885_mbp3_init_verbs[] = {
8450 /* Front mixer: unmute input/output amp left and right (volume = 0) */ 8723 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8451 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 8724 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8452 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 8725 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
@@ -8510,7 +8783,7 @@ static struct hda_verb alc885_mbp3_init_verbs[] = {
8510}; 8783};
8511 8784
8512/* iMac 9,1 */ 8785/* iMac 9,1 */
8513static struct hda_verb alc885_imac91_init_verbs[] = { 8786static const struct hda_verb alc885_imac91_init_verbs[] = {
8514 /* Internal Speaker Pin (0x0c) */ 8787 /* Internal Speaker Pin (0x0c) */
8515 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, 8788 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8516 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 8789 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
@@ -8565,14 +8838,14 @@ static struct hda_verb alc885_imac91_init_verbs[] = {
8565}; 8838};
8566 8839
8567/* iMac 24 mixer. */ 8840/* iMac 24 mixer. */
8568static struct snd_kcontrol_new alc885_imac24_mixer[] = { 8841static const struct snd_kcontrol_new alc885_imac24_mixer[] = {
8569 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), 8842 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8570 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), 8843 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
8571 { } /* end */ 8844 { } /* end */
8572}; 8845};
8573 8846
8574/* iMac 24 init verbs. */ 8847/* iMac 24 init verbs. */
8575static struct hda_verb alc885_imac24_init_verbs[] = { 8848static const struct hda_verb alc885_imac24_init_verbs[] = {
8576 /* Internal speakers: output 0 (0x0c) */ 8849 /* Internal speakers: output 0 (0x0c) */
8577 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 8850 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8578 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 8851 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
@@ -8600,6 +8873,8 @@ static void alc885_imac24_setup(struct hda_codec *codec)
8600 spec->autocfg.hp_pins[0] = 0x14; 8873 spec->autocfg.hp_pins[0] = 0x14;
8601 spec->autocfg.speaker_pins[0] = 0x18; 8874 spec->autocfg.speaker_pins[0] = 0x18;
8602 spec->autocfg.speaker_pins[1] = 0x1a; 8875 spec->autocfg.speaker_pins[1] = 0x1a;
8876 spec->automute = 1;
8877 spec->automute_mode = ALC_AUTOMUTE_AMP;
8603} 8878}
8604 8879
8605#define alc885_mb5_setup alc885_imac24_setup 8880#define alc885_mb5_setup alc885_imac24_setup
@@ -8612,6 +8887,8 @@ static void alc885_mba21_setup(struct hda_codec *codec)
8612 8887
8613 spec->autocfg.hp_pins[0] = 0x14; 8888 spec->autocfg.hp_pins[0] = 0x14;
8614 spec->autocfg.speaker_pins[0] = 0x18; 8889 spec->autocfg.speaker_pins[0] = 0x18;
8890 spec->automute = 1;
8891 spec->automute_mode = ALC_AUTOMUTE_AMP;
8615} 8892}
8616 8893
8617 8894
@@ -8622,6 +8899,8 @@ static void alc885_mbp3_setup(struct hda_codec *codec)
8622 8899
8623 spec->autocfg.hp_pins[0] = 0x15; 8900 spec->autocfg.hp_pins[0] = 0x15;
8624 spec->autocfg.speaker_pins[0] = 0x14; 8901 spec->autocfg.speaker_pins[0] = 0x14;
8902 spec->automute = 1;
8903 spec->automute_mode = ALC_AUTOMUTE_AMP;
8625} 8904}
8626 8905
8627static void alc885_imac91_setup(struct hda_codec *codec) 8906static void alc885_imac91_setup(struct hda_codec *codec)
@@ -8631,9 +8910,11 @@ static void alc885_imac91_setup(struct hda_codec *codec)
8631 spec->autocfg.hp_pins[0] = 0x14; 8910 spec->autocfg.hp_pins[0] = 0x14;
8632 spec->autocfg.speaker_pins[0] = 0x18; 8911 spec->autocfg.speaker_pins[0] = 0x18;
8633 spec->autocfg.speaker_pins[1] = 0x1a; 8912 spec->autocfg.speaker_pins[1] = 0x1a;
8913 spec->automute = 1;
8914 spec->automute_mode = ALC_AUTOMUTE_AMP;
8634} 8915}
8635 8916
8636static struct hda_verb alc882_targa_verbs[] = { 8917static const struct hda_verb alc882_targa_verbs[] = {
8637 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 8918 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8638 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 8919 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8639 8920
@@ -8652,7 +8933,7 @@ static struct hda_verb alc882_targa_verbs[] = {
8652static void alc882_targa_automute(struct hda_codec *codec) 8933static void alc882_targa_automute(struct hda_codec *codec)
8653{ 8934{
8654 struct alc_spec *spec = codec->spec; 8935 struct alc_spec *spec = codec->spec;
8655 alc_automute_amp(codec); 8936 alc_hp_automute(codec);
8656 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, 8937 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8657 spec->jack_present ? 1 : 3); 8938 spec->jack_present ? 1 : 3);
8658} 8939}
@@ -8663,6 +8944,8 @@ static void alc882_targa_setup(struct hda_codec *codec)
8663 8944
8664 spec->autocfg.hp_pins[0] = 0x14; 8945 spec->autocfg.hp_pins[0] = 0x14;
8665 spec->autocfg.speaker_pins[0] = 0x1b; 8946 spec->autocfg.speaker_pins[0] = 0x1b;
8947 spec->automute = 1;
8948 spec->automute_mode = ALC_AUTOMUTE_AMP;
8666} 8949}
8667 8950
8668static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) 8951static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
@@ -8671,7 +8954,7 @@ static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
8671 alc882_targa_automute(codec); 8954 alc882_targa_automute(codec);
8672} 8955}
8673 8956
8674static struct hda_verb alc882_asus_a7j_verbs[] = { 8957static const struct hda_verb alc882_asus_a7j_verbs[] = {
8675 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 8958 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8676 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 8959 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8677 8960
@@ -8689,7 +8972,7 @@ static struct hda_verb alc882_asus_a7j_verbs[] = {
8689 { } /* end */ 8972 { } /* end */
8690}; 8973};
8691 8974
8692static struct hda_verb alc882_asus_a7m_verbs[] = { 8975static const struct hda_verb alc882_asus_a7m_verbs[] = {
8693 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 8976 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8694 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 8977 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8695 8978
@@ -8750,13 +9033,13 @@ static void alc885_macpro_init_hook(struct hda_codec *codec)
8750static void alc885_imac24_init_hook(struct hda_codec *codec) 9033static void alc885_imac24_init_hook(struct hda_codec *codec)
8751{ 9034{
8752 alc885_macpro_init_hook(codec); 9035 alc885_macpro_init_hook(codec);
8753 alc_automute_amp(codec); 9036 alc_hp_automute(codec);
8754} 9037}
8755 9038
8756/* 9039/*
8757 * generic initialization of ADC, input mixers and output mixers 9040 * generic initialization of ADC, input mixers and output mixers
8758 */ 9041 */
8759static struct hda_verb alc883_auto_init_verbs[] = { 9042static const struct hda_verb alc883_auto_init_verbs[] = {
8760 /* 9043 /*
8761 * Unmute ADC0-2 and set the default input to mic-in 9044 * Unmute ADC0-2 and set the default input to mic-in
8762 */ 9045 */
@@ -8796,7 +9079,7 @@ static struct hda_verb alc883_auto_init_verbs[] = {
8796}; 9079};
8797 9080
8798/* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ 9081/* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8799static struct hda_verb alc889A_mb31_ch2_init[] = { 9082static const struct hda_verb alc889A_mb31_ch2_init[] = {
8800 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ 9083 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8801 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ 9084 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8802 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ 9085 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
@@ -8805,7 +9088,7 @@ static struct hda_verb alc889A_mb31_ch2_init[] = {
8805}; 9088};
8806 9089
8807/* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ 9090/* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8808static struct hda_verb alc889A_mb31_ch4_init[] = { 9091static const struct hda_verb alc889A_mb31_ch4_init[] = {
8809 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ 9092 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8810 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ 9093 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8811 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ 9094 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
@@ -8814,7 +9097,7 @@ static struct hda_verb alc889A_mb31_ch4_init[] = {
8814}; 9097};
8815 9098
8816/* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ 9099/* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8817static struct hda_verb alc889A_mb31_ch5_init[] = { 9100static const struct hda_verb alc889A_mb31_ch5_init[] = {
8818 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ 9101 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
8819 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ 9102 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8820 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ 9103 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
@@ -8823,7 +9106,7 @@ static struct hda_verb alc889A_mb31_ch5_init[] = {
8823}; 9106};
8824 9107
8825/* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ 9108/* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8826static struct hda_verb alc889A_mb31_ch6_init[] = { 9109static const struct hda_verb alc889A_mb31_ch6_init[] = {
8827 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ 9110 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8828 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ 9111 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8829 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ 9112 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
@@ -8831,14 +9114,14 @@ static struct hda_verb alc889A_mb31_ch6_init[] = {
8831 { } /* end */ 9114 { } /* end */
8832}; 9115};
8833 9116
8834static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { 9117static const struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8835 { 2, alc889A_mb31_ch2_init }, 9118 { 2, alc889A_mb31_ch2_init },
8836 { 4, alc889A_mb31_ch4_init }, 9119 { 4, alc889A_mb31_ch4_init },
8837 { 5, alc889A_mb31_ch5_init }, 9120 { 5, alc889A_mb31_ch5_init },
8838 { 6, alc889A_mb31_ch6_init }, 9121 { 6, alc889A_mb31_ch6_init },
8839}; 9122};
8840 9123
8841static struct hda_verb alc883_medion_eapd_verbs[] = { 9124static const struct hda_verb alc883_medion_eapd_verbs[] = {
8842 /* eanable EAPD on medion laptop */ 9125 /* eanable EAPD on medion laptop */
8843 {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, 9126 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8844 {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, 9127 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
@@ -8847,7 +9130,7 @@ static struct hda_verb alc883_medion_eapd_verbs[] = {
8847 9130
8848#define alc883_base_mixer alc882_base_mixer 9131#define alc883_base_mixer alc882_base_mixer
8849 9132
8850static struct snd_kcontrol_new alc883_mitac_mixer[] = { 9133static const struct snd_kcontrol_new alc883_mitac_mixer[] = {
8851 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 9134 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8852 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 9135 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8853 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), 9136 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
@@ -8864,7 +9147,7 @@ static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8864 { } /* end */ 9147 { } /* end */
8865}; 9148};
8866 9149
8867static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { 9150static const struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8868 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 9151 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8869 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), 9152 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8870 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 9153 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
@@ -8878,7 +9161,7 @@ static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8878 { } /* end */ 9161 { } /* end */
8879}; 9162};
8880 9163
8881static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { 9164static const struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8882 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 9165 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8883 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), 9166 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8884 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 9167 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
@@ -8892,7 +9175,7 @@ static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8892 { } /* end */ 9175 { } /* end */
8893}; 9176};
8894 9177
8895static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { 9178static const struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8896 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 9179 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8897 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 9180 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8898 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 9181 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
@@ -8909,7 +9192,7 @@ static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8909 { } /* end */ 9192 { } /* end */
8910}; 9193};
8911 9194
8912static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { 9195static const struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8913 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 9196 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8914 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 9197 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8915 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 9198 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
@@ -8932,7 +9215,7 @@ static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8932 { } /* end */ 9215 { } /* end */
8933}; 9216};
8934 9217
8935static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { 9218static const struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8936 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 9219 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8937 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 9220 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8938 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 9221 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
@@ -8956,7 +9239,7 @@ static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8956 { } /* end */ 9239 { } /* end */
8957}; 9240};
8958 9241
8959static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { 9242static const struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8960 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 9243 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8961 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 9244 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8962 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 9245 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
@@ -8980,7 +9263,7 @@ static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8980 { } /* end */ 9263 { } /* end */
8981}; 9264};
8982 9265
8983static struct snd_kcontrol_new alc883_fivestack_mixer[] = { 9266static const struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8984 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 9267 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8985 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 9268 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8986 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 9269 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
@@ -9003,7 +9286,7 @@ static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
9003 { } /* end */ 9286 { } /* end */
9004}; 9287};
9005 9288
9006static struct snd_kcontrol_new alc883_targa_mixer[] = { 9289static const struct snd_kcontrol_new alc883_targa_mixer[] = {
9007 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 9290 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9008 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 9291 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9009 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), 9292 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
@@ -9024,7 +9307,7 @@ static struct snd_kcontrol_new alc883_targa_mixer[] = {
9024 { } /* end */ 9307 { } /* end */
9025}; 9308};
9026 9309
9027static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { 9310static const struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
9028 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 9311 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9029 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 9312 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9030 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), 9313 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
@@ -9040,7 +9323,7 @@ static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
9040 { } /* end */ 9323 { } /* end */
9041}; 9324};
9042 9325
9043static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { 9326static const struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
9044 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), 9327 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9045 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), 9328 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
9046 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 9329 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
@@ -9049,7 +9332,7 @@ static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
9049 { } /* end */ 9332 { } /* end */
9050}; 9333};
9051 9334
9052static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { 9335static const struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
9053 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 9336 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9054 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 9337 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9055 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 9338 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
@@ -9061,7 +9344,7 @@ static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
9061 { } /* end */ 9344 { } /* end */
9062}; 9345};
9063 9346
9064static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { 9347static const struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
9065 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 9348 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9066 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), 9349 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
9067 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), 9350 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
@@ -9074,7 +9357,7 @@ static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
9074 { } /* end */ 9357 { } /* end */
9075}; 9358};
9076 9359
9077static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = { 9360static const struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = {
9078 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 9361 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9079 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 9362 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9080 HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT), 9363 HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT),
@@ -9084,7 +9367,7 @@ static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = {
9084 { } /* end */ 9367 { } /* end */
9085}; 9368};
9086 9369
9087static struct hda_verb alc883_medion_wim2160_verbs[] = { 9370static const struct hda_verb alc883_medion_wim2160_verbs[] = {
9088 /* Unmute front mixer */ 9371 /* Unmute front mixer */
9089 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 9372 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9090 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 9373 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
@@ -9108,9 +9391,11 @@ static void alc883_medion_wim2160_setup(struct hda_codec *codec)
9108 9391
9109 spec->autocfg.hp_pins[0] = 0x1a; 9392 spec->autocfg.hp_pins[0] = 0x1a;
9110 spec->autocfg.speaker_pins[0] = 0x15; 9393 spec->autocfg.speaker_pins[0] = 0x15;
9394 spec->automute = 1;
9395 spec->automute_mode = ALC_AUTOMUTE_AMP;
9111} 9396}
9112 9397
9113static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { 9398static const struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
9114 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 9399 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9115 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 9400 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9116 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), 9401 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
@@ -9122,7 +9407,7 @@ static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
9122 { } /* end */ 9407 { } /* end */
9123}; 9408};
9124 9409
9125static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { 9410static const struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
9126 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 9411 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9127 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), 9412 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9128 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), 9413 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
@@ -9135,7 +9420,7 @@ static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
9135 { } /* end */ 9420 { } /* end */
9136}; 9421};
9137 9422
9138static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { 9423static const struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
9139 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 9424 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9140 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 9425 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9141 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), 9426 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
@@ -9160,7 +9445,7 @@ static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
9160 { } /* end */ 9445 { } /* end */
9161}; 9446};
9162 9447
9163static struct snd_kcontrol_new alc889A_mb31_mixer[] = { 9448static const struct snd_kcontrol_new alc889A_mb31_mixer[] = {
9164 /* Output mixers */ 9449 /* Output mixers */
9165 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), 9450 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
9166 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), 9451 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
@@ -9186,7 +9471,7 @@ static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
9186 { } /* end */ 9471 { } /* end */
9187}; 9472};
9188 9473
9189static struct snd_kcontrol_new alc883_vaiott_mixer[] = { 9474static const struct snd_kcontrol_new alc883_vaiott_mixer[] = {
9190 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 9475 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9191 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 9476 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9192 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), 9477 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
@@ -9196,7 +9481,7 @@ static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
9196 { } /* end */ 9481 { } /* end */
9197}; 9482};
9198 9483
9199static struct hda_bind_ctls alc883_bind_cap_vol = { 9484static const struct hda_bind_ctls alc883_bind_cap_vol = {
9200 .ops = &snd_hda_bind_vol, 9485 .ops = &snd_hda_bind_vol,
9201 .values = { 9486 .values = {
9202 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), 9487 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
@@ -9205,7 +9490,7 @@ static struct hda_bind_ctls alc883_bind_cap_vol = {
9205 }, 9490 },
9206}; 9491};
9207 9492
9208static struct hda_bind_ctls alc883_bind_cap_switch = { 9493static const struct hda_bind_ctls alc883_bind_cap_switch = {
9209 .ops = &snd_hda_bind_sw, 9494 .ops = &snd_hda_bind_sw,
9210 .values = { 9495 .values = {
9211 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), 9496 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
@@ -9214,7 +9499,7 @@ static struct hda_bind_ctls alc883_bind_cap_switch = {
9214 }, 9499 },
9215}; 9500};
9216 9501
9217static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { 9502static const struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
9218 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 9503 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9219 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 9504 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9220 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), 9505 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
@@ -9226,7 +9511,7 @@ static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
9226 { } /* end */ 9511 { } /* end */
9227}; 9512};
9228 9513
9229static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { 9514static const struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
9230 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), 9515 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
9231 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), 9516 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
9232 { 9517 {
@@ -9241,7 +9526,7 @@ static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
9241 { } /* end */ 9526 { } /* end */
9242}; 9527};
9243 9528
9244static struct snd_kcontrol_new alc883_chmode_mixer[] = { 9529static const struct snd_kcontrol_new alc883_chmode_mixer[] = {
9245 { 9530 {
9246 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 9531 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9247 .name = "Channel Mode", 9532 .name = "Channel Mode",
@@ -9260,9 +9545,11 @@ static void alc883_mitac_setup(struct hda_codec *codec)
9260 spec->autocfg.hp_pins[0] = 0x15; 9545 spec->autocfg.hp_pins[0] = 0x15;
9261 spec->autocfg.speaker_pins[0] = 0x14; 9546 spec->autocfg.speaker_pins[0] = 0x14;
9262 spec->autocfg.speaker_pins[1] = 0x17; 9547 spec->autocfg.speaker_pins[1] = 0x17;
9548 spec->automute = 1;
9549 spec->automute_mode = ALC_AUTOMUTE_AMP;
9263} 9550}
9264 9551
9265static struct hda_verb alc883_mitac_verbs[] = { 9552static const struct hda_verb alc883_mitac_verbs[] = {
9266 /* HP */ 9553 /* HP */
9267 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, 9554 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9268 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 9555 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
@@ -9277,7 +9564,7 @@ static struct hda_verb alc883_mitac_verbs[] = {
9277 { } /* end */ 9564 { } /* end */
9278}; 9565};
9279 9566
9280static struct hda_verb alc883_clevo_m540r_verbs[] = { 9567static const struct hda_verb alc883_clevo_m540r_verbs[] = {
9281 /* HP */ 9568 /* HP */
9282 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, 9569 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9283 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 9570 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
@@ -9293,7 +9580,7 @@ static struct hda_verb alc883_clevo_m540r_verbs[] = {
9293 { } /* end */ 9580 { } /* end */
9294}; 9581};
9295 9582
9296static struct hda_verb alc883_clevo_m720_verbs[] = { 9583static const struct hda_verb alc883_clevo_m720_verbs[] = {
9297 /* HP */ 9584 /* HP */
9298 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, 9585 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9299 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 9586 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
@@ -9308,7 +9595,7 @@ static struct hda_verb alc883_clevo_m720_verbs[] = {
9308 { } /* end */ 9595 { } /* end */
9309}; 9596};
9310 9597
9311static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { 9598static const struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
9312 /* HP */ 9599 /* HP */
9313 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, 9600 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9314 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 9601 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
@@ -9322,7 +9609,7 @@ static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
9322 { } /* end */ 9609 { } /* end */
9323}; 9610};
9324 9611
9325static struct hda_verb alc883_targa_verbs[] = { 9612static const struct hda_verb alc883_targa_verbs[] = {
9326 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 9613 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9327 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 9614 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9328 9615
@@ -9351,14 +9638,14 @@ static struct hda_verb alc883_targa_verbs[] = {
9351 { } /* end */ 9638 { } /* end */
9352}; 9639};
9353 9640
9354static struct hda_verb alc883_lenovo_101e_verbs[] = { 9641static const struct hda_verb alc883_lenovo_101e_verbs[] = {
9355 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, 9642 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9356 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, 9643 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
9357 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, 9644 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
9358 { } /* end */ 9645 { } /* end */
9359}; 9646};
9360 9647
9361static struct hda_verb alc883_lenovo_nb0763_verbs[] = { 9648static const struct hda_verb alc883_lenovo_nb0763_verbs[] = {
9362 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, 9649 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9363 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 9650 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9364 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, 9651 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
@@ -9366,7 +9653,7 @@ static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
9366 { } /* end */ 9653 { } /* end */
9367}; 9654};
9368 9655
9369static struct hda_verb alc888_lenovo_ms7195_verbs[] = { 9656static const struct hda_verb alc888_lenovo_ms7195_verbs[] = {
9370 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 9657 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9371 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 9658 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9372 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, 9659 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
@@ -9375,7 +9662,7 @@ static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
9375 { } /* end */ 9662 { } /* end */
9376}; 9663};
9377 9664
9378static struct hda_verb alc883_haier_w66_verbs[] = { 9665static const struct hda_verb alc883_haier_w66_verbs[] = {
9379 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 9666 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9380 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 9667 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9381 9668
@@ -9388,7 +9675,7 @@ static struct hda_verb alc883_haier_w66_verbs[] = {
9388 { } /* end */ 9675 { } /* end */
9389}; 9676};
9390 9677
9391static struct hda_verb alc888_lenovo_sky_verbs[] = { 9678static const struct hda_verb alc888_lenovo_sky_verbs[] = {
9392 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 9679 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9393 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 9680 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9394 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 9681 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
@@ -9400,12 +9687,12 @@ static struct hda_verb alc888_lenovo_sky_verbs[] = {
9400 { } /* end */ 9687 { } /* end */
9401}; 9688};
9402 9689
9403static struct hda_verb alc888_6st_dell_verbs[] = { 9690static const struct hda_verb alc888_6st_dell_verbs[] = {
9404 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, 9691 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9405 { } 9692 { }
9406}; 9693};
9407 9694
9408static struct hda_verb alc883_vaiott_verbs[] = { 9695static const struct hda_verb alc883_vaiott_verbs[] = {
9409 /* HP */ 9696 /* HP */
9410 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, 9697 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9411 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 9698 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
@@ -9424,9 +9711,11 @@ static void alc888_3st_hp_setup(struct hda_codec *codec)
9424 spec->autocfg.speaker_pins[0] = 0x14; 9711 spec->autocfg.speaker_pins[0] = 0x14;
9425 spec->autocfg.speaker_pins[1] = 0x16; 9712 spec->autocfg.speaker_pins[1] = 0x16;
9426 spec->autocfg.speaker_pins[2] = 0x18; 9713 spec->autocfg.speaker_pins[2] = 0x18;
9714 spec->automute = 1;
9715 spec->automute_mode = ALC_AUTOMUTE_AMP;
9427} 9716}
9428 9717
9429static struct hda_verb alc888_3st_hp_verbs[] = { 9718static const struct hda_verb alc888_3st_hp_verbs[] = {
9430 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ 9719 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
9431 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ 9720 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
9432 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ 9721 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
@@ -9437,7 +9726,7 @@ static struct hda_verb alc888_3st_hp_verbs[] = {
9437/* 9726/*
9438 * 2ch mode 9727 * 2ch mode
9439 */ 9728 */
9440static struct hda_verb alc888_3st_hp_2ch_init[] = { 9729static const struct hda_verb alc888_3st_hp_2ch_init[] = {
9441 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, 9730 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9442 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, 9731 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9443 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, 9732 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
@@ -9448,7 +9737,7 @@ static struct hda_verb alc888_3st_hp_2ch_init[] = {
9448/* 9737/*
9449 * 4ch mode 9738 * 4ch mode
9450 */ 9739 */
9451static struct hda_verb alc888_3st_hp_4ch_init[] = { 9740static const struct hda_verb alc888_3st_hp_4ch_init[] = {
9452 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, 9741 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9453 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, 9742 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9454 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 9743 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
@@ -9460,7 +9749,7 @@ static struct hda_verb alc888_3st_hp_4ch_init[] = {
9460/* 9749/*
9461 * 6ch mode 9750 * 6ch mode
9462 */ 9751 */
9463static struct hda_verb alc888_3st_hp_6ch_init[] = { 9752static const struct hda_verb alc888_3st_hp_6ch_init[] = {
9464 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 9753 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9465 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, 9754 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9466 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, 9755 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
@@ -9470,39 +9759,21 @@ static struct hda_verb alc888_3st_hp_6ch_init[] = {
9470 { } /* end */ 9759 { } /* end */
9471}; 9760};
9472 9761
9473static struct hda_channel_mode alc888_3st_hp_modes[3] = { 9762static const struct hda_channel_mode alc888_3st_hp_modes[3] = {
9474 { 2, alc888_3st_hp_2ch_init }, 9763 { 2, alc888_3st_hp_2ch_init },
9475 { 4, alc888_3st_hp_4ch_init }, 9764 { 4, alc888_3st_hp_4ch_init },
9476 { 6, alc888_3st_hp_6ch_init }, 9765 { 6, alc888_3st_hp_6ch_init },
9477}; 9766};
9478 9767
9479/* toggle front-jack and RCA according to the hp-jack state */ 9768static void alc888_lenovo_ms7195_setup(struct hda_codec *codec)
9480static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
9481{ 9769{
9482 unsigned int present = snd_hda_jack_detect(codec, 0x1b); 9770 struct alc_spec *spec = codec->spec;
9483
9484 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9485 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9486 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9487 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9488}
9489
9490/* toggle RCA according to the front-jack state */
9491static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
9492{
9493 unsigned int present = snd_hda_jack_detect(codec, 0x14);
9494
9495 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9496 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9497}
9498 9771
9499static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, 9772 spec->autocfg.hp_pins[0] = 0x1b;
9500 unsigned int res) 9773 spec->autocfg.line_out_pins[0] = 0x14;
9501{ 9774 spec->autocfg.speaker_pins[0] = 0x15;
9502 if ((res >> 26) == ALC880_HP_EVENT) 9775 spec->automute = 1;
9503 alc888_lenovo_ms7195_front_automute(codec); 9776 spec->automute_mode = ALC_AUTOMUTE_AMP;
9504 if ((res >> 26) == ALC880_FRONT_EVENT)
9505 alc888_lenovo_ms7195_rca_automute(codec);
9506} 9777}
9507 9778
9508/* toggle speaker-output according to the hp-jack state */ 9779/* toggle speaker-output according to the hp-jack state */
@@ -9512,6 +9783,8 @@ static void alc883_lenovo_nb0763_setup(struct hda_codec *codec)
9512 9783
9513 spec->autocfg.hp_pins[0] = 0x14; 9784 spec->autocfg.hp_pins[0] = 0x14;
9514 spec->autocfg.speaker_pins[0] = 0x15; 9785 spec->autocfg.speaker_pins[0] = 0x15;
9786 spec->automute = 1;
9787 spec->automute_mode = ALC_AUTOMUTE_AMP;
9515} 9788}
9516 9789
9517/* toggle speaker-output according to the hp-jack state */ 9790/* toggle speaker-output according to the hp-jack state */
@@ -9524,11 +9797,13 @@ static void alc883_clevo_m720_setup(struct hda_codec *codec)
9524 9797
9525 spec->autocfg.hp_pins[0] = 0x15; 9798 spec->autocfg.hp_pins[0] = 0x15;
9526 spec->autocfg.speaker_pins[0] = 0x14; 9799 spec->autocfg.speaker_pins[0] = 0x14;
9800 spec->automute = 1;
9801 spec->automute_mode = ALC_AUTOMUTE_AMP;
9527} 9802}
9528 9803
9529static void alc883_clevo_m720_init_hook(struct hda_codec *codec) 9804static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
9530{ 9805{
9531 alc_automute_amp(codec); 9806 alc_hp_automute(codec);
9532 alc88x_simple_mic_automute(codec); 9807 alc88x_simple_mic_automute(codec);
9533} 9808}
9534 9809
@@ -9540,7 +9815,7 @@ static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
9540 alc88x_simple_mic_automute(codec); 9815 alc88x_simple_mic_automute(codec);
9541 break; 9816 break;
9542 default: 9817 default:
9543 alc_automute_amp_unsol_event(codec, res); 9818 alc_sku_unsol_event(codec, res);
9544 break; 9819 break;
9545 } 9820 }
9546} 9821}
@@ -9552,6 +9827,8 @@ static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
9552 9827
9553 spec->autocfg.hp_pins[0] = 0x14; 9828 spec->autocfg.hp_pins[0] = 0x14;
9554 spec->autocfg.speaker_pins[0] = 0x15; 9829 spec->autocfg.speaker_pins[0] = 0x15;
9830 spec->automute = 1;
9831 spec->automute_mode = ALC_AUTOMUTE_AMP;
9555} 9832}
9556 9833
9557static void alc883_haier_w66_setup(struct hda_codec *codec) 9834static void alc883_haier_w66_setup(struct hda_codec *codec)
@@ -9560,33 +9837,21 @@ static void alc883_haier_w66_setup(struct hda_codec *codec)
9560 9837
9561 spec->autocfg.hp_pins[0] = 0x1b; 9838 spec->autocfg.hp_pins[0] = 0x1b;
9562 spec->autocfg.speaker_pins[0] = 0x14; 9839 spec->autocfg.speaker_pins[0] = 0x14;
9840 spec->automute = 1;
9841 spec->automute_mode = ALC_AUTOMUTE_AMP;
9563} 9842}
9564 9843
9565static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) 9844static void alc883_lenovo_101e_setup(struct hda_codec *codec)
9566{ 9845{
9567 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0; 9846 struct alc_spec *spec = codec->spec;
9568
9569 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9570 HDA_AMP_MUTE, bits);
9571}
9572
9573static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
9574{
9575 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
9576
9577 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9578 HDA_AMP_MUTE, bits);
9579 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9580 HDA_AMP_MUTE, bits);
9581}
9582 9847
9583static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, 9848 spec->autocfg.hp_pins[0] = 0x1b;
9584 unsigned int res) 9849 spec->autocfg.line_out_pins[0] = 0x14;
9585{ 9850 spec->autocfg.speaker_pins[0] = 0x15;
9586 if ((res >> 26) == ALC880_HP_EVENT) 9851 spec->automute = 1;
9587 alc883_lenovo_101e_all_automute(codec); 9852 spec->detect_line = 1;
9588 if ((res >> 26) == ALC880_FRONT_EVENT) 9853 spec->automute_lines = 1;
9589 alc883_lenovo_101e_ispeaker_automute(codec); 9854 spec->automute_mode = ALC_AUTOMUTE_AMP;
9590} 9855}
9591 9856
9592/* toggle speaker-output according to the hp-jack state */ 9857/* toggle speaker-output according to the hp-jack state */
@@ -9597,9 +9862,11 @@ static void alc883_acer_aspire_setup(struct hda_codec *codec)
9597 spec->autocfg.hp_pins[0] = 0x14; 9862 spec->autocfg.hp_pins[0] = 0x14;
9598 spec->autocfg.speaker_pins[0] = 0x15; 9863 spec->autocfg.speaker_pins[0] = 0x15;
9599 spec->autocfg.speaker_pins[1] = 0x16; 9864 spec->autocfg.speaker_pins[1] = 0x16;
9865 spec->automute = 1;
9866 spec->automute_mode = ALC_AUTOMUTE_AMP;
9600} 9867}
9601 9868
9602static struct hda_verb alc883_acer_eapd_verbs[] = { 9869static const struct hda_verb alc883_acer_eapd_verbs[] = {
9603 /* HP Pin: output 0 (0x0c) */ 9870 /* HP Pin: output 0 (0x0c) */
9604 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 9871 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9605 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 9872 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
@@ -9626,6 +9893,8 @@ static void alc888_6st_dell_setup(struct hda_codec *codec)
9626 spec->autocfg.speaker_pins[1] = 0x15; 9893 spec->autocfg.speaker_pins[1] = 0x15;
9627 spec->autocfg.speaker_pins[2] = 0x16; 9894 spec->autocfg.speaker_pins[2] = 0x16;
9628 spec->autocfg.speaker_pins[3] = 0x17; 9895 spec->autocfg.speaker_pins[3] = 0x17;
9896 spec->automute = 1;
9897 spec->automute_mode = ALC_AUTOMUTE_AMP;
9629} 9898}
9630 9899
9631static void alc888_lenovo_sky_setup(struct hda_codec *codec) 9900static void alc888_lenovo_sky_setup(struct hda_codec *codec)
@@ -9638,6 +9907,8 @@ static void alc888_lenovo_sky_setup(struct hda_codec *codec)
9638 spec->autocfg.speaker_pins[2] = 0x16; 9907 spec->autocfg.speaker_pins[2] = 0x16;
9639 spec->autocfg.speaker_pins[3] = 0x17; 9908 spec->autocfg.speaker_pins[3] = 0x17;
9640 spec->autocfg.speaker_pins[4] = 0x1a; 9909 spec->autocfg.speaker_pins[4] = 0x1a;
9910 spec->automute = 1;
9911 spec->automute_mode = ALC_AUTOMUTE_AMP;
9641} 9912}
9642 9913
9643static void alc883_vaiott_setup(struct hda_codec *codec) 9914static void alc883_vaiott_setup(struct hda_codec *codec)
@@ -9647,9 +9918,11 @@ static void alc883_vaiott_setup(struct hda_codec *codec)
9647 spec->autocfg.hp_pins[0] = 0x15; 9918 spec->autocfg.hp_pins[0] = 0x15;
9648 spec->autocfg.speaker_pins[0] = 0x14; 9919 spec->autocfg.speaker_pins[0] = 0x14;
9649 spec->autocfg.speaker_pins[1] = 0x17; 9920 spec->autocfg.speaker_pins[1] = 0x17;
9921 spec->automute = 1;
9922 spec->automute_mode = ALC_AUTOMUTE_AMP;
9650} 9923}
9651 9924
9652static struct hda_verb alc888_asus_m90v_verbs[] = { 9925static const struct hda_verb alc888_asus_m90v_verbs[] = {
9653 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 9926 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9654 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 9927 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9655 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 9928 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
@@ -9672,9 +9945,11 @@ static void alc883_mode2_setup(struct hda_codec *codec)
9672 spec->ext_mic.mux_idx = 0; 9945 spec->ext_mic.mux_idx = 0;
9673 spec->int_mic.mux_idx = 1; 9946 spec->int_mic.mux_idx = 1;
9674 spec->auto_mic = 1; 9947 spec->auto_mic = 1;
9948 spec->automute = 1;
9949 spec->automute_mode = ALC_AUTOMUTE_AMP;
9675} 9950}
9676 9951
9677static struct hda_verb alc888_asus_eee1601_verbs[] = { 9952static const struct hda_verb alc888_asus_eee1601_verbs[] = {
9678 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 9953 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9679 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 9954 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9680 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 9955 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
@@ -9693,10 +9968,10 @@ static void alc883_eee1601_inithook(struct hda_codec *codec)
9693 9968
9694 spec->autocfg.hp_pins[0] = 0x14; 9969 spec->autocfg.hp_pins[0] = 0x14;
9695 spec->autocfg.speaker_pins[0] = 0x1b; 9970 spec->autocfg.speaker_pins[0] = 0x1b;
9696 alc_automute_pin(codec); 9971 alc_hp_automute(codec);
9697} 9972}
9698 9973
9699static struct hda_verb alc889A_mb31_verbs[] = { 9974static const struct hda_verb alc889A_mb31_verbs[] = {
9700 /* Init rear pin (used as headphone output) */ 9975 /* Init rear pin (used as headphone output) */
9701 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ 9976 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
9702 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ 9977 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
@@ -9742,11 +10017,11 @@ static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9742#define alc882_pcm_digital_playback alc880_pcm_digital_playback 10017#define alc882_pcm_digital_playback alc880_pcm_digital_playback
9743#define alc882_pcm_digital_capture alc880_pcm_digital_capture 10018#define alc882_pcm_digital_capture alc880_pcm_digital_capture
9744 10019
9745static hda_nid_t alc883_slave_dig_outs[] = { 10020static const hda_nid_t alc883_slave_dig_outs[] = {
9746 ALC1200_DIGOUT_NID, 0, 10021 ALC1200_DIGOUT_NID, 0,
9747}; 10022};
9748 10023
9749static hda_nid_t alc1200_slave_dig_outs[] = { 10024static const hda_nid_t alc1200_slave_dig_outs[] = {
9750 ALC883_DIGOUT_NID, 0, 10025 ALC883_DIGOUT_NID, 0,
9751}; 10026};
9752 10027
@@ -9805,7 +10080,7 @@ static const char * const alc882_models[ALC882_MODEL_LAST] = {
9805 [ALC882_AUTO] = "auto", 10080 [ALC882_AUTO] = "auto",
9806}; 10081};
9807 10082
9808static struct snd_pci_quirk alc882_cfg_tbl[] = { 10083static const struct snd_pci_quirk alc882_cfg_tbl[] = {
9809 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), 10084 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9810 10085
9811 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), 10086 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
@@ -9932,7 +10207,7 @@ static struct snd_pci_quirk alc882_cfg_tbl[] = {
9932}; 10207};
9933 10208
9934/* codec SSID table for Intel Mac */ 10209/* codec SSID table for Intel Mac */
9935static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { 10210static const struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9936 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), 10211 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9937 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), 10212 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9938 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), 10213 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
@@ -9959,7 +10234,7 @@ static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9959 {} /* terminator */ 10234 {} /* terminator */
9960}; 10235};
9961 10236
9962static struct alc_config_preset alc882_presets[] = { 10237static const struct alc_config_preset alc882_presets[] = {
9963 [ALC882_3ST_DIG] = { 10238 [ALC882_3ST_DIG] = {
9964 .mixers = { alc882_base_mixer }, 10239 .mixers = { alc882_base_mixer },
9965 .init_verbs = { alc882_base_init_verbs, 10240 .init_verbs = { alc882_base_init_verbs,
@@ -10015,9 +10290,9 @@ static struct alc_config_preset alc882_presets[] = {
10015 .channel_mode = alc885_mba21_ch_modes, 10290 .channel_mode = alc885_mba21_ch_modes,
10016 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), 10291 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
10017 .input_mux = &alc882_capture_source, 10292 .input_mux = &alc882_capture_source,
10018 .unsol_event = alc_automute_amp_unsol_event, 10293 .unsol_event = alc_sku_unsol_event,
10019 .setup = alc885_mba21_setup, 10294 .setup = alc885_mba21_setup,
10020 .init_hook = alc_automute_amp, 10295 .init_hook = alc_hp_automute,
10021 }, 10296 },
10022 [ALC885_MBP3] = { 10297 [ALC885_MBP3] = {
10023 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, 10298 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
@@ -10031,9 +10306,9 @@ static struct alc_config_preset alc882_presets[] = {
10031 .input_mux = &alc882_capture_source, 10306 .input_mux = &alc882_capture_source,
10032 .dig_out_nid = ALC882_DIGOUT_NID, 10307 .dig_out_nid = ALC882_DIGOUT_NID,
10033 .dig_in_nid = ALC882_DIGIN_NID, 10308 .dig_in_nid = ALC882_DIGIN_NID,
10034 .unsol_event = alc_automute_amp_unsol_event, 10309 .unsol_event = alc_sku_unsol_event,
10035 .setup = alc885_mbp3_setup, 10310 .setup = alc885_mbp3_setup,
10036 .init_hook = alc_automute_amp, 10311 .init_hook = alc_hp_automute,
10037 }, 10312 },
10038 [ALC885_MB5] = { 10313 [ALC885_MB5] = {
10039 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, 10314 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
@@ -10046,9 +10321,9 @@ static struct alc_config_preset alc882_presets[] = {
10046 .input_mux = &mb5_capture_source, 10321 .input_mux = &mb5_capture_source,
10047 .dig_out_nid = ALC882_DIGOUT_NID, 10322 .dig_out_nid = ALC882_DIGOUT_NID,
10048 .dig_in_nid = ALC882_DIGIN_NID, 10323 .dig_in_nid = ALC882_DIGIN_NID,
10049 .unsol_event = alc_automute_amp_unsol_event, 10324 .unsol_event = alc_sku_unsol_event,
10050 .setup = alc885_mb5_setup, 10325 .setup = alc885_mb5_setup,
10051 .init_hook = alc_automute_amp, 10326 .init_hook = alc_hp_automute,
10052 }, 10327 },
10053 [ALC885_MACMINI3] = { 10328 [ALC885_MACMINI3] = {
10054 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer }, 10329 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
@@ -10061,9 +10336,9 @@ static struct alc_config_preset alc882_presets[] = {
10061 .input_mux = &macmini3_capture_source, 10336 .input_mux = &macmini3_capture_source,
10062 .dig_out_nid = ALC882_DIGOUT_NID, 10337 .dig_out_nid = ALC882_DIGOUT_NID,
10063 .dig_in_nid = ALC882_DIGIN_NID, 10338 .dig_in_nid = ALC882_DIGIN_NID,
10064 .unsol_event = alc_automute_amp_unsol_event, 10339 .unsol_event = alc_sku_unsol_event,
10065 .setup = alc885_macmini3_setup, 10340 .setup = alc885_macmini3_setup,
10066 .init_hook = alc_automute_amp, 10341 .init_hook = alc_hp_automute,
10067 }, 10342 },
10068 [ALC885_MACPRO] = { 10343 [ALC885_MACPRO] = {
10069 .mixers = { alc882_macpro_mixer }, 10344 .mixers = { alc882_macpro_mixer },
@@ -10087,7 +10362,7 @@ static struct alc_config_preset alc882_presets[] = {
10087 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), 10362 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10088 .channel_mode = alc882_ch_modes, 10363 .channel_mode = alc882_ch_modes,
10089 .input_mux = &alc882_capture_source, 10364 .input_mux = &alc882_capture_source,
10090 .unsol_event = alc_automute_amp_unsol_event, 10365 .unsol_event = alc_sku_unsol_event,
10091 .setup = alc885_imac24_setup, 10366 .setup = alc885_imac24_setup,
10092 .init_hook = alc885_imac24_init_hook, 10367 .init_hook = alc885_imac24_init_hook,
10093 }, 10368 },
@@ -10102,9 +10377,9 @@ static struct alc_config_preset alc882_presets[] = {
10102 .input_mux = &alc889A_imac91_capture_source, 10377 .input_mux = &alc889A_imac91_capture_source,
10103 .dig_out_nid = ALC882_DIGOUT_NID, 10378 .dig_out_nid = ALC882_DIGOUT_NID,
10104 .dig_in_nid = ALC882_DIGIN_NID, 10379 .dig_in_nid = ALC882_DIGIN_NID,
10105 .unsol_event = alc_automute_amp_unsol_event, 10380 .unsol_event = alc_sku_unsol_event,
10106 .setup = alc885_imac91_setup, 10381 .setup = alc885_imac91_setup,
10107 .init_hook = alc_automute_amp, 10382 .init_hook = alc_hp_automute,
10108 }, 10383 },
10109 [ALC882_TARGA] = { 10384 [ALC882_TARGA] = {
10110 .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, 10385 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
@@ -10120,7 +10395,7 @@ static struct alc_config_preset alc882_presets[] = {
10120 .channel_mode = alc882_3ST_6ch_modes, 10395 .channel_mode = alc882_3ST_6ch_modes,
10121 .need_dac_fix = 1, 10396 .need_dac_fix = 1,
10122 .input_mux = &alc882_capture_source, 10397 .input_mux = &alc882_capture_source,
10123 .unsol_event = alc882_targa_unsol_event, 10398 .unsol_event = alc_sku_unsol_event,
10124 .setup = alc882_targa_setup, 10399 .setup = alc882_targa_setup,
10125 .init_hook = alc882_targa_automute, 10400 .init_hook = alc882_targa_automute,
10126 }, 10401 },
@@ -10214,8 +10489,8 @@ static struct alc_config_preset alc882_presets[] = {
10214 .capsrc_nids = alc889_capsrc_nids, 10489 .capsrc_nids = alc889_capsrc_nids,
10215 .input_mux = &alc889_capture_source, 10490 .input_mux = &alc889_capture_source,
10216 .setup = alc889_automute_setup, 10491 .setup = alc889_automute_setup,
10217 .init_hook = alc_automute_amp, 10492 .init_hook = alc_hp_automute,
10218 .unsol_event = alc_automute_amp_unsol_event, 10493 .unsol_event = alc_sku_unsol_event,
10219 .need_dac_fix = 1, 10494 .need_dac_fix = 1,
10220 }, 10495 },
10221 [ALC889_INTEL] = { 10496 [ALC889_INTEL] = {
@@ -10235,7 +10510,7 @@ static struct alc_config_preset alc882_presets[] = {
10235 .input_mux = &alc889_capture_source, 10510 .input_mux = &alc889_capture_source,
10236 .setup = alc889_automute_setup, 10511 .setup = alc889_automute_setup,
10237 .init_hook = alc889_intel_init_hook, 10512 .init_hook = alc889_intel_init_hook,
10238 .unsol_event = alc_automute_amp_unsol_event, 10513 .unsol_event = alc_sku_unsol_event,
10239 .need_dac_fix = 1, 10514 .need_dac_fix = 1,
10240 }, 10515 },
10241 [ALC883_6ST_DIG] = { 10516 [ALC883_6ST_DIG] = {
@@ -10324,9 +10599,9 @@ static struct alc_config_preset alc882_presets[] = {
10324 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 10599 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10325 .channel_mode = alc883_3ST_2ch_modes, 10600 .channel_mode = alc883_3ST_2ch_modes,
10326 .input_mux = &alc883_capture_source, 10601 .input_mux = &alc883_capture_source,
10327 .unsol_event = alc_automute_amp_unsol_event, 10602 .unsol_event = alc_sku_unsol_event,
10328 .setup = alc883_acer_aspire_setup, 10603 .setup = alc883_acer_aspire_setup,
10329 .init_hook = alc_automute_amp, 10604 .init_hook = alc_hp_automute,
10330 }, 10605 },
10331 [ALC888_ACER_ASPIRE_4930G] = { 10606 [ALC888_ACER_ASPIRE_4930G] = {
10332 .mixers = { alc888_acer_aspire_4930g_mixer, 10607 .mixers = { alc888_acer_aspire_4930g_mixer,
@@ -10346,9 +10621,9 @@ static struct alc_config_preset alc882_presets[] = {
10346 .num_mux_defs = 10621 .num_mux_defs =
10347 ARRAY_SIZE(alc888_2_capture_sources), 10622 ARRAY_SIZE(alc888_2_capture_sources),
10348 .input_mux = alc888_2_capture_sources, 10623 .input_mux = alc888_2_capture_sources,
10349 .unsol_event = alc_automute_amp_unsol_event, 10624 .unsol_event = alc_sku_unsol_event,
10350 .setup = alc888_acer_aspire_4930g_setup, 10625 .setup = alc888_acer_aspire_4930g_setup,
10351 .init_hook = alc_automute_amp, 10626 .init_hook = alc_hp_automute,
10352 }, 10627 },
10353 [ALC888_ACER_ASPIRE_6530G] = { 10628 [ALC888_ACER_ASPIRE_6530G] = {
10354 .mixers = { alc888_acer_aspire_6530_mixer }, 10629 .mixers = { alc888_acer_aspire_6530_mixer },
@@ -10365,9 +10640,9 @@ static struct alc_config_preset alc882_presets[] = {
10365 .num_mux_defs = 10640 .num_mux_defs =
10366 ARRAY_SIZE(alc888_2_capture_sources), 10641 ARRAY_SIZE(alc888_2_capture_sources),
10367 .input_mux = alc888_acer_aspire_6530_sources, 10642 .input_mux = alc888_acer_aspire_6530_sources,
10368 .unsol_event = alc_automute_amp_unsol_event, 10643 .unsol_event = alc_sku_unsol_event,
10369 .setup = alc888_acer_aspire_6530g_setup, 10644 .setup = alc888_acer_aspire_6530g_setup,
10370 .init_hook = alc_automute_amp, 10645 .init_hook = alc_hp_automute,
10371 }, 10646 },
10372 [ALC888_ACER_ASPIRE_8930G] = { 10647 [ALC888_ACER_ASPIRE_8930G] = {
10373 .mixers = { alc889_acer_aspire_8930g_mixer, 10648 .mixers = { alc889_acer_aspire_8930g_mixer,
@@ -10388,9 +10663,9 @@ static struct alc_config_preset alc882_presets[] = {
10388 .num_mux_defs = 10663 .num_mux_defs =
10389 ARRAY_SIZE(alc889_capture_sources), 10664 ARRAY_SIZE(alc889_capture_sources),
10390 .input_mux = alc889_capture_sources, 10665 .input_mux = alc889_capture_sources,
10391 .unsol_event = alc_automute_amp_unsol_event, 10666 .unsol_event = alc_sku_unsol_event,
10392 .setup = alc889_acer_aspire_8930g_setup, 10667 .setup = alc889_acer_aspire_8930g_setup,
10393 .init_hook = alc_automute_amp, 10668 .init_hook = alc_hp_automute,
10394#ifdef CONFIG_SND_HDA_POWER_SAVE 10669#ifdef CONFIG_SND_HDA_POWER_SAVE
10395 .power_hook = alc_power_eapd, 10670 .power_hook = alc_power_eapd,
10396#endif 10671#endif
@@ -10411,9 +10686,9 @@ static struct alc_config_preset alc882_presets[] = {
10411 .need_dac_fix = 1, 10686 .need_dac_fix = 1,
10412 .const_channel_count = 6, 10687 .const_channel_count = 6,
10413 .input_mux = &alc883_capture_source, 10688 .input_mux = &alc883_capture_source,
10414 .unsol_event = alc_automute_amp_unsol_event, 10689 .unsol_event = alc_sku_unsol_event,
10415 .setup = alc888_acer_aspire_7730g_setup, 10690 .setup = alc888_acer_aspire_7730g_setup,
10416 .init_hook = alc_automute_amp, 10691 .init_hook = alc_hp_automute,
10417 }, 10692 },
10418 [ALC883_MEDION] = { 10693 [ALC883_MEDION] = {
10419 .mixers = { alc883_fivestack_mixer, 10694 .mixers = { alc883_fivestack_mixer,
@@ -10440,9 +10715,9 @@ static struct alc_config_preset alc882_presets[] = {
10440 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 10715 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10441 .channel_mode = alc883_3ST_2ch_modes, 10716 .channel_mode = alc883_3ST_2ch_modes,
10442 .input_mux = &alc883_capture_source, 10717 .input_mux = &alc883_capture_source,
10443 .unsol_event = alc_automute_amp_unsol_event, 10718 .unsol_event = alc_sku_unsol_event,
10444 .setup = alc883_medion_wim2160_setup, 10719 .setup = alc883_medion_wim2160_setup,
10445 .init_hook = alc_automute_amp, 10720 .init_hook = alc_hp_automute,
10446 }, 10721 },
10447 [ALC883_LAPTOP_EAPD] = { 10722 [ALC883_LAPTOP_EAPD] = {
10448 .mixers = { alc883_base_mixer }, 10723 .mixers = { alc883_base_mixer },
@@ -10492,8 +10767,9 @@ static struct alc_config_preset alc882_presets[] = {
10492 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 10767 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10493 .channel_mode = alc883_3ST_2ch_modes, 10768 .channel_mode = alc883_3ST_2ch_modes,
10494 .input_mux = &alc883_lenovo_101e_capture_source, 10769 .input_mux = &alc883_lenovo_101e_capture_source,
10495 .unsol_event = alc883_lenovo_101e_unsol_event, 10770 .setup = alc883_lenovo_101e_setup,
10496 .init_hook = alc883_lenovo_101e_all_automute, 10771 .unsol_event = alc_sku_unsol_event,
10772 .init_hook = alc_inithook,
10497 }, 10773 },
10498 [ALC883_LENOVO_NB0763] = { 10774 [ALC883_LENOVO_NB0763] = {
10499 .mixers = { alc883_lenovo_nb0763_mixer }, 10775 .mixers = { alc883_lenovo_nb0763_mixer },
@@ -10504,9 +10780,9 @@ static struct alc_config_preset alc882_presets[] = {
10504 .channel_mode = alc883_3ST_2ch_modes, 10780 .channel_mode = alc883_3ST_2ch_modes,
10505 .need_dac_fix = 1, 10781 .need_dac_fix = 1,
10506 .input_mux = &alc883_lenovo_nb0763_capture_source, 10782 .input_mux = &alc883_lenovo_nb0763_capture_source,
10507 .unsol_event = alc_automute_amp_unsol_event, 10783 .unsol_event = alc_sku_unsol_event,
10508 .setup = alc883_lenovo_nb0763_setup, 10784 .setup = alc883_lenovo_nb0763_setup,
10509 .init_hook = alc_automute_amp, 10785 .init_hook = alc_hp_automute,
10510 }, 10786 },
10511 [ALC888_LENOVO_MS7195_DIG] = { 10787 [ALC888_LENOVO_MS7195_DIG] = {
10512 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, 10788 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
@@ -10518,8 +10794,9 @@ static struct alc_config_preset alc882_presets[] = {
10518 .channel_mode = alc883_3ST_6ch_modes, 10794 .channel_mode = alc883_3ST_6ch_modes,
10519 .need_dac_fix = 1, 10795 .need_dac_fix = 1,
10520 .input_mux = &alc883_capture_source, 10796 .input_mux = &alc883_capture_source,
10521 .unsol_event = alc883_lenovo_ms7195_unsol_event, 10797 .unsol_event = alc_sku_unsol_event,
10522 .init_hook = alc888_lenovo_ms7195_front_automute, 10798 .setup = alc888_lenovo_ms7195_setup,
10799 .init_hook = alc_inithook,
10523 }, 10800 },
10524 [ALC883_HAIER_W66] = { 10801 [ALC883_HAIER_W66] = {
10525 .mixers = { alc883_targa_2ch_mixer}, 10802 .mixers = { alc883_targa_2ch_mixer},
@@ -10530,9 +10807,9 @@ static struct alc_config_preset alc882_presets[] = {
10530 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 10807 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10531 .channel_mode = alc883_3ST_2ch_modes, 10808 .channel_mode = alc883_3ST_2ch_modes,
10532 .input_mux = &alc883_capture_source, 10809 .input_mux = &alc883_capture_source,
10533 .unsol_event = alc_automute_amp_unsol_event, 10810 .unsol_event = alc_sku_unsol_event,
10534 .setup = alc883_haier_w66_setup, 10811 .setup = alc883_haier_w66_setup,
10535 .init_hook = alc_automute_amp, 10812 .init_hook = alc_hp_automute,
10536 }, 10813 },
10537 [ALC888_3ST_HP] = { 10814 [ALC888_3ST_HP] = {
10538 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, 10815 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
@@ -10543,9 +10820,9 @@ static struct alc_config_preset alc882_presets[] = {
10543 .channel_mode = alc888_3st_hp_modes, 10820 .channel_mode = alc888_3st_hp_modes,
10544 .need_dac_fix = 1, 10821 .need_dac_fix = 1,
10545 .input_mux = &alc883_capture_source, 10822 .input_mux = &alc883_capture_source,
10546 .unsol_event = alc_automute_amp_unsol_event, 10823 .unsol_event = alc_sku_unsol_event,
10547 .setup = alc888_3st_hp_setup, 10824 .setup = alc888_3st_hp_setup,
10548 .init_hook = alc_automute_amp, 10825 .init_hook = alc_hp_automute,
10549 }, 10826 },
10550 [ALC888_6ST_DELL] = { 10827 [ALC888_6ST_DELL] = {
10551 .mixers = { alc883_base_mixer, alc883_chmode_mixer }, 10828 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
@@ -10557,9 +10834,9 @@ static struct alc_config_preset alc882_presets[] = {
10557 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), 10834 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10558 .channel_mode = alc883_sixstack_modes, 10835 .channel_mode = alc883_sixstack_modes,
10559 .input_mux = &alc883_capture_source, 10836 .input_mux = &alc883_capture_source,
10560 .unsol_event = alc_automute_amp_unsol_event, 10837 .unsol_event = alc_sku_unsol_event,
10561 .setup = alc888_6st_dell_setup, 10838 .setup = alc888_6st_dell_setup,
10562 .init_hook = alc_automute_amp, 10839 .init_hook = alc_hp_automute,
10563 }, 10840 },
10564 [ALC883_MITAC] = { 10841 [ALC883_MITAC] = {
10565 .mixers = { alc883_mitac_mixer }, 10842 .mixers = { alc883_mitac_mixer },
@@ -10569,9 +10846,9 @@ static struct alc_config_preset alc882_presets[] = {
10569 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 10846 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10570 .channel_mode = alc883_3ST_2ch_modes, 10847 .channel_mode = alc883_3ST_2ch_modes,
10571 .input_mux = &alc883_capture_source, 10848 .input_mux = &alc883_capture_source,
10572 .unsol_event = alc_automute_amp_unsol_event, 10849 .unsol_event = alc_sku_unsol_event,
10573 .setup = alc883_mitac_setup, 10850 .setup = alc883_mitac_setup,
10574 .init_hook = alc_automute_amp, 10851 .init_hook = alc_hp_automute,
10575 }, 10852 },
10576 [ALC883_FUJITSU_PI2515] = { 10853 [ALC883_FUJITSU_PI2515] = {
10577 .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, 10854 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
@@ -10583,9 +10860,9 @@ static struct alc_config_preset alc882_presets[] = {
10583 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 10860 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10584 .channel_mode = alc883_3ST_2ch_modes, 10861 .channel_mode = alc883_3ST_2ch_modes,
10585 .input_mux = &alc883_fujitsu_pi2515_capture_source, 10862 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10586 .unsol_event = alc_automute_amp_unsol_event, 10863 .unsol_event = alc_sku_unsol_event,
10587 .setup = alc883_2ch_fujitsu_pi2515_setup, 10864 .setup = alc883_2ch_fujitsu_pi2515_setup,
10588 .init_hook = alc_automute_amp, 10865 .init_hook = alc_hp_automute,
10589 }, 10866 },
10590 [ALC888_FUJITSU_XA3530] = { 10867 [ALC888_FUJITSU_XA3530] = {
10591 .mixers = { alc888_base_mixer, alc883_chmode_mixer }, 10868 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
@@ -10602,9 +10879,9 @@ static struct alc_config_preset alc882_presets[] = {
10602 .num_mux_defs = 10879 .num_mux_defs =
10603 ARRAY_SIZE(alc888_2_capture_sources), 10880 ARRAY_SIZE(alc888_2_capture_sources),
10604 .input_mux = alc888_2_capture_sources, 10881 .input_mux = alc888_2_capture_sources,
10605 .unsol_event = alc_automute_amp_unsol_event, 10882 .unsol_event = alc_sku_unsol_event,
10606 .setup = alc888_fujitsu_xa3530_setup, 10883 .setup = alc888_fujitsu_xa3530_setup,
10607 .init_hook = alc_automute_amp, 10884 .init_hook = alc_hp_automute,
10608 }, 10885 },
10609 [ALC888_LENOVO_SKY] = { 10886 [ALC888_LENOVO_SKY] = {
10610 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, 10887 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
@@ -10616,9 +10893,9 @@ static struct alc_config_preset alc882_presets[] = {
10616 .channel_mode = alc883_sixstack_modes, 10893 .channel_mode = alc883_sixstack_modes,
10617 .need_dac_fix = 1, 10894 .need_dac_fix = 1,
10618 .input_mux = &alc883_lenovo_sky_capture_source, 10895 .input_mux = &alc883_lenovo_sky_capture_source,
10619 .unsol_event = alc_automute_amp_unsol_event, 10896 .unsol_event = alc_sku_unsol_event,
10620 .setup = alc888_lenovo_sky_setup, 10897 .setup = alc888_lenovo_sky_setup,
10621 .init_hook = alc_automute_amp, 10898 .init_hook = alc_hp_automute,
10622 }, 10899 },
10623 [ALC888_ASUS_M90V] = { 10900 [ALC888_ASUS_M90V] = {
10624 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, 10901 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
@@ -10686,9 +10963,9 @@ static struct alc_config_preset alc882_presets[] = {
10686 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 10963 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10687 .channel_mode = alc883_3ST_2ch_modes, 10964 .channel_mode = alc883_3ST_2ch_modes,
10688 .input_mux = &alc883_capture_source, 10965 .input_mux = &alc883_capture_source,
10689 .unsol_event = alc_automute_amp_unsol_event, 10966 .unsol_event = alc_sku_unsol_event,
10690 .setup = alc883_vaiott_setup, 10967 .setup = alc883_vaiott_setup,
10691 .init_hook = alc_automute_amp, 10968 .init_hook = alc_hp_automute,
10692 }, 10969 },
10693}; 10970};
10694 10971
@@ -10734,7 +11011,7 @@ static const struct alc_fixup alc882_fixups[] = {
10734 }, 11011 },
10735}; 11012};
10736 11013
10737static struct snd_pci_quirk alc882_fixup_tbl[] = { 11014static const struct snd_pci_quirk alc882_fixup_tbl[] = {
10738 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210), 11015 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210),
10739 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", PINFIX_LENOVO_Y530), 11016 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", PINFIX_LENOVO_Y530),
10740 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), 11017 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
@@ -10842,6 +11119,11 @@ static void alc882_auto_init_input_src(struct hda_codec *codec)
10842 const struct hda_input_mux *imux; 11119 const struct hda_input_mux *imux;
10843 int conns, mute, idx, item; 11120 int conns, mute, idx, item;
10844 11121
11122 /* mute ADC */
11123 snd_hda_codec_write(codec, spec->adc_nids[c], 0,
11124 AC_VERB_SET_AMP_GAIN_MUTE,
11125 AMP_IN_MUTE(0));
11126
10845 conns = snd_hda_get_connections(codec, nid, conn_list, 11127 conns = snd_hda_get_connections(codec, nid, conn_list,
10846 ARRAY_SIZE(conn_list)); 11128 ARRAY_SIZE(conn_list));
10847 if (conns < 0) 11129 if (conns < 0)
@@ -10921,7 +11203,7 @@ static int alc_auto_add_mic_boost(struct hda_codec *codec)
10921static int alc882_parse_auto_config(struct hda_codec *codec) 11203static int alc882_parse_auto_config(struct hda_codec *codec)
10922{ 11204{
10923 struct alc_spec *spec = codec->spec; 11205 struct alc_spec *spec = codec->spec;
10924 static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; 11206 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10925 int err; 11207 int err;
10926 11208
10927 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, 11209 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
@@ -10934,6 +11216,9 @@ static int alc882_parse_auto_config(struct hda_codec *codec)
10934 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); 11216 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10935 if (err < 0) 11217 if (err < 0)
10936 return err; 11218 return err;
11219 err = alc_auto_add_multi_channel_mode(codec);
11220 if (err < 0)
11221 return err;
10937 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); 11222 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10938 if (err < 0) 11223 if (err < 0)
10939 return err; 11224 return err;
@@ -11135,14 +11420,14 @@ static int patch_alc882(struct hda_codec *codec)
11135#define alc262_modes alc260_modes 11420#define alc262_modes alc260_modes
11136#define alc262_capture_source alc882_capture_source 11421#define alc262_capture_source alc882_capture_source
11137 11422
11138static hda_nid_t alc262_dmic_adc_nids[1] = { 11423static const hda_nid_t alc262_dmic_adc_nids[1] = {
11139 /* ADC0 */ 11424 /* ADC0 */
11140 0x09 11425 0x09
11141}; 11426};
11142 11427
11143static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; 11428static const hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
11144 11429
11145static struct snd_kcontrol_new alc262_base_mixer[] = { 11430static const struct snd_kcontrol_new alc262_base_mixer[] = {
11146 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 11431 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11147 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), 11432 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11148 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 11433 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
@@ -11163,71 +11448,30 @@ static struct snd_kcontrol_new alc262_base_mixer[] = {
11163}; 11448};
11164 11449
11165/* update HP, line and mono-out pins according to the master switch */ 11450/* update HP, line and mono-out pins according to the master switch */
11166static void alc262_hp_master_update(struct hda_codec *codec) 11451#define alc262_hp_master_update alc260_hp_master_update
11167{
11168 struct alc_spec *spec = codec->spec;
11169 int val = spec->master_sw;
11170
11171 /* HP & line-out */
11172 snd_hda_codec_write_cache(codec, 0x1b, 0,
11173 AC_VERB_SET_PIN_WIDGET_CONTROL,
11174 val ? PIN_HP : 0);
11175 snd_hda_codec_write_cache(codec, 0x15, 0,
11176 AC_VERB_SET_PIN_WIDGET_CONTROL,
11177 val ? PIN_HP : 0);
11178 /* mono (speaker) depending on the HP jack sense */
11179 val = val && !spec->jack_present;
11180 snd_hda_codec_write_cache(codec, 0x16, 0,
11181 AC_VERB_SET_PIN_WIDGET_CONTROL,
11182 val ? PIN_OUT : 0);
11183}
11184 11452
11185static void alc262_hp_bpc_automute(struct hda_codec *codec) 11453static void alc262_hp_bpc_setup(struct hda_codec *codec)
11186{ 11454{
11187 struct alc_spec *spec = codec->spec; 11455 struct alc_spec *spec = codec->spec;
11188 11456
11189 spec->jack_present = snd_hda_jack_detect(codec, 0x1b); 11457 spec->autocfg.hp_pins[0] = 0x1b;
11190 alc262_hp_master_update(codec); 11458 spec->autocfg.speaker_pins[0] = 0x16;
11191} 11459 spec->automute = 1;
11192 11460 spec->automute_mode = ALC_AUTOMUTE_PIN;
11193static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
11194{
11195 if ((res >> 26) != ALC880_HP_EVENT)
11196 return;
11197 alc262_hp_bpc_automute(codec);
11198} 11461}
11199 11462
11200static void alc262_hp_wildwest_automute(struct hda_codec *codec) 11463static void alc262_hp_wildwest_setup(struct hda_codec *codec)
11201{ 11464{
11202 struct alc_spec *spec = codec->spec; 11465 struct alc_spec *spec = codec->spec;
11203 11466
11204 spec->jack_present = snd_hda_jack_detect(codec, 0x15); 11467 spec->autocfg.hp_pins[0] = 0x15;
11205 alc262_hp_master_update(codec); 11468 spec->autocfg.speaker_pins[0] = 0x16;
11206} 11469 spec->automute = 1;
11207 11470 spec->automute_mode = ALC_AUTOMUTE_PIN;
11208static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
11209 unsigned int res)
11210{
11211 if ((res >> 26) != ALC880_HP_EVENT)
11212 return;
11213 alc262_hp_wildwest_automute(codec);
11214} 11471}
11215 11472
11216#define alc262_hp_master_sw_get alc260_hp_master_sw_get 11473#define alc262_hp_master_sw_get alc260_hp_master_sw_get
11217 11474#define alc262_hp_master_sw_put alc260_hp_master_sw_put
11218static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
11219 struct snd_ctl_elem_value *ucontrol)
11220{
11221 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11222 struct alc_spec *spec = codec->spec;
11223 int val = !!*ucontrol->value.integer.value;
11224
11225 if (val == spec->master_sw)
11226 return 0;
11227 spec->master_sw = val;
11228 alc262_hp_master_update(codec);
11229 return 1;
11230}
11231 11475
11232#define ALC262_HP_MASTER_SWITCH \ 11476#define ALC262_HP_MASTER_SWITCH \
11233 { \ 11477 { \
@@ -11244,7 +11488,7 @@ static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
11244 } 11488 }
11245 11489
11246 11490
11247static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { 11491static const struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
11248 ALC262_HP_MASTER_SWITCH, 11492 ALC262_HP_MASTER_SWITCH,
11249 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 11493 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11250 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), 11494 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
@@ -11268,7 +11512,7 @@ static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
11268 { } /* end */ 11512 { } /* end */
11269}; 11513};
11270 11514
11271static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { 11515static const struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
11272 ALC262_HP_MASTER_SWITCH, 11516 ALC262_HP_MASTER_SWITCH,
11273 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 11517 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11274 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 11518 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
@@ -11288,7 +11532,7 @@ static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
11288 { } /* end */ 11532 { } /* end */
11289}; 11533};
11290 11534
11291static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { 11535static const struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
11292 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 11536 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11293 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 11537 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11294 HDA_CODEC_VOLUME("Rear Mic Boost Volume", 0x18, 0, HDA_INPUT), 11538 HDA_CODEC_VOLUME("Rear Mic Boost Volume", 0x18, 0, HDA_INPUT),
@@ -11302,9 +11546,11 @@ static void alc262_hp_t5735_setup(struct hda_codec *codec)
11302 11546
11303 spec->autocfg.hp_pins[0] = 0x15; 11547 spec->autocfg.hp_pins[0] = 0x15;
11304 spec->autocfg.speaker_pins[0] = 0x14; 11548 spec->autocfg.speaker_pins[0] = 0x14;
11549 spec->automute = 1;
11550 spec->automute_mode = ALC_AUTOMUTE_PIN;
11305} 11551}
11306 11552
11307static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { 11553static const struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
11308 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 11554 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11309 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), 11555 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11310 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 11556 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
@@ -11315,7 +11561,7 @@ static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
11315 { } /* end */ 11561 { } /* end */
11316}; 11562};
11317 11563
11318static struct hda_verb alc262_hp_t5735_verbs[] = { 11564static const struct hda_verb alc262_hp_t5735_verbs[] = {
11319 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 11565 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11320 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 11566 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11321 11567
@@ -11323,7 +11569,7 @@ static struct hda_verb alc262_hp_t5735_verbs[] = {
11323 { } 11569 { }
11324}; 11570};
11325 11571
11326static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { 11572static const struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
11327 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 11573 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11328 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 11574 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11329 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), 11575 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
@@ -11333,7 +11579,7 @@ static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
11333 { } /* end */ 11579 { } /* end */
11334}; 11580};
11335 11581
11336static struct hda_verb alc262_hp_rp5700_verbs[] = { 11582static const struct hda_verb alc262_hp_rp5700_verbs[] = {
11337 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 11583 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11338 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 11584 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11339 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 11585 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
@@ -11347,7 +11593,7 @@ static struct hda_verb alc262_hp_rp5700_verbs[] = {
11347 {} 11593 {}
11348}; 11594};
11349 11595
11350static struct hda_input_mux alc262_hp_rp5700_capture_source = { 11596static const struct hda_input_mux alc262_hp_rp5700_capture_source = {
11351 .num_items = 1, 11597 .num_items = 1,
11352 .items = { 11598 .items = {
11353 { "Line", 0x1 }, 11599 { "Line", 0x1 },
@@ -11355,44 +11601,9 @@ static struct hda_input_mux alc262_hp_rp5700_capture_source = {
11355}; 11601};
11356 11602
11357/* bind hp and internal speaker mute (with plug check) as master switch */ 11603/* bind hp and internal speaker mute (with plug check) as master switch */
11358static void alc262_hippo_master_update(struct hda_codec *codec) 11604#define alc262_hippo_master_update alc262_hp_master_update
11359{
11360 struct alc_spec *spec = codec->spec;
11361 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11362 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11363 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11364 unsigned int mute;
11365
11366 /* HP */
11367 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
11368 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
11369 HDA_AMP_MUTE, mute);
11370 /* mute internal speaker per jack sense */
11371 if (spec->jack_present)
11372 mute = HDA_AMP_MUTE;
11373 if (line_nid)
11374 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
11375 HDA_AMP_MUTE, mute);
11376 if (speaker_nid && speaker_nid != line_nid)
11377 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
11378 HDA_AMP_MUTE, mute);
11379}
11380
11381#define alc262_hippo_master_sw_get alc262_hp_master_sw_get 11605#define alc262_hippo_master_sw_get alc262_hp_master_sw_get
11382 11606#define alc262_hippo_master_sw_put alc262_hp_master_sw_put
11383static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
11384 struct snd_ctl_elem_value *ucontrol)
11385{
11386 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11387 struct alc_spec *spec = codec->spec;
11388 int val = !!*ucontrol->value.integer.value;
11389
11390 if (val == spec->master_sw)
11391 return 0;
11392 spec->master_sw = val;
11393 alc262_hippo_master_update(codec);
11394 return 1;
11395}
11396 11607
11397#define ALC262_HIPPO_MASTER_SWITCH \ 11608#define ALC262_HIPPO_MASTER_SWITCH \
11398 { \ 11609 { \
@@ -11409,7 +11620,7 @@ static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
11409 (SUBDEV_SPEAKER(0) << 16), \ 11620 (SUBDEV_SPEAKER(0) << 16), \
11410 } 11621 }
11411 11622
11412static struct snd_kcontrol_new alc262_hippo_mixer[] = { 11623static const struct snd_kcontrol_new alc262_hippo_mixer[] = {
11413 ALC262_HIPPO_MASTER_SWITCH, 11624 ALC262_HIPPO_MASTER_SWITCH,
11414 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 11625 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11415 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 11626 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
@@ -11426,7 +11637,7 @@ static struct snd_kcontrol_new alc262_hippo_mixer[] = {
11426 { } /* end */ 11637 { } /* end */
11427}; 11638};
11428 11639
11429static struct snd_kcontrol_new alc262_hippo1_mixer[] = { 11640static const struct snd_kcontrol_new alc262_hippo1_mixer[] = {
11430 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 11641 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11431 ALC262_HIPPO_MASTER_SWITCH, 11642 ALC262_HIPPO_MASTER_SWITCH,
11432 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 11643 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
@@ -11443,28 +11654,14 @@ static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
11443}; 11654};
11444 11655
11445/* mute/unmute internal speaker according to the hp jack and mute state */ 11656/* mute/unmute internal speaker according to the hp jack and mute state */
11446static void alc262_hippo_automute(struct hda_codec *codec)
11447{
11448 struct alc_spec *spec = codec->spec;
11449 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11450
11451 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
11452 alc262_hippo_master_update(codec);
11453}
11454
11455static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
11456{
11457 if ((res >> 26) != ALC880_HP_EVENT)
11458 return;
11459 alc262_hippo_automute(codec);
11460}
11461
11462static void alc262_hippo_setup(struct hda_codec *codec) 11657static void alc262_hippo_setup(struct hda_codec *codec)
11463{ 11658{
11464 struct alc_spec *spec = codec->spec; 11659 struct alc_spec *spec = codec->spec;
11465 11660
11466 spec->autocfg.hp_pins[0] = 0x15; 11661 spec->autocfg.hp_pins[0] = 0x15;
11467 spec->autocfg.speaker_pins[0] = 0x14; 11662 spec->autocfg.speaker_pins[0] = 0x14;
11663 spec->automute = 1;
11664 spec->automute_mode = ALC_AUTOMUTE_AMP;
11468} 11665}
11469 11666
11470static void alc262_hippo1_setup(struct hda_codec *codec) 11667static void alc262_hippo1_setup(struct hda_codec *codec)
@@ -11473,10 +11670,12 @@ static void alc262_hippo1_setup(struct hda_codec *codec)
11473 11670
11474 spec->autocfg.hp_pins[0] = 0x1b; 11671 spec->autocfg.hp_pins[0] = 0x1b;
11475 spec->autocfg.speaker_pins[0] = 0x14; 11672 spec->autocfg.speaker_pins[0] = 0x14;
11673 spec->automute = 1;
11674 spec->automute_mode = ALC_AUTOMUTE_AMP;
11476} 11675}
11477 11676
11478 11677
11479static struct snd_kcontrol_new alc262_sony_mixer[] = { 11678static const struct snd_kcontrol_new alc262_sony_mixer[] = {
11480 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 11679 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11481 ALC262_HIPPO_MASTER_SWITCH, 11680 ALC262_HIPPO_MASTER_SWITCH,
11482 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 11681 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
@@ -11486,7 +11685,7 @@ static struct snd_kcontrol_new alc262_sony_mixer[] = {
11486 { } /* end */ 11685 { } /* end */
11487}; 11686};
11488 11687
11489static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { 11688static const struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
11490 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 11689 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11491 ALC262_HIPPO_MASTER_SWITCH, 11690 ALC262_HIPPO_MASTER_SWITCH,
11492 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), 11691 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
@@ -11497,7 +11696,7 @@ static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
11497 { } /* end */ 11696 { } /* end */
11498}; 11697};
11499 11698
11500static struct snd_kcontrol_new alc262_tyan_mixer[] = { 11699static const struct snd_kcontrol_new alc262_tyan_mixer[] = {
11501 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 11700 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11502 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), 11701 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11503 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), 11702 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
@@ -11513,7 +11712,7 @@ static struct snd_kcontrol_new alc262_tyan_mixer[] = {
11513 { } /* end */ 11712 { } /* end */
11514}; 11713};
11515 11714
11516static struct hda_verb alc262_tyan_verbs[] = { 11715static const struct hda_verb alc262_tyan_verbs[] = {
11517 /* Headphone automute */ 11716 /* Headphone automute */
11518 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, 11717 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11519 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 11718 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
@@ -11535,6 +11734,8 @@ static void alc262_tyan_setup(struct hda_codec *codec)
11535 11734
11536 spec->autocfg.hp_pins[0] = 0x1b; 11735 spec->autocfg.hp_pins[0] = 0x1b;
11537 spec->autocfg.speaker_pins[0] = 0x15; 11736 spec->autocfg.speaker_pins[0] = 0x15;
11737 spec->automute = 1;
11738 spec->automute_mode = ALC_AUTOMUTE_AMP;
11538} 11739}
11539 11740
11540 11741
@@ -11544,7 +11745,7 @@ static void alc262_tyan_setup(struct hda_codec *codec)
11544/* 11745/*
11545 * generic initialization of ADC, input mixers and output mixers 11746 * generic initialization of ADC, input mixers and output mixers
11546 */ 11747 */
11547static struct hda_verb alc262_init_verbs[] = { 11748static const struct hda_verb alc262_init_verbs[] = {
11548 /* 11749 /*
11549 * Unmute ADC0-2 and set the default input to mic-in 11750 * Unmute ADC0-2 and set the default input to mic-in
11550 */ 11751 */
@@ -11620,13 +11821,13 @@ static struct hda_verb alc262_init_verbs[] = {
11620 { } 11821 { }
11621}; 11822};
11622 11823
11623static struct hda_verb alc262_eapd_verbs[] = { 11824static const struct hda_verb alc262_eapd_verbs[] = {
11624 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, 11825 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11625 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, 11826 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11626 { } 11827 { }
11627}; 11828};
11628 11829
11629static struct hda_verb alc262_hippo1_unsol_verbs[] = { 11830static const struct hda_verb alc262_hippo1_unsol_verbs[] = {
11630 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, 11831 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11631 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, 11832 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11632 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, 11833 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
@@ -11636,7 +11837,7 @@ static struct hda_verb alc262_hippo1_unsol_verbs[] = {
11636 {} 11837 {}
11637}; 11838};
11638 11839
11639static struct hda_verb alc262_sony_unsol_verbs[] = { 11840static const struct hda_verb alc262_sony_unsol_verbs[] = {
11640 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, 11841 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11641 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, 11842 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11642 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic 11843 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
@@ -11646,7 +11847,7 @@ static struct hda_verb alc262_sony_unsol_verbs[] = {
11646 {} 11847 {}
11647}; 11848};
11648 11849
11649static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { 11850static const struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
11650 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 11851 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11651 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), 11852 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11652 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), 11853 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
@@ -11655,7 +11856,7 @@ static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
11655 { } /* end */ 11856 { } /* end */
11656}; 11857};
11657 11858
11658static struct hda_verb alc262_toshiba_s06_verbs[] = { 11859static const struct hda_verb alc262_toshiba_s06_verbs[] = {
11659 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 11860 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11660 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 11861 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11661 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 11862 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
@@ -11678,6 +11879,8 @@ static void alc262_toshiba_s06_setup(struct hda_codec *codec)
11678 spec->int_mic.pin = 0x12; 11879 spec->int_mic.pin = 0x12;
11679 spec->int_mic.mux_idx = 9; 11880 spec->int_mic.mux_idx = 9;
11680 spec->auto_mic = 1; 11881 spec->auto_mic = 1;
11882 spec->automute = 1;
11883 spec->automute_mode = ALC_AUTOMUTE_PIN;
11681} 11884}
11682 11885
11683/* 11886/*
@@ -11687,7 +11890,7 @@ static void alc262_toshiba_s06_setup(struct hda_codec *codec)
11687 * 0x18 = external mic 11890 * 0x18 = external mic
11688 */ 11891 */
11689 11892
11690static struct snd_kcontrol_new alc262_nec_mixer[] = { 11893static const struct snd_kcontrol_new alc262_nec_mixer[] = {
11691 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), 11894 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
11692 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), 11895 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
11693 11896
@@ -11700,7 +11903,7 @@ static struct snd_kcontrol_new alc262_nec_mixer[] = {
11700 { } /* end */ 11903 { } /* end */
11701}; 11904};
11702 11905
11703static struct hda_verb alc262_nec_verbs[] = { 11906static const struct hda_verb alc262_nec_verbs[] = {
11704 /* Unmute Speaker */ 11907 /* Unmute Speaker */
11705 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 11908 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11706 11909
@@ -11723,7 +11926,7 @@ static struct hda_verb alc262_nec_verbs[] = {
11723 11926
11724#define ALC_HP_EVENT 0x37 11927#define ALC_HP_EVENT 0x37
11725 11928
11726static struct hda_verb alc262_fujitsu_unsol_verbs[] = { 11929static const struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11727 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, 11930 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11728 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 11931 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11729 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, 11932 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
@@ -11731,20 +11934,20 @@ static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11731 {} 11934 {}
11732}; 11935};
11733 11936
11734static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { 11937static const struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
11735 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, 11938 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11736 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 11939 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11737 {} 11940 {}
11738}; 11941};
11739 11942
11740static struct hda_verb alc262_lenovo_3000_init_verbs[] = { 11943static const struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11741 /* Front Mic pin: input vref at 50% */ 11944 /* Front Mic pin: input vref at 50% */
11742 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, 11945 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11743 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 11946 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11744 {} 11947 {}
11745}; 11948};
11746 11949
11747static struct hda_input_mux alc262_fujitsu_capture_source = { 11950static const struct hda_input_mux alc262_fujitsu_capture_source = {
11748 .num_items = 3, 11951 .num_items = 3,
11749 .items = { 11952 .items = {
11750 { "Mic", 0x0 }, 11953 { "Mic", 0x0 },
@@ -11753,7 +11956,7 @@ static struct hda_input_mux alc262_fujitsu_capture_source = {
11753 }, 11956 },
11754}; 11957};
11755 11958
11756static struct hda_input_mux alc262_HP_capture_source = { 11959static const struct hda_input_mux alc262_HP_capture_source = {
11757 .num_items = 5, 11960 .num_items = 5,
11758 .items = { 11961 .items = {
11759 { "Mic", 0x0 }, 11962 { "Mic", 0x0 },
@@ -11764,7 +11967,7 @@ static struct hda_input_mux alc262_HP_capture_source = {
11764 }, 11967 },
11765}; 11968};
11766 11969
11767static struct hda_input_mux alc262_HP_D7000_capture_source = { 11970static const struct hda_input_mux alc262_HP_D7000_capture_source = {
11768 .num_items = 4, 11971 .num_items = 4,
11769 .items = { 11972 .items = {
11770 { "Mic", 0x0 }, 11973 { "Mic", 0x0 },
@@ -11774,44 +11977,19 @@ static struct hda_input_mux alc262_HP_D7000_capture_source = {
11774 }, 11977 },
11775}; 11978};
11776 11979
11777/* mute/unmute internal speaker according to the hp jacks and mute state */ 11980static void alc262_fujitsu_setup(struct hda_codec *codec)
11778static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
11779{ 11981{
11780 struct alc_spec *spec = codec->spec; 11982 struct alc_spec *spec = codec->spec;
11781 unsigned int mute;
11782
11783 if (force || !spec->sense_updated) {
11784 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
11785 snd_hda_jack_detect(codec, 0x1b);
11786 spec->sense_updated = 1;
11787 }
11788 /* unmute internal speaker only if both HPs are unplugged and
11789 * master switch is on
11790 */
11791 if (spec->jack_present)
11792 mute = HDA_AMP_MUTE;
11793 else
11794 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11795 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11796 HDA_AMP_MUTE, mute);
11797}
11798
11799/* unsolicited event for HP jack sensing */
11800static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
11801 unsigned int res)
11802{
11803 if ((res >> 26) != ALC_HP_EVENT)
11804 return;
11805 alc262_fujitsu_automute(codec, 1);
11806}
11807 11983
11808static void alc262_fujitsu_init_hook(struct hda_codec *codec) 11984 spec->autocfg.hp_pins[0] = 0x14;
11809{ 11985 spec->autocfg.hp_pins[1] = 0x1b;
11810 alc262_fujitsu_automute(codec, 1); 11986 spec->autocfg.speaker_pins[0] = 0x15;
11987 spec->automute = 1;
11988 spec->automute_mode = ALC_AUTOMUTE_AMP;
11811} 11989}
11812 11990
11813/* bind volumes of both NID 0x0c and 0x0d */ 11991/* bind volumes of both NID 0x0c and 0x0d */
11814static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { 11992static const struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11815 .ops = &snd_hda_bind_vol, 11993 .ops = &snd_hda_bind_vol,
11816 .values = { 11994 .values = {
11817 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), 11995 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
@@ -11820,78 +11998,15 @@ static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11820 }, 11998 },
11821}; 11999};
11822 12000
11823/* mute/unmute internal speaker according to the hp jack and mute state */ 12001static const struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11824static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
11825{
11826 struct alc_spec *spec = codec->spec;
11827 unsigned int mute;
11828
11829 if (force || !spec->sense_updated) {
11830 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11831 spec->sense_updated = 1;
11832 }
11833 if (spec->jack_present) {
11834 /* mute internal speaker */
11835 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11836 HDA_AMP_MUTE, HDA_AMP_MUTE);
11837 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11838 HDA_AMP_MUTE, HDA_AMP_MUTE);
11839 } else {
11840 /* unmute internal speaker if necessary */
11841 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
11842 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11843 HDA_AMP_MUTE, mute);
11844 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11845 HDA_AMP_MUTE, mute);
11846 }
11847}
11848
11849/* unsolicited event for HP jack sensing */
11850static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
11851 unsigned int res)
11852{
11853 if ((res >> 26) != ALC_HP_EVENT)
11854 return;
11855 alc262_lenovo_3000_automute(codec, 1);
11856}
11857
11858static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
11859 int dir, int idx, long *valp)
11860{
11861 int i, change = 0;
11862
11863 for (i = 0; i < 2; i++, valp++)
11864 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
11865 HDA_AMP_MUTE,
11866 *valp ? 0 : HDA_AMP_MUTE);
11867 return change;
11868}
11869
11870/* bind hp and internal speaker mute (with plug check) */
11871static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
11872 struct snd_ctl_elem_value *ucontrol)
11873{
11874 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11875 long *valp = ucontrol->value.integer.value;
11876 int change;
11877
11878 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11879 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11880 if (change)
11881 alc262_fujitsu_automute(codec, 0);
11882 return change;
11883}
11884
11885static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11886 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), 12002 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11887 { 12003 {
11888 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 12004 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11889 .name = "Master Playback Switch", 12005 .name = "Master Playback Switch",
11890 .subdevice = HDA_SUBDEV_AMP_FLAG, 12006 .subdevice = HDA_SUBDEV_NID_FLAG | 0x14,
11891 .info = snd_hda_mixer_amp_switch_info, 12007 .info = snd_ctl_boolean_mono_info,
11892 .get = snd_hda_mixer_amp_switch_get, 12008 .get = alc262_hp_master_sw_get,
11893 .put = alc262_fujitsu_master_sw_put, 12009 .put = alc262_hp_master_sw_put,
11894 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11895 }, 12010 },
11896 { 12011 {
11897 .iface = NID_MAPPING, 12012 .iface = NID_MAPPING,
@@ -11909,30 +12024,26 @@ static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11909 { } /* end */ 12024 { } /* end */
11910}; 12025};
11911 12026
11912/* bind hp and internal speaker mute (with plug check) */ 12027static void alc262_lenovo_3000_setup(struct hda_codec *codec)
11913static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11914 struct snd_ctl_elem_value *ucontrol)
11915{ 12028{
11916 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 12029 struct alc_spec *spec = codec->spec;
11917 long *valp = ucontrol->value.integer.value;
11918 int change;
11919 12030
11920 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); 12031 spec->autocfg.hp_pins[0] = 0x1b;
11921 if (change) 12032 spec->autocfg.speaker_pins[0] = 0x14;
11922 alc262_lenovo_3000_automute(codec, 0); 12033 spec->autocfg.speaker_pins[1] = 0x16;
11923 return change; 12034 spec->automute = 1;
12035 spec->automute_mode = ALC_AUTOMUTE_AMP;
11924} 12036}
11925 12037
11926static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { 12038static const struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11927 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), 12039 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11928 { 12040 {
11929 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 12041 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11930 .name = "Master Playback Switch", 12042 .name = "Master Playback Switch",
11931 .subdevice = HDA_SUBDEV_AMP_FLAG, 12043 .subdevice = HDA_SUBDEV_NID_FLAG | 0x1b,
11932 .info = snd_hda_mixer_amp_switch_info, 12044 .info = snd_ctl_boolean_mono_info,
11933 .get = snd_hda_mixer_amp_switch_get, 12045 .get = alc262_hp_master_sw_get,
11934 .put = alc262_lenovo_3000_master_sw_put, 12046 .put = alc262_hp_master_sw_put,
11935 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11936 }, 12047 },
11937 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 12048 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11938 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 12049 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
@@ -11945,7 +12056,7 @@ static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11945 { } /* end */ 12056 { } /* end */
11946}; 12057};
11947 12058
11948static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { 12059static const struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11949 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), 12060 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11950 ALC262_HIPPO_MASTER_SWITCH, 12061 ALC262_HIPPO_MASTER_SWITCH,
11951 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 12062 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
@@ -11958,13 +12069,13 @@ static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11958}; 12069};
11959 12070
11960/* additional init verbs for Benq laptops */ 12071/* additional init verbs for Benq laptops */
11961static struct hda_verb alc262_EAPD_verbs[] = { 12072static const struct hda_verb alc262_EAPD_verbs[] = {
11962 {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, 12073 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11963 {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, 12074 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11964 {} 12075 {}
11965}; 12076};
11966 12077
11967static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { 12078static const struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11968 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, 12079 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11969 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, 12080 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11970 12081
@@ -11974,7 +12085,7 @@ static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11974}; 12085};
11975 12086
11976/* Samsung Q1 Ultra Vista model setup */ 12087/* Samsung Q1 Ultra Vista model setup */
11977static struct snd_kcontrol_new alc262_ultra_mixer[] = { 12088static const struct snd_kcontrol_new alc262_ultra_mixer[] = {
11978 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 12089 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11979 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), 12090 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11980 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), 12091 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
@@ -11984,7 +12095,7 @@ static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11984 { } /* end */ 12095 { } /* end */
11985}; 12096};
11986 12097
11987static struct hda_verb alc262_ultra_verbs[] = { 12098static const struct hda_verb alc262_ultra_verbs[] = {
11988 /* output mixer */ 12099 /* output mixer */
11989 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 12100 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11990 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 12101 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
@@ -12047,7 +12158,7 @@ static void alc262_ultra_unsol_event(struct hda_codec *codec,
12047 alc262_ultra_automute(codec); 12158 alc262_ultra_automute(codec);
12048} 12159}
12049 12160
12050static struct hda_input_mux alc262_ultra_capture_source = { 12161static const struct hda_input_mux alc262_ultra_capture_source = {
12051 .num_items = 2, 12162 .num_items = 2,
12052 .items = { 12163 .items = {
12053 { "Mic", 0x1 }, 12164 { "Mic", 0x1 },
@@ -12073,7 +12184,7 @@ static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
12073 return ret; 12184 return ret;
12074} 12185}
12075 12186
12076static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { 12187static const struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
12077 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), 12188 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
12078 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), 12189 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
12079 { 12190 {
@@ -12148,9 +12259,9 @@ static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
12148 12259
12149 spec->multiout.num_dacs = 1; /* only use one dac */ 12260 spec->multiout.num_dacs = 1; /* only use one dac */
12150 spec->multiout.dac_nids = spec->private_dac_nids; 12261 spec->multiout.dac_nids = spec->private_dac_nids;
12151 spec->multiout.dac_nids[0] = 2; 12262 spec->private_dac_nids[0] = 2;
12152 12263
12153 pfx = alc_get_line_out_pfx(cfg, true); 12264 pfx = alc_get_line_out_pfx(spec, true);
12154 if (!pfx) 12265 if (!pfx)
12155 pfx = "Front"; 12266 pfx = "Front";
12156 for (i = 0; i < 2; i++) { 12267 for (i = 0; i < 2; i++) {
@@ -12204,7 +12315,7 @@ static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
12204/* 12315/*
12205 * generic initialization of ADC, input mixers and output mixers 12316 * generic initialization of ADC, input mixers and output mixers
12206 */ 12317 */
12207static struct hda_verb alc262_volume_init_verbs[] = { 12318static const struct hda_verb alc262_volume_init_verbs[] = {
12208 /* 12319 /*
12209 * Unmute ADC0-2 and set the default input to mic-in 12320 * Unmute ADC0-2 and set the default input to mic-in
12210 */ 12321 */
@@ -12265,7 +12376,7 @@ static struct hda_verb alc262_volume_init_verbs[] = {
12265 { } 12376 { }
12266}; 12377};
12267 12378
12268static struct hda_verb alc262_HP_BPC_init_verbs[] = { 12379static const struct hda_verb alc262_HP_BPC_init_verbs[] = {
12269 /* 12380 /*
12270 * Unmute ADC0-2 and set the default input to mic-in 12381 * Unmute ADC0-2 and set the default input to mic-in
12271 */ 12382 */
@@ -12369,7 +12480,7 @@ static struct hda_verb alc262_HP_BPC_init_verbs[] = {
12369 { } 12480 { }
12370}; 12481};
12371 12482
12372static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { 12483static const struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
12373 /* 12484 /*
12374 * Unmute ADC0-2 and set the default input to mic-in 12485 * Unmute ADC0-2 and set the default input to mic-in
12375 */ 12486 */
@@ -12465,7 +12576,7 @@ static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
12465 { } 12576 { }
12466}; 12577};
12467 12578
12468static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { 12579static const struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
12469 12580
12470 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ 12581 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
12471 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, 12582 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
@@ -12501,7 +12612,7 @@ static const struct alc_fixup alc262_fixups[] = {
12501 }, 12612 },
12502}; 12613};
12503 12614
12504static struct snd_pci_quirk alc262_fixup_tbl[] = { 12615static const struct snd_pci_quirk alc262_fixup_tbl[] = {
12505 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270), 12616 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270),
12506 {} 12617 {}
12507}; 12618};
@@ -12524,7 +12635,7 @@ static int alc262_parse_auto_config(struct hda_codec *codec)
12524{ 12635{
12525 struct alc_spec *spec = codec->spec; 12636 struct alc_spec *spec = codec->spec;
12526 int err; 12637 int err;
12527 static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; 12638 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
12528 12639
12529 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, 12640 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12530 alc262_ignore); 12641 alc262_ignore);
@@ -12609,7 +12720,7 @@ static const char * const alc262_models[ALC262_MODEL_LAST] = {
12609 [ALC262_AUTO] = "auto", 12720 [ALC262_AUTO] = "auto",
12610}; 12721};
12611 12722
12612static struct snd_pci_quirk alc262_cfg_tbl[] = { 12723static const struct snd_pci_quirk alc262_cfg_tbl[] = {
12613 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), 12724 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
12614 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), 12725 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
12615 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", 12726 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
@@ -12661,7 +12772,7 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = {
12661 {} 12772 {}
12662}; 12773};
12663 12774
12664static struct alc_config_preset alc262_presets[] = { 12775static const struct alc_config_preset alc262_presets[] = {
12665 [ALC262_BASIC] = { 12776 [ALC262_BASIC] = {
12666 .mixers = { alc262_base_mixer }, 12777 .mixers = { alc262_base_mixer },
12667 .init_verbs = { alc262_init_verbs }, 12778 .init_verbs = { alc262_init_verbs },
@@ -12682,9 +12793,9 @@ static struct alc_config_preset alc262_presets[] = {
12682 .num_channel_mode = ARRAY_SIZE(alc262_modes), 12793 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12683 .channel_mode = alc262_modes, 12794 .channel_mode = alc262_modes,
12684 .input_mux = &alc262_capture_source, 12795 .input_mux = &alc262_capture_source,
12685 .unsol_event = alc262_hippo_unsol_event, 12796 .unsol_event = alc_sku_unsol_event,
12686 .setup = alc262_hippo_setup, 12797 .setup = alc262_hippo_setup,
12687 .init_hook = alc262_hippo_automute, 12798 .init_hook = alc_inithook,
12688 }, 12799 },
12689 [ALC262_HIPPO_1] = { 12800 [ALC262_HIPPO_1] = {
12690 .mixers = { alc262_hippo1_mixer }, 12801 .mixers = { alc262_hippo1_mixer },
@@ -12696,9 +12807,9 @@ static struct alc_config_preset alc262_presets[] = {
12696 .num_channel_mode = ARRAY_SIZE(alc262_modes), 12807 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12697 .channel_mode = alc262_modes, 12808 .channel_mode = alc262_modes,
12698 .input_mux = &alc262_capture_source, 12809 .input_mux = &alc262_capture_source,
12699 .unsol_event = alc262_hippo_unsol_event, 12810 .unsol_event = alc_sku_unsol_event,
12700 .setup = alc262_hippo1_setup, 12811 .setup = alc262_hippo1_setup,
12701 .init_hook = alc262_hippo_automute, 12812 .init_hook = alc_inithook,
12702 }, 12813 },
12703 [ALC262_FUJITSU] = { 12814 [ALC262_FUJITSU] = {
12704 .mixers = { alc262_fujitsu_mixer }, 12815 .mixers = { alc262_fujitsu_mixer },
@@ -12711,8 +12822,9 @@ static struct alc_config_preset alc262_presets[] = {
12711 .num_channel_mode = ARRAY_SIZE(alc262_modes), 12822 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12712 .channel_mode = alc262_modes, 12823 .channel_mode = alc262_modes,
12713 .input_mux = &alc262_fujitsu_capture_source, 12824 .input_mux = &alc262_fujitsu_capture_source,
12714 .unsol_event = alc262_fujitsu_unsol_event, 12825 .unsol_event = alc_sku_unsol_event,
12715 .init_hook = alc262_fujitsu_init_hook, 12826 .setup = alc262_fujitsu_setup,
12827 .init_hook = alc_inithook,
12716 }, 12828 },
12717 [ALC262_HP_BPC] = { 12829 [ALC262_HP_BPC] = {
12718 .mixers = { alc262_HP_BPC_mixer }, 12830 .mixers = { alc262_HP_BPC_mixer },
@@ -12723,8 +12835,9 @@ static struct alc_config_preset alc262_presets[] = {
12723 .num_channel_mode = ARRAY_SIZE(alc262_modes), 12835 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12724 .channel_mode = alc262_modes, 12836 .channel_mode = alc262_modes,
12725 .input_mux = &alc262_HP_capture_source, 12837 .input_mux = &alc262_HP_capture_source,
12726 .unsol_event = alc262_hp_bpc_unsol_event, 12838 .unsol_event = alc_sku_unsol_event,
12727 .init_hook = alc262_hp_bpc_automute, 12839 .setup = alc262_hp_bpc_setup,
12840 .init_hook = alc_inithook,
12728 }, 12841 },
12729 [ALC262_HP_BPC_D7000_WF] = { 12842 [ALC262_HP_BPC_D7000_WF] = {
12730 .mixers = { alc262_HP_BPC_WildWest_mixer }, 12843 .mixers = { alc262_HP_BPC_WildWest_mixer },
@@ -12735,8 +12848,9 @@ static struct alc_config_preset alc262_presets[] = {
12735 .num_channel_mode = ARRAY_SIZE(alc262_modes), 12848 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12736 .channel_mode = alc262_modes, 12849 .channel_mode = alc262_modes,
12737 .input_mux = &alc262_HP_D7000_capture_source, 12850 .input_mux = &alc262_HP_D7000_capture_source,
12738 .unsol_event = alc262_hp_wildwest_unsol_event, 12851 .unsol_event = alc_sku_unsol_event,
12739 .init_hook = alc262_hp_wildwest_automute, 12852 .setup = alc262_hp_wildwest_setup,
12853 .init_hook = alc_inithook,
12740 }, 12854 },
12741 [ALC262_HP_BPC_D7000_WL] = { 12855 [ALC262_HP_BPC_D7000_WL] = {
12742 .mixers = { alc262_HP_BPC_WildWest_mixer, 12856 .mixers = { alc262_HP_BPC_WildWest_mixer,
@@ -12748,8 +12862,9 @@ static struct alc_config_preset alc262_presets[] = {
12748 .num_channel_mode = ARRAY_SIZE(alc262_modes), 12862 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12749 .channel_mode = alc262_modes, 12863 .channel_mode = alc262_modes,
12750 .input_mux = &alc262_HP_D7000_capture_source, 12864 .input_mux = &alc262_HP_D7000_capture_source,
12751 .unsol_event = alc262_hp_wildwest_unsol_event, 12865 .unsol_event = alc_sku_unsol_event,
12752 .init_hook = alc262_hp_wildwest_automute, 12866 .setup = alc262_hp_wildwest_setup,
12867 .init_hook = alc_inithook,
12753 }, 12868 },
12754 [ALC262_HP_TC_T5735] = { 12869 [ALC262_HP_TC_T5735] = {
12755 .mixers = { alc262_hp_t5735_mixer }, 12870 .mixers = { alc262_hp_t5735_mixer },
@@ -12792,9 +12907,9 @@ static struct alc_config_preset alc262_presets[] = {
12792 .num_channel_mode = ARRAY_SIZE(alc262_modes), 12907 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12793 .channel_mode = alc262_modes, 12908 .channel_mode = alc262_modes,
12794 .input_mux = &alc262_capture_source, 12909 .input_mux = &alc262_capture_source,
12795 .unsol_event = alc262_hippo_unsol_event, 12910 .unsol_event = alc_sku_unsol_event,
12796 .setup = alc262_hippo_setup, 12911 .setup = alc262_hippo_setup,
12797 .init_hook = alc262_hippo_automute, 12912 .init_hook = alc_inithook,
12798 }, 12913 },
12799 [ALC262_BENQ_T31] = { 12914 [ALC262_BENQ_T31] = {
12800 .mixers = { alc262_benq_t31_mixer }, 12915 .mixers = { alc262_benq_t31_mixer },
@@ -12806,9 +12921,9 @@ static struct alc_config_preset alc262_presets[] = {
12806 .num_channel_mode = ARRAY_SIZE(alc262_modes), 12921 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12807 .channel_mode = alc262_modes, 12922 .channel_mode = alc262_modes,
12808 .input_mux = &alc262_capture_source, 12923 .input_mux = &alc262_capture_source,
12809 .unsol_event = alc262_hippo_unsol_event, 12924 .unsol_event = alc_sku_unsol_event,
12810 .setup = alc262_hippo_setup, 12925 .setup = alc262_hippo_setup,
12811 .init_hook = alc262_hippo_automute, 12926 .init_hook = alc_inithook,
12812 }, 12927 },
12813 [ALC262_ULTRA] = { 12928 [ALC262_ULTRA] = {
12814 .mixers = { alc262_ultra_mixer }, 12929 .mixers = { alc262_ultra_mixer },
@@ -12837,7 +12952,9 @@ static struct alc_config_preset alc262_presets[] = {
12837 .num_channel_mode = ARRAY_SIZE(alc262_modes), 12952 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12838 .channel_mode = alc262_modes, 12953 .channel_mode = alc262_modes,
12839 .input_mux = &alc262_fujitsu_capture_source, 12954 .input_mux = &alc262_fujitsu_capture_source,
12840 .unsol_event = alc262_lenovo_3000_unsol_event, 12955 .unsol_event = alc_sku_unsol_event,
12956 .setup = alc262_lenovo_3000_setup,
12957 .init_hook = alc_inithook,
12841 }, 12958 },
12842 [ALC262_NEC] = { 12959 [ALC262_NEC] = {
12843 .mixers = { alc262_nec_mixer }, 12960 .mixers = { alc262_nec_mixer },
@@ -12874,9 +12991,9 @@ static struct alc_config_preset alc262_presets[] = {
12874 .num_channel_mode = ARRAY_SIZE(alc262_modes), 12991 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12875 .channel_mode = alc262_modes, 12992 .channel_mode = alc262_modes,
12876 .input_mux = &alc262_capture_source, 12993 .input_mux = &alc262_capture_source,
12877 .unsol_event = alc262_hippo_unsol_event, 12994 .unsol_event = alc_sku_unsol_event,
12878 .setup = alc262_hippo_setup, 12995 .setup = alc262_hippo_setup,
12879 .init_hook = alc262_hippo_automute, 12996 .init_hook = alc_inithook,
12880 }, 12997 },
12881 [ALC262_TYAN] = { 12998 [ALC262_TYAN] = {
12882 .mixers = { alc262_tyan_mixer }, 12999 .mixers = { alc262_tyan_mixer },
@@ -12888,9 +13005,9 @@ static struct alc_config_preset alc262_presets[] = {
12888 .num_channel_mode = ARRAY_SIZE(alc262_modes), 13005 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12889 .channel_mode = alc262_modes, 13006 .channel_mode = alc262_modes,
12890 .input_mux = &alc262_capture_source, 13007 .input_mux = &alc262_capture_source,
12891 .unsol_event = alc_automute_amp_unsol_event, 13008 .unsol_event = alc_sku_unsol_event,
12892 .setup = alc262_tyan_setup, 13009 .setup = alc262_tyan_setup,
12893 .init_hook = alc_automute_amp, 13010 .init_hook = alc_hp_automute,
12894 }, 13011 },
12895}; 13012};
12896 13013
@@ -13011,6 +13128,7 @@ static int patch_alc262(struct hda_codec *codec)
13011 codec->patch_ops = alc_patch_ops; 13128 codec->patch_ops = alc_patch_ops;
13012 if (board_config == ALC262_AUTO) 13129 if (board_config == ALC262_AUTO)
13013 spec->init_hook = alc262_auto_init; 13130 spec->init_hook = alc262_auto_init;
13131 spec->shutup = alc_eapd_shutup;
13014 13132
13015 alc_init_jacks(codec); 13133 alc_init_jacks(codec);
13016#ifdef CONFIG_SND_HDA_POWER_SAVE 13134#ifdef CONFIG_SND_HDA_POWER_SAVE
@@ -13027,24 +13145,24 @@ static int patch_alc262(struct hda_codec *codec)
13027#define ALC268_DIGOUT_NID ALC880_DIGOUT_NID 13145#define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
13028#define alc268_modes alc260_modes 13146#define alc268_modes alc260_modes
13029 13147
13030static hda_nid_t alc268_dac_nids[2] = { 13148static const hda_nid_t alc268_dac_nids[2] = {
13031 /* front, hp */ 13149 /* front, hp */
13032 0x02, 0x03 13150 0x02, 0x03
13033}; 13151};
13034 13152
13035static hda_nid_t alc268_adc_nids[2] = { 13153static const hda_nid_t alc268_adc_nids[2] = {
13036 /* ADC0-1 */ 13154 /* ADC0-1 */
13037 0x08, 0x07 13155 0x08, 0x07
13038}; 13156};
13039 13157
13040static hda_nid_t alc268_adc_nids_alt[1] = { 13158static const hda_nid_t alc268_adc_nids_alt[1] = {
13041 /* ADC0 */ 13159 /* ADC0 */
13042 0x08 13160 0x08
13043}; 13161};
13044 13162
13045static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; 13163static const hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
13046 13164
13047static struct snd_kcontrol_new alc268_base_mixer[] = { 13165static const struct snd_kcontrol_new alc268_base_mixer[] = {
13048 /* output mixer control */ 13166 /* output mixer control */
13049 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), 13167 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13050 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), 13168 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
@@ -13056,7 +13174,7 @@ static struct snd_kcontrol_new alc268_base_mixer[] = {
13056 { } 13174 { }
13057}; 13175};
13058 13176
13059static struct snd_kcontrol_new alc268_toshiba_mixer[] = { 13177static const struct snd_kcontrol_new alc268_toshiba_mixer[] = {
13060 /* output mixer control */ 13178 /* output mixer control */
13061 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), 13179 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13062 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), 13180 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
@@ -13068,7 +13186,7 @@ static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
13068}; 13186};
13069 13187
13070/* bind Beep switches of both NID 0x0f and 0x10 */ 13188/* bind Beep switches of both NID 0x0f and 0x10 */
13071static struct hda_bind_ctls alc268_bind_beep_sw = { 13189static const struct hda_bind_ctls alc268_bind_beep_sw = {
13072 .ops = &snd_hda_bind_sw, 13190 .ops = &snd_hda_bind_sw,
13073 .values = { 13191 .values = {
13074 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), 13192 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
@@ -13077,27 +13195,27 @@ static struct hda_bind_ctls alc268_bind_beep_sw = {
13077 }, 13195 },
13078}; 13196};
13079 13197
13080static struct snd_kcontrol_new alc268_beep_mixer[] = { 13198static const struct snd_kcontrol_new alc268_beep_mixer[] = {
13081 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), 13199 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
13082 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), 13200 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
13083 { } 13201 { }
13084}; 13202};
13085 13203
13086static struct hda_verb alc268_eapd_verbs[] = { 13204static const struct hda_verb alc268_eapd_verbs[] = {
13087 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, 13205 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13088 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, 13206 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13089 { } 13207 { }
13090}; 13208};
13091 13209
13092/* Toshiba specific */ 13210/* Toshiba specific */
13093static struct hda_verb alc268_toshiba_verbs[] = { 13211static const struct hda_verb alc268_toshiba_verbs[] = {
13094 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, 13212 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13095 { } /* end */ 13213 { } /* end */
13096}; 13214};
13097 13215
13098/* Acer specific */ 13216/* Acer specific */
13099/* bind volumes of both NID 0x02 and 0x03 */ 13217/* bind volumes of both NID 0x02 and 0x03 */
13100static struct hda_bind_ctls alc268_acer_bind_master_vol = { 13218static const struct hda_bind_ctls alc268_acer_bind_master_vol = {
13101 .ops = &snd_hda_bind_vol, 13219 .ops = &snd_hda_bind_vol,
13102 .values = { 13220 .values = {
13103 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), 13221 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
@@ -13106,66 +13224,44 @@ static struct hda_bind_ctls alc268_acer_bind_master_vol = {
13106 }, 13224 },
13107}; 13225};
13108 13226
13109/* mute/unmute internal speaker according to the hp jack and mute state */ 13227static void alc268_acer_setup(struct hda_codec *codec)
13110static void alc268_acer_automute(struct hda_codec *codec, int force)
13111{ 13228{
13112 struct alc_spec *spec = codec->spec; 13229 struct alc_spec *spec = codec->spec;
13113 unsigned int mute;
13114 13230
13115 if (force || !spec->sense_updated) { 13231 spec->autocfg.hp_pins[0] = 0x14;
13116 spec->jack_present = snd_hda_jack_detect(codec, 0x14); 13232 spec->autocfg.speaker_pins[0] = 0x15;
13117 spec->sense_updated = 1; 13233 spec->automute = 1;
13118 } 13234 spec->automute_mode = ALC_AUTOMUTE_AMP;
13119 if (spec->jack_present)
13120 mute = HDA_AMP_MUTE; /* mute internal speaker */
13121 else /* unmute internal speaker if necessary */
13122 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
13123 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13124 HDA_AMP_MUTE, mute);
13125} 13235}
13126 13236
13237#define alc268_acer_master_sw_get alc262_hp_master_sw_get
13238#define alc268_acer_master_sw_put alc262_hp_master_sw_put
13127 13239
13128/* bind hp and internal speaker mute (with plug check) */ 13240static const struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
13129static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
13130 struct snd_ctl_elem_value *ucontrol)
13131{
13132 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
13133 long *valp = ucontrol->value.integer.value;
13134 int change;
13135
13136 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
13137 if (change)
13138 alc268_acer_automute(codec, 0);
13139 return change;
13140}
13141
13142static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
13143 /* output mixer control */ 13241 /* output mixer control */
13144 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), 13242 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13145 { 13243 {
13146 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 13244 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13147 .name = "Master Playback Switch", 13245 .name = "Master Playback Switch",
13148 .subdevice = HDA_SUBDEV_AMP_FLAG, 13246 .subdevice = HDA_SUBDEV_NID_FLAG | 0x15,
13149 .info = snd_hda_mixer_amp_switch_info, 13247 .info = snd_ctl_boolean_mono_info,
13150 .get = snd_hda_mixer_amp_switch_get, 13248 .get = alc268_acer_master_sw_get,
13151 .put = alc268_acer_master_sw_put, 13249 .put = alc268_acer_master_sw_put,
13152 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13153 }, 13250 },
13154 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), 13251 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
13155 { } 13252 { }
13156}; 13253};
13157 13254
13158static struct snd_kcontrol_new alc268_acer_mixer[] = { 13255static const struct snd_kcontrol_new alc268_acer_mixer[] = {
13159 /* output mixer control */ 13256 /* output mixer control */
13160 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), 13257 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13161 { 13258 {
13162 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 13259 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13163 .name = "Master Playback Switch", 13260 .name = "Master Playback Switch",
13164 .subdevice = HDA_SUBDEV_AMP_FLAG, 13261 .subdevice = HDA_SUBDEV_NID_FLAG | 0x14,
13165 .info = snd_hda_mixer_amp_switch_info, 13262 .info = snd_ctl_boolean_mono_info,
13166 .get = snd_hda_mixer_amp_switch_get, 13263 .get = alc268_acer_master_sw_get,
13167 .put = alc268_acer_master_sw_put, 13264 .put = alc268_acer_master_sw_put,
13168 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13169 }, 13265 },
13170 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), 13266 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13171 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), 13267 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
@@ -13173,24 +13269,23 @@ static struct snd_kcontrol_new alc268_acer_mixer[] = {
13173 { } 13269 { }
13174}; 13270};
13175 13271
13176static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { 13272static const struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
13177 /* output mixer control */ 13273 /* output mixer control */
13178 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), 13274 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13179 { 13275 {
13180 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 13276 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13181 .name = "Master Playback Switch", 13277 .name = "Master Playback Switch",
13182 .subdevice = HDA_SUBDEV_AMP_FLAG, 13278 .subdevice = HDA_SUBDEV_NID_FLAG | 0x14,
13183 .info = snd_hda_mixer_amp_switch_info, 13279 .info = snd_ctl_boolean_mono_info,
13184 .get = snd_hda_mixer_amp_switch_get, 13280 .get = alc268_acer_master_sw_get,
13185 .put = alc268_acer_master_sw_put, 13281 .put = alc268_acer_master_sw_put,
13186 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13187 }, 13282 },
13188 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), 13283 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13189 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT), 13284 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13190 { } 13285 { }
13191}; 13286};
13192 13287
13193static struct hda_verb alc268_acer_aspire_one_verbs[] = { 13288static const struct hda_verb alc268_acer_aspire_one_verbs[] = {
13194 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 13289 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13195 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 13290 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13196 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, 13291 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
@@ -13200,7 +13295,7 @@ static struct hda_verb alc268_acer_aspire_one_verbs[] = {
13200 { } 13295 { }
13201}; 13296};
13202 13297
13203static struct hda_verb alc268_acer_verbs[] = { 13298static const struct hda_verb alc268_acer_verbs[] = {
13204 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ 13299 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
13205 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 13300 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13206 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 13301 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
@@ -13212,53 +13307,16 @@ static struct hda_verb alc268_acer_verbs[] = {
13212}; 13307};
13213 13308
13214/* unsolicited event for HP jack sensing */ 13309/* unsolicited event for HP jack sensing */
13215#define alc268_toshiba_unsol_event alc262_hippo_unsol_event
13216#define alc268_toshiba_setup alc262_hippo_setup 13310#define alc268_toshiba_setup alc262_hippo_setup
13217#define alc268_toshiba_automute alc262_hippo_automute
13218
13219static void alc268_acer_unsol_event(struct hda_codec *codec,
13220 unsigned int res)
13221{
13222 if ((res >> 26) != ALC880_HP_EVENT)
13223 return;
13224 alc268_acer_automute(codec, 1);
13225}
13226
13227static void alc268_acer_init_hook(struct hda_codec *codec)
13228{
13229 alc268_acer_automute(codec, 1);
13230}
13231
13232/* toggle speaker-output according to the hp-jack state */
13233static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
13234{
13235 unsigned int present;
13236 unsigned char bits;
13237
13238 present = snd_hda_jack_detect(codec, 0x15);
13239 bits = present ? HDA_AMP_MUTE : 0;
13240 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
13241 HDA_AMP_MUTE, bits);
13242 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
13243 HDA_AMP_MUTE, bits);
13244}
13245
13246static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
13247 unsigned int res)
13248{
13249 switch (res >> 26) {
13250 case ALC880_HP_EVENT:
13251 alc268_aspire_one_speaker_automute(codec);
13252 break;
13253 case ALC880_MIC_EVENT:
13254 alc_mic_automute(codec);
13255 break;
13256 }
13257}
13258 13311
13259static void alc268_acer_lc_setup(struct hda_codec *codec) 13312static void alc268_acer_lc_setup(struct hda_codec *codec)
13260{ 13313{
13261 struct alc_spec *spec = codec->spec; 13314 struct alc_spec *spec = codec->spec;
13315 spec->autocfg.hp_pins[0] = 0x15;
13316 spec->autocfg.speaker_pins[0] = 0x14;
13317 spec->automute_mixer_nid[0] = 0x0f;
13318 spec->automute = 1;
13319 spec->automute_mode = ALC_AUTOMUTE_MIXER;
13262 spec->ext_mic.pin = 0x18; 13320 spec->ext_mic.pin = 0x18;
13263 spec->ext_mic.mux_idx = 0; 13321 spec->ext_mic.mux_idx = 0;
13264 spec->int_mic.pin = 0x12; 13322 spec->int_mic.pin = 0x12;
@@ -13266,13 +13324,7 @@ static void alc268_acer_lc_setup(struct hda_codec *codec)
13266 spec->auto_mic = 1; 13324 spec->auto_mic = 1;
13267} 13325}
13268 13326
13269static void alc268_acer_lc_init_hook(struct hda_codec *codec) 13327static const struct snd_kcontrol_new alc268_dell_mixer[] = {
13270{
13271 alc268_aspire_one_speaker_automute(codec);
13272 alc_mic_automute(codec);
13273}
13274
13275static struct snd_kcontrol_new alc268_dell_mixer[] = {
13276 /* output mixer control */ 13328 /* output mixer control */
13277 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), 13329 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13278 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), 13330 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
@@ -13283,7 +13335,7 @@ static struct snd_kcontrol_new alc268_dell_mixer[] = {
13283 { } 13335 { }
13284}; 13336};
13285 13337
13286static struct hda_verb alc268_dell_verbs[] = { 13338static const struct hda_verb alc268_dell_verbs[] = {
13287 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 13339 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13288 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 13340 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13289 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, 13341 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
@@ -13303,9 +13355,11 @@ static void alc268_dell_setup(struct hda_codec *codec)
13303 spec->int_mic.pin = 0x19; 13355 spec->int_mic.pin = 0x19;
13304 spec->int_mic.mux_idx = 1; 13356 spec->int_mic.mux_idx = 1;
13305 spec->auto_mic = 1; 13357 spec->auto_mic = 1;
13358 spec->automute = 1;
13359 spec->automute_mode = ALC_AUTOMUTE_PIN;
13306} 13360}
13307 13361
13308static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { 13362static const struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
13309 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), 13363 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13310 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), 13364 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13311 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), 13365 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
@@ -13317,7 +13371,7 @@ static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
13317 { } 13371 { }
13318}; 13372};
13319 13373
13320static struct hda_verb alc267_quanta_il1_verbs[] = { 13374static const struct hda_verb alc267_quanta_il1_verbs[] = {
13321 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, 13375 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13322 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, 13376 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13323 { } 13377 { }
@@ -13333,12 +13387,14 @@ static void alc267_quanta_il1_setup(struct hda_codec *codec)
13333 spec->int_mic.pin = 0x19; 13387 spec->int_mic.pin = 0x19;
13334 spec->int_mic.mux_idx = 1; 13388 spec->int_mic.mux_idx = 1;
13335 spec->auto_mic = 1; 13389 spec->auto_mic = 1;
13390 spec->automute = 1;
13391 spec->automute_mode = ALC_AUTOMUTE_PIN;
13336} 13392}
13337 13393
13338/* 13394/*
13339 * generic initialization of ADC, input mixers and output mixers 13395 * generic initialization of ADC, input mixers and output mixers
13340 */ 13396 */
13341static struct hda_verb alc268_base_init_verbs[] = { 13397static const struct hda_verb alc268_base_init_verbs[] = {
13342 /* Unmute DAC0-1 and set vol = 0 */ 13398 /* Unmute DAC0-1 and set vol = 0 */
13343 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 13399 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13344 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 13400 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
@@ -13386,7 +13442,7 @@ static struct hda_verb alc268_base_init_verbs[] = {
13386/* 13442/*
13387 * generic initialization of ADC, input mixers and output mixers 13443 * generic initialization of ADC, input mixers and output mixers
13388 */ 13444 */
13389static struct hda_verb alc268_volume_init_verbs[] = { 13445static const struct hda_verb alc268_volume_init_verbs[] = {
13390 /* set output DAC */ 13446 /* set output DAC */
13391 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 13447 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13392 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 13448 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
@@ -13412,20 +13468,20 @@ static struct hda_verb alc268_volume_init_verbs[] = {
13412 { } 13468 { }
13413}; 13469};
13414 13470
13415static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { 13471static const struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
13416 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), 13472 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13417 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), 13473 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13418 { } /* end */ 13474 { } /* end */
13419}; 13475};
13420 13476
13421static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { 13477static const struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
13422 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), 13478 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13423 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), 13479 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13424 _DEFINE_CAPSRC(1), 13480 _DEFINE_CAPSRC(1),
13425 { } /* end */ 13481 { } /* end */
13426}; 13482};
13427 13483
13428static struct snd_kcontrol_new alc268_capture_mixer[] = { 13484static const struct snd_kcontrol_new alc268_capture_mixer[] = {
13429 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), 13485 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13430 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), 13486 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13431 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), 13487 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
@@ -13434,7 +13490,7 @@ static struct snd_kcontrol_new alc268_capture_mixer[] = {
13434 { } /* end */ 13490 { } /* end */
13435}; 13491};
13436 13492
13437static struct hda_input_mux alc268_capture_source = { 13493static const struct hda_input_mux alc268_capture_source = {
13438 .num_items = 4, 13494 .num_items = 4,
13439 .items = { 13495 .items = {
13440 { "Mic", 0x0 }, 13496 { "Mic", 0x0 },
@@ -13444,7 +13500,7 @@ static struct hda_input_mux alc268_capture_source = {
13444 }, 13500 },
13445}; 13501};
13446 13502
13447static struct hda_input_mux alc268_acer_capture_source = { 13503static const struct hda_input_mux alc268_acer_capture_source = {
13448 .num_items = 3, 13504 .num_items = 3,
13449 .items = { 13505 .items = {
13450 { "Mic", 0x0 }, 13506 { "Mic", 0x0 },
@@ -13453,7 +13509,7 @@ static struct hda_input_mux alc268_acer_capture_source = {
13453 }, 13509 },
13454}; 13510};
13455 13511
13456static struct hda_input_mux alc268_acer_dmic_capture_source = { 13512static const struct hda_input_mux alc268_acer_dmic_capture_source = {
13457 .num_items = 3, 13513 .num_items = 3,
13458 .items = { 13514 .items = {
13459 { "Mic", 0x0 }, 13515 { "Mic", 0x0 },
@@ -13463,7 +13519,7 @@ static struct hda_input_mux alc268_acer_dmic_capture_source = {
13463}; 13519};
13464 13520
13465#ifdef CONFIG_SND_DEBUG 13521#ifdef CONFIG_SND_DEBUG
13466static struct snd_kcontrol_new alc268_test_mixer[] = { 13522static const struct snd_kcontrol_new alc268_test_mixer[] = {
13467 /* Volume widgets */ 13523 /* Volume widgets */
13468 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), 13524 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13469 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), 13525 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
@@ -13542,7 +13598,7 @@ static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
13542 HDA_OUTPUT)); 13598 HDA_OUTPUT));
13543 if (err < 0) 13599 if (err < 0)
13544 return err; 13600 return err;
13545 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; 13601 spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
13546 } 13602 }
13547 13603
13548 if (nid != 0x16) 13604 if (nid != 0x16)
@@ -13715,7 +13771,7 @@ static int alc268_parse_auto_config(struct hda_codec *codec)
13715{ 13771{
13716 struct alc_spec *spec = codec->spec; 13772 struct alc_spec *spec = codec->spec;
13717 int err; 13773 int err;
13718 static hda_nid_t alc268_ignore[] = { 0 }; 13774 static const hda_nid_t alc268_ignore[] = { 0 };
13719 13775
13720 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, 13776 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13721 alc268_ignore); 13777 alc268_ignore);
@@ -13795,7 +13851,7 @@ static const char * const alc268_models[ALC268_MODEL_LAST] = {
13795 [ALC268_AUTO] = "auto", 13851 [ALC268_AUTO] = "auto",
13796}; 13852};
13797 13853
13798static struct snd_pci_quirk alc268_cfg_tbl[] = { 13854static const struct snd_pci_quirk alc268_cfg_tbl[] = {
13799 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), 13855 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13800 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), 13856 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13801 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), 13857 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
@@ -13820,7 +13876,7 @@ static struct snd_pci_quirk alc268_cfg_tbl[] = {
13820}; 13876};
13821 13877
13822/* Toshiba laptops have no unique PCI SSID but only codec SSID */ 13878/* Toshiba laptops have no unique PCI SSID but only codec SSID */
13823static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { 13879static const struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13824 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), 13880 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13825 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), 13881 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13826 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", 13882 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
@@ -13828,7 +13884,7 @@ static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13828 {} 13884 {}
13829}; 13885};
13830 13886
13831static struct alc_config_preset alc268_presets[] = { 13887static const struct alc_config_preset alc268_presets[] = {
13832 [ALC267_QUANTA_IL1] = { 13888 [ALC267_QUANTA_IL1] = {
13833 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, 13889 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13834 alc268_capture_nosrc_mixer }, 13890 alc268_capture_nosrc_mixer },
@@ -13874,9 +13930,9 @@ static struct alc_config_preset alc268_presets[] = {
13874 .num_channel_mode = ARRAY_SIZE(alc268_modes), 13930 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13875 .channel_mode = alc268_modes, 13931 .channel_mode = alc268_modes,
13876 .input_mux = &alc268_capture_source, 13932 .input_mux = &alc268_capture_source,
13877 .unsol_event = alc268_toshiba_unsol_event, 13933 .unsol_event = alc_sku_unsol_event,
13878 .setup = alc268_toshiba_setup, 13934 .setup = alc268_toshiba_setup,
13879 .init_hook = alc268_toshiba_automute, 13935 .init_hook = alc_inithook,
13880 }, 13936 },
13881 [ALC268_ACER] = { 13937 [ALC268_ACER] = {
13882 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, 13938 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
@@ -13892,8 +13948,9 @@ static struct alc_config_preset alc268_presets[] = {
13892 .num_channel_mode = ARRAY_SIZE(alc268_modes), 13948 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13893 .channel_mode = alc268_modes, 13949 .channel_mode = alc268_modes,
13894 .input_mux = &alc268_acer_capture_source, 13950 .input_mux = &alc268_acer_capture_source,
13895 .unsol_event = alc268_acer_unsol_event, 13951 .unsol_event = alc_sku_unsol_event,
13896 .init_hook = alc268_acer_init_hook, 13952 .setup = alc268_acer_setup,
13953 .init_hook = alc_inithook,
13897 }, 13954 },
13898 [ALC268_ACER_DMIC] = { 13955 [ALC268_ACER_DMIC] = {
13899 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, 13956 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
@@ -13909,8 +13966,9 @@ static struct alc_config_preset alc268_presets[] = {
13909 .num_channel_mode = ARRAY_SIZE(alc268_modes), 13966 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13910 .channel_mode = alc268_modes, 13967 .channel_mode = alc268_modes,
13911 .input_mux = &alc268_acer_dmic_capture_source, 13968 .input_mux = &alc268_acer_dmic_capture_source,
13912 .unsol_event = alc268_acer_unsol_event, 13969 .unsol_event = alc_sku_unsol_event,
13913 .init_hook = alc268_acer_init_hook, 13970 .setup = alc268_acer_setup,
13971 .init_hook = alc_inithook,
13914 }, 13972 },
13915 [ALC268_ACER_ASPIRE_ONE] = { 13973 [ALC268_ACER_ASPIRE_ONE] = {
13916 .mixers = { alc268_acer_aspire_one_mixer, 13974 .mixers = { alc268_acer_aspire_one_mixer,
@@ -13926,9 +13984,9 @@ static struct alc_config_preset alc268_presets[] = {
13926 .hp_nid = 0x03, 13984 .hp_nid = 0x03,
13927 .num_channel_mode = ARRAY_SIZE(alc268_modes), 13985 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13928 .channel_mode = alc268_modes, 13986 .channel_mode = alc268_modes,
13929 .unsol_event = alc268_acer_lc_unsol_event, 13987 .unsol_event = alc_sku_unsol_event,
13930 .setup = alc268_acer_lc_setup, 13988 .setup = alc268_acer_lc_setup,
13931 .init_hook = alc268_acer_lc_init_hook, 13989 .init_hook = alc_inithook,
13932 }, 13990 },
13933 [ALC268_DELL] = { 13991 [ALC268_DELL] = {
13934 .mixers = { alc268_dell_mixer, alc268_beep_mixer, 13992 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
@@ -13962,8 +14020,9 @@ static struct alc_config_preset alc268_presets[] = {
13962 .num_channel_mode = ARRAY_SIZE(alc268_modes), 14020 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13963 .channel_mode = alc268_modes, 14021 .channel_mode = alc268_modes,
13964 .input_mux = &alc268_capture_source, 14022 .input_mux = &alc268_capture_source,
14023 .unsol_event = alc_sku_unsol_event,
13965 .setup = alc268_toshiba_setup, 14024 .setup = alc268_toshiba_setup,
13966 .init_hook = alc268_toshiba_automute, 14025 .init_hook = alc_inithook,
13967 }, 14026 },
13968#ifdef CONFIG_SND_DEBUG 14027#ifdef CONFIG_SND_DEBUG
13969 [ALC268_TEST] = { 14028 [ALC268_TEST] = {
@@ -14085,6 +14144,7 @@ static int patch_alc268(struct hda_codec *codec)
14085 codec->patch_ops = alc_patch_ops; 14144 codec->patch_ops = alc_patch_ops;
14086 if (board_config == ALC268_AUTO) 14145 if (board_config == ALC268_AUTO)
14087 spec->init_hook = alc268_auto_init; 14146 spec->init_hook = alc268_auto_init;
14147 spec->shutup = alc_eapd_shutup;
14088 14148
14089 alc_init_jacks(codec); 14149 alc_init_jacks(codec);
14090 14150
@@ -14098,32 +14158,32 @@ static int patch_alc268(struct hda_codec *codec)
14098 14158
14099#define alc269_dac_nids alc260_dac_nids 14159#define alc269_dac_nids alc260_dac_nids
14100 14160
14101static hda_nid_t alc269_adc_nids[1] = { 14161static const hda_nid_t alc269_adc_nids[1] = {
14102 /* ADC1 */ 14162 /* ADC1 */
14103 0x08, 14163 0x08,
14104}; 14164};
14105 14165
14106static hda_nid_t alc269_capsrc_nids[1] = { 14166static const hda_nid_t alc269_capsrc_nids[1] = {
14107 0x23, 14167 0x23,
14108}; 14168};
14109 14169
14110static hda_nid_t alc269vb_adc_nids[1] = { 14170static const hda_nid_t alc269vb_adc_nids[1] = {
14111 /* ADC1 */ 14171 /* ADC1 */
14112 0x09, 14172 0x09,
14113}; 14173};
14114 14174
14115static hda_nid_t alc269vb_capsrc_nids[1] = { 14175static const hda_nid_t alc269vb_capsrc_nids[1] = {
14116 0x22, 14176 0x22,
14117}; 14177};
14118 14178
14119static hda_nid_t alc269_adc_candidates[] = { 14179static const hda_nid_t alc269_adc_candidates[] = {
14120 0x08, 0x09, 0x07, 0x11, 14180 0x08, 0x09, 0x07, 0x11,
14121}; 14181};
14122 14182
14123#define alc269_modes alc260_modes 14183#define alc269_modes alc260_modes
14124#define alc269_capture_source alc880_lg_lw_capture_source 14184#define alc269_capture_source alc880_lg_lw_capture_source
14125 14185
14126static struct snd_kcontrol_new alc269_base_mixer[] = { 14186static const struct snd_kcontrol_new alc269_base_mixer[] = {
14127 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), 14187 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14128 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), 14188 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14129 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), 14189 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
@@ -14139,7 +14199,7 @@ static struct snd_kcontrol_new alc269_base_mixer[] = {
14139 { } /* end */ 14199 { } /* end */
14140}; 14200};
14141 14201
14142static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { 14202static const struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
14143 /* output mixer control */ 14203 /* output mixer control */
14144 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), 14204 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14145 { 14205 {
@@ -14160,7 +14220,7 @@ static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
14160 { } 14220 { }
14161}; 14221};
14162 14222
14163static struct snd_kcontrol_new alc269_lifebook_mixer[] = { 14223static const struct snd_kcontrol_new alc269_lifebook_mixer[] = {
14164 /* output mixer control */ 14224 /* output mixer control */
14165 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), 14225 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14166 { 14226 {
@@ -14184,7 +14244,7 @@ static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
14184 { } 14244 { }
14185}; 14245};
14186 14246
14187static struct snd_kcontrol_new alc269_laptop_mixer[] = { 14247static const struct snd_kcontrol_new alc269_laptop_mixer[] = {
14188 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), 14248 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14189 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), 14249 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14190 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), 14250 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
@@ -14192,7 +14252,7 @@ static struct snd_kcontrol_new alc269_laptop_mixer[] = {
14192 { } /* end */ 14252 { } /* end */
14193}; 14253};
14194 14254
14195static struct snd_kcontrol_new alc269vb_laptop_mixer[] = { 14255static const struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
14196 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), 14256 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14197 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), 14257 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14198 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), 14258 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
@@ -14200,14 +14260,14 @@ static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
14200 { } /* end */ 14260 { } /* end */
14201}; 14261};
14202 14262
14203static struct snd_kcontrol_new alc269_asus_mixer[] = { 14263static const struct snd_kcontrol_new alc269_asus_mixer[] = {
14204 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), 14264 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14205 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT), 14265 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT),
14206 { } /* end */ 14266 { } /* end */
14207}; 14267};
14208 14268
14209/* capture mixer elements */ 14269/* capture mixer elements */
14210static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = { 14270static const struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
14211 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), 14271 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14212 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), 14272 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14213 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), 14273 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
@@ -14215,14 +14275,14 @@ static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
14215 { } /* end */ 14275 { } /* end */
14216}; 14276};
14217 14277
14218static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = { 14278static const struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
14219 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), 14279 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14220 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), 14280 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14221 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), 14281 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14222 { } /* end */ 14282 { } /* end */
14223}; 14283};
14224 14284
14225static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = { 14285static const struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
14226 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), 14286 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14227 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), 14287 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14228 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), 14288 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
@@ -14230,7 +14290,7 @@ static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
14230 { } /* end */ 14290 { } /* end */
14231}; 14291};
14232 14292
14233static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = { 14293static const struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
14234 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), 14294 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14235 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), 14295 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14236 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), 14296 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
@@ -14240,7 +14300,7 @@ static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
14240/* FSC amilo */ 14300/* FSC amilo */
14241#define alc269_fujitsu_mixer alc269_laptop_mixer 14301#define alc269_fujitsu_mixer alc269_laptop_mixer
14242 14302
14243static struct hda_verb alc269_quanta_fl1_verbs[] = { 14303static const struct hda_verb alc269_quanta_fl1_verbs[] = {
14244 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, 14304 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14245 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 14305 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14246 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 14306 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
@@ -14250,7 +14310,7 @@ static struct hda_verb alc269_quanta_fl1_verbs[] = {
14250 { } 14310 { }
14251}; 14311};
14252 14312
14253static struct hda_verb alc269_lifebook_verbs[] = { 14313static const struct hda_verb alc269_lifebook_verbs[] = {
14254 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, 14314 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14255 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, 14315 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
14256 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 14316 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
@@ -14267,15 +14327,7 @@ static struct hda_verb alc269_lifebook_verbs[] = {
14267/* toggle speaker-output according to the hp-jack state */ 14327/* toggle speaker-output according to the hp-jack state */
14268static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) 14328static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
14269{ 14329{
14270 unsigned int present; 14330 alc_hp_automute(codec);
14271 unsigned char bits;
14272
14273 present = snd_hda_jack_detect(codec, 0x15);
14274 bits = present ? HDA_AMP_MUTE : 0;
14275 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14276 HDA_AMP_MUTE, bits);
14277 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14278 HDA_AMP_MUTE, bits);
14279 14331
14280 snd_hda_codec_write(codec, 0x20, 0, 14332 snd_hda_codec_write(codec, 0x20, 0,
14281 AC_VERB_SET_COEF_INDEX, 0x0c); 14333 AC_VERB_SET_COEF_INDEX, 0x0c);
@@ -14288,34 +14340,8 @@ static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
14288 AC_VERB_SET_PROC_COEF, 0x480); 14340 AC_VERB_SET_PROC_COEF, 0x480);
14289} 14341}
14290 14342
14291/* toggle speaker-output according to the hp-jacks state */ 14343#define alc269_lifebook_speaker_automute \
14292static void alc269_lifebook_speaker_automute(struct hda_codec *codec) 14344 alc269_quanta_fl1_speaker_automute
14293{
14294 unsigned int present;
14295 unsigned char bits;
14296
14297 /* Check laptop headphone socket */
14298 present = snd_hda_jack_detect(codec, 0x15);
14299
14300 /* Check port replicator headphone socket */
14301 present |= snd_hda_jack_detect(codec, 0x1a);
14302
14303 bits = present ? HDA_AMP_MUTE : 0;
14304 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14305 HDA_AMP_MUTE, bits);
14306 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14307 HDA_AMP_MUTE, bits);
14308
14309 snd_hda_codec_write(codec, 0x20, 0,
14310 AC_VERB_SET_COEF_INDEX, 0x0c);
14311 snd_hda_codec_write(codec, 0x20, 0,
14312 AC_VERB_SET_PROC_COEF, 0x680);
14313
14314 snd_hda_codec_write(codec, 0x20, 0,
14315 AC_VERB_SET_COEF_INDEX, 0x0c);
14316 snd_hda_codec_write(codec, 0x20, 0,
14317 AC_VERB_SET_PROC_COEF, 0x480);
14318}
14319 14345
14320static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) 14346static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
14321{ 14347{
@@ -14364,6 +14390,9 @@ static void alc269_quanta_fl1_setup(struct hda_codec *codec)
14364 struct alc_spec *spec = codec->spec; 14390 struct alc_spec *spec = codec->spec;
14365 spec->autocfg.hp_pins[0] = 0x15; 14391 spec->autocfg.hp_pins[0] = 0x15;
14366 spec->autocfg.speaker_pins[0] = 0x14; 14392 spec->autocfg.speaker_pins[0] = 0x14;
14393 spec->automute_mixer_nid[0] = 0x0c;
14394 spec->automute = 1;
14395 spec->automute_mode = ALC_AUTOMUTE_MIXER;
14367 spec->ext_mic.pin = 0x18; 14396 spec->ext_mic.pin = 0x18;
14368 spec->ext_mic.mux_idx = 0; 14397 spec->ext_mic.mux_idx = 0;
14369 spec->int_mic.pin = 0x19; 14398 spec->int_mic.pin = 0x19;
@@ -14377,13 +14406,24 @@ static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
14377 alc_mic_automute(codec); 14406 alc_mic_automute(codec);
14378} 14407}
14379 14408
14409static void alc269_lifebook_setup(struct hda_codec *codec)
14410{
14411 struct alc_spec *spec = codec->spec;
14412 spec->autocfg.hp_pins[0] = 0x15;
14413 spec->autocfg.hp_pins[1] = 0x1a;
14414 spec->autocfg.speaker_pins[0] = 0x14;
14415 spec->automute_mixer_nid[0] = 0x0c;
14416 spec->automute = 1;
14417 spec->automute_mode = ALC_AUTOMUTE_MIXER;
14418}
14419
14380static void alc269_lifebook_init_hook(struct hda_codec *codec) 14420static void alc269_lifebook_init_hook(struct hda_codec *codec)
14381{ 14421{
14382 alc269_lifebook_speaker_automute(codec); 14422 alc269_lifebook_speaker_automute(codec);
14383 alc269_lifebook_mic_autoswitch(codec); 14423 alc269_lifebook_mic_autoswitch(codec);
14384} 14424}
14385 14425
14386static struct hda_verb alc269_laptop_dmic_init_verbs[] = { 14426static const struct hda_verb alc269_laptop_dmic_init_verbs[] = {
14387 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, 14427 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14388 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, 14428 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
14389 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, 14429 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
@@ -14394,7 +14434,7 @@ static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
14394 {} 14434 {}
14395}; 14435};
14396 14436
14397static struct hda_verb alc269_laptop_amic_init_verbs[] = { 14437static const struct hda_verb alc269_laptop_amic_init_verbs[] = {
14398 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, 14438 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14399 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, 14439 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
14400 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, 14440 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
@@ -14404,7 +14444,7 @@ static struct hda_verb alc269_laptop_amic_init_verbs[] = {
14404 {} 14444 {}
14405}; 14445};
14406 14446
14407static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = { 14447static const struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
14408 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, 14448 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14409 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06}, 14449 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
14410 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, 14450 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
@@ -14415,7 +14455,7 @@ static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
14415 {} 14455 {}
14416}; 14456};
14417 14457
14418static struct hda_verb alc269vb_laptop_amic_init_verbs[] = { 14458static const struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
14419 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, 14459 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14420 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, 14460 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
14421 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, 14461 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
@@ -14426,7 +14466,7 @@ static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
14426 {} 14466 {}
14427}; 14467};
14428 14468
14429static struct hda_verb alc271_acer_dmic_verbs[] = { 14469static const struct hda_verb alc271_acer_dmic_verbs[] = {
14430 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, 14470 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
14431 {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, 14471 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
14432 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 14472 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
@@ -14440,42 +14480,14 @@ static struct hda_verb alc271_acer_dmic_verbs[] = {
14440 { } 14480 { }
14441}; 14481};
14442 14482
14443/* toggle speaker-output according to the hp-jack state */
14444static void alc269_speaker_automute(struct hda_codec *codec)
14445{
14446 struct alc_spec *spec = codec->spec;
14447 unsigned int nid = spec->autocfg.hp_pins[0];
14448 unsigned int present;
14449 unsigned char bits;
14450
14451 present = snd_hda_jack_detect(codec, nid);
14452 bits = present ? HDA_AMP_MUTE : 0;
14453 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14454 HDA_AMP_MUTE, bits);
14455 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14456 HDA_AMP_MUTE, bits);
14457 snd_hda_input_jack_report(codec, nid);
14458}
14459
14460/* unsolicited event for HP jack sensing */
14461static void alc269_laptop_unsol_event(struct hda_codec *codec,
14462 unsigned int res)
14463{
14464 switch (res >> 26) {
14465 case ALC880_HP_EVENT:
14466 alc269_speaker_automute(codec);
14467 break;
14468 case ALC880_MIC_EVENT:
14469 alc_mic_automute(codec);
14470 break;
14471 }
14472}
14473
14474static void alc269_laptop_amic_setup(struct hda_codec *codec) 14483static void alc269_laptop_amic_setup(struct hda_codec *codec)
14475{ 14484{
14476 struct alc_spec *spec = codec->spec; 14485 struct alc_spec *spec = codec->spec;
14477 spec->autocfg.hp_pins[0] = 0x15; 14486 spec->autocfg.hp_pins[0] = 0x15;
14478 spec->autocfg.speaker_pins[0] = 0x14; 14487 spec->autocfg.speaker_pins[0] = 0x14;
14488 spec->automute_mixer_nid[0] = 0x0c;
14489 spec->automute = 1;
14490 spec->automute_mode = ALC_AUTOMUTE_MIXER;
14479 spec->ext_mic.pin = 0x18; 14491 spec->ext_mic.pin = 0x18;
14480 spec->ext_mic.mux_idx = 0; 14492 spec->ext_mic.mux_idx = 0;
14481 spec->int_mic.pin = 0x19; 14493 spec->int_mic.pin = 0x19;
@@ -14488,6 +14500,9 @@ static void alc269_laptop_dmic_setup(struct hda_codec *codec)
14488 struct alc_spec *spec = codec->spec; 14500 struct alc_spec *spec = codec->spec;
14489 spec->autocfg.hp_pins[0] = 0x15; 14501 spec->autocfg.hp_pins[0] = 0x15;
14490 spec->autocfg.speaker_pins[0] = 0x14; 14502 spec->autocfg.speaker_pins[0] = 0x14;
14503 spec->automute_mixer_nid[0] = 0x0c;
14504 spec->automute = 1;
14505 spec->automute_mode = ALC_AUTOMUTE_MIXER;
14491 spec->ext_mic.pin = 0x18; 14506 spec->ext_mic.pin = 0x18;
14492 spec->ext_mic.mux_idx = 0; 14507 spec->ext_mic.mux_idx = 0;
14493 spec->int_mic.pin = 0x12; 14508 spec->int_mic.pin = 0x12;
@@ -14500,6 +14515,9 @@ static void alc269vb_laptop_amic_setup(struct hda_codec *codec)
14500 struct alc_spec *spec = codec->spec; 14515 struct alc_spec *spec = codec->spec;
14501 spec->autocfg.hp_pins[0] = 0x21; 14516 spec->autocfg.hp_pins[0] = 0x21;
14502 spec->autocfg.speaker_pins[0] = 0x14; 14517 spec->autocfg.speaker_pins[0] = 0x14;
14518 spec->automute_mixer_nid[0] = 0x0c;
14519 spec->automute = 1;
14520 spec->automute_mode = ALC_AUTOMUTE_MIXER;
14503 spec->ext_mic.pin = 0x18; 14521 spec->ext_mic.pin = 0x18;
14504 spec->ext_mic.mux_idx = 0; 14522 spec->ext_mic.mux_idx = 0;
14505 spec->int_mic.pin = 0x19; 14523 spec->int_mic.pin = 0x19;
@@ -14512,6 +14530,9 @@ static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
14512 struct alc_spec *spec = codec->spec; 14530 struct alc_spec *spec = codec->spec;
14513 spec->autocfg.hp_pins[0] = 0x21; 14531 spec->autocfg.hp_pins[0] = 0x21;
14514 spec->autocfg.speaker_pins[0] = 0x14; 14532 spec->autocfg.speaker_pins[0] = 0x14;
14533 spec->automute_mixer_nid[0] = 0x0c;
14534 spec->automute = 1;
14535 spec->automute_mode = ALC_AUTOMUTE_MIXER;
14515 spec->ext_mic.pin = 0x18; 14536 spec->ext_mic.pin = 0x18;
14516 spec->ext_mic.mux_idx = 0; 14537 spec->ext_mic.mux_idx = 0;
14517 spec->int_mic.pin = 0x12; 14538 spec->int_mic.pin = 0x12;
@@ -14519,16 +14540,10 @@ static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
14519 spec->auto_mic = 1; 14540 spec->auto_mic = 1;
14520} 14541}
14521 14542
14522static void alc269_laptop_inithook(struct hda_codec *codec)
14523{
14524 alc269_speaker_automute(codec);
14525 alc_mic_automute(codec);
14526}
14527
14528/* 14543/*
14529 * generic initialization of ADC, input mixers and output mixers 14544 * generic initialization of ADC, input mixers and output mixers
14530 */ 14545 */
14531static struct hda_verb alc269_init_verbs[] = { 14546static const struct hda_verb alc269_init_verbs[] = {
14532 /* 14547 /*
14533 * Unmute ADC0 and set the default input to mic-in 14548 * Unmute ADC0 and set the default input to mic-in
14534 */ 14549 */
@@ -14571,7 +14586,7 @@ static struct hda_verb alc269_init_verbs[] = {
14571 { } 14586 { }
14572}; 14587};
14573 14588
14574static struct hda_verb alc269vb_init_verbs[] = { 14589static const struct hda_verb alc269vb_init_verbs[] = {
14575 /* 14590 /*
14576 * Unmute ADC0 and set the default input to mic-in 14591 * Unmute ADC0 and set the default input to mic-in
14577 */ 14592 */
@@ -14629,7 +14644,7 @@ static struct hda_verb alc269vb_init_verbs[] = {
14629#define alc269_pcm_digital_playback alc880_pcm_digital_playback 14644#define alc269_pcm_digital_playback alc880_pcm_digital_playback
14630#define alc269_pcm_digital_capture alc880_pcm_digital_capture 14645#define alc269_pcm_digital_capture alc880_pcm_digital_capture
14631 14646
14632static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { 14647static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
14633 .substreams = 1, 14648 .substreams = 1,
14634 .channels_min = 2, 14649 .channels_min = 2,
14635 .channels_max = 8, 14650 .channels_max = 8,
@@ -14642,7 +14657,7 @@ static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
14642 }, 14657 },
14643}; 14658};
14644 14659
14645static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { 14660static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
14646 .substreams = 1, 14661 .substreams = 1,
14647 .channels_min = 2, 14662 .channels_min = 2,
14648 .channels_max = 2, 14663 .channels_max = 2,
@@ -14726,7 +14741,7 @@ static int alc269_parse_auto_config(struct hda_codec *codec)
14726{ 14741{
14727 struct alc_spec *spec = codec->spec; 14742 struct alc_spec *spec = codec->spec;
14728 int err; 14743 int err;
14729 static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; 14744 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
14730 14745
14731 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, 14746 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14732 alc269_ignore); 14747 alc269_ignore);
@@ -14796,7 +14811,6 @@ static void alc269_auto_init(struct hda_codec *codec)
14796 alc_inithook(codec); 14811 alc_inithook(codec);
14797} 14812}
14798 14813
14799#ifdef SND_HDA_NEEDS_RESUME
14800static void alc269_toggle_power_output(struct hda_codec *codec, int power_up) 14814static void alc269_toggle_power_output(struct hda_codec *codec, int power_up)
14801{ 14815{
14802 int val = alc_read_coef_idx(codec, 0x04); 14816 int val = alc_read_coef_idx(codec, 0x04);
@@ -14807,25 +14821,17 @@ static void alc269_toggle_power_output(struct hda_codec *codec, int power_up)
14807 alc_write_coef_idx(codec, 0x04, val); 14821 alc_write_coef_idx(codec, 0x04, val);
14808} 14822}
14809 14823
14810#ifdef CONFIG_SND_HDA_POWER_SAVE 14824static void alc269_shutup(struct hda_codec *codec)
14811static int alc269_suspend(struct hda_codec *codec, pm_message_t state)
14812{ 14825{
14813 struct alc_spec *spec = codec->spec;
14814
14815 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) 14826 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017)
14816 alc269_toggle_power_output(codec, 0); 14827 alc269_toggle_power_output(codec, 0);
14817 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { 14828 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14818 alc269_toggle_power_output(codec, 0); 14829 alc269_toggle_power_output(codec, 0);
14819 msleep(150); 14830 msleep(150);
14820 } 14831 }
14821
14822 alc_shutup(codec);
14823 if (spec && spec->power_hook)
14824 spec->power_hook(codec);
14825 return 0;
14826} 14832}
14827#endif /* CONFIG_SND_HDA_POWER_SAVE */
14828 14833
14834#ifdef SND_HDA_NEEDS_RESUME
14829static int alc269_resume(struct hda_codec *codec) 14835static int alc269_resume(struct hda_codec *codec)
14830{ 14836{
14831 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) { 14837 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
@@ -14864,7 +14870,7 @@ static void alc269_fixup_hweq(struct hda_codec *codec,
14864static void alc271_fixup_dmic(struct hda_codec *codec, 14870static void alc271_fixup_dmic(struct hda_codec *codec,
14865 const struct alc_fixup *fix, int action) 14871 const struct alc_fixup *fix, int action)
14866{ 14872{
14867 static struct hda_verb verbs[] = { 14873 static const struct hda_verb verbs[] = {
14868 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, 14874 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
14869 {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, 14875 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
14870 {} 14876 {}
@@ -14947,7 +14953,7 @@ static const struct alc_fixup alc269_fixups[] = {
14947 }, 14953 },
14948}; 14954};
14949 14955
14950static struct snd_pci_quirk alc269_fixup_tbl[] = { 14956static const struct snd_pci_quirk alc269_fixup_tbl[] = {
14951 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2), 14957 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
14952 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), 14958 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
14953 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), 14959 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
@@ -14978,7 +14984,7 @@ static const char * const alc269_models[ALC269_MODEL_LAST] = {
14978 [ALC269_AUTO] = "auto", 14984 [ALC269_AUTO] = "auto",
14979}; 14985};
14980 14986
14981static struct snd_pci_quirk alc269_cfg_tbl[] = { 14987static const struct snd_pci_quirk alc269_cfg_tbl[] = {
14982 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), 14988 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
14983 SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER), 14989 SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER),
14984 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", 14990 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
@@ -15036,7 +15042,7 @@ static struct snd_pci_quirk alc269_cfg_tbl[] = {
15036 {} 15042 {}
15037}; 15043};
15038 15044
15039static struct alc_config_preset alc269_presets[] = { 15045static const struct alc_config_preset alc269_presets[] = {
15040 [ALC269_BASIC] = { 15046 [ALC269_BASIC] = {
15041 .mixers = { alc269_base_mixer }, 15047 .mixers = { alc269_base_mixer },
15042 .init_verbs = { alc269_init_verbs }, 15048 .init_verbs = { alc269_init_verbs },
@@ -15070,9 +15076,9 @@ static struct alc_config_preset alc269_presets[] = {
15070 .hp_nid = 0x03, 15076 .hp_nid = 0x03,
15071 .num_channel_mode = ARRAY_SIZE(alc269_modes), 15077 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15072 .channel_mode = alc269_modes, 15078 .channel_mode = alc269_modes,
15073 .unsol_event = alc269_laptop_unsol_event, 15079 .unsol_event = alc_sku_unsol_event,
15074 .setup = alc269_laptop_amic_setup, 15080 .setup = alc269_laptop_amic_setup,
15075 .init_hook = alc269_laptop_inithook, 15081 .init_hook = alc_inithook,
15076 }, 15082 },
15077 [ALC269_DMIC] = { 15083 [ALC269_DMIC] = {
15078 .mixers = { alc269_laptop_mixer }, 15084 .mixers = { alc269_laptop_mixer },
@@ -15084,9 +15090,9 @@ static struct alc_config_preset alc269_presets[] = {
15084 .hp_nid = 0x03, 15090 .hp_nid = 0x03,
15085 .num_channel_mode = ARRAY_SIZE(alc269_modes), 15091 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15086 .channel_mode = alc269_modes, 15092 .channel_mode = alc269_modes,
15087 .unsol_event = alc269_laptop_unsol_event, 15093 .unsol_event = alc_sku_unsol_event,
15088 .setup = alc269_laptop_dmic_setup, 15094 .setup = alc269_laptop_dmic_setup,
15089 .init_hook = alc269_laptop_inithook, 15095 .init_hook = alc_inithook,
15090 }, 15096 },
15091 [ALC269VB_AMIC] = { 15097 [ALC269VB_AMIC] = {
15092 .mixers = { alc269vb_laptop_mixer }, 15098 .mixers = { alc269vb_laptop_mixer },
@@ -15098,9 +15104,9 @@ static struct alc_config_preset alc269_presets[] = {
15098 .hp_nid = 0x03, 15104 .hp_nid = 0x03,
15099 .num_channel_mode = ARRAY_SIZE(alc269_modes), 15105 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15100 .channel_mode = alc269_modes, 15106 .channel_mode = alc269_modes,
15101 .unsol_event = alc269_laptop_unsol_event, 15107 .unsol_event = alc_sku_unsol_event,
15102 .setup = alc269vb_laptop_amic_setup, 15108 .setup = alc269vb_laptop_amic_setup,
15103 .init_hook = alc269_laptop_inithook, 15109 .init_hook = alc_inithook,
15104 }, 15110 },
15105 [ALC269VB_DMIC] = { 15111 [ALC269VB_DMIC] = {
15106 .mixers = { alc269vb_laptop_mixer }, 15112 .mixers = { alc269vb_laptop_mixer },
@@ -15112,9 +15118,9 @@ static struct alc_config_preset alc269_presets[] = {
15112 .hp_nid = 0x03, 15118 .hp_nid = 0x03,
15113 .num_channel_mode = ARRAY_SIZE(alc269_modes), 15119 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15114 .channel_mode = alc269_modes, 15120 .channel_mode = alc269_modes,
15115 .unsol_event = alc269_laptop_unsol_event, 15121 .unsol_event = alc_sku_unsol_event,
15116 .setup = alc269vb_laptop_dmic_setup, 15122 .setup = alc269vb_laptop_dmic_setup,
15117 .init_hook = alc269_laptop_inithook, 15123 .init_hook = alc_inithook,
15118 }, 15124 },
15119 [ALC269_FUJITSU] = { 15125 [ALC269_FUJITSU] = {
15120 .mixers = { alc269_fujitsu_mixer }, 15126 .mixers = { alc269_fujitsu_mixer },
@@ -15126,9 +15132,9 @@ static struct alc_config_preset alc269_presets[] = {
15126 .hp_nid = 0x03, 15132 .hp_nid = 0x03,
15127 .num_channel_mode = ARRAY_SIZE(alc269_modes), 15133 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15128 .channel_mode = alc269_modes, 15134 .channel_mode = alc269_modes,
15129 .unsol_event = alc269_laptop_unsol_event, 15135 .unsol_event = alc_sku_unsol_event,
15130 .setup = alc269_laptop_dmic_setup, 15136 .setup = alc269_laptop_dmic_setup,
15131 .init_hook = alc269_laptop_inithook, 15137 .init_hook = alc_inithook,
15132 }, 15138 },
15133 [ALC269_LIFEBOOK] = { 15139 [ALC269_LIFEBOOK] = {
15134 .mixers = { alc269_lifebook_mixer }, 15140 .mixers = { alc269_lifebook_mixer },
@@ -15140,6 +15146,7 @@ static struct alc_config_preset alc269_presets[] = {
15140 .channel_mode = alc269_modes, 15146 .channel_mode = alc269_modes,
15141 .input_mux = &alc269_capture_source, 15147 .input_mux = &alc269_capture_source,
15142 .unsol_event = alc269_lifebook_unsol_event, 15148 .unsol_event = alc269_lifebook_unsol_event,
15149 .setup = alc269_lifebook_setup,
15143 .init_hook = alc269_lifebook_init_hook, 15150 .init_hook = alc269_lifebook_init_hook,
15144 }, 15151 },
15145 [ALC271_ACER] = { 15152 [ALC271_ACER] = {
@@ -15185,14 +15192,21 @@ static int alc269_fill_coef(struct hda_codec *codec)
15185 val = alc_read_coef_idx(codec, 0xd); 15192 val = alc_read_coef_idx(codec, 0xd);
15186 if ((val & 0x0c00) >> 10 != 0x1) { 15193 if ((val & 0x0c00) >> 10 != 0x1) {
15187 /* Capless ramp up clock control */ 15194 /* Capless ramp up clock control */
15188 alc_write_coef_idx(codec, 0xd, val | 1<<10); 15195 alc_write_coef_idx(codec, 0xd, val | (1<<10));
15189 } 15196 }
15190 val = alc_read_coef_idx(codec, 0x17); 15197 val = alc_read_coef_idx(codec, 0x17);
15191 if ((val & 0x01c0) >> 6 != 0x4) { 15198 if ((val & 0x01c0) >> 6 != 0x4) {
15192 /* Class D power on reset */ 15199 /* Class D power on reset */
15193 alc_write_coef_idx(codec, 0x17, val | 1<<7); 15200 alc_write_coef_idx(codec, 0x17, val | (1<<7));
15194 } 15201 }
15195 } 15202 }
15203
15204 val = alc_read_coef_idx(codec, 0xd); /* Class D */
15205 alc_write_coef_idx(codec, 0xd, val | (1<<14));
15206
15207 val = alc_read_coef_idx(codec, 0x4); /* HP */
15208 alc_write_coef_idx(codec, 0x4, val | (1<<11));
15209
15196 return 0; 15210 return 0;
15197} 15211}
15198 15212
@@ -15313,14 +15327,12 @@ static int patch_alc269(struct hda_codec *codec)
15313 spec->vmaster_nid = 0x02; 15327 spec->vmaster_nid = 0x02;
15314 15328
15315 codec->patch_ops = alc_patch_ops; 15329 codec->patch_ops = alc_patch_ops;
15316#ifdef CONFIG_SND_HDA_POWER_SAVE
15317 codec->patch_ops.suspend = alc269_suspend;
15318#endif
15319#ifdef SND_HDA_NEEDS_RESUME 15330#ifdef SND_HDA_NEEDS_RESUME
15320 codec->patch_ops.resume = alc269_resume; 15331 codec->patch_ops.resume = alc269_resume;
15321#endif 15332#endif
15322 if (board_config == ALC269_AUTO) 15333 if (board_config == ALC269_AUTO)
15323 spec->init_hook = alc269_auto_init; 15334 spec->init_hook = alc269_auto_init;
15335 spec->shutup = alc269_shutup;
15324 15336
15325 alc_init_jacks(codec); 15337 alc_init_jacks(codec);
15326#ifdef CONFIG_SND_HDA_POWER_SAVE 15338#ifdef CONFIG_SND_HDA_POWER_SAVE
@@ -15341,7 +15353,7 @@ static int patch_alc269(struct hda_codec *codec)
15341 * set the path ways for 2 channel output 15353 * set the path ways for 2 channel output
15342 * need to set the codec line out and mic 1 pin widgets to inputs 15354 * need to set the codec line out and mic 1 pin widgets to inputs
15343 */ 15355 */
15344static struct hda_verb alc861_threestack_ch2_init[] = { 15356static const struct hda_verb alc861_threestack_ch2_init[] = {
15345 /* set pin widget 1Ah (line in) for input */ 15357 /* set pin widget 1Ah (line in) for input */
15346 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, 15358 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15347 /* set pin widget 18h (mic1/2) for input, for mic also enable 15359 /* set pin widget 18h (mic1/2) for input, for mic also enable
@@ -15360,7 +15372,7 @@ static struct hda_verb alc861_threestack_ch2_init[] = {
15360 * 6ch mode 15372 * 6ch mode
15361 * need to set the codec line out and mic 1 pin widgets to outputs 15373 * need to set the codec line out and mic 1 pin widgets to outputs
15362 */ 15374 */
15363static struct hda_verb alc861_threestack_ch6_init[] = { 15375static const struct hda_verb alc861_threestack_ch6_init[] = {
15364 /* set pin widget 1Ah (line in) for output (Back Surround)*/ 15376 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15365 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, 15377 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15366 /* set pin widget 18h (mic1) for output (CLFE)*/ 15378 /* set pin widget 18h (mic1) for output (CLFE)*/
@@ -15377,30 +15389,30 @@ static struct hda_verb alc861_threestack_ch6_init[] = {
15377 { } /* end */ 15389 { } /* end */
15378}; 15390};
15379 15391
15380static struct hda_channel_mode alc861_threestack_modes[2] = { 15392static const struct hda_channel_mode alc861_threestack_modes[2] = {
15381 { 2, alc861_threestack_ch2_init }, 15393 { 2, alc861_threestack_ch2_init },
15382 { 6, alc861_threestack_ch6_init }, 15394 { 6, alc861_threestack_ch6_init },
15383}; 15395};
15384/* Set mic1 as input and unmute the mixer */ 15396/* Set mic1 as input and unmute the mixer */
15385static struct hda_verb alc861_uniwill_m31_ch2_init[] = { 15397static const struct hda_verb alc861_uniwill_m31_ch2_init[] = {
15386 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, 15398 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15387 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ 15399 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15388 { } /* end */ 15400 { } /* end */
15389}; 15401};
15390/* Set mic1 as output and mute mixer */ 15402/* Set mic1 as output and mute mixer */
15391static struct hda_verb alc861_uniwill_m31_ch4_init[] = { 15403static const struct hda_verb alc861_uniwill_m31_ch4_init[] = {
15392 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, 15404 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15393 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ 15405 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15394 { } /* end */ 15406 { } /* end */
15395}; 15407};
15396 15408
15397static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { 15409static const struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
15398 { 2, alc861_uniwill_m31_ch2_init }, 15410 { 2, alc861_uniwill_m31_ch2_init },
15399 { 4, alc861_uniwill_m31_ch4_init }, 15411 { 4, alc861_uniwill_m31_ch4_init },
15400}; 15412};
15401 15413
15402/* Set mic1 and line-in as input and unmute the mixer */ 15414/* Set mic1 and line-in as input and unmute the mixer */
15403static struct hda_verb alc861_asus_ch2_init[] = { 15415static const struct hda_verb alc861_asus_ch2_init[] = {
15404 /* set pin widget 1Ah (line in) for input */ 15416 /* set pin widget 1Ah (line in) for input */
15405 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, 15417 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15406 /* set pin widget 18h (mic1/2) for input, for mic also enable 15418 /* set pin widget 18h (mic1/2) for input, for mic also enable
@@ -15416,7 +15428,7 @@ static struct hda_verb alc861_asus_ch2_init[] = {
15416 { } /* end */ 15428 { } /* end */
15417}; 15429};
15418/* Set mic1 nad line-in as output and mute mixer */ 15430/* Set mic1 nad line-in as output and mute mixer */
15419static struct hda_verb alc861_asus_ch6_init[] = { 15431static const struct hda_verb alc861_asus_ch6_init[] = {
15420 /* set pin widget 1Ah (line in) for output (Back Surround)*/ 15432 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15421 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, 15433 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15422 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ 15434 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
@@ -15434,14 +15446,14 @@ static struct hda_verb alc861_asus_ch6_init[] = {
15434 { } /* end */ 15446 { } /* end */
15435}; 15447};
15436 15448
15437static struct hda_channel_mode alc861_asus_modes[2] = { 15449static const struct hda_channel_mode alc861_asus_modes[2] = {
15438 { 2, alc861_asus_ch2_init }, 15450 { 2, alc861_asus_ch2_init },
15439 { 6, alc861_asus_ch6_init }, 15451 { 6, alc861_asus_ch6_init },
15440}; 15452};
15441 15453
15442/* patch-ALC861 */ 15454/* patch-ALC861 */
15443 15455
15444static struct snd_kcontrol_new alc861_base_mixer[] = { 15456static const struct snd_kcontrol_new alc861_base_mixer[] = {
15445 /* output mixer control */ 15457 /* output mixer control */
15446 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), 15458 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15447 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), 15459 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
@@ -15464,7 +15476,7 @@ static struct snd_kcontrol_new alc861_base_mixer[] = {
15464 { } /* end */ 15476 { } /* end */
15465}; 15477};
15466 15478
15467static struct snd_kcontrol_new alc861_3ST_mixer[] = { 15479static const struct snd_kcontrol_new alc861_3ST_mixer[] = {
15468 /* output mixer control */ 15480 /* output mixer control */
15469 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), 15481 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15470 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), 15482 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
@@ -15495,7 +15507,7 @@ static struct snd_kcontrol_new alc861_3ST_mixer[] = {
15495 { } /* end */ 15507 { } /* end */
15496}; 15508};
15497 15509
15498static struct snd_kcontrol_new alc861_toshiba_mixer[] = { 15510static const struct snd_kcontrol_new alc861_toshiba_mixer[] = {
15499 /* output mixer control */ 15511 /* output mixer control */
15500 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), 15512 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15501 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), 15513 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
@@ -15504,7 +15516,7 @@ static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
15504 { } /* end */ 15516 { } /* end */
15505}; 15517};
15506 15518
15507static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { 15519static const struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
15508 /* output mixer control */ 15520 /* output mixer control */
15509 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), 15521 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15510 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), 15522 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
@@ -15535,7 +15547,7 @@ static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
15535 { } /* end */ 15547 { } /* end */
15536}; 15548};
15537 15549
15538static struct snd_kcontrol_new alc861_asus_mixer[] = { 15550static const struct snd_kcontrol_new alc861_asus_mixer[] = {
15539 /* output mixer control */ 15551 /* output mixer control */
15540 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), 15552 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15541 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), 15553 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
@@ -15567,7 +15579,7 @@ static struct snd_kcontrol_new alc861_asus_mixer[] = {
15567}; 15579};
15568 15580
15569/* additional mixer */ 15581/* additional mixer */
15570static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { 15582static const struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
15571 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), 15583 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15572 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), 15584 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15573 { } 15585 { }
@@ -15576,7 +15588,7 @@ static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
15576/* 15588/*
15577 * generic initialization of ADC, input mixers and output mixers 15589 * generic initialization of ADC, input mixers and output mixers
15578 */ 15590 */
15579static struct hda_verb alc861_base_init_verbs[] = { 15591static const struct hda_verb alc861_base_init_verbs[] = {
15580 /* 15592 /*
15581 * Unmute ADC0 and set the default input to mic-in 15593 * Unmute ADC0 and set the default input to mic-in
15582 */ 15594 */
@@ -15642,7 +15654,7 @@ static struct hda_verb alc861_base_init_verbs[] = {
15642 { } 15654 { }
15643}; 15655};
15644 15656
15645static struct hda_verb alc861_threestack_init_verbs[] = { 15657static const struct hda_verb alc861_threestack_init_verbs[] = {
15646 /* 15658 /*
15647 * Unmute ADC0 and set the default input to mic-in 15659 * Unmute ADC0 and set the default input to mic-in
15648 */ 15660 */
@@ -15703,7 +15715,7 @@ static struct hda_verb alc861_threestack_init_verbs[] = {
15703 { } 15715 { }
15704}; 15716};
15705 15717
15706static struct hda_verb alc861_uniwill_m31_init_verbs[] = { 15718static const struct hda_verb alc861_uniwill_m31_init_verbs[] = {
15707 /* 15719 /*
15708 * Unmute ADC0 and set the default input to mic-in 15720 * Unmute ADC0 and set the default input to mic-in
15709 */ 15721 */
@@ -15765,7 +15777,7 @@ static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
15765 { } 15777 { }
15766}; 15778};
15767 15779
15768static struct hda_verb alc861_asus_init_verbs[] = { 15780static const struct hda_verb alc861_asus_init_verbs[] = {
15769 /* 15781 /*
15770 * Unmute ADC0 and set the default input to mic-in 15782 * Unmute ADC0 and set the default input to mic-in
15771 */ 15783 */
@@ -15831,7 +15843,7 @@ static struct hda_verb alc861_asus_init_verbs[] = {
15831}; 15843};
15832 15844
15833/* additional init verbs for ASUS laptops */ 15845/* additional init verbs for ASUS laptops */
15834static struct hda_verb alc861_asus_laptop_init_verbs[] = { 15846static const struct hda_verb alc861_asus_laptop_init_verbs[] = {
15835 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ 15847 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
15836 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ 15848 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
15837 { } 15849 { }
@@ -15840,7 +15852,7 @@ static struct hda_verb alc861_asus_laptop_init_verbs[] = {
15840/* 15852/*
15841 * generic initialization of ADC, input mixers and output mixers 15853 * generic initialization of ADC, input mixers and output mixers
15842 */ 15854 */
15843static struct hda_verb alc861_auto_init_verbs[] = { 15855static const struct hda_verb alc861_auto_init_verbs[] = {
15844 /* 15856 /*
15845 * Unmute ADC0 and set the default input to mic-in 15857 * Unmute ADC0 and set the default input to mic-in
15846 */ 15858 */
@@ -15889,7 +15901,7 @@ static struct hda_verb alc861_auto_init_verbs[] = {
15889 { } 15901 { }
15890}; 15902};
15891 15903
15892static struct hda_verb alc861_toshiba_init_verbs[] = { 15904static const struct hda_verb alc861_toshiba_init_verbs[] = {
15893 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, 15905 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15894 15906
15895 { } 15907 { }
@@ -15922,26 +15934,26 @@ static void alc861_toshiba_unsol_event(struct hda_codec *codec,
15922 15934
15923#define ALC861_DIGOUT_NID 0x07 15935#define ALC861_DIGOUT_NID 0x07
15924 15936
15925static struct hda_channel_mode alc861_8ch_modes[1] = { 15937static const struct hda_channel_mode alc861_8ch_modes[1] = {
15926 { 8, NULL } 15938 { 8, NULL }
15927}; 15939};
15928 15940
15929static hda_nid_t alc861_dac_nids[4] = { 15941static const hda_nid_t alc861_dac_nids[4] = {
15930 /* front, surround, clfe, side */ 15942 /* front, surround, clfe, side */
15931 0x03, 0x06, 0x05, 0x04 15943 0x03, 0x06, 0x05, 0x04
15932}; 15944};
15933 15945
15934static hda_nid_t alc660_dac_nids[3] = { 15946static const hda_nid_t alc660_dac_nids[3] = {
15935 /* front, clfe, surround */ 15947 /* front, clfe, surround */
15936 0x03, 0x05, 0x06 15948 0x03, 0x05, 0x06
15937}; 15949};
15938 15950
15939static hda_nid_t alc861_adc_nids[1] = { 15951static const hda_nid_t alc861_adc_nids[1] = {
15940 /* ADC0-2 */ 15952 /* ADC0-2 */
15941 0x08, 15953 0x08,
15942}; 15954};
15943 15955
15944static struct hda_input_mux alc861_capture_source = { 15956static const struct hda_input_mux alc861_capture_source = {
15945 .num_items = 5, 15957 .num_items = 5,
15946 .items = { 15958 .items = {
15947 { "Mic", 0x0 }, 15959 { "Mic", 0x0 },
@@ -15991,7 +16003,7 @@ static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
15991 dac = alc861_look_for_dac(codec, nid); 16003 dac = alc861_look_for_dac(codec, nid);
15992 if (!dac) 16004 if (!dac)
15993 continue; 16005 continue;
15994 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; 16006 spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
15995 } 16007 }
15996 return 0; 16008 return 0;
15997} 16009}
@@ -16014,11 +16026,15 @@ static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
16014 static const char * const chname[4] = { 16026 static const char * const chname[4] = {
16015 "Front", "Surround", NULL /*CLFE*/, "Side" 16027 "Front", "Surround", NULL /*CLFE*/, "Side"
16016 }; 16028 };
16017 const char *pfx = alc_get_line_out_pfx(cfg, true); 16029 const char *pfx = alc_get_line_out_pfx(spec, true);
16018 hda_nid_t nid; 16030 hda_nid_t nid;
16019 int i, err; 16031 int i, err, noutputs;
16020 16032
16021 for (i = 0; i < cfg->line_outs; i++) { 16033 noutputs = cfg->line_outs;
16034 if (spec->multi_ios > 0)
16035 noutputs += spec->multi_ios;
16036
16037 for (i = 0; i < noutputs; i++) {
16022 nid = spec->multiout.dac_nids[i]; 16038 nid = spec->multiout.dac_nids[i];
16023 if (!nid) 16039 if (!nid)
16024 continue; 16040 continue;
@@ -16151,7 +16167,7 @@ static int alc861_parse_auto_config(struct hda_codec *codec)
16151{ 16167{
16152 struct alc_spec *spec = codec->spec; 16168 struct alc_spec *spec = codec->spec;
16153 int err; 16169 int err;
16154 static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; 16170 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
16155 16171
16156 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, 16172 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16157 alc861_ignore); 16173 alc861_ignore);
@@ -16163,6 +16179,9 @@ static int alc861_parse_auto_config(struct hda_codec *codec)
16163 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); 16179 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
16164 if (err < 0) 16180 if (err < 0)
16165 return err; 16181 return err;
16182 err = alc_auto_add_multi_channel_mode(codec);
16183 if (err < 0)
16184 return err;
16166 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); 16185 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
16167 if (err < 0) 16186 if (err < 0)
16168 return err; 16187 return err;
@@ -16207,7 +16226,7 @@ static void alc861_auto_init(struct hda_codec *codec)
16207} 16226}
16208 16227
16209#ifdef CONFIG_SND_HDA_POWER_SAVE 16228#ifdef CONFIG_SND_HDA_POWER_SAVE
16210static struct hda_amp_list alc861_loopbacks[] = { 16229static const struct hda_amp_list alc861_loopbacks[] = {
16211 { 0x15, HDA_INPUT, 0 }, 16230 { 0x15, HDA_INPUT, 0 },
16212 { 0x15, HDA_INPUT, 1 }, 16231 { 0x15, HDA_INPUT, 1 },
16213 { 0x15, HDA_INPUT, 2 }, 16232 { 0x15, HDA_INPUT, 2 },
@@ -16232,7 +16251,7 @@ static const char * const alc861_models[ALC861_MODEL_LAST] = {
16232 [ALC861_AUTO] = "auto", 16251 [ALC861_AUTO] = "auto",
16233}; 16252};
16234 16253
16235static struct snd_pci_quirk alc861_cfg_tbl[] = { 16254static const struct snd_pci_quirk alc861_cfg_tbl[] = {
16236 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), 16255 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
16237 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), 16256 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
16238 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), 16257 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
@@ -16256,7 +16275,7 @@ static struct snd_pci_quirk alc861_cfg_tbl[] = {
16256 {} 16275 {}
16257}; 16276};
16258 16277
16259static struct alc_config_preset alc861_presets[] = { 16278static const struct alc_config_preset alc861_presets[] = {
16260 [ALC861_3ST] = { 16279 [ALC861_3ST] = {
16261 .mixers = { alc861_3ST_mixer }, 16280 .mixers = { alc861_3ST_mixer },
16262 .init_verbs = { alc861_threestack_init_verbs }, 16281 .init_verbs = { alc861_threestack_init_verbs },
@@ -16379,7 +16398,7 @@ static const struct alc_fixup alc861_fixups[] = {
16379 }, 16398 },
16380}; 16399};
16381 16400
16382static struct snd_pci_quirk alc861_fixup_tbl[] = { 16401static const struct snd_pci_quirk alc861_fixup_tbl[] = {
16383 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), 16402 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
16384 {} 16403 {}
16385}; 16404};
@@ -16472,7 +16491,7 @@ static int patch_alc861(struct hda_codec *codec)
16472 */ 16491 */
16473#define ALC861VD_DIGOUT_NID 0x06 16492#define ALC861VD_DIGOUT_NID 0x06
16474 16493
16475static hda_nid_t alc861vd_dac_nids[4] = { 16494static const hda_nid_t alc861vd_dac_nids[4] = {
16476 /* front, surr, clfe, side surr */ 16495 /* front, surr, clfe, side surr */
16477 0x02, 0x03, 0x04, 0x05 16496 0x02, 0x03, 0x04, 0x05
16478}; 16497};
@@ -16484,21 +16503,21 @@ static hda_nid_t alc861vd_dac_nids[4] = {
16484 * - and it is the same as in 861vd. 16503 * - and it is the same as in 861vd.
16485 * adc_nids in ALC660vd are (is) the same as in 861vd 16504 * adc_nids in ALC660vd are (is) the same as in 861vd
16486 */ 16505 */
16487static hda_nid_t alc660vd_dac_nids[3] = { 16506static const hda_nid_t alc660vd_dac_nids[3] = {
16488 /* front, rear, clfe, rear_surr */ 16507 /* front, rear, clfe, rear_surr */
16489 0x02, 0x04, 0x03 16508 0x02, 0x04, 0x03
16490}; 16509};
16491 16510
16492static hda_nid_t alc861vd_adc_nids[1] = { 16511static const hda_nid_t alc861vd_adc_nids[1] = {
16493 /* ADC0 */ 16512 /* ADC0 */
16494 0x09, 16513 0x09,
16495}; 16514};
16496 16515
16497static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; 16516static const hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
16498 16517
16499/* input MUX */ 16518/* input MUX */
16500/* FIXME: should be a matrix-type input source selection */ 16519/* FIXME: should be a matrix-type input source selection */
16501static struct hda_input_mux alc861vd_capture_source = { 16520static const struct hda_input_mux alc861vd_capture_source = {
16502 .num_items = 4, 16521 .num_items = 4,
16503 .items = { 16522 .items = {
16504 { "Mic", 0x0 }, 16523 { "Mic", 0x0 },
@@ -16508,7 +16527,7 @@ static struct hda_input_mux alc861vd_capture_source = {
16508 }, 16527 },
16509}; 16528};
16510 16529
16511static struct hda_input_mux alc861vd_dallas_capture_source = { 16530static const struct hda_input_mux alc861vd_dallas_capture_source = {
16512 .num_items = 2, 16531 .num_items = 2,
16513 .items = { 16532 .items = {
16514 { "Mic", 0x0 }, 16533 { "Mic", 0x0 },
@@ -16516,7 +16535,7 @@ static struct hda_input_mux alc861vd_dallas_capture_source = {
16516 }, 16535 },
16517}; 16536};
16518 16537
16519static struct hda_input_mux alc861vd_hp_capture_source = { 16538static const struct hda_input_mux alc861vd_hp_capture_source = {
16520 .num_items = 2, 16539 .num_items = 2,
16521 .items = { 16540 .items = {
16522 { "Front Mic", 0x0 }, 16541 { "Front Mic", 0x0 },
@@ -16527,14 +16546,14 @@ static struct hda_input_mux alc861vd_hp_capture_source = {
16527/* 16546/*
16528 * 2ch mode 16547 * 2ch mode
16529 */ 16548 */
16530static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { 16549static const struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
16531 { 2, NULL } 16550 { 2, NULL }
16532}; 16551};
16533 16552
16534/* 16553/*
16535 * 6ch mode 16554 * 6ch mode
16536 */ 16555 */
16537static struct hda_verb alc861vd_6stack_ch6_init[] = { 16556static const struct hda_verb alc861vd_6stack_ch6_init[] = {
16538 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, 16557 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16539 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 16558 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16540 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 16559 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
@@ -16545,7 +16564,7 @@ static struct hda_verb alc861vd_6stack_ch6_init[] = {
16545/* 16564/*
16546 * 8ch mode 16565 * 8ch mode
16547 */ 16566 */
16548static struct hda_verb alc861vd_6stack_ch8_init[] = { 16567static const struct hda_verb alc861vd_6stack_ch8_init[] = {
16549 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 16568 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16550 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 16569 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16551 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 16570 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
@@ -16553,12 +16572,12 @@ static struct hda_verb alc861vd_6stack_ch8_init[] = {
16553 { } /* end */ 16572 { } /* end */
16554}; 16573};
16555 16574
16556static struct hda_channel_mode alc861vd_6stack_modes[2] = { 16575static const struct hda_channel_mode alc861vd_6stack_modes[2] = {
16557 { 6, alc861vd_6stack_ch6_init }, 16576 { 6, alc861vd_6stack_ch6_init },
16558 { 8, alc861vd_6stack_ch8_init }, 16577 { 8, alc861vd_6stack_ch8_init },
16559}; 16578};
16560 16579
16561static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { 16580static const struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
16562 { 16581 {
16563 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 16582 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16564 .name = "Channel Mode", 16583 .name = "Channel Mode",
@@ -16572,7 +16591,7 @@ static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
16572/* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 16591/* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16573 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b 16592 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16574 */ 16593 */
16575static struct snd_kcontrol_new alc861vd_6st_mixer[] = { 16594static const struct snd_kcontrol_new alc861vd_6st_mixer[] = {
16576 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), 16595 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16577 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 16596 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16578 16597
@@ -16608,7 +16627,7 @@ static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
16608 { } /* end */ 16627 { } /* end */
16609}; 16628};
16610 16629
16611static struct snd_kcontrol_new alc861vd_3st_mixer[] = { 16630static const struct snd_kcontrol_new alc861vd_3st_mixer[] = {
16612 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), 16631 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16613 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 16632 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16614 16633
@@ -16631,7 +16650,7 @@ static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
16631 { } /* end */ 16650 { } /* end */
16632}; 16651};
16633 16652
16634static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { 16653static const struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
16635 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), 16654 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16636 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ 16655 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
16637 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), 16656 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
@@ -16655,7 +16674,7 @@ static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
16655/* Pin assignment: Speaker=0x14, HP = 0x15, 16674/* Pin assignment: Speaker=0x14, HP = 0x15,
16656 * Mic=0x18, Internal Mic = 0x19, CD = 0x1c, PC Beep = 0x1d 16675 * Mic=0x18, Internal Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
16657 */ 16676 */
16658static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { 16677static const struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
16659 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), 16678 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16660 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), 16679 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
16661 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), 16680 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
@@ -16672,7 +16691,7 @@ static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
16672/* Pin assignment: Speaker=0x14, Line-out = 0x15, 16691/* Pin assignment: Speaker=0x14, Line-out = 0x15,
16673 * Front Mic=0x18, ATAPI Mic = 0x19, 16692 * Front Mic=0x18, ATAPI Mic = 0x19,
16674 */ 16693 */
16675static struct snd_kcontrol_new alc861vd_hp_mixer[] = { 16694static const struct snd_kcontrol_new alc861vd_hp_mixer[] = {
16676 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), 16695 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16677 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 16696 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16678 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), 16697 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
@@ -16688,7 +16707,7 @@ static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
16688/* 16707/*
16689 * generic initialization of ADC, input mixers and output mixers 16708 * generic initialization of ADC, input mixers and output mixers
16690 */ 16709 */
16691static struct hda_verb alc861vd_volume_init_verbs[] = { 16710static const struct hda_verb alc861vd_volume_init_verbs[] = {
16692 /* 16711 /*
16693 * Unmute ADC0 and set the default input to mic-in 16712 * Unmute ADC0 and set the default input to mic-in
16694 */ 16713 */
@@ -16738,7 +16757,7 @@ static struct hda_verb alc861vd_volume_init_verbs[] = {
16738 * 3-stack pin configuration: 16757 * 3-stack pin configuration:
16739 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b 16758 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
16740 */ 16759 */
16741static struct hda_verb alc861vd_3stack_init_verbs[] = { 16760static const struct hda_verb alc861vd_3stack_init_verbs[] = {
16742 /* 16761 /*
16743 * Set pin mode and muting 16762 * Set pin mode and muting
16744 */ 16763 */
@@ -16769,7 +16788,7 @@ static struct hda_verb alc861vd_3stack_init_verbs[] = {
16769/* 16788/*
16770 * 6-stack pin configuration: 16789 * 6-stack pin configuration:
16771 */ 16790 */
16772static struct hda_verb alc861vd_6stack_init_verbs[] = { 16791static const struct hda_verb alc861vd_6stack_init_verbs[] = {
16773 /* 16792 /*
16774 * Set pin mode and muting 16793 * Set pin mode and muting
16775 */ 16794 */
@@ -16810,18 +16829,18 @@ static struct hda_verb alc861vd_6stack_init_verbs[] = {
16810 { } 16829 { }
16811}; 16830};
16812 16831
16813static struct hda_verb alc861vd_eapd_verbs[] = { 16832static const struct hda_verb alc861vd_eapd_verbs[] = {
16814 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, 16833 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16815 { } 16834 { }
16816}; 16835};
16817 16836
16818static struct hda_verb alc660vd_eapd_verbs[] = { 16837static const struct hda_verb alc660vd_eapd_verbs[] = {
16819 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, 16838 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16820 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, 16839 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16821 { } 16840 { }
16822}; 16841};
16823 16842
16824static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { 16843static const struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
16825 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 16844 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16826 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 16845 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16827 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, 16846 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
@@ -16835,11 +16854,13 @@ static void alc861vd_lenovo_setup(struct hda_codec *codec)
16835 struct alc_spec *spec = codec->spec; 16854 struct alc_spec *spec = codec->spec;
16836 spec->autocfg.hp_pins[0] = 0x1b; 16855 spec->autocfg.hp_pins[0] = 0x1b;
16837 spec->autocfg.speaker_pins[0] = 0x14; 16856 spec->autocfg.speaker_pins[0] = 0x14;
16857 spec->automute = 1;
16858 spec->automute_mode = ALC_AUTOMUTE_AMP;
16838} 16859}
16839 16860
16840static void alc861vd_lenovo_init_hook(struct hda_codec *codec) 16861static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
16841{ 16862{
16842 alc_automute_amp(codec); 16863 alc_hp_automute(codec);
16843 alc88x_simple_mic_automute(codec); 16864 alc88x_simple_mic_automute(codec);
16844} 16865}
16845 16866
@@ -16851,12 +16872,12 @@ static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
16851 alc88x_simple_mic_automute(codec); 16872 alc88x_simple_mic_automute(codec);
16852 break; 16873 break;
16853 default: 16874 default:
16854 alc_automute_amp_unsol_event(codec, res); 16875 alc_sku_unsol_event(codec, res);
16855 break; 16876 break;
16856 } 16877 }
16857} 16878}
16858 16879
16859static struct hda_verb alc861vd_dallas_verbs[] = { 16880static const struct hda_verb alc861vd_dallas_verbs[] = {
16860 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 16881 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16861 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 16882 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16862 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 16883 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
@@ -16908,6 +16929,8 @@ static void alc861vd_dallas_setup(struct hda_codec *codec)
16908 16929
16909 spec->autocfg.hp_pins[0] = 0x15; 16930 spec->autocfg.hp_pins[0] = 0x15;
16910 spec->autocfg.speaker_pins[0] = 0x14; 16931 spec->autocfg.speaker_pins[0] = 0x14;
16932 spec->automute = 1;
16933 spec->automute_mode = ALC_AUTOMUTE_AMP;
16911} 16934}
16912 16935
16913#ifdef CONFIG_SND_HDA_POWER_SAVE 16936#ifdef CONFIG_SND_HDA_POWER_SAVE
@@ -16936,7 +16959,7 @@ static const char * const alc861vd_models[ALC861VD_MODEL_LAST] = {
16936 [ALC861VD_AUTO] = "auto", 16959 [ALC861VD_AUTO] = "auto",
16937}; 16960};
16938 16961
16939static struct snd_pci_quirk alc861vd_cfg_tbl[] = { 16962static const struct snd_pci_quirk alc861vd_cfg_tbl[] = {
16940 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), 16963 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
16941 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), 16964 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
16942 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), 16965 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
@@ -16955,7 +16978,7 @@ static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
16955 {} 16978 {}
16956}; 16979};
16957 16980
16958static struct alc_config_preset alc861vd_presets[] = { 16981static const struct alc_config_preset alc861vd_presets[] = {
16959 [ALC660VD_3ST] = { 16982 [ALC660VD_3ST] = {
16960 .mixers = { alc861vd_3st_mixer }, 16983 .mixers = { alc861vd_3st_mixer },
16961 .init_verbs = { alc861vd_volume_init_verbs, 16984 .init_verbs = { alc861vd_volume_init_verbs,
@@ -17032,9 +17055,9 @@ static struct alc_config_preset alc861vd_presets[] = {
17032 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), 17055 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17033 .channel_mode = alc861vd_3stack_2ch_modes, 17056 .channel_mode = alc861vd_3stack_2ch_modes,
17034 .input_mux = &alc861vd_dallas_capture_source, 17057 .input_mux = &alc861vd_dallas_capture_source,
17035 .unsol_event = alc_automute_amp_unsol_event, 17058 .unsol_event = alc_sku_unsol_event,
17036 .setup = alc861vd_dallas_setup, 17059 .setup = alc861vd_dallas_setup,
17037 .init_hook = alc_automute_amp, 17060 .init_hook = alc_hp_automute,
17038 }, 17061 },
17039 [ALC861VD_HP] = { 17062 [ALC861VD_HP] = {
17040 .mixers = { alc861vd_hp_mixer }, 17063 .mixers = { alc861vd_hp_mixer },
@@ -17045,9 +17068,9 @@ static struct alc_config_preset alc861vd_presets[] = {
17045 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), 17068 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17046 .channel_mode = alc861vd_3stack_2ch_modes, 17069 .channel_mode = alc861vd_3stack_2ch_modes,
17047 .input_mux = &alc861vd_hp_capture_source, 17070 .input_mux = &alc861vd_hp_capture_source,
17048 .unsol_event = alc_automute_amp_unsol_event, 17071 .unsol_event = alc_sku_unsol_event,
17049 .setup = alc861vd_dallas_setup, 17072 .setup = alc861vd_dallas_setup,
17050 .init_hook = alc_automute_amp, 17073 .init_hook = alc_hp_automute,
17051 }, 17074 },
17052 [ALC660VD_ASUS_V1S] = { 17075 [ALC660VD_ASUS_V1S] = {
17053 .mixers = { alc861vd_lenovo_mixer }, 17076 .mixers = { alc861vd_lenovo_mixer },
@@ -17146,11 +17169,15 @@ static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
17146 static const char * const chname[4] = { 17169 static const char * const chname[4] = {
17147 "Front", "Surround", "CLFE", "Side" 17170 "Front", "Surround", "CLFE", "Side"
17148 }; 17171 };
17149 const char *pfx = alc_get_line_out_pfx(cfg, true); 17172 const char *pfx = alc_get_line_out_pfx(spec, true);
17150 hda_nid_t nid_v, nid_s; 17173 hda_nid_t nid_v, nid_s;
17151 int i, err; 17174 int i, err, noutputs;
17152 17175
17153 for (i = 0; i < cfg->line_outs; i++) { 17176 noutputs = cfg->line_outs;
17177 if (spec->multi_ios > 0)
17178 noutputs += spec->multi_ios;
17179
17180 for (i = 0; i < noutputs; i++) {
17154 if (!spec->multiout.dac_nids[i]) 17181 if (!spec->multiout.dac_nids[i])
17155 continue; 17182 continue;
17156 nid_v = alc861vd_idx_to_mixer_vol( 17183 nid_v = alc861vd_idx_to_mixer_vol(
@@ -17263,7 +17290,7 @@ static int alc861vd_parse_auto_config(struct hda_codec *codec)
17263{ 17290{
17264 struct alc_spec *spec = codec->spec; 17291 struct alc_spec *spec = codec->spec;
17265 int err; 17292 int err;
17266 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; 17293 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
17267 17294
17268 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, 17295 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17269 alc861vd_ignore); 17296 alc861vd_ignore);
@@ -17275,6 +17302,9 @@ static int alc861vd_parse_auto_config(struct hda_codec *codec)
17275 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); 17302 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
17276 if (err < 0) 17303 if (err < 0)
17277 return err; 17304 return err;
17305 err = alc_auto_add_multi_channel_mode(codec);
17306 if (err < 0)
17307 return err;
17278 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); 17308 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
17279 if (err < 0) 17309 if (err < 0)
17280 return err; 17310 return err;
@@ -17343,7 +17373,7 @@ static const struct alc_fixup alc861vd_fixups[] = {
17343 }, 17373 },
17344}; 17374};
17345 17375
17346static struct snd_pci_quirk alc861vd_fixup_tbl[] = { 17376static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
17347 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), 17377 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
17348 {} 17378 {}
17349}; 17379};
@@ -17426,6 +17456,7 @@ static int patch_alc861vd(struct hda_codec *codec)
17426 17456
17427 if (board_config == ALC861VD_AUTO) 17457 if (board_config == ALC861VD_AUTO)
17428 spec->init_hook = alc861vd_auto_init; 17458 spec->init_hook = alc861vd_auto_init;
17459 spec->shutup = alc_eapd_shutup;
17429#ifdef CONFIG_SND_HDA_POWER_SAVE 17460#ifdef CONFIG_SND_HDA_POWER_SAVE
17430 if (!spec->loopback.amplist) 17461 if (!spec->loopback.amplist)
17431 spec->loopback.amplist = alc861vd_loopbacks; 17462 spec->loopback.amplist = alc861vd_loopbacks;
@@ -17448,32 +17479,32 @@ static int patch_alc861vd(struct hda_codec *codec)
17448#define ALC662_DIGOUT_NID 0x06 17479#define ALC662_DIGOUT_NID 0x06
17449#define ALC662_DIGIN_NID 0x0a 17480#define ALC662_DIGIN_NID 0x0a
17450 17481
17451static hda_nid_t alc662_dac_nids[4] = { 17482static const hda_nid_t alc662_dac_nids[3] = {
17452 /* front, rear, clfe, rear_surr */ 17483 /* front, rear, clfe */
17453 0x02, 0x03, 0x04 17484 0x02, 0x03, 0x04
17454}; 17485};
17455 17486
17456static hda_nid_t alc272_dac_nids[2] = { 17487static const hda_nid_t alc272_dac_nids[2] = {
17457 0x02, 0x03 17488 0x02, 0x03
17458}; 17489};
17459 17490
17460static hda_nid_t alc662_adc_nids[2] = { 17491static const hda_nid_t alc662_adc_nids[2] = {
17461 /* ADC1-2 */ 17492 /* ADC1-2 */
17462 0x09, 0x08 17493 0x09, 0x08
17463}; 17494};
17464 17495
17465static hda_nid_t alc272_adc_nids[1] = { 17496static const hda_nid_t alc272_adc_nids[1] = {
17466 /* ADC1-2 */ 17497 /* ADC1-2 */
17467 0x08, 17498 0x08,
17468}; 17499};
17469 17500
17470static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; 17501static const hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
17471static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; 17502static const hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
17472 17503
17473 17504
17474/* input MUX */ 17505/* input MUX */
17475/* FIXME: should be a matrix-type input source selection */ 17506/* FIXME: should be a matrix-type input source selection */
17476static struct hda_input_mux alc662_capture_source = { 17507static const struct hda_input_mux alc662_capture_source = {
17477 .num_items = 4, 17508 .num_items = 4,
17478 .items = { 17509 .items = {
17479 { "Mic", 0x0 }, 17510 { "Mic", 0x0 },
@@ -17483,7 +17514,7 @@ static struct hda_input_mux alc662_capture_source = {
17483 }, 17514 },
17484}; 17515};
17485 17516
17486static struct hda_input_mux alc662_lenovo_101e_capture_source = { 17517static const struct hda_input_mux alc662_lenovo_101e_capture_source = {
17487 .num_items = 2, 17518 .num_items = 2,
17488 .items = { 17519 .items = {
17489 { "Mic", 0x1 }, 17520 { "Mic", 0x1 },
@@ -17491,7 +17522,7 @@ static struct hda_input_mux alc662_lenovo_101e_capture_source = {
17491 }, 17522 },
17492}; 17523};
17493 17524
17494static struct hda_input_mux alc663_capture_source = { 17525static const struct hda_input_mux alc663_capture_source = {
17495 .num_items = 3, 17526 .num_items = 3,
17496 .items = { 17527 .items = {
17497 { "Mic", 0x0 }, 17528 { "Mic", 0x0 },
@@ -17501,7 +17532,7 @@ static struct hda_input_mux alc663_capture_source = {
17501}; 17532};
17502 17533
17503#if 0 /* set to 1 for testing other input sources below */ 17534#if 0 /* set to 1 for testing other input sources below */
17504static struct hda_input_mux alc272_nc10_capture_source = { 17535static const struct hda_input_mux alc272_nc10_capture_source = {
17505 .num_items = 16, 17536 .num_items = 16,
17506 .items = { 17537 .items = {
17507 { "Autoselect Mic", 0x0 }, 17538 { "Autoselect Mic", 0x0 },
@@ -17527,14 +17558,14 @@ static struct hda_input_mux alc272_nc10_capture_source = {
17527/* 17558/*
17528 * 2ch mode 17559 * 2ch mode
17529 */ 17560 */
17530static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { 17561static const struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
17531 { 2, NULL } 17562 { 2, NULL }
17532}; 17563};
17533 17564
17534/* 17565/*
17535 * 2ch mode 17566 * 2ch mode
17536 */ 17567 */
17537static struct hda_verb alc662_3ST_ch2_init[] = { 17568static const struct hda_verb alc662_3ST_ch2_init[] = {
17538 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, 17569 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
17539 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, 17570 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17540 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, 17571 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
@@ -17545,7 +17576,7 @@ static struct hda_verb alc662_3ST_ch2_init[] = {
17545/* 17576/*
17546 * 6ch mode 17577 * 6ch mode
17547 */ 17578 */
17548static struct hda_verb alc662_3ST_ch6_init[] = { 17579static const struct hda_verb alc662_3ST_ch6_init[] = {
17549 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 17580 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17550 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, 17581 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17551 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, 17582 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
@@ -17555,7 +17586,7 @@ static struct hda_verb alc662_3ST_ch6_init[] = {
17555 { } /* end */ 17586 { } /* end */
17556}; 17587};
17557 17588
17558static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { 17589static const struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
17559 { 2, alc662_3ST_ch2_init }, 17590 { 2, alc662_3ST_ch2_init },
17560 { 6, alc662_3ST_ch6_init }, 17591 { 6, alc662_3ST_ch6_init },
17561}; 17592};
@@ -17563,7 +17594,7 @@ static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
17563/* 17594/*
17564 * 2ch mode 17595 * 2ch mode
17565 */ 17596 */
17566static struct hda_verb alc662_sixstack_ch6_init[] = { 17597static const struct hda_verb alc662_sixstack_ch6_init[] = {
17567 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, 17598 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17568 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, 17599 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17569 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 17600 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
@@ -17573,14 +17604,14 @@ static struct hda_verb alc662_sixstack_ch6_init[] = {
17573/* 17604/*
17574 * 6ch mode 17605 * 6ch mode
17575 */ 17606 */
17576static struct hda_verb alc662_sixstack_ch8_init[] = { 17607static const struct hda_verb alc662_sixstack_ch8_init[] = {
17577 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 17608 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17578 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 17609 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17579 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 17610 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17580 { } /* end */ 17611 { } /* end */
17581}; 17612};
17582 17613
17583static struct hda_channel_mode alc662_5stack_modes[2] = { 17614static const struct hda_channel_mode alc662_5stack_modes[2] = {
17584 { 2, alc662_sixstack_ch6_init }, 17615 { 2, alc662_sixstack_ch6_init },
17585 { 6, alc662_sixstack_ch8_init }, 17616 { 6, alc662_sixstack_ch8_init },
17586}; 17617};
@@ -17589,7 +17620,7 @@ static struct hda_channel_mode alc662_5stack_modes[2] = {
17589 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b 17620 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
17590 */ 17621 */
17591 17622
17592static struct snd_kcontrol_new alc662_base_mixer[] = { 17623static const struct snd_kcontrol_new alc662_base_mixer[] = {
17593 /* output mixer control */ 17624 /* output mixer control */
17594 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), 17625 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
17595 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), 17626 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
@@ -17613,7 +17644,7 @@ static struct snd_kcontrol_new alc662_base_mixer[] = {
17613 { } /* end */ 17644 { } /* end */
17614}; 17645};
17615 17646
17616static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { 17647static const struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
17617 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), 17648 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17618 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), 17649 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17619 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 17650 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
@@ -17628,7 +17659,7 @@ static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
17628 { } /* end */ 17659 { } /* end */
17629}; 17660};
17630 17661
17631static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { 17662static const struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
17632 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), 17663 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17633 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), 17664 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17634 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), 17665 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
@@ -17649,7 +17680,7 @@ static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
17649 { } /* end */ 17680 { } /* end */
17650}; 17681};
17651 17682
17652static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { 17683static const struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
17653 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), 17684 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17654 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), 17685 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
17655 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), 17686 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
@@ -17662,7 +17693,7 @@ static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
17662 { } /* end */ 17693 { } /* end */
17663}; 17694};
17664 17695
17665static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { 17696static const struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
17666 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), 17697 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17667 ALC262_HIPPO_MASTER_SWITCH, 17698 ALC262_HIPPO_MASTER_SWITCH,
17668 17699
@@ -17676,7 +17707,7 @@ static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
17676 { } /* end */ 17707 { } /* end */
17677}; 17708};
17678 17709
17679static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { 17710static const struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
17680 ALC262_HIPPO_MASTER_SWITCH, 17711 ALC262_HIPPO_MASTER_SWITCH,
17681 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), 17712 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17682 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), 17713 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
@@ -17690,7 +17721,7 @@ static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
17690 { } /* end */ 17721 { } /* end */
17691}; 17722};
17692 17723
17693static struct hda_bind_ctls alc663_asus_bind_master_vol = { 17724static const struct hda_bind_ctls alc663_asus_bind_master_vol = {
17694 .ops = &snd_hda_bind_vol, 17725 .ops = &snd_hda_bind_vol,
17695 .values = { 17726 .values = {
17696 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), 17727 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
@@ -17699,7 +17730,7 @@ static struct hda_bind_ctls alc663_asus_bind_master_vol = {
17699 }, 17730 },
17700}; 17731};
17701 17732
17702static struct hda_bind_ctls alc663_asus_one_bind_switch = { 17733static const struct hda_bind_ctls alc663_asus_one_bind_switch = {
17703 .ops = &snd_hda_bind_sw, 17734 .ops = &snd_hda_bind_sw,
17704 .values = { 17735 .values = {
17705 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), 17736 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
@@ -17708,7 +17739,7 @@ static struct hda_bind_ctls alc663_asus_one_bind_switch = {
17708 }, 17739 },
17709}; 17740};
17710 17741
17711static struct snd_kcontrol_new alc663_m51va_mixer[] = { 17742static const struct snd_kcontrol_new alc663_m51va_mixer[] = {
17712 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), 17743 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17713 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), 17744 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
17714 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 17745 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
@@ -17716,7 +17747,7 @@ static struct snd_kcontrol_new alc663_m51va_mixer[] = {
17716 { } /* end */ 17747 { } /* end */
17717}; 17748};
17718 17749
17719static struct hda_bind_ctls alc663_asus_tree_bind_switch = { 17750static const struct hda_bind_ctls alc663_asus_tree_bind_switch = {
17720 .ops = &snd_hda_bind_sw, 17751 .ops = &snd_hda_bind_sw,
17721 .values = { 17752 .values = {
17722 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), 17753 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
@@ -17726,7 +17757,7 @@ static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
17726 }, 17757 },
17727}; 17758};
17728 17759
17729static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { 17760static const struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
17730 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), 17761 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17731 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), 17762 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
17732 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 17763 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
@@ -17737,7 +17768,7 @@ static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
17737 { } /* end */ 17768 { } /* end */
17738}; 17769};
17739 17770
17740static struct hda_bind_ctls alc663_asus_four_bind_switch = { 17771static const struct hda_bind_ctls alc663_asus_four_bind_switch = {
17741 .ops = &snd_hda_bind_sw, 17772 .ops = &snd_hda_bind_sw,
17742 .values = { 17773 .values = {
17743 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), 17774 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
@@ -17747,7 +17778,7 @@ static struct hda_bind_ctls alc663_asus_four_bind_switch = {
17747 }, 17778 },
17748}; 17779};
17749 17780
17750static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { 17781static const struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
17751 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), 17782 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17752 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), 17783 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
17753 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 17784 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
@@ -17757,7 +17788,7 @@ static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
17757 { } /* end */ 17788 { } /* end */
17758}; 17789};
17759 17790
17760static struct snd_kcontrol_new alc662_1bjd_mixer[] = { 17791static const struct snd_kcontrol_new alc662_1bjd_mixer[] = {
17761 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), 17792 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17762 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), 17793 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17763 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 17794 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
@@ -17768,7 +17799,7 @@ static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
17768 { } /* end */ 17799 { } /* end */
17769}; 17800};
17770 17801
17771static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { 17802static const struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
17772 .ops = &snd_hda_bind_vol, 17803 .ops = &snd_hda_bind_vol,
17773 .values = { 17804 .values = {
17774 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), 17805 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
@@ -17777,7 +17808,7 @@ static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
17777 }, 17808 },
17778}; 17809};
17779 17810
17780static struct hda_bind_ctls alc663_asus_two_bind_switch = { 17811static const struct hda_bind_ctls alc663_asus_two_bind_switch = {
17781 .ops = &snd_hda_bind_sw, 17812 .ops = &snd_hda_bind_sw,
17782 .values = { 17813 .values = {
17783 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), 17814 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
@@ -17786,7 +17817,7 @@ static struct hda_bind_ctls alc663_asus_two_bind_switch = {
17786 }, 17817 },
17787}; 17818};
17788 17819
17789static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { 17820static const struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
17790 HDA_BIND_VOL("Master Playback Volume", 17821 HDA_BIND_VOL("Master Playback Volume",
17791 &alc663_asus_two_bind_master_vol), 17822 &alc663_asus_two_bind_master_vol),
17792 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), 17823 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
@@ -17797,7 +17828,7 @@ static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
17797 { } /* end */ 17828 { } /* end */
17798}; 17829};
17799 17830
17800static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { 17831static const struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
17801 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), 17832 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17802 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), 17833 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17803 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), 17834 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
@@ -17807,7 +17838,7 @@ static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
17807 { } /* end */ 17838 { } /* end */
17808}; 17839};
17809 17840
17810static struct snd_kcontrol_new alc663_g71v_mixer[] = { 17841static const struct snd_kcontrol_new alc663_g71v_mixer[] = {
17811 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), 17842 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17812 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), 17843 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17813 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), 17844 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
@@ -17821,7 +17852,7 @@ static struct snd_kcontrol_new alc663_g71v_mixer[] = {
17821 { } /* end */ 17852 { } /* end */
17822}; 17853};
17823 17854
17824static struct snd_kcontrol_new alc663_g50v_mixer[] = { 17855static const struct snd_kcontrol_new alc663_g50v_mixer[] = {
17825 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), 17856 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17826 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), 17857 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17827 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), 17858 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
@@ -17835,7 +17866,7 @@ static struct snd_kcontrol_new alc663_g50v_mixer[] = {
17835 { } /* end */ 17866 { } /* end */
17836}; 17867};
17837 17868
17838static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { 17869static const struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
17839 .ops = &snd_hda_bind_sw, 17870 .ops = &snd_hda_bind_sw,
17840 .values = { 17871 .values = {
17841 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), 17872 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
@@ -17847,7 +17878,7 @@ static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
17847 }, 17878 },
17848}; 17879};
17849 17880
17850static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { 17881static const struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
17851 .ops = &snd_hda_bind_sw, 17882 .ops = &snd_hda_bind_sw,
17852 .values = { 17883 .values = {
17853 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), 17884 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
@@ -17856,7 +17887,7 @@ static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
17856 }, 17887 },
17857}; 17888};
17858 17889
17859static struct snd_kcontrol_new alc663_mode7_mixer[] = { 17890static const struct snd_kcontrol_new alc663_mode7_mixer[] = {
17860 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), 17891 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17861 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), 17892 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17862 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), 17893 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
@@ -17869,7 +17900,7 @@ static struct snd_kcontrol_new alc663_mode7_mixer[] = {
17869 { } /* end */ 17900 { } /* end */
17870}; 17901};
17871 17902
17872static struct snd_kcontrol_new alc663_mode8_mixer[] = { 17903static const struct snd_kcontrol_new alc663_mode8_mixer[] = {
17873 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), 17904 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17874 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), 17905 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17875 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), 17906 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
@@ -17881,7 +17912,7 @@ static struct snd_kcontrol_new alc663_mode8_mixer[] = {
17881}; 17912};
17882 17913
17883 17914
17884static struct snd_kcontrol_new alc662_chmode_mixer[] = { 17915static const struct snd_kcontrol_new alc662_chmode_mixer[] = {
17885 { 17916 {
17886 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 17917 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
17887 .name = "Channel Mode", 17918 .name = "Channel Mode",
@@ -17892,7 +17923,7 @@ static struct snd_kcontrol_new alc662_chmode_mixer[] = {
17892 { } /* end */ 17923 { } /* end */
17893}; 17924};
17894 17925
17895static struct hda_verb alc662_init_verbs[] = { 17926static const struct hda_verb alc662_init_verbs[] = {
17896 /* ADC: mute amp left and right */ 17927 /* ADC: mute amp left and right */
17897 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 17928 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17898 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, 17929 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
@@ -17938,55 +17969,36 @@ static struct hda_verb alc662_init_verbs[] = {
17938 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 17969 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17939 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 17970 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17940 17971
17941 /* always trun on EAPD */
17942 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
17943 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
17944
17945 { }
17946};
17947
17948static struct hda_verb alc663_init_verbs[] = {
17949 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17950 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17951 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17952 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17953 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17954 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17955 { } 17972 { }
17956}; 17973};
17957 17974
17958static struct hda_verb alc272_init_verbs[] = { 17975static const struct hda_verb alc662_eapd_init_verbs[] = {
17959 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 17976 /* always trun on EAPD */
17960 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 17977 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
17961 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 17978 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
17962 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17963 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17964 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17965 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17966 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17967 { } 17979 { }
17968}; 17980};
17969 17981
17970static struct hda_verb alc662_sue_init_verbs[] = { 17982static const struct hda_verb alc662_sue_init_verbs[] = {
17971 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, 17983 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17972 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, 17984 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17973 {} 17985 {}
17974}; 17986};
17975 17987
17976static struct hda_verb alc662_eeepc_sue_init_verbs[] = { 17988static const struct hda_verb alc662_eeepc_sue_init_verbs[] = {
17977 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, 17989 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17978 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, 17990 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17979 {} 17991 {}
17980}; 17992};
17981 17993
17982/* Set Unsolicited Event*/ 17994/* Set Unsolicited Event*/
17983static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { 17995static const struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
17984 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 17996 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17985 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, 17997 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17986 {} 17998 {}
17987}; 17999};
17988 18000
17989static struct hda_verb alc663_m51va_init_verbs[] = { 18001static const struct hda_verb alc663_m51va_init_verbs[] = {
17990 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 18002 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17991 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 18003 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17992 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 18004 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
@@ -17999,7 +18011,7 @@ static struct hda_verb alc663_m51va_init_verbs[] = {
17999 {} 18011 {}
18000}; 18012};
18001 18013
18002static struct hda_verb alc663_21jd_amic_init_verbs[] = { 18014static const struct hda_verb alc663_21jd_amic_init_verbs[] = {
18003 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 18015 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18004 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 18016 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18005 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ 18017 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
@@ -18010,7 +18022,7 @@ static struct hda_verb alc663_21jd_amic_init_verbs[] = {
18010 {} 18022 {}
18011}; 18023};
18012 18024
18013static struct hda_verb alc662_1bjd_amic_init_verbs[] = { 18025static const struct hda_verb alc662_1bjd_amic_init_verbs[] = {
18014 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 18026 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18015 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 18027 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18016 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 18028 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
@@ -18022,7 +18034,7 @@ static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
18022 {} 18034 {}
18023}; 18035};
18024 18036
18025static struct hda_verb alc663_15jd_amic_init_verbs[] = { 18037static const struct hda_verb alc663_15jd_amic_init_verbs[] = {
18026 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 18038 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18027 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 18039 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18028 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ 18040 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
@@ -18033,7 +18045,7 @@ static struct hda_verb alc663_15jd_amic_init_verbs[] = {
18033 {} 18045 {}
18034}; 18046};
18035 18047
18036static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { 18048static const struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
18037 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 18049 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18038 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 18050 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18039 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 18051 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
@@ -18049,7 +18061,7 @@ static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
18049 {} 18061 {}
18050}; 18062};
18051 18063
18052static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { 18064static const struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
18053 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 18065 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18054 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 18066 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18055 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 18067 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
@@ -18065,7 +18077,7 @@ static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
18065 {} 18077 {}
18066}; 18078};
18067 18079
18068static struct hda_verb alc663_g71v_init_verbs[] = { 18080static const struct hda_verb alc663_g71v_init_verbs[] = {
18069 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 18081 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18070 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ 18082 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
18071 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ 18083 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
@@ -18080,7 +18092,7 @@ static struct hda_verb alc663_g71v_init_verbs[] = {
18080 {} 18092 {}
18081}; 18093};
18082 18094
18083static struct hda_verb alc663_g50v_init_verbs[] = { 18095static const struct hda_verb alc663_g50v_init_verbs[] = {
18084 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 18096 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18085 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 18097 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18086 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ 18098 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
@@ -18090,7 +18102,7 @@ static struct hda_verb alc663_g50v_init_verbs[] = {
18090 {} 18102 {}
18091}; 18103};
18092 18104
18093static struct hda_verb alc662_ecs_init_verbs[] = { 18105static const struct hda_verb alc662_ecs_init_verbs[] = {
18094 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, 18106 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
18095 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 18107 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18096 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, 18108 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
@@ -18098,7 +18110,7 @@ static struct hda_verb alc662_ecs_init_verbs[] = {
18098 {} 18110 {}
18099}; 18111};
18100 18112
18101static struct hda_verb alc272_dell_zm1_init_verbs[] = { 18113static const struct hda_verb alc272_dell_zm1_init_verbs[] = {
18102 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 18114 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18103 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 18115 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18104 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 18116 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
@@ -18113,7 +18125,7 @@ static struct hda_verb alc272_dell_zm1_init_verbs[] = {
18113 {} 18125 {}
18114}; 18126};
18115 18127
18116static struct hda_verb alc272_dell_init_verbs[] = { 18128static const struct hda_verb alc272_dell_init_verbs[] = {
18117 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 18129 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18118 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 18130 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18119 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 18131 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
@@ -18128,7 +18140,7 @@ static struct hda_verb alc272_dell_init_verbs[] = {
18128 {} 18140 {}
18129}; 18141};
18130 18142
18131static struct hda_verb alc663_mode7_init_verbs[] = { 18143static const struct hda_verb alc663_mode7_init_verbs[] = {
18132 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 18144 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18133 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 18145 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18134 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 18146 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
@@ -18147,7 +18159,7 @@ static struct hda_verb alc663_mode7_init_verbs[] = {
18147 {} 18159 {}
18148}; 18160};
18149 18161
18150static struct hda_verb alc663_mode8_init_verbs[] = { 18162static const struct hda_verb alc663_mode8_init_verbs[] = {
18151 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 18163 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18152 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 18164 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18153 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 18165 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
@@ -18167,61 +18179,29 @@ static struct hda_verb alc663_mode8_init_verbs[] = {
18167 {} 18179 {}
18168}; 18180};
18169 18181
18170static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { 18182static const struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
18171 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), 18183 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
18172 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), 18184 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
18173 { } /* end */ 18185 { } /* end */
18174}; 18186};
18175 18187
18176static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { 18188static const struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
18177 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), 18189 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
18178 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), 18190 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
18179 { } /* end */ 18191 { } /* end */
18180}; 18192};
18181 18193
18182static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) 18194static void alc662_lenovo_101e_setup(struct hda_codec *codec)
18183{
18184 unsigned int present;
18185 unsigned char bits;
18186
18187 present = snd_hda_jack_detect(codec, 0x14);
18188 bits = present ? HDA_AMP_MUTE : 0;
18189
18190 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18191 HDA_AMP_MUTE, bits);
18192}
18193
18194static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
18195{
18196 unsigned int present;
18197 unsigned char bits;
18198
18199 present = snd_hda_jack_detect(codec, 0x1b);
18200 bits = present ? HDA_AMP_MUTE : 0;
18201
18202 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18203 HDA_AMP_MUTE, bits);
18204 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18205 HDA_AMP_MUTE, bits);
18206}
18207
18208static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
18209 unsigned int res)
18210{ 18195{
18211 if ((res >> 26) == ALC880_HP_EVENT) 18196 struct alc_spec *spec = codec->spec;
18212 alc662_lenovo_101e_all_automute(codec);
18213 if ((res >> 26) == ALC880_FRONT_EVENT)
18214 alc662_lenovo_101e_ispeaker_automute(codec);
18215}
18216 18197
18217/* unsolicited event for HP jack sensing */ 18198 spec->autocfg.hp_pins[0] = 0x1b;
18218static void alc662_eeepc_unsol_event(struct hda_codec *codec, 18199 spec->autocfg.line_out_pins[0] = 0x14;
18219 unsigned int res) 18200 spec->autocfg.speaker_pins[0] = 0x15;
18220{ 18201 spec->automute = 1;
18221 if ((res >> 26) == ALC880_MIC_EVENT) 18202 spec->detect_line = 1;
18222 alc_mic_automute(codec); 18203 spec->automute_lines = 1;
18223 else 18204 spec->automute_mode = ALC_AUTOMUTE_AMP;
18224 alc262_hippo_unsol_event(codec, res);
18225} 18205}
18226 18206
18227static void alc662_eeepc_setup(struct hda_codec *codec) 18207static void alc662_eeepc_setup(struct hda_codec *codec)
@@ -18236,180 +18216,24 @@ static void alc662_eeepc_setup(struct hda_codec *codec)
18236 spec->auto_mic = 1; 18216 spec->auto_mic = 1;
18237} 18217}
18238 18218
18239static void alc662_eeepc_inithook(struct hda_codec *codec)
18240{
18241 alc262_hippo_automute(codec);
18242 alc_mic_automute(codec);
18243}
18244
18245static void alc662_eeepc_ep20_setup(struct hda_codec *codec) 18219static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
18246{ 18220{
18247 struct alc_spec *spec = codec->spec; 18221 struct alc_spec *spec = codec->spec;
18248 18222
18249 spec->autocfg.hp_pins[0] = 0x14; 18223 spec->autocfg.hp_pins[0] = 0x14;
18250 spec->autocfg.speaker_pins[0] = 0x1b; 18224 spec->autocfg.speaker_pins[0] = 0x1b;
18251} 18225 spec->automute = 1;
18252 18226 spec->automute_mode = ALC_AUTOMUTE_AMP;
18253#define alc662_eeepc_ep20_inithook alc262_hippo_master_update
18254
18255static void alc663_m51va_speaker_automute(struct hda_codec *codec)
18256{
18257 unsigned int present;
18258 unsigned char bits;
18259
18260 present = snd_hda_jack_detect(codec, 0x21);
18261 bits = present ? HDA_AMP_MUTE : 0;
18262 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18263 HDA_AMP_MUTE, bits);
18264 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18265 HDA_AMP_MUTE, bits);
18266}
18267
18268static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
18269{
18270 unsigned int present;
18271 unsigned char bits;
18272
18273 present = snd_hda_jack_detect(codec, 0x21);
18274 bits = present ? HDA_AMP_MUTE : 0;
18275 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18276 HDA_AMP_MUTE, bits);
18277 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18278 HDA_AMP_MUTE, bits);
18279 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
18280 HDA_AMP_MUTE, bits);
18281 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
18282 HDA_AMP_MUTE, bits);
18283}
18284
18285static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
18286{
18287 unsigned int present;
18288 unsigned char bits;
18289
18290 present = snd_hda_jack_detect(codec, 0x15);
18291 bits = present ? HDA_AMP_MUTE : 0;
18292 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18293 HDA_AMP_MUTE, bits);
18294 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18295 HDA_AMP_MUTE, bits);
18296 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
18297 HDA_AMP_MUTE, bits);
18298 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
18299 HDA_AMP_MUTE, bits);
18300}
18301
18302static void alc662_f5z_speaker_automute(struct hda_codec *codec)
18303{
18304 unsigned int present;
18305 unsigned char bits;
18306
18307 present = snd_hda_jack_detect(codec, 0x1b);
18308 bits = present ? 0 : PIN_OUT;
18309 snd_hda_codec_write(codec, 0x14, 0,
18310 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
18311}
18312
18313static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
18314{
18315 unsigned int present1, present2;
18316
18317 present1 = snd_hda_jack_detect(codec, 0x21);
18318 present2 = snd_hda_jack_detect(codec, 0x15);
18319
18320 if (present1 || present2) {
18321 snd_hda_codec_write_cache(codec, 0x14, 0,
18322 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18323 } else {
18324 snd_hda_codec_write_cache(codec, 0x14, 0,
18325 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18326 }
18327}
18328
18329static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
18330{
18331 unsigned int present1, present2;
18332
18333 present1 = snd_hda_jack_detect(codec, 0x1b);
18334 present2 = snd_hda_jack_detect(codec, 0x15);
18335
18336 if (present1 || present2) {
18337 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18338 HDA_AMP_MUTE, HDA_AMP_MUTE);
18339 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18340 HDA_AMP_MUTE, HDA_AMP_MUTE);
18341 } else {
18342 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18343 HDA_AMP_MUTE, 0);
18344 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18345 HDA_AMP_MUTE, 0);
18346 }
18347}
18348
18349static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
18350{
18351 unsigned int present1, present2;
18352
18353 present1 = snd_hda_codec_read(codec, 0x1b, 0,
18354 AC_VERB_GET_PIN_SENSE, 0)
18355 & AC_PINSENSE_PRESENCE;
18356 present2 = snd_hda_codec_read(codec, 0x21, 0,
18357 AC_VERB_GET_PIN_SENSE, 0)
18358 & AC_PINSENSE_PRESENCE;
18359
18360 if (present1 || present2) {
18361 snd_hda_codec_write_cache(codec, 0x14, 0,
18362 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18363 snd_hda_codec_write_cache(codec, 0x17, 0,
18364 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18365 } else {
18366 snd_hda_codec_write_cache(codec, 0x14, 0,
18367 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18368 snd_hda_codec_write_cache(codec, 0x17, 0,
18369 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18370 }
18371}
18372
18373static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
18374{
18375 unsigned int present1, present2;
18376
18377 present1 = snd_hda_codec_read(codec, 0x21, 0,
18378 AC_VERB_GET_PIN_SENSE, 0)
18379 & AC_PINSENSE_PRESENCE;
18380 present2 = snd_hda_codec_read(codec, 0x15, 0,
18381 AC_VERB_GET_PIN_SENSE, 0)
18382 & AC_PINSENSE_PRESENCE;
18383
18384 if (present1 || present2) {
18385 snd_hda_codec_write_cache(codec, 0x14, 0,
18386 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18387 snd_hda_codec_write_cache(codec, 0x17, 0,
18388 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18389 } else {
18390 snd_hda_codec_write_cache(codec, 0x14, 0,
18391 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18392 snd_hda_codec_write_cache(codec, 0x17, 0,
18393 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18394 }
18395}
18396
18397static void alc663_m51va_unsol_event(struct hda_codec *codec,
18398 unsigned int res)
18399{
18400 switch (res >> 26) {
18401 case ALC880_HP_EVENT:
18402 alc663_m51va_speaker_automute(codec);
18403 break;
18404 case ALC880_MIC_EVENT:
18405 alc_mic_automute(codec);
18406 break;
18407 }
18408} 18227}
18409 18228
18410static void alc663_m51va_setup(struct hda_codec *codec) 18229static void alc663_m51va_setup(struct hda_codec *codec)
18411{ 18230{
18412 struct alc_spec *spec = codec->spec; 18231 struct alc_spec *spec = codec->spec;
18232 spec->autocfg.hp_pins[0] = 0x21;
18233 spec->autocfg.speaker_pins[0] = 0x14;
18234 spec->automute_mixer_nid[0] = 0x0c;
18235 spec->automute = 1;
18236 spec->automute_mode = ALC_AUTOMUTE_MIXER;
18413 spec->ext_mic.pin = 0x18; 18237 spec->ext_mic.pin = 0x18;
18414 spec->ext_mic.mux_idx = 0; 18238 spec->ext_mic.mux_idx = 0;
18415 spec->int_mic.pin = 0x12; 18239 spec->int_mic.pin = 0x12;
@@ -18417,18 +18241,15 @@ static void alc663_m51va_setup(struct hda_codec *codec)
18417 spec->auto_mic = 1; 18241 spec->auto_mic = 1;
18418} 18242}
18419 18243
18420static void alc663_m51va_inithook(struct hda_codec *codec)
18421{
18422 alc663_m51va_speaker_automute(codec);
18423 alc_mic_automute(codec);
18424}
18425
18426/* ***************** Mode1 ******************************/ 18244/* ***************** Mode1 ******************************/
18427#define alc663_mode1_unsol_event alc663_m51va_unsol_event
18428
18429static void alc663_mode1_setup(struct hda_codec *codec) 18245static void alc663_mode1_setup(struct hda_codec *codec)
18430{ 18246{
18431 struct alc_spec *spec = codec->spec; 18247 struct alc_spec *spec = codec->spec;
18248 spec->autocfg.hp_pins[0] = 0x21;
18249 spec->autocfg.speaker_pins[0] = 0x14;
18250 spec->automute_mixer_nid[0] = 0x0c;
18251 spec->automute = 1;
18252 spec->automute_mode = ALC_AUTOMUTE_MIXER;
18432 spec->ext_mic.pin = 0x18; 18253 spec->ext_mic.pin = 0x18;
18433 spec->ext_mic.mux_idx = 0; 18254 spec->ext_mic.mux_idx = 0;
18434 spec->int_mic.pin = 0x19; 18255 spec->int_mic.pin = 0x19;
@@ -18436,229 +18257,144 @@ static void alc663_mode1_setup(struct hda_codec *codec)
18436 spec->auto_mic = 1; 18257 spec->auto_mic = 1;
18437} 18258}
18438 18259
18439#define alc663_mode1_inithook alc663_m51va_inithook
18440
18441/* ***************** Mode2 ******************************/ 18260/* ***************** Mode2 ******************************/
18442static void alc662_mode2_unsol_event(struct hda_codec *codec, 18261static void alc662_mode2_setup(struct hda_codec *codec)
18443 unsigned int res)
18444{ 18262{
18445 switch (res >> 26) { 18263 struct alc_spec *spec = codec->spec;
18446 case ALC880_HP_EVENT: 18264 spec->autocfg.hp_pins[0] = 0x1b;
18447 alc662_f5z_speaker_automute(codec); 18265 spec->autocfg.speaker_pins[0] = 0x14;
18448 break; 18266 spec->automute = 1;
18449 case ALC880_MIC_EVENT: 18267 spec->automute_mode = ALC_AUTOMUTE_PIN;
18450 alc_mic_automute(codec); 18268 spec->ext_mic.pin = 0x18;
18451 break; 18269 spec->ext_mic.mux_idx = 0;
18452 } 18270 spec->int_mic.pin = 0x19;
18271 spec->int_mic.mux_idx = 1;
18272 spec->auto_mic = 1;
18453} 18273}
18454 18274
18455#define alc662_mode2_setup alc663_mode1_setup
18456
18457static void alc662_mode2_inithook(struct hda_codec *codec)
18458{
18459 alc662_f5z_speaker_automute(codec);
18460 alc_mic_automute(codec);
18461}
18462/* ***************** Mode3 ******************************/ 18275/* ***************** Mode3 ******************************/
18463static void alc663_mode3_unsol_event(struct hda_codec *codec, 18276static void alc663_mode3_setup(struct hda_codec *codec)
18464 unsigned int res)
18465{ 18277{
18466 switch (res >> 26) { 18278 struct alc_spec *spec = codec->spec;
18467 case ALC880_HP_EVENT: 18279 spec->autocfg.hp_pins[0] = 0x21;
18468 alc663_two_hp_m1_speaker_automute(codec); 18280 spec->autocfg.hp_pins[0] = 0x15;
18469 break; 18281 spec->autocfg.speaker_pins[0] = 0x14;
18470 case ALC880_MIC_EVENT: 18282 spec->automute = 1;
18471 alc_mic_automute(codec); 18283 spec->automute_mode = ALC_AUTOMUTE_PIN;
18472 break; 18284 spec->ext_mic.pin = 0x18;
18473 } 18285 spec->ext_mic.mux_idx = 0;
18286 spec->int_mic.pin = 0x19;
18287 spec->int_mic.mux_idx = 1;
18288 spec->auto_mic = 1;
18474} 18289}
18475 18290
18476#define alc663_mode3_setup alc663_mode1_setup
18477
18478static void alc663_mode3_inithook(struct hda_codec *codec)
18479{
18480 alc663_two_hp_m1_speaker_automute(codec);
18481 alc_mic_automute(codec);
18482}
18483/* ***************** Mode4 ******************************/ 18291/* ***************** Mode4 ******************************/
18484static void alc663_mode4_unsol_event(struct hda_codec *codec, 18292static void alc663_mode4_setup(struct hda_codec *codec)
18485 unsigned int res)
18486{ 18293{
18487 switch (res >> 26) { 18294 struct alc_spec *spec = codec->spec;
18488 case ALC880_HP_EVENT: 18295 spec->autocfg.hp_pins[0] = 0x21;
18489 alc663_21jd_two_speaker_automute(codec); 18296 spec->autocfg.speaker_pins[0] = 0x14;
18490 break; 18297 spec->autocfg.speaker_pins[1] = 0x16;
18491 case ALC880_MIC_EVENT: 18298 spec->automute_mixer_nid[0] = 0x0c;
18492 alc_mic_automute(codec); 18299 spec->automute_mixer_nid[1] = 0x0e;
18493 break; 18300 spec->automute = 1;
18494 } 18301 spec->automute_mode = ALC_AUTOMUTE_MIXER;
18302 spec->ext_mic.pin = 0x18;
18303 spec->ext_mic.mux_idx = 0;
18304 spec->int_mic.pin = 0x19;
18305 spec->int_mic.mux_idx = 1;
18306 spec->auto_mic = 1;
18495} 18307}
18496 18308
18497#define alc663_mode4_setup alc663_mode1_setup
18498
18499static void alc663_mode4_inithook(struct hda_codec *codec)
18500{
18501 alc663_21jd_two_speaker_automute(codec);
18502 alc_mic_automute(codec);
18503}
18504/* ***************** Mode5 ******************************/ 18309/* ***************** Mode5 ******************************/
18505static void alc663_mode5_unsol_event(struct hda_codec *codec, 18310static void alc663_mode5_setup(struct hda_codec *codec)
18506 unsigned int res)
18507{ 18311{
18508 switch (res >> 26) { 18312 struct alc_spec *spec = codec->spec;
18509 case ALC880_HP_EVENT: 18313 spec->autocfg.hp_pins[0] = 0x15;
18510 alc663_15jd_two_speaker_automute(codec); 18314 spec->autocfg.speaker_pins[0] = 0x14;
18511 break; 18315 spec->autocfg.speaker_pins[1] = 0x16;
18512 case ALC880_MIC_EVENT: 18316 spec->automute_mixer_nid[0] = 0x0c;
18513 alc_mic_automute(codec); 18317 spec->automute_mixer_nid[1] = 0x0e;
18514 break; 18318 spec->automute = 1;
18515 } 18319 spec->automute_mode = ALC_AUTOMUTE_MIXER;
18320 spec->ext_mic.pin = 0x18;
18321 spec->ext_mic.mux_idx = 0;
18322 spec->int_mic.pin = 0x19;
18323 spec->int_mic.mux_idx = 1;
18324 spec->auto_mic = 1;
18516} 18325}
18517 18326
18518#define alc663_mode5_setup alc663_mode1_setup
18519
18520static void alc663_mode5_inithook(struct hda_codec *codec)
18521{
18522 alc663_15jd_two_speaker_automute(codec);
18523 alc_mic_automute(codec);
18524}
18525/* ***************** Mode6 ******************************/ 18327/* ***************** Mode6 ******************************/
18526static void alc663_mode6_unsol_event(struct hda_codec *codec, 18328static void alc663_mode6_setup(struct hda_codec *codec)
18527 unsigned int res)
18528{ 18329{
18529 switch (res >> 26) { 18330 struct alc_spec *spec = codec->spec;
18530 case ALC880_HP_EVENT: 18331 spec->autocfg.hp_pins[0] = 0x1b;
18531 alc663_two_hp_m2_speaker_automute(codec); 18332 spec->autocfg.hp_pins[0] = 0x15;
18532 break; 18333 spec->autocfg.speaker_pins[0] = 0x14;
18533 case ALC880_MIC_EVENT: 18334 spec->automute_mixer_nid[0] = 0x0c;
18534 alc_mic_automute(codec); 18335 spec->automute = 1;
18535 break; 18336 spec->automute_mode = ALC_AUTOMUTE_MIXER;
18536 } 18337 spec->ext_mic.pin = 0x18;
18537} 18338 spec->ext_mic.mux_idx = 0;
18538 18339 spec->int_mic.pin = 0x19;
18539#define alc663_mode6_setup alc663_mode1_setup 18340 spec->int_mic.mux_idx = 1;
18540 18341 spec->auto_mic = 1;
18541static void alc663_mode6_inithook(struct hda_codec *codec)
18542{
18543 alc663_two_hp_m2_speaker_automute(codec);
18544 alc_mic_automute(codec);
18545} 18342}
18546 18343
18547/* ***************** Mode7 ******************************/ 18344/* ***************** Mode7 ******************************/
18548static void alc663_mode7_unsol_event(struct hda_codec *codec, 18345static void alc663_mode7_setup(struct hda_codec *codec)
18549 unsigned int res)
18550{
18551 switch (res >> 26) {
18552 case ALC880_HP_EVENT:
18553 alc663_two_hp_m7_speaker_automute(codec);
18554 break;
18555 case ALC880_MIC_EVENT:
18556 alc_mic_automute(codec);
18557 break;
18558 }
18559}
18560
18561#define alc663_mode7_setup alc663_mode1_setup
18562
18563static void alc663_mode7_inithook(struct hda_codec *codec)
18564{ 18346{
18565 alc663_two_hp_m7_speaker_automute(codec); 18347 struct alc_spec *spec = codec->spec;
18566 alc_mic_automute(codec); 18348 spec->autocfg.hp_pins[0] = 0x1b;
18349 spec->autocfg.hp_pins[0] = 0x21;
18350 spec->autocfg.speaker_pins[0] = 0x14;
18351 spec->autocfg.speaker_pins[0] = 0x17;
18352 spec->automute = 1;
18353 spec->automute_mode = ALC_AUTOMUTE_PIN;
18354 spec->ext_mic.pin = 0x18;
18355 spec->ext_mic.mux_idx = 0;
18356 spec->int_mic.pin = 0x19;
18357 spec->int_mic.mux_idx = 1;
18358 spec->auto_mic = 1;
18567} 18359}
18568 18360
18569/* ***************** Mode8 ******************************/ 18361/* ***************** Mode8 ******************************/
18570static void alc663_mode8_unsol_event(struct hda_codec *codec, 18362static void alc663_mode8_setup(struct hda_codec *codec)
18571 unsigned int res)
18572{
18573 switch (res >> 26) {
18574 case ALC880_HP_EVENT:
18575 alc663_two_hp_m8_speaker_automute(codec);
18576 break;
18577 case ALC880_MIC_EVENT:
18578 alc_mic_automute(codec);
18579 break;
18580 }
18581}
18582
18583#define alc663_mode8_setup alc663_m51va_setup
18584
18585static void alc663_mode8_inithook(struct hda_codec *codec)
18586{
18587 alc663_two_hp_m8_speaker_automute(codec);
18588 alc_mic_automute(codec);
18589}
18590
18591static void alc663_g71v_hp_automute(struct hda_codec *codec)
18592{
18593 unsigned int present;
18594 unsigned char bits;
18595
18596 present = snd_hda_jack_detect(codec, 0x21);
18597 bits = present ? HDA_AMP_MUTE : 0;
18598 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18599 HDA_AMP_MUTE, bits);
18600 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18601 HDA_AMP_MUTE, bits);
18602}
18603
18604static void alc663_g71v_front_automute(struct hda_codec *codec)
18605{
18606 unsigned int present;
18607 unsigned char bits;
18608
18609 present = snd_hda_jack_detect(codec, 0x15);
18610 bits = present ? HDA_AMP_MUTE : 0;
18611 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18612 HDA_AMP_MUTE, bits);
18613}
18614
18615static void alc663_g71v_unsol_event(struct hda_codec *codec,
18616 unsigned int res)
18617{ 18363{
18618 switch (res >> 26) { 18364 struct alc_spec *spec = codec->spec;
18619 case ALC880_HP_EVENT: 18365 spec->autocfg.hp_pins[0] = 0x21;
18620 alc663_g71v_hp_automute(codec); 18366 spec->autocfg.hp_pins[1] = 0x15;
18621 break; 18367 spec->autocfg.speaker_pins[0] = 0x14;
18622 case ALC880_FRONT_EVENT: 18368 spec->autocfg.speaker_pins[0] = 0x17;
18623 alc663_g71v_front_automute(codec); 18369 spec->automute = 1;
18624 break; 18370 spec->automute_mode = ALC_AUTOMUTE_PIN;
18625 case ALC880_MIC_EVENT: 18371 spec->ext_mic.pin = 0x18;
18626 alc_mic_automute(codec); 18372 spec->ext_mic.mux_idx = 0;
18627 break; 18373 spec->int_mic.pin = 0x12;
18628 } 18374 spec->int_mic.mux_idx = 9;
18629} 18375 spec->auto_mic = 1;
18630
18631#define alc663_g71v_setup alc663_m51va_setup
18632
18633static void alc663_g71v_inithook(struct hda_codec *codec)
18634{
18635 alc663_g71v_front_automute(codec);
18636 alc663_g71v_hp_automute(codec);
18637 alc_mic_automute(codec);
18638} 18376}
18639 18377
18640static void alc663_g50v_unsol_event(struct hda_codec *codec, 18378static void alc663_g71v_setup(struct hda_codec *codec)
18641 unsigned int res)
18642{ 18379{
18643 switch (res >> 26) { 18380 struct alc_spec *spec = codec->spec;
18644 case ALC880_HP_EVENT: 18381 spec->autocfg.hp_pins[0] = 0x21;
18645 alc663_m51va_speaker_automute(codec); 18382 spec->autocfg.line_out_pins[0] = 0x15;
18646 break; 18383 spec->autocfg.speaker_pins[0] = 0x14;
18647 case ALC880_MIC_EVENT: 18384 spec->automute = 1;
18648 alc_mic_automute(codec); 18385 spec->automute_mode = ALC_AUTOMUTE_AMP;
18649 break; 18386 spec->detect_line = 1;
18650 } 18387 spec->automute_lines = 1;
18388 spec->ext_mic.pin = 0x18;
18389 spec->ext_mic.mux_idx = 0;
18390 spec->int_mic.pin = 0x12;
18391 spec->int_mic.mux_idx = 9;
18392 spec->auto_mic = 1;
18651} 18393}
18652 18394
18653#define alc663_g50v_setup alc663_m51va_setup 18395#define alc663_g50v_setup alc663_m51va_setup
18654 18396
18655static void alc663_g50v_inithook(struct hda_codec *codec) 18397static const struct snd_kcontrol_new alc662_ecs_mixer[] = {
18656{
18657 alc663_m51va_speaker_automute(codec);
18658 alc_mic_automute(codec);
18659}
18660
18661static struct snd_kcontrol_new alc662_ecs_mixer[] = {
18662 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), 18398 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18663 ALC262_HIPPO_MASTER_SWITCH, 18399 ALC262_HIPPO_MASTER_SWITCH,
18664 18400
@@ -18672,7 +18408,7 @@ static struct snd_kcontrol_new alc662_ecs_mixer[] = {
18672 { } /* end */ 18408 { } /* end */
18673}; 18409};
18674 18410
18675static struct snd_kcontrol_new alc272_nc10_mixer[] = { 18411static const struct snd_kcontrol_new alc272_nc10_mixer[] = {
18676 /* Master Playback automatically created from Speaker and Headphone */ 18412 /* Master Playback automatically created from Speaker and Headphone */
18677 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), 18413 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18678 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), 18414 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
@@ -18707,7 +18443,7 @@ static const char * const alc662_models[ALC662_MODEL_LAST] = {
18707 [ALC662_3ST_2ch_DIG] = "3stack-dig", 18443 [ALC662_3ST_2ch_DIG] = "3stack-dig",
18708 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", 18444 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
18709 [ALC662_3ST_6ch] = "3stack-6ch", 18445 [ALC662_3ST_6ch] = "3stack-6ch",
18710 [ALC662_5ST_DIG] = "6stack-dig", 18446 [ALC662_5ST_DIG] = "5stack-dig",
18711 [ALC662_LENOVO_101E] = "lenovo-101e", 18447 [ALC662_LENOVO_101E] = "lenovo-101e",
18712 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", 18448 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
18713 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", 18449 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
@@ -18730,7 +18466,7 @@ static const char * const alc662_models[ALC662_MODEL_LAST] = {
18730 [ALC662_AUTO] = "auto", 18466 [ALC662_AUTO] = "auto",
18731}; 18467};
18732 18468
18733static struct snd_pci_quirk alc662_cfg_tbl[] = { 18469static const struct snd_pci_quirk alc662_cfg_tbl[] = {
18734 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), 18470 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
18735 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), 18471 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
18736 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), 18472 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
@@ -18812,10 +18548,10 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = {
18812 {} 18548 {}
18813}; 18549};
18814 18550
18815static struct alc_config_preset alc662_presets[] = { 18551static const struct alc_config_preset alc662_presets[] = {
18816 [ALC662_3ST_2ch_DIG] = { 18552 [ALC662_3ST_2ch_DIG] = {
18817 .mixers = { alc662_3ST_2ch_mixer }, 18553 .mixers = { alc662_3ST_2ch_mixer },
18818 .init_verbs = { alc662_init_verbs }, 18554 .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs },
18819 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 18555 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18820 .dac_nids = alc662_dac_nids, 18556 .dac_nids = alc662_dac_nids,
18821 .dig_out_nid = ALC662_DIGOUT_NID, 18557 .dig_out_nid = ALC662_DIGOUT_NID,
@@ -18826,7 +18562,7 @@ static struct alc_config_preset alc662_presets[] = {
18826 }, 18562 },
18827 [ALC662_3ST_6ch_DIG] = { 18563 [ALC662_3ST_6ch_DIG] = {
18828 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, 18564 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18829 .init_verbs = { alc662_init_verbs }, 18565 .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs },
18830 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 18566 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18831 .dac_nids = alc662_dac_nids, 18567 .dac_nids = alc662_dac_nids,
18832 .dig_out_nid = ALC662_DIGOUT_NID, 18568 .dig_out_nid = ALC662_DIGOUT_NID,
@@ -18838,7 +18574,7 @@ static struct alc_config_preset alc662_presets[] = {
18838 }, 18574 },
18839 [ALC662_3ST_6ch] = { 18575 [ALC662_3ST_6ch] = {
18840 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, 18576 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18841 .init_verbs = { alc662_init_verbs }, 18577 .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs },
18842 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 18578 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18843 .dac_nids = alc662_dac_nids, 18579 .dac_nids = alc662_dac_nids,
18844 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), 18580 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
@@ -18848,7 +18584,7 @@ static struct alc_config_preset alc662_presets[] = {
18848 }, 18584 },
18849 [ALC662_5ST_DIG] = { 18585 [ALC662_5ST_DIG] = {
18850 .mixers = { alc662_base_mixer, alc662_chmode_mixer }, 18586 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
18851 .init_verbs = { alc662_init_verbs }, 18587 .init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs },
18852 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 18588 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18853 .dac_nids = alc662_dac_nids, 18589 .dac_nids = alc662_dac_nids,
18854 .dig_out_nid = ALC662_DIGOUT_NID, 18590 .dig_out_nid = ALC662_DIGOUT_NID,
@@ -18859,104 +18595,120 @@ static struct alc_config_preset alc662_presets[] = {
18859 }, 18595 },
18860 [ALC662_LENOVO_101E] = { 18596 [ALC662_LENOVO_101E] = {
18861 .mixers = { alc662_lenovo_101e_mixer }, 18597 .mixers = { alc662_lenovo_101e_mixer },
18862 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, 18598 .init_verbs = { alc662_init_verbs,
18599 alc662_eapd_init_verbs,
18600 alc662_sue_init_verbs },
18863 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 18601 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18864 .dac_nids = alc662_dac_nids, 18602 .dac_nids = alc662_dac_nids,
18865 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), 18603 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18866 .channel_mode = alc662_3ST_2ch_modes, 18604 .channel_mode = alc662_3ST_2ch_modes,
18867 .input_mux = &alc662_lenovo_101e_capture_source, 18605 .input_mux = &alc662_lenovo_101e_capture_source,
18868 .unsol_event = alc662_lenovo_101e_unsol_event, 18606 .unsol_event = alc_sku_unsol_event,
18869 .init_hook = alc662_lenovo_101e_all_automute, 18607 .setup = alc662_lenovo_101e_setup,
18608 .init_hook = alc_inithook,
18870 }, 18609 },
18871 [ALC662_ASUS_EEEPC_P701] = { 18610 [ALC662_ASUS_EEEPC_P701] = {
18872 .mixers = { alc662_eeepc_p701_mixer }, 18611 .mixers = { alc662_eeepc_p701_mixer },
18873 .init_verbs = { alc662_init_verbs, 18612 .init_verbs = { alc662_init_verbs,
18613 alc662_eapd_init_verbs,
18874 alc662_eeepc_sue_init_verbs }, 18614 alc662_eeepc_sue_init_verbs },
18875 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 18615 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18876 .dac_nids = alc662_dac_nids, 18616 .dac_nids = alc662_dac_nids,
18877 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), 18617 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18878 .channel_mode = alc662_3ST_2ch_modes, 18618 .channel_mode = alc662_3ST_2ch_modes,
18879 .unsol_event = alc662_eeepc_unsol_event, 18619 .unsol_event = alc_sku_unsol_event,
18880 .setup = alc662_eeepc_setup, 18620 .setup = alc662_eeepc_setup,
18881 .init_hook = alc662_eeepc_inithook, 18621 .init_hook = alc_inithook,
18882 }, 18622 },
18883 [ALC662_ASUS_EEEPC_EP20] = { 18623 [ALC662_ASUS_EEEPC_EP20] = {
18884 .mixers = { alc662_eeepc_ep20_mixer, 18624 .mixers = { alc662_eeepc_ep20_mixer,
18885 alc662_chmode_mixer }, 18625 alc662_chmode_mixer },
18886 .init_verbs = { alc662_init_verbs, 18626 .init_verbs = { alc662_init_verbs,
18627 alc662_eapd_init_verbs,
18887 alc662_eeepc_ep20_sue_init_verbs }, 18628 alc662_eeepc_ep20_sue_init_verbs },
18888 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 18629 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18889 .dac_nids = alc662_dac_nids, 18630 .dac_nids = alc662_dac_nids,
18890 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), 18631 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18891 .channel_mode = alc662_3ST_6ch_modes, 18632 .channel_mode = alc662_3ST_6ch_modes,
18892 .input_mux = &alc662_lenovo_101e_capture_source, 18633 .input_mux = &alc662_lenovo_101e_capture_source,
18893 .unsol_event = alc662_eeepc_unsol_event, 18634 .unsol_event = alc_sku_unsol_event,
18894 .setup = alc662_eeepc_ep20_setup, 18635 .setup = alc662_eeepc_ep20_setup,
18895 .init_hook = alc662_eeepc_ep20_inithook, 18636 .init_hook = alc_inithook,
18896 }, 18637 },
18897 [ALC662_ECS] = { 18638 [ALC662_ECS] = {
18898 .mixers = { alc662_ecs_mixer }, 18639 .mixers = { alc662_ecs_mixer },
18899 .init_verbs = { alc662_init_verbs, 18640 .init_verbs = { alc662_init_verbs,
18641 alc662_eapd_init_verbs,
18900 alc662_ecs_init_verbs }, 18642 alc662_ecs_init_verbs },
18901 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 18643 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18902 .dac_nids = alc662_dac_nids, 18644 .dac_nids = alc662_dac_nids,
18903 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), 18645 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18904 .channel_mode = alc662_3ST_2ch_modes, 18646 .channel_mode = alc662_3ST_2ch_modes,
18905 .unsol_event = alc662_eeepc_unsol_event, 18647 .unsol_event = alc_sku_unsol_event,
18906 .setup = alc662_eeepc_setup, 18648 .setup = alc662_eeepc_setup,
18907 .init_hook = alc662_eeepc_inithook, 18649 .init_hook = alc_inithook,
18908 }, 18650 },
18909 [ALC663_ASUS_M51VA] = { 18651 [ALC663_ASUS_M51VA] = {
18910 .mixers = { alc663_m51va_mixer }, 18652 .mixers = { alc663_m51va_mixer },
18911 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, 18653 .init_verbs = { alc662_init_verbs,
18654 alc662_eapd_init_verbs,
18655 alc663_m51va_init_verbs },
18912 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 18656 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18913 .dac_nids = alc662_dac_nids, 18657 .dac_nids = alc662_dac_nids,
18914 .dig_out_nid = ALC662_DIGOUT_NID, 18658 .dig_out_nid = ALC662_DIGOUT_NID,
18915 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), 18659 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18916 .channel_mode = alc662_3ST_2ch_modes, 18660 .channel_mode = alc662_3ST_2ch_modes,
18917 .unsol_event = alc663_m51va_unsol_event, 18661 .unsol_event = alc_sku_unsol_event,
18918 .setup = alc663_m51va_setup, 18662 .setup = alc663_m51va_setup,
18919 .init_hook = alc663_m51va_inithook, 18663 .init_hook = alc_inithook,
18920 }, 18664 },
18921 [ALC663_ASUS_G71V] = { 18665 [ALC663_ASUS_G71V] = {
18922 .mixers = { alc663_g71v_mixer }, 18666 .mixers = { alc663_g71v_mixer },
18923 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, 18667 .init_verbs = { alc662_init_verbs,
18668 alc662_eapd_init_verbs,
18669 alc663_g71v_init_verbs },
18924 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 18670 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18925 .dac_nids = alc662_dac_nids, 18671 .dac_nids = alc662_dac_nids,
18926 .dig_out_nid = ALC662_DIGOUT_NID, 18672 .dig_out_nid = ALC662_DIGOUT_NID,
18927 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), 18673 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18928 .channel_mode = alc662_3ST_2ch_modes, 18674 .channel_mode = alc662_3ST_2ch_modes,
18929 .unsol_event = alc663_g71v_unsol_event, 18675 .unsol_event = alc_sku_unsol_event,
18930 .setup = alc663_g71v_setup, 18676 .setup = alc663_g71v_setup,
18931 .init_hook = alc663_g71v_inithook, 18677 .init_hook = alc_inithook,
18932 }, 18678 },
18933 [ALC663_ASUS_H13] = { 18679 [ALC663_ASUS_H13] = {
18934 .mixers = { alc663_m51va_mixer }, 18680 .mixers = { alc663_m51va_mixer },
18935 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, 18681 .init_verbs = { alc662_init_verbs,
18682 alc662_eapd_init_verbs,
18683 alc663_m51va_init_verbs },
18936 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 18684 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18937 .dac_nids = alc662_dac_nids, 18685 .dac_nids = alc662_dac_nids,
18938 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), 18686 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18939 .channel_mode = alc662_3ST_2ch_modes, 18687 .channel_mode = alc662_3ST_2ch_modes,
18940 .unsol_event = alc663_m51va_unsol_event, 18688 .setup = alc663_m51va_setup,
18941 .init_hook = alc663_m51va_inithook, 18689 .unsol_event = alc_sku_unsol_event,
18690 .init_hook = alc_inithook,
18942 }, 18691 },
18943 [ALC663_ASUS_G50V] = { 18692 [ALC663_ASUS_G50V] = {
18944 .mixers = { alc663_g50v_mixer }, 18693 .mixers = { alc663_g50v_mixer },
18945 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, 18694 .init_verbs = { alc662_init_verbs,
18695 alc662_eapd_init_verbs,
18696 alc663_g50v_init_verbs },
18946 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 18697 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18947 .dac_nids = alc662_dac_nids, 18698 .dac_nids = alc662_dac_nids,
18948 .dig_out_nid = ALC662_DIGOUT_NID, 18699 .dig_out_nid = ALC662_DIGOUT_NID,
18949 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), 18700 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18950 .channel_mode = alc662_3ST_6ch_modes, 18701 .channel_mode = alc662_3ST_6ch_modes,
18951 .input_mux = &alc663_capture_source, 18702 .input_mux = &alc663_capture_source,
18952 .unsol_event = alc663_g50v_unsol_event, 18703 .unsol_event = alc_sku_unsol_event,
18953 .setup = alc663_g50v_setup, 18704 .setup = alc663_g50v_setup,
18954 .init_hook = alc663_g50v_inithook, 18705 .init_hook = alc_inithook,
18955 }, 18706 },
18956 [ALC663_ASUS_MODE1] = { 18707 [ALC663_ASUS_MODE1] = {
18957 .mixers = { alc663_m51va_mixer }, 18708 .mixers = { alc663_m51va_mixer },
18958 .cap_mixer = alc662_auto_capture_mixer, 18709 .cap_mixer = alc662_auto_capture_mixer,
18959 .init_verbs = { alc662_init_verbs, 18710 .init_verbs = { alc662_init_verbs,
18711 alc662_eapd_init_verbs,
18960 alc663_21jd_amic_init_verbs }, 18712 alc663_21jd_amic_init_verbs },
18961 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 18713 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18962 .hp_nid = 0x03, 18714 .hp_nid = 0x03,
@@ -18964,28 +18716,30 @@ static struct alc_config_preset alc662_presets[] = {
18964 .dig_out_nid = ALC662_DIGOUT_NID, 18716 .dig_out_nid = ALC662_DIGOUT_NID,
18965 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), 18717 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18966 .channel_mode = alc662_3ST_2ch_modes, 18718 .channel_mode = alc662_3ST_2ch_modes,
18967 .unsol_event = alc663_mode1_unsol_event, 18719 .unsol_event = alc_sku_unsol_event,
18968 .setup = alc663_mode1_setup, 18720 .setup = alc663_mode1_setup,
18969 .init_hook = alc663_mode1_inithook, 18721 .init_hook = alc_inithook,
18970 }, 18722 },
18971 [ALC662_ASUS_MODE2] = { 18723 [ALC662_ASUS_MODE2] = {
18972 .mixers = { alc662_1bjd_mixer }, 18724 .mixers = { alc662_1bjd_mixer },
18973 .cap_mixer = alc662_auto_capture_mixer, 18725 .cap_mixer = alc662_auto_capture_mixer,
18974 .init_verbs = { alc662_init_verbs, 18726 .init_verbs = { alc662_init_verbs,
18727 alc662_eapd_init_verbs,
18975 alc662_1bjd_amic_init_verbs }, 18728 alc662_1bjd_amic_init_verbs },
18976 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 18729 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18977 .dac_nids = alc662_dac_nids, 18730 .dac_nids = alc662_dac_nids,
18978 .dig_out_nid = ALC662_DIGOUT_NID, 18731 .dig_out_nid = ALC662_DIGOUT_NID,
18979 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), 18732 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18980 .channel_mode = alc662_3ST_2ch_modes, 18733 .channel_mode = alc662_3ST_2ch_modes,
18981 .unsol_event = alc662_mode2_unsol_event, 18734 .unsol_event = alc_sku_unsol_event,
18982 .setup = alc662_mode2_setup, 18735 .setup = alc662_mode2_setup,
18983 .init_hook = alc662_mode2_inithook, 18736 .init_hook = alc_inithook,
18984 }, 18737 },
18985 [ALC663_ASUS_MODE3] = { 18738 [ALC663_ASUS_MODE3] = {
18986 .mixers = { alc663_two_hp_m1_mixer }, 18739 .mixers = { alc663_two_hp_m1_mixer },
18987 .cap_mixer = alc662_auto_capture_mixer, 18740 .cap_mixer = alc662_auto_capture_mixer,
18988 .init_verbs = { alc662_init_verbs, 18741 .init_verbs = { alc662_init_verbs,
18742 alc662_eapd_init_verbs,
18989 alc663_two_hp_amic_m1_init_verbs }, 18743 alc663_two_hp_amic_m1_init_verbs },
18990 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 18744 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18991 .hp_nid = 0x03, 18745 .hp_nid = 0x03,
@@ -18993,14 +18747,15 @@ static struct alc_config_preset alc662_presets[] = {
18993 .dig_out_nid = ALC662_DIGOUT_NID, 18747 .dig_out_nid = ALC662_DIGOUT_NID,
18994 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), 18748 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18995 .channel_mode = alc662_3ST_2ch_modes, 18749 .channel_mode = alc662_3ST_2ch_modes,
18996 .unsol_event = alc663_mode3_unsol_event, 18750 .unsol_event = alc_sku_unsol_event,
18997 .setup = alc663_mode3_setup, 18751 .setup = alc663_mode3_setup,
18998 .init_hook = alc663_mode3_inithook, 18752 .init_hook = alc_inithook,
18999 }, 18753 },
19000 [ALC663_ASUS_MODE4] = { 18754 [ALC663_ASUS_MODE4] = {
19001 .mixers = { alc663_asus_21jd_clfe_mixer }, 18755 .mixers = { alc663_asus_21jd_clfe_mixer },
19002 .cap_mixer = alc662_auto_capture_mixer, 18756 .cap_mixer = alc662_auto_capture_mixer,
19003 .init_verbs = { alc662_init_verbs, 18757 .init_verbs = { alc662_init_verbs,
18758 alc662_eapd_init_verbs,
19004 alc663_21jd_amic_init_verbs}, 18759 alc663_21jd_amic_init_verbs},
19005 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 18760 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19006 .hp_nid = 0x03, 18761 .hp_nid = 0x03,
@@ -19008,14 +18763,15 @@ static struct alc_config_preset alc662_presets[] = {
19008 .dig_out_nid = ALC662_DIGOUT_NID, 18763 .dig_out_nid = ALC662_DIGOUT_NID,
19009 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), 18764 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19010 .channel_mode = alc662_3ST_2ch_modes, 18765 .channel_mode = alc662_3ST_2ch_modes,
19011 .unsol_event = alc663_mode4_unsol_event, 18766 .unsol_event = alc_sku_unsol_event,
19012 .setup = alc663_mode4_setup, 18767 .setup = alc663_mode4_setup,
19013 .init_hook = alc663_mode4_inithook, 18768 .init_hook = alc_inithook,
19014 }, 18769 },
19015 [ALC663_ASUS_MODE5] = { 18770 [ALC663_ASUS_MODE5] = {
19016 .mixers = { alc663_asus_15jd_clfe_mixer }, 18771 .mixers = { alc663_asus_15jd_clfe_mixer },
19017 .cap_mixer = alc662_auto_capture_mixer, 18772 .cap_mixer = alc662_auto_capture_mixer,
19018 .init_verbs = { alc662_init_verbs, 18773 .init_verbs = { alc662_init_verbs,
18774 alc662_eapd_init_verbs,
19019 alc663_15jd_amic_init_verbs }, 18775 alc663_15jd_amic_init_verbs },
19020 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 18776 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19021 .hp_nid = 0x03, 18777 .hp_nid = 0x03,
@@ -19023,14 +18779,15 @@ static struct alc_config_preset alc662_presets[] = {
19023 .dig_out_nid = ALC662_DIGOUT_NID, 18779 .dig_out_nid = ALC662_DIGOUT_NID,
19024 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), 18780 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19025 .channel_mode = alc662_3ST_2ch_modes, 18781 .channel_mode = alc662_3ST_2ch_modes,
19026 .unsol_event = alc663_mode5_unsol_event, 18782 .unsol_event = alc_sku_unsol_event,
19027 .setup = alc663_mode5_setup, 18783 .setup = alc663_mode5_setup,
19028 .init_hook = alc663_mode5_inithook, 18784 .init_hook = alc_inithook,
19029 }, 18785 },
19030 [ALC663_ASUS_MODE6] = { 18786 [ALC663_ASUS_MODE6] = {
19031 .mixers = { alc663_two_hp_m2_mixer }, 18787 .mixers = { alc663_two_hp_m2_mixer },
19032 .cap_mixer = alc662_auto_capture_mixer, 18788 .cap_mixer = alc662_auto_capture_mixer,
19033 .init_verbs = { alc662_init_verbs, 18789 .init_verbs = { alc662_init_verbs,
18790 alc662_eapd_init_verbs,
19034 alc663_two_hp_amic_m2_init_verbs }, 18791 alc663_two_hp_amic_m2_init_verbs },
19035 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 18792 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19036 .hp_nid = 0x03, 18793 .hp_nid = 0x03,
@@ -19038,14 +18795,15 @@ static struct alc_config_preset alc662_presets[] = {
19038 .dig_out_nid = ALC662_DIGOUT_NID, 18795 .dig_out_nid = ALC662_DIGOUT_NID,
19039 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), 18796 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19040 .channel_mode = alc662_3ST_2ch_modes, 18797 .channel_mode = alc662_3ST_2ch_modes,
19041 .unsol_event = alc663_mode6_unsol_event, 18798 .unsol_event = alc_sku_unsol_event,
19042 .setup = alc663_mode6_setup, 18799 .setup = alc663_mode6_setup,
19043 .init_hook = alc663_mode6_inithook, 18800 .init_hook = alc_inithook,
19044 }, 18801 },
19045 [ALC663_ASUS_MODE7] = { 18802 [ALC663_ASUS_MODE7] = {
19046 .mixers = { alc663_mode7_mixer }, 18803 .mixers = { alc663_mode7_mixer },
19047 .cap_mixer = alc662_auto_capture_mixer, 18804 .cap_mixer = alc662_auto_capture_mixer,
19048 .init_verbs = { alc662_init_verbs, 18805 .init_verbs = { alc662_init_verbs,
18806 alc662_eapd_init_verbs,
19049 alc663_mode7_init_verbs }, 18807 alc663_mode7_init_verbs },
19050 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 18808 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19051 .hp_nid = 0x03, 18809 .hp_nid = 0x03,
@@ -19053,14 +18811,15 @@ static struct alc_config_preset alc662_presets[] = {
19053 .dig_out_nid = ALC662_DIGOUT_NID, 18811 .dig_out_nid = ALC662_DIGOUT_NID,
19054 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), 18812 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19055 .channel_mode = alc662_3ST_2ch_modes, 18813 .channel_mode = alc662_3ST_2ch_modes,
19056 .unsol_event = alc663_mode7_unsol_event, 18814 .unsol_event = alc_sku_unsol_event,
19057 .setup = alc663_mode7_setup, 18815 .setup = alc663_mode7_setup,
19058 .init_hook = alc663_mode7_inithook, 18816 .init_hook = alc_inithook,
19059 }, 18817 },
19060 [ALC663_ASUS_MODE8] = { 18818 [ALC663_ASUS_MODE8] = {
19061 .mixers = { alc663_mode8_mixer }, 18819 .mixers = { alc663_mode8_mixer },
19062 .cap_mixer = alc662_auto_capture_mixer, 18820 .cap_mixer = alc662_auto_capture_mixer,
19063 .init_verbs = { alc662_init_verbs, 18821 .init_verbs = { alc662_init_verbs,
18822 alc662_eapd_init_verbs,
19064 alc663_mode8_init_verbs }, 18823 alc663_mode8_init_verbs },
19065 .num_dacs = ARRAY_SIZE(alc662_dac_nids), 18824 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
19066 .hp_nid = 0x03, 18825 .hp_nid = 0x03,
@@ -19068,52 +18827,57 @@ static struct alc_config_preset alc662_presets[] = {
19068 .dig_out_nid = ALC662_DIGOUT_NID, 18827 .dig_out_nid = ALC662_DIGOUT_NID,
19069 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), 18828 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19070 .channel_mode = alc662_3ST_2ch_modes, 18829 .channel_mode = alc662_3ST_2ch_modes,
19071 .unsol_event = alc663_mode8_unsol_event, 18830 .unsol_event = alc_sku_unsol_event,
19072 .setup = alc663_mode8_setup, 18831 .setup = alc663_mode8_setup,
19073 .init_hook = alc663_mode8_inithook, 18832 .init_hook = alc_inithook,
19074 }, 18833 },
19075 [ALC272_DELL] = { 18834 [ALC272_DELL] = {
19076 .mixers = { alc663_m51va_mixer }, 18835 .mixers = { alc663_m51va_mixer },
19077 .cap_mixer = alc272_auto_capture_mixer, 18836 .cap_mixer = alc272_auto_capture_mixer,
19078 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, 18837 .init_verbs = { alc662_init_verbs,
18838 alc662_eapd_init_verbs,
18839 alc272_dell_init_verbs },
19079 .num_dacs = ARRAY_SIZE(alc272_dac_nids), 18840 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
19080 .dac_nids = alc662_dac_nids, 18841 .dac_nids = alc272_dac_nids,
19081 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), 18842 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19082 .adc_nids = alc272_adc_nids, 18843 .adc_nids = alc272_adc_nids,
19083 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), 18844 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
19084 .capsrc_nids = alc272_capsrc_nids, 18845 .capsrc_nids = alc272_capsrc_nids,
19085 .channel_mode = alc662_3ST_2ch_modes, 18846 .channel_mode = alc662_3ST_2ch_modes,
19086 .unsol_event = alc663_m51va_unsol_event, 18847 .unsol_event = alc_sku_unsol_event,
19087 .setup = alc663_m51va_setup, 18848 .setup = alc663_m51va_setup,
19088 .init_hook = alc663_m51va_inithook, 18849 .init_hook = alc_inithook,
19089 }, 18850 },
19090 [ALC272_DELL_ZM1] = { 18851 [ALC272_DELL_ZM1] = {
19091 .mixers = { alc663_m51va_mixer }, 18852 .mixers = { alc663_m51va_mixer },
19092 .cap_mixer = alc662_auto_capture_mixer, 18853 .cap_mixer = alc662_auto_capture_mixer,
19093 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, 18854 .init_verbs = { alc662_init_verbs,
18855 alc662_eapd_init_verbs,
18856 alc272_dell_zm1_init_verbs },
19094 .num_dacs = ARRAY_SIZE(alc272_dac_nids), 18857 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
19095 .dac_nids = alc662_dac_nids, 18858 .dac_nids = alc272_dac_nids,
19096 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), 18859 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19097 .adc_nids = alc662_adc_nids, 18860 .adc_nids = alc662_adc_nids,
19098 .num_adc_nids = 1, 18861 .num_adc_nids = 1,
19099 .capsrc_nids = alc662_capsrc_nids, 18862 .capsrc_nids = alc662_capsrc_nids,
19100 .channel_mode = alc662_3ST_2ch_modes, 18863 .channel_mode = alc662_3ST_2ch_modes,
19101 .unsol_event = alc663_m51va_unsol_event, 18864 .unsol_event = alc_sku_unsol_event,
19102 .setup = alc663_m51va_setup, 18865 .setup = alc663_m51va_setup,
19103 .init_hook = alc663_m51va_inithook, 18866 .init_hook = alc_inithook,
19104 }, 18867 },
19105 [ALC272_SAMSUNG_NC10] = { 18868 [ALC272_SAMSUNG_NC10] = {
19106 .mixers = { alc272_nc10_mixer }, 18869 .mixers = { alc272_nc10_mixer },
19107 .init_verbs = { alc662_init_verbs, 18870 .init_verbs = { alc662_init_verbs,
18871 alc662_eapd_init_verbs,
19108 alc663_21jd_amic_init_verbs }, 18872 alc663_21jd_amic_init_verbs },
19109 .num_dacs = ARRAY_SIZE(alc272_dac_nids), 18873 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
19110 .dac_nids = alc272_dac_nids, 18874 .dac_nids = alc272_dac_nids,
19111 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), 18875 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19112 .channel_mode = alc662_3ST_2ch_modes, 18876 .channel_mode = alc662_3ST_2ch_modes,
19113 /*.input_mux = &alc272_nc10_capture_source,*/ 18877 /*.input_mux = &alc272_nc10_capture_source,*/
19114 .unsol_event = alc663_mode4_unsol_event, 18878 .unsol_event = alc_sku_unsol_event,
19115 .setup = alc663_mode4_setup, 18879 .setup = alc663_mode4_setup,
19116 .init_hook = alc663_mode4_inithook, 18880 .init_hook = alc_inithook,
19117 }, 18881 },
19118}; 18882};
19119 18883
@@ -19123,45 +18887,79 @@ static struct alc_config_preset alc662_presets[] = {
19123 */ 18887 */
19124 18888
19125/* convert from MIX nid to DAC */ 18889/* convert from MIX nid to DAC */
19126static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) 18890static hda_nid_t alc_auto_mix_to_dac(struct hda_codec *codec, hda_nid_t nid)
19127{ 18891{
19128 if (nid == 0x0f) 18892 hda_nid_t list[5];
19129 return 0x02; 18893 int i, num;
19130 else if (nid >= 0x0c && nid <= 0x0e) 18894
19131 return nid - 0x0c + 0x02; 18895 num = snd_hda_get_connections(codec, nid, list, ARRAY_SIZE(list));
19132 else if (nid == 0x26) /* ALC887-VD has this DAC too */ 18896 for (i = 0; i < num; i++) {
19133 return 0x25; 18897 if (get_wcaps_type(get_wcaps(codec, list[i])) == AC_WID_AUD_OUT)
19134 else 18898 return list[i];
19135 return 0; 18899 }
18900 return 0;
18901}
18902
18903/* go down to the selector widget before the mixer */
18904static hda_nid_t alc_go_down_to_selector(struct hda_codec *codec, hda_nid_t pin)
18905{
18906 hda_nid_t srcs[5];
18907 int num = snd_hda_get_connections(codec, pin, srcs,
18908 ARRAY_SIZE(srcs));
18909 if (num != 1 ||
18910 get_wcaps_type(get_wcaps(codec, srcs[0])) != AC_WID_AUD_SEL)
18911 return pin;
18912 return srcs[0];
19136} 18913}
19137 18914
19138/* get MIX nid connected to the given pin targeted to DAC */ 18915/* get MIX nid connected to the given pin targeted to DAC */
19139static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, 18916static hda_nid_t alc_auto_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
19140 hda_nid_t dac) 18917 hda_nid_t dac)
19141{ 18918{
19142 hda_nid_t mix[5]; 18919 hda_nid_t mix[5];
19143 int i, num; 18920 int i, num;
19144 18921
18922 pin = alc_go_down_to_selector(codec, pin);
19145 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); 18923 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
19146 for (i = 0; i < num; i++) { 18924 for (i = 0; i < num; i++) {
19147 if (alc662_mix_to_dac(mix[i]) == dac) 18925 if (alc_auto_mix_to_dac(codec, mix[i]) == dac)
19148 return mix[i]; 18926 return mix[i];
19149 } 18927 }
19150 return 0; 18928 return 0;
19151} 18929}
19152 18930
18931/* select the connection from pin to DAC if needed */
18932static int alc_auto_select_dac(struct hda_codec *codec, hda_nid_t pin,
18933 hda_nid_t dac)
18934{
18935 hda_nid_t mix[5];
18936 int i, num;
18937
18938 pin = alc_go_down_to_selector(codec, pin);
18939 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
18940 if (num < 2)
18941 return 0;
18942 for (i = 0; i < num; i++) {
18943 if (alc_auto_mix_to_dac(codec, mix[i]) == dac) {
18944 snd_hda_codec_update_cache(codec, pin, 0,
18945 AC_VERB_SET_CONNECT_SEL, i);
18946 return 0;
18947 }
18948 }
18949 return 0;
18950}
18951
19153/* look for an empty DAC slot */ 18952/* look for an empty DAC slot */
19154static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin) 18953static hda_nid_t alc_auto_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
19155{ 18954{
19156 struct alc_spec *spec = codec->spec; 18955 struct alc_spec *spec = codec->spec;
19157 hda_nid_t srcs[5]; 18956 hda_nid_t srcs[5];
19158 int i, j, num; 18957 int i, j, num;
19159 18958
18959 pin = alc_go_down_to_selector(codec, pin);
19160 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); 18960 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
19161 if (num < 0)
19162 return 0;
19163 for (i = 0; i < num; i++) { 18961 for (i = 0; i < num; i++) {
19164 hda_nid_t nid = alc662_mix_to_dac(srcs[i]); 18962 hda_nid_t nid = alc_auto_mix_to_dac(codec, srcs[i]);
19165 if (!nid) 18963 if (!nid)
19166 continue; 18964 continue;
19167 for (j = 0; j < spec->multiout.num_dacs; j++) 18965 for (j = 0; j < spec->multiout.num_dacs; j++)
@@ -19183,10 +18981,10 @@ static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
19183 18981
19184 spec->multiout.dac_nids = spec->private_dac_nids; 18982 spec->multiout.dac_nids = spec->private_dac_nids;
19185 for (i = 0; i < cfg->line_outs; i++) { 18983 for (i = 0; i < cfg->line_outs; i++) {
19186 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]); 18984 dac = alc_auto_look_for_dac(codec, cfg->line_out_pins[i]);
19187 if (!dac) 18985 if (!dac)
19188 continue; 18986 continue;
19189 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; 18987 spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
19190 } 18988 }
19191 return 0; 18989 return 0;
19192} 18990}
@@ -19222,15 +19020,23 @@ static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
19222 static const char * const chname[4] = { 19020 static const char * const chname[4] = {
19223 "Front", "Surround", NULL /*CLFE*/, "Side" 19021 "Front", "Surround", NULL /*CLFE*/, "Side"
19224 }; 19022 };
19225 const char *pfx = alc_get_line_out_pfx(cfg, true); 19023 const char *pfx = alc_get_line_out_pfx(spec, true);
19226 hda_nid_t nid, mix; 19024 hda_nid_t nid, mix, pin;
19227 int i, err; 19025 int i, err, noutputs;
19228 19026
19229 for (i = 0; i < cfg->line_outs; i++) { 19027 noutputs = cfg->line_outs;
19028 if (spec->multi_ios > 0)
19029 noutputs += spec->multi_ios;
19030
19031 for (i = 0; i < noutputs; i++) {
19230 nid = spec->multiout.dac_nids[i]; 19032 nid = spec->multiout.dac_nids[i];
19231 if (!nid) 19033 if (!nid)
19232 continue; 19034 continue;
19233 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid); 19035 if (i >= cfg->line_outs)
19036 pin = spec->multi_io[i - 1].pin;
19037 else
19038 pin = cfg->line_out_pins[i];
19039 mix = alc_auto_dac_to_mix(codec, pin, nid);
19234 if (!mix) 19040 if (!mix)
19235 continue; 19041 continue;
19236 if (!pfx && i == 2) { 19042 if (!pfx && i == 2) {
@@ -19276,7 +19082,7 @@ static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
19276 19082
19277 if (!pin) 19083 if (!pin)
19278 return 0; 19084 return 0;
19279 nid = alc662_look_for_dac(codec, pin); 19085 nid = alc_auto_look_for_dac(codec, pin);
19280 if (!nid) { 19086 if (!nid) {
19281 /* the corresponding DAC is already occupied */ 19087 /* the corresponding DAC is already occupied */
19282 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) 19088 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
@@ -19286,7 +19092,7 @@ static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
19286 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); 19092 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
19287 } 19093 }
19288 19094
19289 mix = alc662_dac_to_mix(codec, pin, nid); 19095 mix = alc_auto_dac_to_mix(codec, pin, nid);
19290 if (!mix) 19096 if (!mix)
19291 return 0; 19097 return 0;
19292 err = alc662_add_vol_ctl(spec, pfx, nid, 3); 19098 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
@@ -19310,14 +19116,21 @@ static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
19310 hda_nid_t srcs[HDA_MAX_CONNECTIONS]; 19116 hda_nid_t srcs[HDA_MAX_CONNECTIONS];
19311 19117
19312 alc_set_pin_output(codec, nid, pin_type); 19118 alc_set_pin_output(codec, nid, pin_type);
19313 /* need the manual connection? */
19314 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); 19119 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
19315 if (num <= 1)
19316 return;
19317 for (i = 0; i < num; i++) { 19120 for (i = 0; i < num; i++) {
19318 if (alc662_mix_to_dac(srcs[i]) != dac) 19121 if (alc_auto_mix_to_dac(codec, srcs[i]) != dac)
19319 continue; 19122 continue;
19320 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i); 19123 /* need the manual connection? */
19124 if (num > 1)
19125 snd_hda_codec_write(codec, nid, 0,
19126 AC_VERB_SET_CONNECT_SEL, i);
19127 /* unmute mixer widget inputs */
19128 snd_hda_codec_write(codec, srcs[i], 0,
19129 AC_VERB_SET_AMP_GAIN_MUTE,
19130 AMP_IN_UNMUTE(0));
19131 snd_hda_codec_write(codec, srcs[i], 0,
19132 AC_VERB_SET_AMP_GAIN_MUTE,
19133 AMP_IN_UNMUTE(1));
19321 return; 19134 return;
19322 } 19135 }
19323} 19136}
@@ -19374,11 +19187,164 @@ static void alc662_auto_init_analog_input(struct hda_codec *codec)
19374 19187
19375#define alc662_auto_init_input_src alc882_auto_init_input_src 19188#define alc662_auto_init_input_src alc882_auto_init_input_src
19376 19189
19190/*
19191 * multi-io helper
19192 */
19193static int alc_auto_fill_multi_ios(struct hda_codec *codec,
19194 unsigned int location)
19195{
19196 struct alc_spec *spec = codec->spec;
19197 struct auto_pin_cfg *cfg = &spec->autocfg;
19198 int type, i, num_pins = 0;
19199
19200 for (type = AUTO_PIN_LINE_IN; type >= AUTO_PIN_MIC; type--) {
19201 for (i = 0; i < cfg->num_inputs; i++) {
19202 hda_nid_t nid = cfg->inputs[i].pin;
19203 hda_nid_t dac;
19204 unsigned int defcfg, caps;
19205 if (cfg->inputs[i].type != type)
19206 continue;
19207 defcfg = snd_hda_codec_get_pincfg(codec, nid);
19208 if (get_defcfg_connect(defcfg) != AC_JACK_PORT_COMPLEX)
19209 continue;
19210 if (location && get_defcfg_location(defcfg) != location)
19211 continue;
19212 caps = snd_hda_query_pin_caps(codec, nid);
19213 if (!(caps & AC_PINCAP_OUT))
19214 continue;
19215 dac = alc_auto_look_for_dac(codec, nid);
19216 if (!dac)
19217 continue;
19218 spec->multi_io[num_pins].pin = nid;
19219 spec->multi_io[num_pins].dac = dac;
19220 num_pins++;
19221 spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
19222 }
19223 }
19224 spec->multiout.num_dacs = 1;
19225 if (num_pins < 2)
19226 return 0;
19227 return num_pins;
19228}
19229
19230static int alc_auto_ch_mode_info(struct snd_kcontrol *kcontrol,
19231 struct snd_ctl_elem_info *uinfo)
19232{
19233 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
19234 struct alc_spec *spec = codec->spec;
19235
19236 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
19237 uinfo->count = 1;
19238 uinfo->value.enumerated.items = spec->multi_ios + 1;
19239 if (uinfo->value.enumerated.item > spec->multi_ios)
19240 uinfo->value.enumerated.item = spec->multi_ios;
19241 sprintf(uinfo->value.enumerated.name, "%dch",
19242 (uinfo->value.enumerated.item + 1) * 2);
19243 return 0;
19244}
19245
19246static int alc_auto_ch_mode_get(struct snd_kcontrol *kcontrol,
19247 struct snd_ctl_elem_value *ucontrol)
19248{
19249 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
19250 struct alc_spec *spec = codec->spec;
19251 ucontrol->value.enumerated.item[0] = (spec->ext_channel_count - 1) / 2;
19252 return 0;
19253}
19254
19255static int alc_set_multi_io(struct hda_codec *codec, int idx, bool output)
19256{
19257 struct alc_spec *spec = codec->spec;
19258 hda_nid_t nid = spec->multi_io[idx].pin;
19259
19260 if (!spec->multi_io[idx].ctl_in)
19261 spec->multi_io[idx].ctl_in =
19262 snd_hda_codec_read(codec, nid, 0,
19263 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
19264 if (output) {
19265 snd_hda_codec_update_cache(codec, nid, 0,
19266 AC_VERB_SET_PIN_WIDGET_CONTROL,
19267 PIN_OUT);
19268 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
19269 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
19270 HDA_AMP_MUTE, 0);
19271 alc_auto_select_dac(codec, nid, spec->multi_io[idx].dac);
19272 } else {
19273 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
19274 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
19275 HDA_AMP_MUTE, HDA_AMP_MUTE);
19276 snd_hda_codec_update_cache(codec, nid, 0,
19277 AC_VERB_SET_PIN_WIDGET_CONTROL,
19278 spec->multi_io[idx].ctl_in);
19279 }
19280 return 0;
19281}
19282
19283static int alc_auto_ch_mode_put(struct snd_kcontrol *kcontrol,
19284 struct snd_ctl_elem_value *ucontrol)
19285{
19286 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
19287 struct alc_spec *spec = codec->spec;
19288 int i, ch;
19289
19290 ch = ucontrol->value.enumerated.item[0];
19291 if (ch < 0 || ch > spec->multi_ios)
19292 return -EINVAL;
19293 if (ch == (spec->ext_channel_count - 1) / 2)
19294 return 0;
19295 spec->ext_channel_count = (ch + 1) * 2;
19296 for (i = 0; i < spec->multi_ios; i++)
19297 alc_set_multi_io(codec, i, i < ch);
19298 spec->multiout.max_channels = spec->ext_channel_count;
19299 return 1;
19300}
19301
19302static const struct snd_kcontrol_new alc_auto_channel_mode_enum = {
19303 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
19304 .name = "Channel Mode",
19305 .info = alc_auto_ch_mode_info,
19306 .get = alc_auto_ch_mode_get,
19307 .put = alc_auto_ch_mode_put,
19308};
19309
19310static int alc_auto_add_multi_channel_mode(struct hda_codec *codec)
19311{
19312 struct alc_spec *spec = codec->spec;
19313 struct auto_pin_cfg *cfg = &spec->autocfg;
19314 unsigned int location, defcfg;
19315 int num_pins;
19316
19317 if (cfg->line_outs != 1 ||
19318 cfg->line_out_type != AUTO_PIN_LINE_OUT)
19319 return 0;
19320
19321 defcfg = snd_hda_codec_get_pincfg(codec, cfg->line_out_pins[0]);
19322 location = get_defcfg_location(defcfg);
19323
19324 num_pins = alc_auto_fill_multi_ios(codec, location);
19325 if (num_pins > 0) {
19326 struct snd_kcontrol_new *knew;
19327
19328 knew = alc_kcontrol_new(spec);
19329 if (!knew)
19330 return -ENOMEM;
19331 *knew = alc_auto_channel_mode_enum;
19332 knew->name = kstrdup("Channel Mode", GFP_KERNEL);
19333 if (!knew->name)
19334 return -ENOMEM;
19335
19336 spec->multi_ios = num_pins;
19337 spec->ext_channel_count = 2;
19338 spec->multiout.num_dacs = num_pins + 1;
19339 }
19340 return 0;
19341}
19342
19377static int alc662_parse_auto_config(struct hda_codec *codec) 19343static int alc662_parse_auto_config(struct hda_codec *codec)
19378{ 19344{
19379 struct alc_spec *spec = codec->spec; 19345 struct alc_spec *spec = codec->spec;
19380 int err; 19346 int err;
19381 static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; 19347 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
19382 19348
19383 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, 19349 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19384 alc662_ignore); 19350 alc662_ignore);
@@ -19390,6 +19356,9 @@ static int alc662_parse_auto_config(struct hda_codec *codec)
19390 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); 19356 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
19391 if (err < 0) 19357 if (err < 0)
19392 return err; 19358 return err;
19359 err = alc_auto_add_multi_channel_mode(codec);
19360 if (err < 0)
19361 return err;
19393 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); 19362 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
19394 if (err < 0) 19363 if (err < 0)
19395 return err; 19364 return err;
@@ -19420,14 +19389,6 @@ static int alc662_parse_auto_config(struct hda_codec *codec)
19420 spec->num_mux_defs = 1; 19389 spec->num_mux_defs = 1;
19421 spec->input_mux = &spec->private_imux[0]; 19390 spec->input_mux = &spec->private_imux[0];
19422 19391
19423 add_verb(spec, alc662_init_verbs);
19424 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
19425 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
19426 add_verb(spec, alc663_init_verbs);
19427
19428 if (codec->vendor_id == 0x10ec0272)
19429 add_verb(spec, alc272_init_verbs);
19430
19431 err = alc_auto_add_mic_boost(codec); 19392 err = alc_auto_add_mic_boost(codec);
19432 if (err < 0) 19393 if (err < 0)
19433 return err; 19394 return err;
@@ -19508,7 +19469,7 @@ static const struct alc_fixup alc662_fixups[] = {
19508 }, 19469 },
19509}; 19470};
19510 19471
19511static struct snd_pci_quirk alc662_fixup_tbl[] = { 19472static const struct snd_pci_quirk alc662_fixup_tbl[] = {
19512 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE), 19473 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
19513 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE), 19474 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
19514 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), 19475 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
@@ -19626,6 +19587,7 @@ static int patch_alc662(struct hda_codec *codec)
19626 codec->patch_ops = alc_patch_ops; 19587 codec->patch_ops = alc_patch_ops;
19627 if (board_config == ALC662_AUTO) 19588 if (board_config == ALC662_AUTO)
19628 spec->init_hook = alc662_auto_init; 19589 spec->init_hook = alc662_auto_init;
19590 spec->shutup = alc_eapd_shutup;
19629 19591
19630 alc_init_jacks(codec); 19592 alc_init_jacks(codec);
19631 19593
@@ -19654,6 +19616,15 @@ static int patch_alc888(struct hda_codec *codec)
19654 return patch_alc882(codec); 19616 return patch_alc882(codec);
19655} 19617}
19656 19618
19619static int patch_alc899(struct hda_codec *codec)
19620{
19621 if ((alc_read_coef_idx(codec, 0) & 0x2000) != 0x2000) {
19622 kfree(codec->chip_name);
19623 codec->chip_name = kstrdup("ALC898", GFP_KERNEL);
19624 }
19625 return patch_alc882(codec);
19626}
19627
19657/* 19628/*
19658 * ALC680 support 19629 * ALC680 support
19659 */ 19630 */
@@ -19661,12 +19632,12 @@ static int patch_alc888(struct hda_codec *codec)
19661#define ALC680_DIGOUT_NID ALC880_DIGOUT_NID 19632#define ALC680_DIGOUT_NID ALC880_DIGOUT_NID
19662#define alc680_modes alc260_modes 19633#define alc680_modes alc260_modes
19663 19634
19664static hda_nid_t alc680_dac_nids[3] = { 19635static const hda_nid_t alc680_dac_nids[3] = {
19665 /* Lout1, Lout2, hp */ 19636 /* Lout1, Lout2, hp */
19666 0x02, 0x03, 0x04 19637 0x02, 0x03, 0x04
19667}; 19638};
19668 19639
19669static hda_nid_t alc680_adc_nids[3] = { 19640static const hda_nid_t alc680_adc_nids[3] = {
19670 /* ADC0-2 */ 19641 /* ADC0-2 */
19671 /* DMIC, MIC, Line-in*/ 19642 /* DMIC, MIC, Line-in*/
19672 0x07, 0x08, 0x09 19643 0x07, 0x08, 0x09
@@ -19686,8 +19657,7 @@ static void alc680_rec_autoswitch(struct hda_codec *codec)
19686 19657
19687 for (i = 0; i < cfg->num_inputs; i++) { 19658 for (i = 0; i < cfg->num_inputs; i++) {
19688 nid = cfg->inputs[i].pin; 19659 nid = cfg->inputs[i].pin;
19689 if (!(snd_hda_query_pin_caps(codec, nid) & 19660 if (!is_jack_detectable(codec, nid))
19690 AC_PINCAP_PRES_DETECT))
19691 continue; 19661 continue;
19692 if (snd_hda_jack_detect(codec, nid)) { 19662 if (snd_hda_jack_detect(codec, nid)) {
19693 if (cfg->inputs[i].type < type_found) { 19663 if (cfg->inputs[i].type < type_found) {
@@ -19734,7 +19704,7 @@ static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
19734 return 0; 19704 return 0;
19735} 19705}
19736 19706
19737static struct hda_pcm_stream alc680_pcm_analog_auto_capture = { 19707static const struct hda_pcm_stream alc680_pcm_analog_auto_capture = {
19738 .substreams = 1, /* can be overridden */ 19708 .substreams = 1, /* can be overridden */
19739 .channels_min = 2, 19709 .channels_min = 2,
19740 .channels_max = 2, 19710 .channels_max = 2,
@@ -19745,7 +19715,7 @@ static struct hda_pcm_stream alc680_pcm_analog_auto_capture = {
19745 }, 19715 },
19746}; 19716};
19747 19717
19748static struct snd_kcontrol_new alc680_base_mixer[] = { 19718static const struct snd_kcontrol_new alc680_base_mixer[] = {
19749 /* output mixer control */ 19719 /* output mixer control */
19750 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), 19720 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
19751 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), 19721 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
@@ -19757,7 +19727,7 @@ static struct snd_kcontrol_new alc680_base_mixer[] = {
19757 { } 19727 { }
19758}; 19728};
19759 19729
19760static struct hda_bind_ctls alc680_bind_cap_vol = { 19730static const struct hda_bind_ctls alc680_bind_cap_vol = {
19761 .ops = &snd_hda_bind_vol, 19731 .ops = &snd_hda_bind_vol,
19762 .values = { 19732 .values = {
19763 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), 19733 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
@@ -19767,7 +19737,7 @@ static struct hda_bind_ctls alc680_bind_cap_vol = {
19767 }, 19737 },
19768}; 19738};
19769 19739
19770static struct hda_bind_ctls alc680_bind_cap_switch = { 19740static const struct hda_bind_ctls alc680_bind_cap_switch = {
19771 .ops = &snd_hda_bind_sw, 19741 .ops = &snd_hda_bind_sw,
19772 .values = { 19742 .values = {
19773 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT), 19743 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
@@ -19777,7 +19747,7 @@ static struct hda_bind_ctls alc680_bind_cap_switch = {
19777 }, 19747 },
19778}; 19748};
19779 19749
19780static struct snd_kcontrol_new alc680_master_capture_mixer[] = { 19750static const struct snd_kcontrol_new alc680_master_capture_mixer[] = {
19781 HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol), 19751 HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol),
19782 HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch), 19752 HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch),
19783 { } /* end */ 19753 { } /* end */
@@ -19786,7 +19756,7 @@ static struct snd_kcontrol_new alc680_master_capture_mixer[] = {
19786/* 19756/*
19787 * generic initialization of ADC, input mixers and output mixers 19757 * generic initialization of ADC, input mixers and output mixers
19788 */ 19758 */
19789static struct hda_verb alc680_init_verbs[] = { 19759static const struct hda_verb alc680_init_verbs[] = {
19790 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 19760 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19791 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 19761 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19792 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 19762 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
@@ -19824,20 +19794,22 @@ static void alc680_base_setup(struct hda_codec *codec)
19824 spec->autocfg.inputs[0].type = AUTO_PIN_MIC; 19794 spec->autocfg.inputs[0].type = AUTO_PIN_MIC;
19825 spec->autocfg.inputs[1].pin = 0x19; 19795 spec->autocfg.inputs[1].pin = 0x19;
19826 spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN; 19796 spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN;
19797 spec->automute = 1;
19798 spec->automute_mode = ALC_AUTOMUTE_AMP;
19827} 19799}
19828 19800
19829static void alc680_unsol_event(struct hda_codec *codec, 19801static void alc680_unsol_event(struct hda_codec *codec,
19830 unsigned int res) 19802 unsigned int res)
19831{ 19803{
19832 if ((res >> 26) == ALC880_HP_EVENT) 19804 if ((res >> 26) == ALC880_HP_EVENT)
19833 alc_automute_amp(codec); 19805 alc_hp_automute(codec);
19834 if ((res >> 26) == ALC880_MIC_EVENT) 19806 if ((res >> 26) == ALC880_MIC_EVENT)
19835 alc680_rec_autoswitch(codec); 19807 alc680_rec_autoswitch(codec);
19836} 19808}
19837 19809
19838static void alc680_inithook(struct hda_codec *codec) 19810static void alc680_inithook(struct hda_codec *codec)
19839{ 19811{
19840 alc_automute_amp(codec); 19812 alc_hp_automute(codec);
19841 alc680_rec_autoswitch(codec); 19813 alc680_rec_autoswitch(codec);
19842} 19814}
19843 19815
@@ -19874,7 +19846,7 @@ static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
19874 19846
19875 if (err < 0) 19847 if (err < 0)
19876 return err; 19848 return err;
19877 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; 19849 spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
19878 } 19850 }
19879 19851
19880 return 0; 19852 return 0;
@@ -19960,7 +19932,7 @@ static int alc680_parse_auto_config(struct hda_codec *codec)
19960{ 19932{
19961 struct alc_spec *spec = codec->spec; 19933 struct alc_spec *spec = codec->spec;
19962 int err; 19934 int err;
19963 static hda_nid_t alc680_ignore[] = { 0 }; 19935 static const hda_nid_t alc680_ignore[] = { 0 };
19964 19936
19965 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, 19937 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19966 alc680_ignore); 19938 alc680_ignore);
@@ -20018,12 +19990,12 @@ static const char * const alc680_models[ALC680_MODEL_LAST] = {
20018 [ALC680_AUTO] = "auto", 19990 [ALC680_AUTO] = "auto",
20019}; 19991};
20020 19992
20021static struct snd_pci_quirk alc680_cfg_tbl[] = { 19993static const struct snd_pci_quirk alc680_cfg_tbl[] = {
20022 SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE), 19994 SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE),
20023 {} 19995 {}
20024}; 19996};
20025 19997
20026static struct alc_config_preset alc680_presets[] = { 19998static const struct alc_config_preset alc680_presets[] = {
20027 [ALC680_BASE] = { 19999 [ALC680_BASE] = {
20028 .mixers = { alc680_base_mixer }, 20000 .mixers = { alc680_base_mixer },
20029 .cap_mixer = alc680_master_capture_mixer, 20001 .cap_mixer = alc680_master_capture_mixer,
@@ -20104,7 +20076,8 @@ static int patch_alc680(struct hda_codec *codec)
20104/* 20076/*
20105 * patch entries 20077 * patch entries
20106 */ 20078 */
20107static struct hda_codec_preset snd_hda_preset_realtek[] = { 20079static const struct hda_codec_preset snd_hda_preset_realtek[] = {
20080 { .id = 0x10ec0221, .name = "ALC221", .patch = patch_alc269 },
20108 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, 20081 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
20109 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, 20082 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
20110 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, 20083 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
@@ -20113,6 +20086,7 @@ static struct hda_codec_preset snd_hda_preset_realtek[] = {
20113 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, 20086 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
20114 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, 20087 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
20115 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, 20088 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
20089 { .id = 0x10ec0276, .name = "ALC276", .patch = patch_alc269 },
20116 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", 20090 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
20117 .patch = patch_alc861 }, 20091 .patch = patch_alc861 },
20118 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, 20092 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
@@ -20140,6 +20114,7 @@ static struct hda_codec_preset snd_hda_preset_realtek[] = {
20140 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, 20114 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
20141 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, 20115 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
20142 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, 20116 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
20117 { .id = 0x10ec0899, .name = "ALC899", .patch = patch_alc899 },
20143 {} /* terminator */ 20118 {} /* terminator */
20144}; 20119};
20145 20120
diff --git a/sound/pci/hda/patch_si3054.c b/sound/pci/hda/patch_si3054.c
index f419ee8d75f..2f55f32876f 100644
--- a/sound/pci/hda/patch_si3054.c
+++ b/sound/pci/hda/patch_si3054.c
@@ -130,7 +130,7 @@ static int si3054_switch_put(struct snd_kcontrol *kcontrol,
130} 130}
131 131
132 132
133static struct snd_kcontrol_new si3054_modem_mixer[] = { 133static const struct snd_kcontrol_new si3054_modem_mixer[] = {
134 SI3054_KCONTROL("Off-hook Switch", SI3054_GPIO_CONTROL, SI3054_GPIO_OH), 134 SI3054_KCONTROL("Off-hook Switch", SI3054_GPIO_CONTROL, SI3054_GPIO_OH),
135 SI3054_KCONTROL("Caller ID Switch", SI3054_GPIO_CONTROL, SI3054_GPIO_CID), 135 SI3054_KCONTROL("Caller ID Switch", SI3054_GPIO_CONTROL, SI3054_GPIO_CID),
136 {} 136 {}
@@ -181,7 +181,7 @@ static int si3054_pcm_open(struct hda_pcm_stream *hinfo,
181} 181}
182 182
183 183
184static struct hda_pcm_stream si3054_pcm = { 184static const struct hda_pcm_stream si3054_pcm = {
185 .substreams = 1, 185 .substreams = 1,
186 .channels_min = 1, 186 .channels_min = 1,
187 .channels_max = 1, 187 .channels_max = 1,
@@ -200,12 +200,13 @@ static int si3054_build_pcms(struct hda_codec *codec)
200{ 200{
201 struct si3054_spec *spec = codec->spec; 201 struct si3054_spec *spec = codec->spec;
202 struct hda_pcm *info = &spec->pcm; 202 struct hda_pcm *info = &spec->pcm;
203 si3054_pcm.nid = codec->mfg;
204 codec->num_pcms = 1; 203 codec->num_pcms = 1;
205 codec->pcm_info = info; 204 codec->pcm_info = info;
206 info->name = "Si3054 Modem"; 205 info->name = "Si3054 Modem";
207 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = si3054_pcm; 206 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = si3054_pcm;
208 info->stream[SNDRV_PCM_STREAM_CAPTURE] = si3054_pcm; 207 info->stream[SNDRV_PCM_STREAM_CAPTURE] = si3054_pcm;
208 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = codec->mfg;
209 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = codec->mfg;
209 info->pcm_type = HDA_PCM_TYPE_MODEM; 210 info->pcm_type = HDA_PCM_TYPE_MODEM;
210 return 0; 211 return 0;
211} 212}
@@ -263,7 +264,7 @@ static void si3054_free(struct hda_codec *codec)
263/* 264/*
264 */ 265 */
265 266
266static struct hda_codec_ops si3054_patch_ops = { 267static const struct hda_codec_ops si3054_patch_ops = {
267 .build_controls = si3054_build_controls, 268 .build_controls = si3054_build_controls,
268 .build_pcms = si3054_build_pcms, 269 .build_pcms = si3054_build_pcms,
269 .init = si3054_init, 270 .init = si3054_init,
@@ -283,7 +284,7 @@ static int patch_si3054(struct hda_codec *codec)
283/* 284/*
284 * patch entries 285 * patch entries
285 */ 286 */
286static struct hda_codec_preset snd_hda_preset_si3054[] = { 287static const struct hda_codec_preset snd_hda_preset_si3054[] = {
287 { .id = 0x163c3055, .name = "Si3054", .patch = patch_si3054 }, 288 { .id = 0x163c3055, .name = "Si3054", .patch = patch_si3054 },
288 { .id = 0x163c3155, .name = "Si3054", .patch = patch_si3054 }, 289 { .id = 0x163c3155, .name = "Si3054", .patch = patch_si3054 },
289 { .id = 0x11c13026, .name = "Si3054", .patch = patch_si3054 }, 290 { .id = 0x11c13026, .name = "Si3054", .patch = patch_si3054 },
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 94d19c03a7f..7f81cc2274f 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -217,15 +217,15 @@ struct sigmatel_spec {
217 unsigned int stream_delay; 217 unsigned int stream_delay;
218 218
219 /* analog loopback */ 219 /* analog loopback */
220 struct snd_kcontrol_new *aloopback_ctl; 220 const struct snd_kcontrol_new *aloopback_ctl;
221 unsigned char aloopback_mask; 221 unsigned char aloopback_mask;
222 unsigned char aloopback_shift; 222 unsigned char aloopback_shift;
223 223
224 /* power management */ 224 /* power management */
225 unsigned int num_pwrs; 225 unsigned int num_pwrs;
226 unsigned int *pwr_mapping; 226 const unsigned int *pwr_mapping;
227 hda_nid_t *pwr_nids; 227 const hda_nid_t *pwr_nids;
228 hda_nid_t *dac_list; 228 const hda_nid_t *dac_list;
229 229
230 /* events */ 230 /* events */
231 struct snd_array events; 231 struct snd_array events;
@@ -241,20 +241,20 @@ struct sigmatel_spec {
241 int volume_offset; 241 int volume_offset;
242 242
243 /* capture */ 243 /* capture */
244 hda_nid_t *adc_nids; 244 const hda_nid_t *adc_nids;
245 unsigned int num_adcs; 245 unsigned int num_adcs;
246 hda_nid_t *mux_nids; 246 const hda_nid_t *mux_nids;
247 unsigned int num_muxes; 247 unsigned int num_muxes;
248 hda_nid_t *dmic_nids; 248 const hda_nid_t *dmic_nids;
249 unsigned int num_dmics; 249 unsigned int num_dmics;
250 hda_nid_t *dmux_nids; 250 const hda_nid_t *dmux_nids;
251 unsigned int num_dmuxes; 251 unsigned int num_dmuxes;
252 hda_nid_t *smux_nids; 252 const hda_nid_t *smux_nids;
253 unsigned int num_smuxes; 253 unsigned int num_smuxes;
254 unsigned int num_analog_muxes; 254 unsigned int num_analog_muxes;
255 255
256 unsigned long *capvols; /* amp-volume attr: HDA_COMPOSE_AMP_VAL() */ 256 const unsigned long *capvols; /* amp-volume attr: HDA_COMPOSE_AMP_VAL() */
257 unsigned long *capsws; /* amp-mute attr: HDA_COMPOSE_AMP_VAL() */ 257 const unsigned long *capsws; /* amp-mute attr: HDA_COMPOSE_AMP_VAL() */
258 unsigned int num_caps; /* number of capture volume/switch elements */ 258 unsigned int num_caps; /* number of capture volume/switch elements */
259 259
260 struct sigmatel_mic_route ext_mic; 260 struct sigmatel_mic_route ext_mic;
@@ -269,12 +269,12 @@ struct sigmatel_spec {
269 hda_nid_t digbeep_nid; 269 hda_nid_t digbeep_nid;
270 270
271 /* pin widgets */ 271 /* pin widgets */
272 hda_nid_t *pin_nids; 272 const hda_nid_t *pin_nids;
273 unsigned int num_pins; 273 unsigned int num_pins;
274 274
275 /* codec specific stuff */ 275 /* codec specific stuff */
276 struct hda_verb *init; 276 const struct hda_verb *init;
277 struct snd_kcontrol_new *mixer; 277 const struct snd_kcontrol_new *mixer;
278 278
279 /* capture source */ 279 /* capture source */
280 struct hda_input_mux *dinput_mux; 280 struct hda_input_mux *dinput_mux;
@@ -317,52 +317,52 @@ struct sigmatel_spec {
317 hda_nid_t auto_dmic_nids[MAX_DMICS_NUM]; 317 hda_nid_t auto_dmic_nids[MAX_DMICS_NUM];
318}; 318};
319 319
320static hda_nid_t stac9200_adc_nids[1] = { 320static const hda_nid_t stac9200_adc_nids[1] = {
321 0x03, 321 0x03,
322}; 322};
323 323
324static hda_nid_t stac9200_mux_nids[1] = { 324static const hda_nid_t stac9200_mux_nids[1] = {
325 0x0c, 325 0x0c,
326}; 326};
327 327
328static hda_nid_t stac9200_dac_nids[1] = { 328static const hda_nid_t stac9200_dac_nids[1] = {
329 0x02, 329 0x02,
330}; 330};
331 331
332static hda_nid_t stac92hd73xx_pwr_nids[8] = { 332static const hda_nid_t stac92hd73xx_pwr_nids[8] = {
333 0x0a, 0x0b, 0x0c, 0xd, 0x0e, 333 0x0a, 0x0b, 0x0c, 0xd, 0x0e,
334 0x0f, 0x10, 0x11 334 0x0f, 0x10, 0x11
335}; 335};
336 336
337static hda_nid_t stac92hd73xx_slave_dig_outs[2] = { 337static const hda_nid_t stac92hd73xx_slave_dig_outs[2] = {
338 0x26, 0, 338 0x26, 0,
339}; 339};
340 340
341static hda_nid_t stac92hd73xx_adc_nids[2] = { 341static const hda_nid_t stac92hd73xx_adc_nids[2] = {
342 0x1a, 0x1b 342 0x1a, 0x1b
343}; 343};
344 344
345#define STAC92HD73XX_NUM_DMICS 2 345#define STAC92HD73XX_NUM_DMICS 2
346static hda_nid_t stac92hd73xx_dmic_nids[STAC92HD73XX_NUM_DMICS + 1] = { 346static const hda_nid_t stac92hd73xx_dmic_nids[STAC92HD73XX_NUM_DMICS + 1] = {
347 0x13, 0x14, 0 347 0x13, 0x14, 0
348}; 348};
349 349
350#define STAC92HD73_DAC_COUNT 5 350#define STAC92HD73_DAC_COUNT 5
351 351
352static hda_nid_t stac92hd73xx_mux_nids[2] = { 352static const hda_nid_t stac92hd73xx_mux_nids[2] = {
353 0x20, 0x21, 353 0x20, 0x21,
354}; 354};
355 355
356static hda_nid_t stac92hd73xx_dmux_nids[2] = { 356static const hda_nid_t stac92hd73xx_dmux_nids[2] = {
357 0x20, 0x21, 357 0x20, 0x21,
358}; 358};
359 359
360static hda_nid_t stac92hd73xx_smux_nids[2] = { 360static const hda_nid_t stac92hd73xx_smux_nids[2] = {
361 0x22, 0x23, 361 0x22, 0x23,
362}; 362};
363 363
364#define STAC92HD73XX_NUM_CAPS 2 364#define STAC92HD73XX_NUM_CAPS 2
365static unsigned long stac92hd73xx_capvols[] = { 365static const unsigned long stac92hd73xx_capvols[] = {
366 HDA_COMPOSE_AMP_VAL(0x20, 3, 0, HDA_OUTPUT), 366 HDA_COMPOSE_AMP_VAL(0x20, 3, 0, HDA_OUTPUT),
367 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), 367 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
368}; 368};
@@ -370,137 +370,141 @@ static unsigned long stac92hd73xx_capvols[] = {
370 370
371#define STAC92HD83_DAC_COUNT 3 371#define STAC92HD83_DAC_COUNT 3
372 372
373static hda_nid_t stac92hd83xxx_pwr_nids[4] = { 373static const hda_nid_t stac92hd83xxx_pwr_nids[4] = {
374 0xa, 0xb, 0xd, 0xe, 374 0xa, 0xb, 0xd, 0xe,
375}; 375};
376 376
377static hda_nid_t stac92hd83xxx_slave_dig_outs[2] = { 377static const hda_nid_t stac92hd83xxx_slave_dig_outs[2] = {
378 0x1e, 0, 378 0x1e, 0,
379}; 379};
380 380
381static unsigned int stac92hd83xxx_pwr_mapping[4] = { 381static const unsigned int stac92hd83xxx_pwr_mapping[4] = {
382 0x03, 0x0c, 0x20, 0x40, 382 0x03, 0x0c, 0x20, 0x40,
383}; 383};
384 384
385static hda_nid_t stac92hd83xxx_dmic_nids[] = { 385static const hda_nid_t stac92hd83xxx_dmic_nids[] = {
386 0x11, 0x20, 386 0x11, 0x20,
387}; 387};
388 388
389static hda_nid_t stac92hd71bxx_pwr_nids[3] = { 389static const hda_nid_t stac92hd71bxx_pwr_nids[3] = {
390 0x0a, 0x0d, 0x0f 390 0x0a, 0x0d, 0x0f
391}; 391};
392 392
393static hda_nid_t stac92hd71bxx_adc_nids[2] = { 393static const hda_nid_t stac92hd71bxx_adc_nids[2] = {
394 0x12, 0x13, 394 0x12, 0x13,
395}; 395};
396 396
397static hda_nid_t stac92hd71bxx_mux_nids[2] = { 397static const hda_nid_t stac92hd71bxx_mux_nids[2] = {
398 0x1a, 0x1b 398 0x1a, 0x1b
399}; 399};
400 400
401static hda_nid_t stac92hd71bxx_dmux_nids[2] = { 401static const hda_nid_t stac92hd71bxx_dmux_nids[2] = {
402 0x1c, 0x1d, 402 0x1c, 0x1d,
403}; 403};
404 404
405static hda_nid_t stac92hd71bxx_smux_nids[2] = { 405static const hda_nid_t stac92hd71bxx_smux_nids[2] = {
406 0x24, 0x25, 406 0x24, 0x25,
407}; 407};
408 408
409#define STAC92HD71BXX_NUM_DMICS 2 409#define STAC92HD71BXX_NUM_DMICS 2
410static hda_nid_t stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS + 1] = { 410static const hda_nid_t stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS + 1] = {
411 0x18, 0x19, 0 411 0x18, 0x19, 0
412}; 412};
413 413
414static hda_nid_t stac92hd71bxx_slave_dig_outs[2] = { 414static const hda_nid_t stac92hd71bxx_dmic_5port_nids[STAC92HD71BXX_NUM_DMICS] = {
415 0x18, 0
416};
417
418static const hda_nid_t stac92hd71bxx_slave_dig_outs[2] = {
415 0x22, 0 419 0x22, 0
416}; 420};
417 421
418#define STAC92HD71BXX_NUM_CAPS 2 422#define STAC92HD71BXX_NUM_CAPS 2
419static unsigned long stac92hd71bxx_capvols[] = { 423static const unsigned long stac92hd71bxx_capvols[] = {
420 HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_OUTPUT), 424 HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_OUTPUT),
421 HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT), 425 HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT),
422}; 426};
423#define stac92hd71bxx_capsws stac92hd71bxx_capvols 427#define stac92hd71bxx_capsws stac92hd71bxx_capvols
424 428
425static hda_nid_t stac925x_adc_nids[1] = { 429static const hda_nid_t stac925x_adc_nids[1] = {
426 0x03, 430 0x03,
427}; 431};
428 432
429static hda_nid_t stac925x_mux_nids[1] = { 433static const hda_nid_t stac925x_mux_nids[1] = {
430 0x0f, 434 0x0f,
431}; 435};
432 436
433static hda_nid_t stac925x_dac_nids[1] = { 437static const hda_nid_t stac925x_dac_nids[1] = {
434 0x02, 438 0x02,
435}; 439};
436 440
437#define STAC925X_NUM_DMICS 1 441#define STAC925X_NUM_DMICS 1
438static hda_nid_t stac925x_dmic_nids[STAC925X_NUM_DMICS + 1] = { 442static const hda_nid_t stac925x_dmic_nids[STAC925X_NUM_DMICS + 1] = {
439 0x15, 0 443 0x15, 0
440}; 444};
441 445
442static hda_nid_t stac925x_dmux_nids[1] = { 446static const hda_nid_t stac925x_dmux_nids[1] = {
443 0x14, 447 0x14,
444}; 448};
445 449
446static unsigned long stac925x_capvols[] = { 450static const unsigned long stac925x_capvols[] = {
447 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), 451 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
448}; 452};
449static unsigned long stac925x_capsws[] = { 453static const unsigned long stac925x_capsws[] = {
450 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), 454 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
451}; 455};
452 456
453static hda_nid_t stac922x_adc_nids[2] = { 457static const hda_nid_t stac922x_adc_nids[2] = {
454 0x06, 0x07, 458 0x06, 0x07,
455}; 459};
456 460
457static hda_nid_t stac922x_mux_nids[2] = { 461static const hda_nid_t stac922x_mux_nids[2] = {
458 0x12, 0x13, 462 0x12, 0x13,
459}; 463};
460 464
461#define STAC922X_NUM_CAPS 2 465#define STAC922X_NUM_CAPS 2
462static unsigned long stac922x_capvols[] = { 466static const unsigned long stac922x_capvols[] = {
463 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_INPUT), 467 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_INPUT),
464 HDA_COMPOSE_AMP_VAL(0x18, 3, 0, HDA_INPUT), 468 HDA_COMPOSE_AMP_VAL(0x18, 3, 0, HDA_INPUT),
465}; 469};
466#define stac922x_capsws stac922x_capvols 470#define stac922x_capsws stac922x_capvols
467 471
468static hda_nid_t stac927x_slave_dig_outs[2] = { 472static const hda_nid_t stac927x_slave_dig_outs[2] = {
469 0x1f, 0, 473 0x1f, 0,
470}; 474};
471 475
472static hda_nid_t stac927x_adc_nids[3] = { 476static const hda_nid_t stac927x_adc_nids[3] = {
473 0x07, 0x08, 0x09 477 0x07, 0x08, 0x09
474}; 478};
475 479
476static hda_nid_t stac927x_mux_nids[3] = { 480static const hda_nid_t stac927x_mux_nids[3] = {
477 0x15, 0x16, 0x17 481 0x15, 0x16, 0x17
478}; 482};
479 483
480static hda_nid_t stac927x_smux_nids[1] = { 484static const hda_nid_t stac927x_smux_nids[1] = {
481 0x21, 485 0x21,
482}; 486};
483 487
484static hda_nid_t stac927x_dac_nids[6] = { 488static const hda_nid_t stac927x_dac_nids[6] = {
485 0x02, 0x03, 0x04, 0x05, 0x06, 0 489 0x02, 0x03, 0x04, 0x05, 0x06, 0
486}; 490};
487 491
488static hda_nid_t stac927x_dmux_nids[1] = { 492static const hda_nid_t stac927x_dmux_nids[1] = {
489 0x1b, 493 0x1b,
490}; 494};
491 495
492#define STAC927X_NUM_DMICS 2 496#define STAC927X_NUM_DMICS 2
493static hda_nid_t stac927x_dmic_nids[STAC927X_NUM_DMICS + 1] = { 497static const hda_nid_t stac927x_dmic_nids[STAC927X_NUM_DMICS + 1] = {
494 0x13, 0x14, 0 498 0x13, 0x14, 0
495}; 499};
496 500
497#define STAC927X_NUM_CAPS 3 501#define STAC927X_NUM_CAPS 3
498static unsigned long stac927x_capvols[] = { 502static const unsigned long stac927x_capvols[] = {
499 HDA_COMPOSE_AMP_VAL(0x18, 3, 0, HDA_INPUT), 503 HDA_COMPOSE_AMP_VAL(0x18, 3, 0, HDA_INPUT),
500 HDA_COMPOSE_AMP_VAL(0x19, 3, 0, HDA_INPUT), 504 HDA_COMPOSE_AMP_VAL(0x19, 3, 0, HDA_INPUT),
501 HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, HDA_INPUT), 505 HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, HDA_INPUT),
502}; 506};
503static unsigned long stac927x_capsws[] = { 507static const unsigned long stac927x_capsws[] = {
504 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), 508 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
505 HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_OUTPUT), 509 HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_OUTPUT),
506 HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT), 510 HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT),
@@ -511,77 +515,77 @@ static const char * const stac927x_spdif_labels[5] = {
511 "Analog Mux 2", "Analog Mux 3" 515 "Analog Mux 2", "Analog Mux 3"
512}; 516};
513 517
514static hda_nid_t stac9205_adc_nids[2] = { 518static const hda_nid_t stac9205_adc_nids[2] = {
515 0x12, 0x13 519 0x12, 0x13
516}; 520};
517 521
518static hda_nid_t stac9205_mux_nids[2] = { 522static const hda_nid_t stac9205_mux_nids[2] = {
519 0x19, 0x1a 523 0x19, 0x1a
520}; 524};
521 525
522static hda_nid_t stac9205_dmux_nids[1] = { 526static const hda_nid_t stac9205_dmux_nids[1] = {
523 0x1d, 527 0x1d,
524}; 528};
525 529
526static hda_nid_t stac9205_smux_nids[1] = { 530static const hda_nid_t stac9205_smux_nids[1] = {
527 0x21, 531 0x21,
528}; 532};
529 533
530#define STAC9205_NUM_DMICS 2 534#define STAC9205_NUM_DMICS 2
531static hda_nid_t stac9205_dmic_nids[STAC9205_NUM_DMICS + 1] = { 535static const hda_nid_t stac9205_dmic_nids[STAC9205_NUM_DMICS + 1] = {
532 0x17, 0x18, 0 536 0x17, 0x18, 0
533}; 537};
534 538
535#define STAC9205_NUM_CAPS 2 539#define STAC9205_NUM_CAPS 2
536static unsigned long stac9205_capvols[] = { 540static const unsigned long stac9205_capvols[] = {
537 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_INPUT), 541 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_INPUT),
538 HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_INPUT), 542 HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_INPUT),
539}; 543};
540static unsigned long stac9205_capsws[] = { 544static const unsigned long stac9205_capsws[] = {
541 HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT), 545 HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT),
542 HDA_COMPOSE_AMP_VAL(0x1e, 3, 0, HDA_OUTPUT), 546 HDA_COMPOSE_AMP_VAL(0x1e, 3, 0, HDA_OUTPUT),
543}; 547};
544 548
545static hda_nid_t stac9200_pin_nids[8] = { 549static const hda_nid_t stac9200_pin_nids[8] = {
546 0x08, 0x09, 0x0d, 0x0e, 550 0x08, 0x09, 0x0d, 0x0e,
547 0x0f, 0x10, 0x11, 0x12, 551 0x0f, 0x10, 0x11, 0x12,
548}; 552};
549 553
550static hda_nid_t stac925x_pin_nids[8] = { 554static const hda_nid_t stac925x_pin_nids[8] = {
551 0x07, 0x08, 0x0a, 0x0b, 555 0x07, 0x08, 0x0a, 0x0b,
552 0x0c, 0x0d, 0x10, 0x11, 556 0x0c, 0x0d, 0x10, 0x11,
553}; 557};
554 558
555static hda_nid_t stac922x_pin_nids[10] = { 559static const hda_nid_t stac922x_pin_nids[10] = {
556 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 560 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
557 0x0f, 0x10, 0x11, 0x15, 0x1b, 561 0x0f, 0x10, 0x11, 0x15, 0x1b,
558}; 562};
559 563
560static hda_nid_t stac92hd73xx_pin_nids[13] = { 564static const hda_nid_t stac92hd73xx_pin_nids[13] = {
561 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 565 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
562 0x0f, 0x10, 0x11, 0x12, 0x13, 566 0x0f, 0x10, 0x11, 0x12, 0x13,
563 0x14, 0x22, 0x23 567 0x14, 0x22, 0x23
564}; 568};
565 569
566#define STAC92HD71BXX_NUM_PINS 13 570#define STAC92HD71BXX_NUM_PINS 13
567static hda_nid_t stac92hd71bxx_pin_nids_4port[STAC92HD71BXX_NUM_PINS] = { 571static const hda_nid_t stac92hd71bxx_pin_nids_4port[STAC92HD71BXX_NUM_PINS] = {
568 0x0a, 0x0b, 0x0c, 0x0d, 0x00, 572 0x0a, 0x0b, 0x0c, 0x0d, 0x00,
569 0x00, 0x14, 0x18, 0x19, 0x1e, 573 0x00, 0x14, 0x18, 0x19, 0x1e,
570 0x1f, 0x20, 0x27 574 0x1f, 0x20, 0x27
571}; 575};
572static hda_nid_t stac92hd71bxx_pin_nids_6port[STAC92HD71BXX_NUM_PINS] = { 576static const hda_nid_t stac92hd71bxx_pin_nids_6port[STAC92HD71BXX_NUM_PINS] = {
573 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 577 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
574 0x0f, 0x14, 0x18, 0x19, 0x1e, 578 0x0f, 0x14, 0x18, 0x19, 0x1e,
575 0x1f, 0x20, 0x27 579 0x1f, 0x20, 0x27
576}; 580};
577 581
578static hda_nid_t stac927x_pin_nids[14] = { 582static const hda_nid_t stac927x_pin_nids[14] = {
579 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 583 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
580 0x0f, 0x10, 0x11, 0x12, 0x13, 584 0x0f, 0x10, 0x11, 0x12, 0x13,
581 0x14, 0x21, 0x22, 0x23, 585 0x14, 0x21, 0x22, 0x23,
582}; 586};
583 587
584static hda_nid_t stac9205_pin_nids[12] = { 588static const hda_nid_t stac9205_pin_nids[12] = {
585 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 589 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
586 0x0f, 0x14, 0x16, 0x17, 0x18, 590 0x0f, 0x14, 0x16, 0x17, 0x18,
587 0x21, 0x22, 591 0x21, 0x22,
@@ -841,45 +845,45 @@ static int stac92xx_aloopback_put(struct snd_kcontrol *kcontrol,
841 return 1; 845 return 1;
842} 846}
843 847
844static struct hda_verb stac9200_core_init[] = { 848static const struct hda_verb stac9200_core_init[] = {
845 /* set dac0mux for dac converter */ 849 /* set dac0mux for dac converter */
846 { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, 850 { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
847 {} 851 {}
848}; 852};
849 853
850static struct hda_verb stac9200_eapd_init[] = { 854static const struct hda_verb stac9200_eapd_init[] = {
851 /* set dac0mux for dac converter */ 855 /* set dac0mux for dac converter */
852 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, 856 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
853 {0x08, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, 857 {0x08, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
854 {} 858 {}
855}; 859};
856 860
857static struct hda_verb dell_eq_core_init[] = { 861static const struct hda_verb dell_eq_core_init[] = {
858 /* set master volume to max value without distortion 862 /* set master volume to max value without distortion
859 * and direct control */ 863 * and direct control */
860 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec}, 864 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec},
861 {} 865 {}
862}; 866};
863 867
864static struct hda_verb stac92hd73xx_core_init[] = { 868static const struct hda_verb stac92hd73xx_core_init[] = {
865 /* set master volume and direct control */ 869 /* set master volume and direct control */
866 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, 870 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
867 {} 871 {}
868}; 872};
869 873
870static struct hda_verb stac92hd83xxx_core_init[] = { 874static const struct hda_verb stac92hd83xxx_core_init[] = {
871 /* power state controls amps */ 875 /* power state controls amps */
872 { 0x01, AC_VERB_SET_EAPD, 1 << 2}, 876 { 0x01, AC_VERB_SET_EAPD, 1 << 2},
873 {} 877 {}
874}; 878};
875 879
876static struct hda_verb stac92hd71bxx_core_init[] = { 880static const struct hda_verb stac92hd71bxx_core_init[] = {
877 /* set master volume and direct control */ 881 /* set master volume and direct control */
878 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, 882 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
879 {} 883 {}
880}; 884};
881 885
882static struct hda_verb stac92hd71bxx_unmute_core_init[] = { 886static const struct hda_verb stac92hd71bxx_unmute_core_init[] = {
883 /* unmute right and left channels for nodes 0x0f, 0xa, 0x0d */ 887 /* unmute right and left channels for nodes 0x0f, 0xa, 0x0d */
884 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 888 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
885 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 889 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
@@ -887,7 +891,7 @@ static struct hda_verb stac92hd71bxx_unmute_core_init[] = {
887 {} 891 {}
888}; 892};
889 893
890static struct hda_verb stac925x_core_init[] = { 894static const struct hda_verb stac925x_core_init[] = {
891 /* set dac0mux for dac converter */ 895 /* set dac0mux for dac converter */
892 { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00}, 896 { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00},
893 /* mute the master volume */ 897 /* mute the master volume */
@@ -895,13 +899,13 @@ static struct hda_verb stac925x_core_init[] = {
895 {} 899 {}
896}; 900};
897 901
898static struct hda_verb stac922x_core_init[] = { 902static const struct hda_verb stac922x_core_init[] = {
899 /* set master volume and direct control */ 903 /* set master volume and direct control */
900 { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, 904 { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
901 {} 905 {}
902}; 906};
903 907
904static struct hda_verb d965_core_init[] = { 908static const struct hda_verb d965_core_init[] = {
905 /* set master volume and direct control */ 909 /* set master volume and direct control */
906 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, 910 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
907 /* unmute node 0x1b */ 911 /* unmute node 0x1b */
@@ -911,7 +915,7 @@ static struct hda_verb d965_core_init[] = {
911 {} 915 {}
912}; 916};
913 917
914static struct hda_verb dell_3st_core_init[] = { 918static const struct hda_verb dell_3st_core_init[] = {
915 /* don't set delta bit */ 919 /* don't set delta bit */
916 {0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0x7f}, 920 {0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0x7f},
917 /* unmute node 0x1b */ 921 /* unmute node 0x1b */
@@ -921,7 +925,7 @@ static struct hda_verb dell_3st_core_init[] = {
921 {} 925 {}
922}; 926};
923 927
924static struct hda_verb stac927x_core_init[] = { 928static const struct hda_verb stac927x_core_init[] = {
925 /* set master volume and direct control */ 929 /* set master volume and direct control */
926 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, 930 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
927 /* enable analog pc beep path */ 931 /* enable analog pc beep path */
@@ -929,7 +933,7 @@ static struct hda_verb stac927x_core_init[] = {
929 {} 933 {}
930}; 934};
931 935
932static struct hda_verb stac927x_volknob_core_init[] = { 936static const struct hda_verb stac927x_volknob_core_init[] = {
933 /* don't set delta bit */ 937 /* don't set delta bit */
934 {0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0x7f}, 938 {0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0x7f},
935 /* enable analog pc beep path */ 939 /* enable analog pc beep path */
@@ -937,7 +941,7 @@ static struct hda_verb stac927x_volknob_core_init[] = {
937 {} 941 {}
938}; 942};
939 943
940static struct hda_verb stac9205_core_init[] = { 944static const struct hda_verb stac9205_core_init[] = {
941 /* set master volume and direct control */ 945 /* set master volume and direct control */
942 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, 946 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
943 /* enable analog pc beep path */ 947 /* enable analog pc beep path */
@@ -977,7 +981,7 @@ static struct hda_verb stac9205_core_init[] = {
977 .private_value = nid, \ 981 .private_value = nid, \
978 } 982 }
979 983
980static struct snd_kcontrol_new stac9200_mixer[] = { 984static const struct snd_kcontrol_new stac9200_mixer[] = {
981 HDA_CODEC_VOLUME_MIN_MUTE("Master Playback Volume", 0xb, 0, HDA_OUTPUT), 985 HDA_CODEC_VOLUME_MIN_MUTE("Master Playback Volume", 0xb, 0, HDA_OUTPUT),
982 HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT), 986 HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT),
983 HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT), 987 HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT),
@@ -985,38 +989,38 @@ static struct snd_kcontrol_new stac9200_mixer[] = {
985 { } /* end */ 989 { } /* end */
986}; 990};
987 991
988static struct snd_kcontrol_new stac92hd73xx_6ch_loopback[] = { 992static const struct snd_kcontrol_new stac92hd73xx_6ch_loopback[] = {
989 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3), 993 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3),
990 {} 994 {}
991}; 995};
992 996
993static struct snd_kcontrol_new stac92hd73xx_8ch_loopback[] = { 997static const struct snd_kcontrol_new stac92hd73xx_8ch_loopback[] = {
994 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4), 998 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4),
995 {} 999 {}
996}; 1000};
997 1001
998static struct snd_kcontrol_new stac92hd73xx_10ch_loopback[] = { 1002static const struct snd_kcontrol_new stac92hd73xx_10ch_loopback[] = {
999 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5), 1003 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5),
1000 {} 1004 {}
1001}; 1005};
1002 1006
1003 1007
1004static struct snd_kcontrol_new stac92hd71bxx_loopback[] = { 1008static const struct snd_kcontrol_new stac92hd71bxx_loopback[] = {
1005 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2) 1009 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2)
1006}; 1010};
1007 1011
1008static struct snd_kcontrol_new stac925x_mixer[] = { 1012static const struct snd_kcontrol_new stac925x_mixer[] = {
1009 HDA_CODEC_VOLUME_MIN_MUTE("Master Playback Volume", 0xe, 0, HDA_OUTPUT), 1013 HDA_CODEC_VOLUME_MIN_MUTE("Master Playback Volume", 0xe, 0, HDA_OUTPUT),
1010 HDA_CODEC_MUTE("Master Playback Switch", 0x0e, 0, HDA_OUTPUT), 1014 HDA_CODEC_MUTE("Master Playback Switch", 0x0e, 0, HDA_OUTPUT),
1011 { } /* end */ 1015 { } /* end */
1012}; 1016};
1013 1017
1014static struct snd_kcontrol_new stac9205_loopback[] = { 1018static const struct snd_kcontrol_new stac9205_loopback[] = {
1015 STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1), 1019 STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1),
1016 {} 1020 {}
1017}; 1021};
1018 1022
1019static struct snd_kcontrol_new stac927x_loopback[] = { 1023static const struct snd_kcontrol_new stac927x_loopback[] = {
1020 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1), 1024 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1),
1021 {} 1025 {}
1022}; 1026};
@@ -1182,16 +1186,16 @@ static int stac92xx_build_controls(struct hda_codec *codec)
1182 return 0; 1186 return 0;
1183} 1187}
1184 1188
1185static unsigned int ref9200_pin_configs[8] = { 1189static const unsigned int ref9200_pin_configs[8] = {
1186 0x01c47010, 0x01447010, 0x0221401f, 0x01114010, 1190 0x01c47010, 0x01447010, 0x0221401f, 0x01114010,
1187 0x02a19020, 0x01a19021, 0x90100140, 0x01813122, 1191 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
1188}; 1192};
1189 1193
1190static unsigned int gateway9200_m4_pin_configs[8] = { 1194static const unsigned int gateway9200_m4_pin_configs[8] = {
1191 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010, 1195 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010,
1192 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3, 1196 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3,
1193}; 1197};
1194static unsigned int gateway9200_m4_2_pin_configs[8] = { 1198static const unsigned int gateway9200_m4_2_pin_configs[8] = {
1195 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010, 1199 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010,
1196 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3, 1200 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3,
1197}; 1201};
@@ -1202,7 +1206,7 @@ static unsigned int gateway9200_m4_2_pin_configs[8] = {
1202 102801DE 1206 102801DE
1203 102801E8 1207 102801E8
1204*/ 1208*/
1205static unsigned int dell9200_d21_pin_configs[8] = { 1209static const unsigned int dell9200_d21_pin_configs[8] = {
1206 0x400001f0, 0x400001f1, 0x02214030, 0x01014010, 1210 0x400001f0, 0x400001f1, 0x02214030, 0x01014010,
1207 0x02a19020, 0x01a19021, 0x90100140, 0x01813122, 1211 0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
1208}; 1212};
@@ -1212,7 +1216,7 @@ static unsigned int dell9200_d21_pin_configs[8] = {
1212 102801C0 1216 102801C0
1213 102801C1 1217 102801C1
1214*/ 1218*/
1215static unsigned int dell9200_d22_pin_configs[8] = { 1219static const unsigned int dell9200_d22_pin_configs[8] = {
1216 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010, 1220 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
1217 0x01813020, 0x02a19021, 0x90100140, 0x400001f2, 1221 0x01813020, 0x02a19021, 0x90100140, 0x400001f2,
1218}; 1222};
@@ -1226,7 +1230,7 @@ static unsigned int dell9200_d22_pin_configs[8] = {
1226 102801DA 1230 102801DA
1227 102801E3 1231 102801E3
1228*/ 1232*/
1229static unsigned int dell9200_d23_pin_configs[8] = { 1233static const unsigned int dell9200_d23_pin_configs[8] = {
1230 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010, 1234 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
1231 0x01813020, 0x01a19021, 0x90100140, 0x400001f2, 1235 0x01813020, 0x01a19021, 0x90100140, 0x400001f2,
1232}; 1236};
@@ -1237,7 +1241,7 @@ static unsigned int dell9200_d23_pin_configs[8] = {
1237 102801B5 (Dell Inspiron 630m) 1241 102801B5 (Dell Inspiron 630m)
1238 102801D8 (Dell Inspiron 640m) 1242 102801D8 (Dell Inspiron 640m)
1239*/ 1243*/
1240static unsigned int dell9200_m21_pin_configs[8] = { 1244static const unsigned int dell9200_m21_pin_configs[8] = {
1241 0x40c003fa, 0x03441340, 0x0321121f, 0x90170310, 1245 0x40c003fa, 0x03441340, 0x0321121f, 0x90170310,
1242 0x408003fb, 0x03a11020, 0x401003fc, 0x403003fd, 1246 0x408003fb, 0x03a11020, 0x401003fc, 0x403003fd,
1243}; 1247};
@@ -1250,7 +1254,7 @@ static unsigned int dell9200_m21_pin_configs[8] = {
1250 102801D4 1254 102801D4
1251 102801D6 1255 102801D6
1252*/ 1256*/
1253static unsigned int dell9200_m22_pin_configs[8] = { 1257static const unsigned int dell9200_m22_pin_configs[8] = {
1254 0x40c003fa, 0x0144131f, 0x0321121f, 0x90170310, 1258 0x40c003fa, 0x0144131f, 0x0321121f, 0x90170310,
1255 0x90a70321, 0x03a11020, 0x401003fb, 0x40f000fc, 1259 0x90a70321, 0x03a11020, 0x401003fb, 0x40f000fc,
1256}; 1260};
@@ -1260,7 +1264,7 @@ static unsigned int dell9200_m22_pin_configs[8] = {
1260 102801CE (Dell XPS M1710) 1264 102801CE (Dell XPS M1710)
1261 102801CF (Dell Precision M90) 1265 102801CF (Dell Precision M90)
1262*/ 1266*/
1263static unsigned int dell9200_m23_pin_configs[8] = { 1267static const unsigned int dell9200_m23_pin_configs[8] = {
1264 0x40c003fa, 0x01441340, 0x0421421f, 0x90170310, 1268 0x40c003fa, 0x01441340, 0x0421421f, 0x90170310,
1265 0x408003fb, 0x04a1102e, 0x90170311, 0x403003fc, 1269 0x408003fb, 0x04a1102e, 0x90170311, 0x403003fc,
1266}; 1270};
@@ -1272,7 +1276,7 @@ static unsigned int dell9200_m23_pin_configs[8] = {
1272 102801CB (Dell Latitude 120L) 1276 102801CB (Dell Latitude 120L)
1273 102801D3 1277 102801D3
1274*/ 1278*/
1275static unsigned int dell9200_m24_pin_configs[8] = { 1279static const unsigned int dell9200_m24_pin_configs[8] = {
1276 0x40c003fa, 0x404003fb, 0x0321121f, 0x90170310, 1280 0x40c003fa, 0x404003fb, 0x0321121f, 0x90170310,
1277 0x408003fc, 0x03a11020, 0x401003fd, 0x403003fe, 1281 0x408003fc, 0x03a11020, 0x401003fd, 0x403003fe,
1278}; 1282};
@@ -1283,7 +1287,7 @@ static unsigned int dell9200_m24_pin_configs[8] = {
1283 102801EE 1287 102801EE
1284 102801EF 1288 102801EF
1285*/ 1289*/
1286static unsigned int dell9200_m25_pin_configs[8] = { 1290static const unsigned int dell9200_m25_pin_configs[8] = {
1287 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310, 1291 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
1288 0x408003fb, 0x04a11020, 0x401003fc, 0x403003fd, 1292 0x408003fb, 0x04a11020, 0x401003fc, 0x403003fd,
1289}; 1293};
@@ -1293,7 +1297,7 @@ static unsigned int dell9200_m25_pin_configs[8] = {
1293 102801F5 (Dell Inspiron 1501) 1297 102801F5 (Dell Inspiron 1501)
1294 102801F6 1298 102801F6
1295*/ 1299*/
1296static unsigned int dell9200_m26_pin_configs[8] = { 1300static const unsigned int dell9200_m26_pin_configs[8] = {
1297 0x40c003fa, 0x404003fb, 0x0421121f, 0x90170310, 1301 0x40c003fa, 0x404003fb, 0x0421121f, 0x90170310,
1298 0x408003fc, 0x04a11020, 0x401003fd, 0x403003fe, 1302 0x408003fc, 0x04a11020, 0x401003fd, 0x403003fe,
1299}; 1303};
@@ -1302,18 +1306,18 @@ static unsigned int dell9200_m26_pin_configs[8] = {
1302 STAC 9200-32 1306 STAC 9200-32
1303 102801CD (Dell Inspiron E1705/9400) 1307 102801CD (Dell Inspiron E1705/9400)
1304*/ 1308*/
1305static unsigned int dell9200_m27_pin_configs[8] = { 1309static const unsigned int dell9200_m27_pin_configs[8] = {
1306 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310, 1310 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
1307 0x90170310, 0x04a11020, 0x90170310, 0x40f003fc, 1311 0x90170310, 0x04a11020, 0x90170310, 0x40f003fc,
1308}; 1312};
1309 1313
1310static unsigned int oqo9200_pin_configs[8] = { 1314static const unsigned int oqo9200_pin_configs[8] = {
1311 0x40c000f0, 0x404000f1, 0x0221121f, 0x02211210, 1315 0x40c000f0, 0x404000f1, 0x0221121f, 0x02211210,
1312 0x90170111, 0x90a70120, 0x400000f2, 0x400000f3, 1316 0x90170111, 0x90a70120, 0x400000f2, 0x400000f3,
1313}; 1317};
1314 1318
1315 1319
1316static unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = { 1320static const unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = {
1317 [STAC_REF] = ref9200_pin_configs, 1321 [STAC_REF] = ref9200_pin_configs,
1318 [STAC_9200_OQO] = oqo9200_pin_configs, 1322 [STAC_9200_OQO] = oqo9200_pin_configs,
1319 [STAC_9200_DELL_D21] = dell9200_d21_pin_configs, 1323 [STAC_9200_DELL_D21] = dell9200_d21_pin_configs,
@@ -1350,7 +1354,7 @@ static const char * const stac9200_models[STAC_9200_MODELS] = {
1350 [STAC_9200_PANASONIC] = "panasonic", 1354 [STAC_9200_PANASONIC] = "panasonic",
1351}; 1355};
1352 1356
1353static struct snd_pci_quirk stac9200_cfg_tbl[] = { 1357static const struct snd_pci_quirk stac9200_cfg_tbl[] = {
1354 /* SigmaTel reference board */ 1358 /* SigmaTel reference board */
1355 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, 1359 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1356 "DFI LanParty", STAC_REF), 1360 "DFI LanParty", STAC_REF),
@@ -1426,47 +1430,47 @@ static struct snd_pci_quirk stac9200_cfg_tbl[] = {
1426 {} /* terminator */ 1430 {} /* terminator */
1427}; 1431};
1428 1432
1429static unsigned int ref925x_pin_configs[8] = { 1433static const unsigned int ref925x_pin_configs[8] = {
1430 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021, 1434 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1431 0x90a70320, 0x02214210, 0x01019020, 0x9033032e, 1435 0x90a70320, 0x02214210, 0x01019020, 0x9033032e,
1432}; 1436};
1433 1437
1434static unsigned int stac925xM1_pin_configs[8] = { 1438static const unsigned int stac925xM1_pin_configs[8] = {
1435 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, 1439 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1436 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, 1440 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1437}; 1441};
1438 1442
1439static unsigned int stac925xM1_2_pin_configs[8] = { 1443static const unsigned int stac925xM1_2_pin_configs[8] = {
1440 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, 1444 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1441 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, 1445 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1442}; 1446};
1443 1447
1444static unsigned int stac925xM2_pin_configs[8] = { 1448static const unsigned int stac925xM2_pin_configs[8] = {
1445 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, 1449 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1446 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, 1450 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1447}; 1451};
1448 1452
1449static unsigned int stac925xM2_2_pin_configs[8] = { 1453static const unsigned int stac925xM2_2_pin_configs[8] = {
1450 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, 1454 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1451 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, 1455 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1452}; 1456};
1453 1457
1454static unsigned int stac925xM3_pin_configs[8] = { 1458static const unsigned int stac925xM3_pin_configs[8] = {
1455 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, 1459 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1456 0x40a000f0, 0x90100210, 0x400003f1, 0x503303f3, 1460 0x40a000f0, 0x90100210, 0x400003f1, 0x503303f3,
1457}; 1461};
1458 1462
1459static unsigned int stac925xM5_pin_configs[8] = { 1463static const unsigned int stac925xM5_pin_configs[8] = {
1460 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, 1464 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1461 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, 1465 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1462}; 1466};
1463 1467
1464static unsigned int stac925xM6_pin_configs[8] = { 1468static const unsigned int stac925xM6_pin_configs[8] = {
1465 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, 1469 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1466 0x40a000f0, 0x90100210, 0x400003f1, 0x90330320, 1470 0x40a000f0, 0x90100210, 0x400003f1, 0x90330320,
1467}; 1471};
1468 1472
1469static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = { 1473static const unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = {
1470 [STAC_REF] = ref925x_pin_configs, 1474 [STAC_REF] = ref925x_pin_configs,
1471 [STAC_M1] = stac925xM1_pin_configs, 1475 [STAC_M1] = stac925xM1_pin_configs,
1472 [STAC_M1_2] = stac925xM1_2_pin_configs, 1476 [STAC_M1_2] = stac925xM1_2_pin_configs,
@@ -1489,7 +1493,7 @@ static const char * const stac925x_models[STAC_925x_MODELS] = {
1489 [STAC_M6] = "m6", 1493 [STAC_M6] = "m6",
1490}; 1494};
1491 1495
1492static struct snd_pci_quirk stac925x_codec_id_cfg_tbl[] = { 1496static const struct snd_pci_quirk stac925x_codec_id_cfg_tbl[] = {
1493 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_M2), 1497 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_M2),
1494 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_M5), 1498 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_M5),
1495 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_M1), 1499 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_M1),
@@ -1503,7 +1507,7 @@ static struct snd_pci_quirk stac925x_codec_id_cfg_tbl[] = {
1503 {} /* terminator */ 1507 {} /* terminator */
1504}; 1508};
1505 1509
1506static struct snd_pci_quirk stac925x_cfg_tbl[] = { 1510static const struct snd_pci_quirk stac925x_cfg_tbl[] = {
1507 /* SigmaTel reference board */ 1511 /* SigmaTel reference board */
1508 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF), 1512 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF),
1509 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, "DFI LanParty", STAC_REF), 1513 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, "DFI LanParty", STAC_REF),
@@ -1515,33 +1519,33 @@ static struct snd_pci_quirk stac925x_cfg_tbl[] = {
1515 {} /* terminator */ 1519 {} /* terminator */
1516}; 1520};
1517 1521
1518static unsigned int ref92hd73xx_pin_configs[13] = { 1522static const unsigned int ref92hd73xx_pin_configs[13] = {
1519 0x02214030, 0x02a19040, 0x01a19020, 0x02214030, 1523 0x02214030, 0x02a19040, 0x01a19020, 0x02214030,
1520 0x0181302e, 0x01014010, 0x01014020, 0x01014030, 1524 0x0181302e, 0x01014010, 0x01014020, 0x01014030,
1521 0x02319040, 0x90a000f0, 0x90a000f0, 0x01452050, 1525 0x02319040, 0x90a000f0, 0x90a000f0, 0x01452050,
1522 0x01452050, 1526 0x01452050,
1523}; 1527};
1524 1528
1525static unsigned int dell_m6_pin_configs[13] = { 1529static const unsigned int dell_m6_pin_configs[13] = {
1526 0x0321101f, 0x4f00000f, 0x4f0000f0, 0x90170110, 1530 0x0321101f, 0x4f00000f, 0x4f0000f0, 0x90170110,
1527 0x03a11020, 0x0321101f, 0x4f0000f0, 0x4f0000f0, 1531 0x03a11020, 0x0321101f, 0x4f0000f0, 0x4f0000f0,
1528 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0, 1532 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0,
1529 0x4f0000f0, 1533 0x4f0000f0,
1530}; 1534};
1531 1535
1532static unsigned int alienware_m17x_pin_configs[13] = { 1536static const unsigned int alienware_m17x_pin_configs[13] = {
1533 0x0321101f, 0x0321101f, 0x03a11020, 0x03014020, 1537 0x0321101f, 0x0321101f, 0x03a11020, 0x03014020,
1534 0x90170110, 0x4f0000f0, 0x4f0000f0, 0x4f0000f0, 1538 0x90170110, 0x4f0000f0, 0x4f0000f0, 0x4f0000f0,
1535 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0, 1539 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0,
1536 0x904601b0, 1540 0x904601b0,
1537}; 1541};
1538 1542
1539static unsigned int intel_dg45id_pin_configs[13] = { 1543static const unsigned int intel_dg45id_pin_configs[13] = {
1540 0x02214230, 0x02A19240, 0x01013214, 0x01014210, 1544 0x02214230, 0x02A19240, 0x01013214, 0x01014210,
1541 0x01A19250, 0x01011212, 0x01016211 1545 0x01A19250, 0x01011212, 0x01016211
1542}; 1546};
1543 1547
1544static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = { 1548static const unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = {
1545 [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs, 1549 [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs,
1546 [STAC_DELL_M6_AMIC] = dell_m6_pin_configs, 1550 [STAC_DELL_M6_AMIC] = dell_m6_pin_configs,
1547 [STAC_DELL_M6_DMIC] = dell_m6_pin_configs, 1551 [STAC_DELL_M6_DMIC] = dell_m6_pin_configs,
@@ -1563,7 +1567,7 @@ static const char * const stac92hd73xx_models[STAC_92HD73XX_MODELS] = {
1563 [STAC_ALIENWARE_M17X] = "alienware", 1567 [STAC_ALIENWARE_M17X] = "alienware",
1564}; 1568};
1565 1569
1566static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = { 1570static const struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = {
1567 /* SigmaTel reference board */ 1571 /* SigmaTel reference board */
1568 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, 1572 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1569 "DFI LanParty", STAC_92HD73XX_REF), 1573 "DFI LanParty", STAC_92HD73XX_REF),
@@ -1600,11 +1604,11 @@ static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = {
1600 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02fe, 1604 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02fe,
1601 "Dell Studio XPS 1645", STAC_DELL_M6_BOTH), 1605 "Dell Studio XPS 1645", STAC_DELL_M6_BOTH),
1602 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0413, 1606 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0413,
1603 "Dell Studio 1558", STAC_DELL_M6_BOTH), 1607 "Dell Studio 1558", STAC_DELL_M6_DMIC),
1604 {} /* terminator */ 1608 {} /* terminator */
1605}; 1609};
1606 1610
1607static struct snd_pci_quirk stac92hd73xx_codec_id_cfg_tbl[] = { 1611static const struct snd_pci_quirk stac92hd73xx_codec_id_cfg_tbl[] = {
1608 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a1, 1612 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a1,
1609 "Alienware M17x", STAC_ALIENWARE_M17X), 1613 "Alienware M17x", STAC_ALIENWARE_M17X),
1610 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x043a, 1614 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x043a,
@@ -1612,25 +1616,25 @@ static struct snd_pci_quirk stac92hd73xx_codec_id_cfg_tbl[] = {
1612 {} /* terminator */ 1616 {} /* terminator */
1613}; 1617};
1614 1618
1615static unsigned int ref92hd83xxx_pin_configs[10] = { 1619static const unsigned int ref92hd83xxx_pin_configs[10] = {
1616 0x02214030, 0x02211010, 0x02a19020, 0x02170130, 1620 0x02214030, 0x02211010, 0x02a19020, 0x02170130,
1617 0x01014050, 0x01819040, 0x01014020, 0x90a3014e, 1621 0x01014050, 0x01819040, 0x01014020, 0x90a3014e,
1618 0x01451160, 0x98560170, 1622 0x01451160, 0x98560170,
1619}; 1623};
1620 1624
1621static unsigned int dell_s14_pin_configs[10] = { 1625static const unsigned int dell_s14_pin_configs[10] = {
1622 0x0221403f, 0x0221101f, 0x02a19020, 0x90170110, 1626 0x0221403f, 0x0221101f, 0x02a19020, 0x90170110,
1623 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x90a60160, 1627 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x90a60160,
1624 0x40f000f0, 0x40f000f0, 1628 0x40f000f0, 0x40f000f0,
1625}; 1629};
1626 1630
1627static unsigned int hp_dv7_4000_pin_configs[10] = { 1631static const unsigned int hp_dv7_4000_pin_configs[10] = {
1628 0x03a12050, 0x0321201f, 0x40f000f0, 0x90170110, 1632 0x03a12050, 0x0321201f, 0x40f000f0, 0x90170110,
1629 0x40f000f0, 0x40f000f0, 0x90170110, 0xd5a30140, 1633 0x40f000f0, 0x40f000f0, 0x90170110, 0xd5a30140,
1630 0x40f000f0, 0x40f000f0, 1634 0x40f000f0, 0x40f000f0,
1631}; 1635};
1632 1636
1633static unsigned int *stac92hd83xxx_brd_tbl[STAC_92HD83XXX_MODELS] = { 1637static const unsigned int *stac92hd83xxx_brd_tbl[STAC_92HD83XXX_MODELS] = {
1634 [STAC_92HD83XXX_REF] = ref92hd83xxx_pin_configs, 1638 [STAC_92HD83XXX_REF] = ref92hd83xxx_pin_configs,
1635 [STAC_92HD83XXX_PWR_REF] = ref92hd83xxx_pin_configs, 1639 [STAC_92HD83XXX_PWR_REF] = ref92hd83xxx_pin_configs,
1636 [STAC_DELL_S14] = dell_s14_pin_configs, 1640 [STAC_DELL_S14] = dell_s14_pin_configs,
@@ -1646,7 +1650,7 @@ static const char * const stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = {
1646 [STAC_HP_DV7_4000] = "hp-dv7-4000", 1650 [STAC_HP_DV7_4000] = "hp-dv7-4000",
1647}; 1651};
1648 1652
1649static struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { 1653static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = {
1650 /* SigmaTel reference board */ 1654 /* SigmaTel reference board */
1651 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, 1655 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1652 "DFI LanParty", STAC_92HD83XXX_REF), 1656 "DFI LanParty", STAC_92HD83XXX_REF),
@@ -1659,35 +1663,35 @@ static struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = {
1659 {} /* terminator */ 1663 {} /* terminator */
1660}; 1664};
1661 1665
1662static unsigned int ref92hd71bxx_pin_configs[STAC92HD71BXX_NUM_PINS] = { 1666static const unsigned int ref92hd71bxx_pin_configs[STAC92HD71BXX_NUM_PINS] = {
1663 0x02214030, 0x02a19040, 0x01a19020, 0x01014010, 1667 0x02214030, 0x02a19040, 0x01a19020, 0x01014010,
1664 0x0181302e, 0x01014010, 0x01019020, 0x90a000f0, 1668 0x0181302e, 0x01014010, 0x01019020, 0x90a000f0,
1665 0x90a000f0, 0x01452050, 0x01452050, 0x00000000, 1669 0x90a000f0, 0x01452050, 0x01452050, 0x00000000,
1666 0x00000000 1670 0x00000000
1667}; 1671};
1668 1672
1669static unsigned int dell_m4_1_pin_configs[STAC92HD71BXX_NUM_PINS] = { 1673static const unsigned int dell_m4_1_pin_configs[STAC92HD71BXX_NUM_PINS] = {
1670 0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110, 1674 0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110,
1671 0x23a1902e, 0x23014250, 0x40f000f0, 0x90a000f0, 1675 0x23a1902e, 0x23014250, 0x40f000f0, 0x90a000f0,
1672 0x40f000f0, 0x4f0000f0, 0x4f0000f0, 0x00000000, 1676 0x40f000f0, 0x4f0000f0, 0x4f0000f0, 0x00000000,
1673 0x00000000 1677 0x00000000
1674}; 1678};
1675 1679
1676static unsigned int dell_m4_2_pin_configs[STAC92HD71BXX_NUM_PINS] = { 1680static const unsigned int dell_m4_2_pin_configs[STAC92HD71BXX_NUM_PINS] = {
1677 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110, 1681 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110,
1678 0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0, 1682 0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0,
1679 0x40f000f0, 0x044413b0, 0x044413b0, 0x00000000, 1683 0x40f000f0, 0x044413b0, 0x044413b0, 0x00000000,
1680 0x00000000 1684 0x00000000
1681}; 1685};
1682 1686
1683static unsigned int dell_m4_3_pin_configs[STAC92HD71BXX_NUM_PINS] = { 1687static const unsigned int dell_m4_3_pin_configs[STAC92HD71BXX_NUM_PINS] = {
1684 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110, 1688 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110,
1685 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x90a000f0, 1689 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x90a000f0,
1686 0x40f000f0, 0x044413b0, 0x044413b0, 0x00000000, 1690 0x40f000f0, 0x044413b0, 0x044413b0, 0x00000000,
1687 0x00000000 1691 0x00000000
1688}; 1692};
1689 1693
1690static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = { 1694static const unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = {
1691 [STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs, 1695 [STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs,
1692 [STAC_DELL_M4_1] = dell_m4_1_pin_configs, 1696 [STAC_DELL_M4_1] = dell_m4_1_pin_configs,
1693 [STAC_DELL_M4_2] = dell_m4_2_pin_configs, 1697 [STAC_DELL_M4_2] = dell_m4_2_pin_configs,
@@ -1712,7 +1716,7 @@ static const char * const stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = {
1712 [STAC_HP_DV4_1222NR] = "hp-dv4-1222nr", 1716 [STAC_HP_DV4_1222NR] = "hp-dv4-1222nr",
1713}; 1717};
1714 1718
1715static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { 1719static const struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
1716 /* SigmaTel reference board */ 1720 /* SigmaTel reference board */
1717 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, 1721 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1718 "DFI LanParty", STAC_92HD71BXX_REF), 1722 "DFI LanParty", STAC_92HD71BXX_REF),
@@ -1769,7 +1773,7 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
1769 {} /* terminator */ 1773 {} /* terminator */
1770}; 1774};
1771 1775
1772static unsigned int ref922x_pin_configs[10] = { 1776static const unsigned int ref922x_pin_configs[10] = {
1773 0x01014010, 0x01016011, 0x01012012, 0x0221401f, 1777 0x01014010, 0x01016011, 0x01012012, 0x0221401f,
1774 0x01813122, 0x01011014, 0x01441030, 0x01c41030, 1778 0x01813122, 0x01011014, 0x01441030, 0x01c41030,
1775 0x40000100, 0x40000100, 1779 0x40000100, 0x40000100,
@@ -1783,7 +1787,7 @@ static unsigned int ref922x_pin_configs[10] = {
1783 102801D1 1787 102801D1
1784 102801D2 1788 102801D2
1785*/ 1789*/
1786static unsigned int dell_922x_d81_pin_configs[10] = { 1790static const unsigned int dell_922x_d81_pin_configs[10] = {
1787 0x02214030, 0x01a19021, 0x01111012, 0x01114010, 1791 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
1788 0x02a19020, 0x01117011, 0x400001f0, 0x400001f1, 1792 0x02a19020, 0x01117011, 0x400001f0, 0x400001f1,
1789 0x01813122, 0x400001f2, 1793 0x01813122, 0x400001f2,
@@ -1794,7 +1798,7 @@ static unsigned int dell_922x_d81_pin_configs[10] = {
1794 102801AC 1798 102801AC
1795 102801D0 1799 102801D0
1796*/ 1800*/
1797static unsigned int dell_922x_d82_pin_configs[10] = { 1801static const unsigned int dell_922x_d82_pin_configs[10] = {
1798 0x02214030, 0x01a19021, 0x01111012, 0x01114010, 1802 0x02214030, 0x01a19021, 0x01111012, 0x01114010,
1799 0x02a19020, 0x01117011, 0x01451140, 0x400001f0, 1803 0x02a19020, 0x01117011, 0x01451140, 0x400001f0,
1800 0x01813122, 0x400001f1, 1804 0x01813122, 0x400001f1,
@@ -1804,7 +1808,7 @@ static unsigned int dell_922x_d82_pin_configs[10] = {
1804 STAC 922X pin configs for 1808 STAC 922X pin configs for
1805 102801BF 1809 102801BF
1806*/ 1810*/
1807static unsigned int dell_922x_m81_pin_configs[10] = { 1811static const unsigned int dell_922x_m81_pin_configs[10] = {
1808 0x0321101f, 0x01112024, 0x01111222, 0x91174220, 1812 0x0321101f, 0x01112024, 0x01111222, 0x91174220,
1809 0x03a11050, 0x01116221, 0x90a70330, 0x01452340, 1813 0x03a11050, 0x01116221, 0x90a70330, 0x01452340,
1810 0x40C003f1, 0x405003f0, 1814 0x40C003f1, 0x405003f0,
@@ -1814,61 +1818,61 @@ static unsigned int dell_922x_m81_pin_configs[10] = {
1814 STAC 9221 A1 pin configs for 1818 STAC 9221 A1 pin configs for
1815 102801D7 (Dell XPS M1210) 1819 102801D7 (Dell XPS M1210)
1816*/ 1820*/
1817static unsigned int dell_922x_m82_pin_configs[10] = { 1821static const unsigned int dell_922x_m82_pin_configs[10] = {
1818 0x02211211, 0x408103ff, 0x02a1123e, 0x90100310, 1822 0x02211211, 0x408103ff, 0x02a1123e, 0x90100310,
1819 0x408003f1, 0x0221121f, 0x03451340, 0x40c003f2, 1823 0x408003f1, 0x0221121f, 0x03451340, 0x40c003f2,
1820 0x508003f3, 0x405003f4, 1824 0x508003f3, 0x405003f4,
1821}; 1825};
1822 1826
1823static unsigned int d945gtp3_pin_configs[10] = { 1827static const unsigned int d945gtp3_pin_configs[10] = {
1824 0x0221401f, 0x01a19022, 0x01813021, 0x01014010, 1828 0x0221401f, 0x01a19022, 0x01813021, 0x01014010,
1825 0x40000100, 0x40000100, 0x40000100, 0x40000100, 1829 0x40000100, 0x40000100, 0x40000100, 0x40000100,
1826 0x02a19120, 0x40000100, 1830 0x02a19120, 0x40000100,
1827}; 1831};
1828 1832
1829static unsigned int d945gtp5_pin_configs[10] = { 1833static const unsigned int d945gtp5_pin_configs[10] = {
1830 0x0221401f, 0x01011012, 0x01813024, 0x01014010, 1834 0x0221401f, 0x01011012, 0x01813024, 0x01014010,
1831 0x01a19021, 0x01016011, 0x01452130, 0x40000100, 1835 0x01a19021, 0x01016011, 0x01452130, 0x40000100,
1832 0x02a19320, 0x40000100, 1836 0x02a19320, 0x40000100,
1833}; 1837};
1834 1838
1835static unsigned int intel_mac_v1_pin_configs[10] = { 1839static const unsigned int intel_mac_v1_pin_configs[10] = {
1836 0x0121e21f, 0x400000ff, 0x9017e110, 0x400000fd, 1840 0x0121e21f, 0x400000ff, 0x9017e110, 0x400000fd,
1837 0x400000fe, 0x0181e020, 0x1145e030, 0x11c5e240, 1841 0x400000fe, 0x0181e020, 0x1145e030, 0x11c5e240,
1838 0x400000fc, 0x400000fb, 1842 0x400000fc, 0x400000fb,
1839}; 1843};
1840 1844
1841static unsigned int intel_mac_v2_pin_configs[10] = { 1845static const unsigned int intel_mac_v2_pin_configs[10] = {
1842 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd, 1846 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
1843 0x400000fe, 0x0181e020, 0x1145e230, 0x500000fa, 1847 0x400000fe, 0x0181e020, 0x1145e230, 0x500000fa,
1844 0x400000fc, 0x400000fb, 1848 0x400000fc, 0x400000fb,
1845}; 1849};
1846 1850
1847static unsigned int intel_mac_v3_pin_configs[10] = { 1851static const unsigned int intel_mac_v3_pin_configs[10] = {
1848 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd, 1852 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
1849 0x400000fe, 0x0181e020, 0x1145e230, 0x11c5e240, 1853 0x400000fe, 0x0181e020, 0x1145e230, 0x11c5e240,
1850 0x400000fc, 0x400000fb, 1854 0x400000fc, 0x400000fb,
1851}; 1855};
1852 1856
1853static unsigned int intel_mac_v4_pin_configs[10] = { 1857static const unsigned int intel_mac_v4_pin_configs[10] = {
1854 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f, 1858 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
1855 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240, 1859 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
1856 0x400000fc, 0x400000fb, 1860 0x400000fc, 0x400000fb,
1857}; 1861};
1858 1862
1859static unsigned int intel_mac_v5_pin_configs[10] = { 1863static const unsigned int intel_mac_v5_pin_configs[10] = {
1860 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f, 1864 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
1861 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240, 1865 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
1862 0x400000fc, 0x400000fb, 1866 0x400000fc, 0x400000fb,
1863}; 1867};
1864 1868
1865static unsigned int ecs202_pin_configs[10] = { 1869static const unsigned int ecs202_pin_configs[10] = {
1866 0x0221401f, 0x02a19020, 0x01a19020, 0x01114010, 1870 0x0221401f, 0x02a19020, 0x01a19020, 0x01114010,
1867 0x408000f0, 0x01813022, 0x074510a0, 0x40c400f1, 1871 0x408000f0, 0x01813022, 0x074510a0, 0x40c400f1,
1868 0x9037012e, 0x40e000f2, 1872 0x9037012e, 0x40e000f2,
1869}; 1873};
1870 1874
1871static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = { 1875static const unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = {
1872 [STAC_D945_REF] = ref922x_pin_configs, 1876 [STAC_D945_REF] = ref922x_pin_configs,
1873 [STAC_D945GTP3] = d945gtp3_pin_configs, 1877 [STAC_D945GTP3] = d945gtp3_pin_configs,
1874 [STAC_D945GTP5] = d945gtp5_pin_configs, 1878 [STAC_D945GTP5] = d945gtp5_pin_configs,
@@ -1917,7 +1921,7 @@ static const char * const stac922x_models[STAC_922X_MODELS] = {
1917 [STAC_922X_DELL_M82] = "dell-m82", 1921 [STAC_922X_DELL_M82] = "dell-m82",
1918}; 1922};
1919 1923
1920static struct snd_pci_quirk stac922x_cfg_tbl[] = { 1924static const struct snd_pci_quirk stac922x_cfg_tbl[] = {
1921 /* SigmaTel reference board */ 1925 /* SigmaTel reference board */
1922 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, 1926 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1923 "DFI LanParty", STAC_D945_REF), 1927 "DFI LanParty", STAC_D945_REF),
@@ -2008,42 +2012,42 @@ static struct snd_pci_quirk stac922x_cfg_tbl[] = {
2008 {} /* terminator */ 2012 {} /* terminator */
2009}; 2013};
2010 2014
2011static unsigned int ref927x_pin_configs[14] = { 2015static const unsigned int ref927x_pin_configs[14] = {
2012 0x02214020, 0x02a19080, 0x0181304e, 0x01014010, 2016 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
2013 0x01a19040, 0x01011012, 0x01016011, 0x0101201f, 2017 0x01a19040, 0x01011012, 0x01016011, 0x0101201f,
2014 0x183301f0, 0x18a001f0, 0x18a001f0, 0x01442070, 2018 0x183301f0, 0x18a001f0, 0x18a001f0, 0x01442070,
2015 0x01c42190, 0x40000100, 2019 0x01c42190, 0x40000100,
2016}; 2020};
2017 2021
2018static unsigned int d965_3st_pin_configs[14] = { 2022static const unsigned int d965_3st_pin_configs[14] = {
2019 0x0221401f, 0x02a19120, 0x40000100, 0x01014011, 2023 0x0221401f, 0x02a19120, 0x40000100, 0x01014011,
2020 0x01a19021, 0x01813024, 0x40000100, 0x40000100, 2024 0x01a19021, 0x01813024, 0x40000100, 0x40000100,
2021 0x40000100, 0x40000100, 0x40000100, 0x40000100, 2025 0x40000100, 0x40000100, 0x40000100, 0x40000100,
2022 0x40000100, 0x40000100 2026 0x40000100, 0x40000100
2023}; 2027};
2024 2028
2025static unsigned int d965_5st_pin_configs[14] = { 2029static const unsigned int d965_5st_pin_configs[14] = {
2026 0x02214020, 0x02a19080, 0x0181304e, 0x01014010, 2030 0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
2027 0x01a19040, 0x01011012, 0x01016011, 0x40000100, 2031 0x01a19040, 0x01011012, 0x01016011, 0x40000100,
2028 0x40000100, 0x40000100, 0x40000100, 0x01442070, 2032 0x40000100, 0x40000100, 0x40000100, 0x01442070,
2029 0x40000100, 0x40000100 2033 0x40000100, 0x40000100
2030}; 2034};
2031 2035
2032static unsigned int d965_5st_no_fp_pin_configs[14] = { 2036static const unsigned int d965_5st_no_fp_pin_configs[14] = {
2033 0x40000100, 0x40000100, 0x0181304e, 0x01014010, 2037 0x40000100, 0x40000100, 0x0181304e, 0x01014010,
2034 0x01a19040, 0x01011012, 0x01016011, 0x40000100, 2038 0x01a19040, 0x01011012, 0x01016011, 0x40000100,
2035 0x40000100, 0x40000100, 0x40000100, 0x01442070, 2039 0x40000100, 0x40000100, 0x40000100, 0x01442070,
2036 0x40000100, 0x40000100 2040 0x40000100, 0x40000100
2037}; 2041};
2038 2042
2039static unsigned int dell_3st_pin_configs[14] = { 2043static const unsigned int dell_3st_pin_configs[14] = {
2040 0x02211230, 0x02a11220, 0x01a19040, 0x01114210, 2044 0x02211230, 0x02a11220, 0x01a19040, 0x01114210,
2041 0x01111212, 0x01116211, 0x01813050, 0x01112214, 2045 0x01111212, 0x01116211, 0x01813050, 0x01112214,
2042 0x403003fa, 0x90a60040, 0x90a60040, 0x404003fb, 2046 0x403003fa, 0x90a60040, 0x90a60040, 0x404003fb,
2043 0x40c003fc, 0x40000100 2047 0x40c003fc, 0x40000100
2044}; 2048};
2045 2049
2046static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = { 2050static const unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = {
2047 [STAC_D965_REF_NO_JD] = ref927x_pin_configs, 2051 [STAC_D965_REF_NO_JD] = ref927x_pin_configs,
2048 [STAC_D965_REF] = ref927x_pin_configs, 2052 [STAC_D965_REF] = ref927x_pin_configs,
2049 [STAC_D965_3ST] = d965_3st_pin_configs, 2053 [STAC_D965_3ST] = d965_3st_pin_configs,
@@ -2066,7 +2070,7 @@ static const char * const stac927x_models[STAC_927X_MODELS] = {
2066 [STAC_927X_VOLKNOB] = "volknob", 2070 [STAC_927X_VOLKNOB] = "volknob",
2067}; 2071};
2068 2072
2069static struct snd_pci_quirk stac927x_cfg_tbl[] = { 2073static const struct snd_pci_quirk stac927x_cfg_tbl[] = {
2070 /* SigmaTel reference board */ 2074 /* SigmaTel reference board */
2071 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, 2075 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
2072 "DFI LanParty", STAC_D965_REF), 2076 "DFI LanParty", STAC_D965_REF),
@@ -2104,7 +2108,7 @@ static struct snd_pci_quirk stac927x_cfg_tbl[] = {
2104 {} /* terminator */ 2108 {} /* terminator */
2105}; 2109};
2106 2110
2107static unsigned int ref9205_pin_configs[12] = { 2111static const unsigned int ref9205_pin_configs[12] = {
2108 0x40000100, 0x40000100, 0x01016011, 0x01014010, 2112 0x40000100, 0x40000100, 0x01016011, 0x01014010,
2109 0x01813122, 0x01a19021, 0x01019020, 0x40000100, 2113 0x01813122, 0x01a19021, 0x01019020, 0x40000100,
2110 0x90a000f0, 0x90a000f0, 0x01441030, 0x01c41030 2114 0x90a000f0, 0x90a000f0, 0x01441030, 0x01c41030
@@ -2121,7 +2125,7 @@ static unsigned int ref9205_pin_configs[12] = {
2121 10280228 (Dell Vostro 1500) 2125 10280228 (Dell Vostro 1500)
2122 10280229 (Dell Vostro 1700) 2126 10280229 (Dell Vostro 1700)
2123*/ 2127*/
2124static unsigned int dell_9205_m42_pin_configs[12] = { 2128static const unsigned int dell_9205_m42_pin_configs[12] = {
2125 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310, 2129 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310,
2126 0x400003FB, 0x400003FC, 0x400003FD, 0x40F000F9, 2130 0x400003FB, 0x400003FC, 0x400003FD, 0x40F000F9,
2127 0x90A60330, 0x400003FF, 0x0144131F, 0x40C003FE, 2131 0x90A60330, 0x400003FF, 0x0144131F, 0x40C003FE,
@@ -2137,19 +2141,19 @@ static unsigned int dell_9205_m42_pin_configs[12] = {
2137 10280200 2141 10280200
2138 10280201 2142 10280201
2139*/ 2143*/
2140static unsigned int dell_9205_m43_pin_configs[12] = { 2144static const unsigned int dell_9205_m43_pin_configs[12] = {
2141 0x0321101f, 0x03a11020, 0x90a70330, 0x90170310, 2145 0x0321101f, 0x03a11020, 0x90a70330, 0x90170310,
2142 0x400000fe, 0x400000ff, 0x400000fd, 0x40f000f9, 2146 0x400000fe, 0x400000ff, 0x400000fd, 0x40f000f9,
2143 0x400000fa, 0x400000fc, 0x0144131f, 0x40c003f8, 2147 0x400000fa, 0x400000fc, 0x0144131f, 0x40c003f8,
2144}; 2148};
2145 2149
2146static unsigned int dell_9205_m44_pin_configs[12] = { 2150static const unsigned int dell_9205_m44_pin_configs[12] = {
2147 0x0421101f, 0x04a11020, 0x400003fa, 0x90170310, 2151 0x0421101f, 0x04a11020, 0x400003fa, 0x90170310,
2148 0x400003fb, 0x400003fc, 0x400003fd, 0x400003f9, 2152 0x400003fb, 0x400003fc, 0x400003fd, 0x400003f9,
2149 0x90a60330, 0x400003ff, 0x01441340, 0x40c003fe, 2153 0x90a60330, 0x400003ff, 0x01441340, 0x40c003fe,
2150}; 2154};
2151 2155
2152static unsigned int *stac9205_brd_tbl[STAC_9205_MODELS] = { 2156static const unsigned int *stac9205_brd_tbl[STAC_9205_MODELS] = {
2153 [STAC_9205_REF] = ref9205_pin_configs, 2157 [STAC_9205_REF] = ref9205_pin_configs,
2154 [STAC_9205_DELL_M42] = dell_9205_m42_pin_configs, 2158 [STAC_9205_DELL_M42] = dell_9205_m42_pin_configs,
2155 [STAC_9205_DELL_M43] = dell_9205_m43_pin_configs, 2159 [STAC_9205_DELL_M43] = dell_9205_m43_pin_configs,
@@ -2166,7 +2170,7 @@ static const char * const stac9205_models[STAC_9205_MODELS] = {
2166 [STAC_9205_EAPD] = "eapd", 2170 [STAC_9205_EAPD] = "eapd",
2167}; 2171};
2168 2172
2169static struct snd_pci_quirk stac9205_cfg_tbl[] = { 2173static const struct snd_pci_quirk stac9205_cfg_tbl[] = {
2170 /* SigmaTel reference board */ 2174 /* SigmaTel reference board */
2171 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, 2175 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
2172 "DFI LanParty", STAC_9205_REF), 2176 "DFI LanParty", STAC_9205_REF),
@@ -2214,7 +2218,7 @@ static struct snd_pci_quirk stac9205_cfg_tbl[] = {
2214}; 2218};
2215 2219
2216static void stac92xx_set_config_regs(struct hda_codec *codec, 2220static void stac92xx_set_config_regs(struct hda_codec *codec,
2217 unsigned int *pincfgs) 2221 const unsigned int *pincfgs)
2218{ 2222{
2219 int i; 2223 int i;
2220 struct sigmatel_spec *spec = codec->spec; 2224 struct sigmatel_spec *spec = codec->spec;
@@ -2334,7 +2338,7 @@ static int stac92xx_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2334 return 0; 2338 return 0;
2335} 2339}
2336 2340
2337static struct hda_pcm_stream stac92xx_pcm_digital_playback = { 2341static const struct hda_pcm_stream stac92xx_pcm_digital_playback = {
2338 .substreams = 1, 2342 .substreams = 1,
2339 .channels_min = 2, 2343 .channels_min = 2,
2340 .channels_max = 2, 2344 .channels_max = 2,
@@ -2347,14 +2351,14 @@ static struct hda_pcm_stream stac92xx_pcm_digital_playback = {
2347 }, 2351 },
2348}; 2352};
2349 2353
2350static struct hda_pcm_stream stac92xx_pcm_digital_capture = { 2354static const struct hda_pcm_stream stac92xx_pcm_digital_capture = {
2351 .substreams = 1, 2355 .substreams = 1,
2352 .channels_min = 2, 2356 .channels_min = 2,
2353 .channels_max = 2, 2357 .channels_max = 2,
2354 /* NID is set in stac92xx_build_pcms */ 2358 /* NID is set in stac92xx_build_pcms */
2355}; 2359};
2356 2360
2357static struct hda_pcm_stream stac92xx_pcm_analog_playback = { 2361static const struct hda_pcm_stream stac92xx_pcm_analog_playback = {
2358 .substreams = 1, 2362 .substreams = 1,
2359 .channels_min = 2, 2363 .channels_min = 2,
2360 .channels_max = 8, 2364 .channels_max = 8,
@@ -2366,7 +2370,7 @@ static struct hda_pcm_stream stac92xx_pcm_analog_playback = {
2366 }, 2370 },
2367}; 2371};
2368 2372
2369static struct hda_pcm_stream stac92xx_pcm_analog_alt_playback = { 2373static const struct hda_pcm_stream stac92xx_pcm_analog_alt_playback = {
2370 .substreams = 1, 2374 .substreams = 1,
2371 .channels_min = 2, 2375 .channels_min = 2,
2372 .channels_max = 2, 2376 .channels_max = 2,
@@ -2378,7 +2382,7 @@ static struct hda_pcm_stream stac92xx_pcm_analog_alt_playback = {
2378 }, 2382 },
2379}; 2383};
2380 2384
2381static struct hda_pcm_stream stac92xx_pcm_analog_capture = { 2385static const struct hda_pcm_stream stac92xx_pcm_analog_capture = {
2382 .channels_min = 2, 2386 .channels_min = 2,
2383 .channels_max = 2, 2387 .channels_max = 2,
2384 /* NID + .substreams is set in stac92xx_build_pcms */ 2388 /* NID + .substreams is set in stac92xx_build_pcms */
@@ -2487,7 +2491,7 @@ static int stac92xx_dc_bias_info(struct snd_kcontrol *kcontrol,
2487 struct snd_ctl_elem_info *uinfo) 2491 struct snd_ctl_elem_info *uinfo)
2488{ 2492{
2489 int i; 2493 int i;
2490 static char *texts[] = { 2494 static const char * const texts[] = {
2491 "Mic In", "Line In", "Line Out" 2495 "Mic In", "Line In", "Line Out"
2492 }; 2496 };
2493 2497
@@ -2556,7 +2560,7 @@ static int stac92xx_dc_bias_put(struct snd_kcontrol *kcontrol,
2556static int stac92xx_io_switch_info(struct snd_kcontrol *kcontrol, 2560static int stac92xx_io_switch_info(struct snd_kcontrol *kcontrol,
2557 struct snd_ctl_elem_info *uinfo) 2561 struct snd_ctl_elem_info *uinfo)
2558{ 2562{
2559 static char *texts[2]; 2563 char *texts[2];
2560 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 2564 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2561 struct sigmatel_spec *spec = codec->spec; 2565 struct sigmatel_spec *spec = codec->spec;
2562 2566
@@ -2687,7 +2691,7 @@ enum {
2687 STAC_CTL_WIDGET_DC_BIAS 2691 STAC_CTL_WIDGET_DC_BIAS
2688}; 2692};
2689 2693
2690static struct snd_kcontrol_new stac92xx_control_templates[] = { 2694static const struct snd_kcontrol_new stac92xx_control_templates[] = {
2691 HDA_CODEC_VOLUME(NULL, 0, 0, 0), 2695 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
2692 HDA_CODEC_MUTE(NULL, 0, 0, 0), 2696 HDA_CODEC_MUTE(NULL, 0, 0, 0),
2693 HDA_CODEC_MUTE_BEEP(NULL, 0, 0, 0), 2697 HDA_CODEC_MUTE_BEEP(NULL, 0, 0, 0),
@@ -2701,7 +2705,7 @@ static struct snd_kcontrol_new stac92xx_control_templates[] = {
2701/* add dynamic controls */ 2705/* add dynamic controls */
2702static struct snd_kcontrol_new * 2706static struct snd_kcontrol_new *
2703stac_control_new(struct sigmatel_spec *spec, 2707stac_control_new(struct sigmatel_spec *spec,
2704 struct snd_kcontrol_new *ktemp, 2708 const struct snd_kcontrol_new *ktemp,
2705 const char *name, 2709 const char *name,
2706 unsigned int subdev) 2710 unsigned int subdev)
2707{ 2711{
@@ -2724,7 +2728,7 @@ stac_control_new(struct sigmatel_spec *spec,
2724} 2728}
2725 2729
2726static int stac92xx_add_control_temp(struct sigmatel_spec *spec, 2730static int stac92xx_add_control_temp(struct sigmatel_spec *spec,
2727 struct snd_kcontrol_new *ktemp, 2731 const struct snd_kcontrol_new *ktemp,
2728 int idx, const char *name, 2732 int idx, const char *name,
2729 unsigned long val) 2733 unsigned long val)
2730{ 2734{
@@ -2754,7 +2758,7 @@ static inline int stac92xx_add_control(struct sigmatel_spec *spec, int type,
2754 return stac92xx_add_control_idx(spec, type, 0, name, val); 2758 return stac92xx_add_control_idx(spec, type, 0, name, val);
2755} 2759}
2756 2760
2757static struct snd_kcontrol_new stac_input_src_temp = { 2761static const struct snd_kcontrol_new stac_input_src_temp = {
2758 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2762 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2759 .name = "Input Source", 2763 .name = "Input Source",
2760 .info = stac92xx_mux_enum_info, 2764 .info = stac92xx_mux_enum_info,
@@ -3072,7 +3076,8 @@ static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid)
3072 printk(KERN_WARNING "stac92xx: No space for DAC 0x%x\n", nid); 3076 printk(KERN_WARNING "stac92xx: No space for DAC 0x%x\n", nid);
3073 return 1; 3077 return 1;
3074 } else { 3078 } else {
3075 spec->multiout.dac_nids[spec->multiout.num_dacs] = nid; 3079 snd_BUG_ON(spec->multiout.dac_nids != spec->dac_nids);
3080 spec->dac_nids[spec->multiout.num_dacs] = nid;
3076 spec->multiout.num_dacs++; 3081 spec->multiout.num_dacs++;
3077 } 3082 }
3078 return 0; 3083 return 0;
@@ -3109,8 +3114,7 @@ static int create_multi_out_ctls(struct hda_codec *codec, int num_outs,
3109 3114
3110 for (i = 0; i < num_outs && i < ARRAY_SIZE(chname); i++) { 3115 for (i = 0; i < num_outs && i < ARRAY_SIZE(chname); i++) {
3111 if (type == AUTO_PIN_HP_OUT && !spec->hp_detect) { 3116 if (type == AUTO_PIN_HP_OUT && !spec->hp_detect) {
3112 wid_caps = get_wcaps(codec, pins[i]); 3117 if (is_jack_detectable(codec, pins[i]))
3113 if (wid_caps & AC_WCAP_UNSOL_CAP)
3114 spec->hp_detect = 1; 3118 spec->hp_detect = 1;
3115 } 3119 }
3116 nid = dac_nids[i]; 3120 nid = dac_nids[i];
@@ -3309,7 +3313,7 @@ static int stac92xx_dig_beep_switch_put(struct snd_kcontrol *kcontrol,
3309 return snd_hda_enable_beep_device(codec, ucontrol->value.integer.value[0]); 3313 return snd_hda_enable_beep_device(codec, ucontrol->value.integer.value[0]);
3310} 3314}
3311 3315
3312static struct snd_kcontrol_new stac92xx_dig_beep_ctrl = { 3316static const struct snd_kcontrol_new stac92xx_dig_beep_ctrl = {
3313 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 3317 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3314 .info = stac92xx_dig_beep_switch_info, 3318 .info = stac92xx_dig_beep_switch_info,
3315 .get = stac92xx_dig_beep_switch_get, 3319 .get = stac92xx_dig_beep_switch_get,
@@ -3516,14 +3520,18 @@ static int check_mic_pin(struct hda_codec *codec, hda_nid_t nid,
3516 hda_nid_t *fixed, hda_nid_t *ext, hda_nid_t *dock) 3520 hda_nid_t *fixed, hda_nid_t *ext, hda_nid_t *dock)
3517{ 3521{
3518 unsigned int cfg; 3522 unsigned int cfg;
3523 unsigned int type;
3519 3524
3520 if (!nid) 3525 if (!nid)
3521 return 0; 3526 return 0;
3522 cfg = snd_hda_codec_get_pincfg(codec, nid); 3527 cfg = snd_hda_codec_get_pincfg(codec, nid);
3528 type = get_defcfg_device(cfg);
3523 switch (snd_hda_get_input_pin_attr(cfg)) { 3529 switch (snd_hda_get_input_pin_attr(cfg)) {
3524 case INPUT_PIN_ATTR_INT: 3530 case INPUT_PIN_ATTR_INT:
3525 if (*fixed) 3531 if (*fixed)
3526 return 1; /* already occupied */ 3532 return 1; /* already occupied */
3533 if (type != AC_JACK_MIC_IN)
3534 return 1; /* invalid type */
3527 *fixed = nid; 3535 *fixed = nid;
3528 break; 3536 break;
3529 case INPUT_PIN_ATTR_UNUSED: 3537 case INPUT_PIN_ATTR_UNUSED:
@@ -3531,11 +3539,15 @@ static int check_mic_pin(struct hda_codec *codec, hda_nid_t nid,
3531 case INPUT_PIN_ATTR_DOCK: 3539 case INPUT_PIN_ATTR_DOCK:
3532 if (*dock) 3540 if (*dock)
3533 return 1; /* already occupied */ 3541 return 1; /* already occupied */
3542 if (type != AC_JACK_MIC_IN && type != AC_JACK_LINE_IN)
3543 return 1; /* invalid type */
3534 *dock = nid; 3544 *dock = nid;
3535 break; 3545 break;
3536 default: 3546 default:
3537 if (*ext) 3547 if (*ext)
3538 return 1; /* already occupied */ 3548 return 1; /* already occupied */
3549 if (type != AC_JACK_MIC_IN)
3550 return 1; /* invalid type */
3539 *ext = nid; 3551 *ext = nid;
3540 break; 3552 break;
3541 } 3553 }
@@ -3591,10 +3603,6 @@ static int stac_check_auto_mic(struct hda_codec *codec)
3591 hda_nid_t fixed, ext, dock; 3603 hda_nid_t fixed, ext, dock;
3592 int i; 3604 int i;
3593 3605
3594 for (i = 0; i < cfg->num_inputs; i++) {
3595 if (cfg->inputs[i].type >= AUTO_PIN_LINE_IN)
3596 return 0; /* must be exclusively mics */
3597 }
3598 fixed = ext = dock = 0; 3606 fixed = ext = dock = 0;
3599 for (i = 0; i < cfg->num_inputs; i++) 3607 for (i = 0; i < cfg->num_inputs; i++)
3600 if (check_mic_pin(codec, cfg->inputs[i].pin, 3608 if (check_mic_pin(codec, cfg->inputs[i].pin,
@@ -3606,7 +3614,7 @@ static int stac_check_auto_mic(struct hda_codec *codec)
3606 return 0; 3614 return 0;
3607 if (!fixed || (!ext && !dock)) 3615 if (!fixed || (!ext && !dock))
3608 return 0; /* no input to switch */ 3616 return 0; /* no input to switch */
3609 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) 3617 if (!is_jack_detectable(codec, ext))
3610 return 0; /* no unsol support */ 3618 return 0; /* no unsol support */
3611 if (set_mic_route(codec, &spec->ext_mic, ext) || 3619 if (set_mic_route(codec, &spec->ext_mic, ext) ||
3612 set_mic_route(codec, &spec->int_mic, fixed) || 3620 set_mic_route(codec, &spec->int_mic, fixed) ||
@@ -3921,13 +3929,11 @@ static int stac9200_auto_create_hp_ctls(struct hda_codec *codec,
3921{ 3929{
3922 struct sigmatel_spec *spec = codec->spec; 3930 struct sigmatel_spec *spec = codec->spec;
3923 hda_nid_t pin = cfg->hp_pins[0]; 3931 hda_nid_t pin = cfg->hp_pins[0];
3924 unsigned int wid_caps;
3925 3932
3926 if (! pin) 3933 if (! pin)
3927 return 0; 3934 return 0;
3928 3935
3929 wid_caps = get_wcaps(codec, pin); 3936 if (is_jack_detectable(codec, pin))
3930 if (wid_caps & AC_WCAP_UNSOL_CAP)
3931 spec->hp_detect = 1; 3937 spec->hp_detect = 1;
3932 3938
3933 return 0; 3939 return 0;
@@ -4138,7 +4144,7 @@ static int enable_pin_detect(struct hda_codec *codec, hda_nid_t nid,
4138 struct sigmatel_event *event; 4144 struct sigmatel_event *event;
4139 int tag; 4145 int tag;
4140 4146
4141 if (!(get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP)) 4147 if (!is_jack_detectable(codec, nid))
4142 return 0; 4148 return 0;
4143 event = stac_get_event(codec, nid); 4149 event = stac_get_event(codec, nid);
4144 if (event) { 4150 if (event) {
@@ -4171,7 +4177,7 @@ static void stac92xx_power_down(struct hda_codec *codec)
4171 struct sigmatel_spec *spec = codec->spec; 4177 struct sigmatel_spec *spec = codec->spec;
4172 4178
4173 /* power down inactive DACs */ 4179 /* power down inactive DACs */
4174 hda_nid_t *dac; 4180 const hda_nid_t *dac;
4175 for (dac = spec->dac_list; *dac; dac++) 4181 for (dac = spec->dac_list; *dac; dac++)
4176 if (!check_all_dac_nids(spec, *dac)) 4182 if (!check_all_dac_nids(spec, *dac))
4177 snd_hda_codec_write(codec, *dac, 0, 4183 snd_hda_codec_write(codec, *dac, 0,
@@ -4644,7 +4650,7 @@ static unsigned int stac_get_defcfg_connect(struct hda_codec *codec, int idx)
4644} 4650}
4645 4651
4646static int stac92xx_connected_ports(struct hda_codec *codec, 4652static int stac92xx_connected_ports(struct hda_codec *codec,
4647 hda_nid_t *nids, int num_nids) 4653 const hda_nid_t *nids, int num_nids)
4648{ 4654{
4649 struct sigmatel_spec *spec = codec->spec; 4655 struct sigmatel_spec *spec = codec->spec;
4650 int idx, num; 4656 int idx, num;
@@ -4968,7 +4974,7 @@ static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state)
4968} 4974}
4969#endif 4975#endif
4970 4976
4971static struct hda_codec_ops stac92xx_patch_ops = { 4977static const struct hda_codec_ops stac92xx_patch_ops = {
4972 .build_controls = stac92xx_build_controls, 4978 .build_controls = stac92xx_build_controls,
4973 .build_pcms = stac92xx_build_pcms, 4979 .build_pcms = stac92xx_build_pcms,
4974 .init = stac92xx_init, 4980 .init = stac92xx_init,
@@ -5588,7 +5594,7 @@ static int stac_hp_bass_gpio_put(struct snd_kcontrol *kcontrol,
5588 return 1; 5594 return 1;
5589} 5595}
5590 5596
5591static struct snd_kcontrol_new stac_hp_bass_sw_ctrl = { 5597static const struct snd_kcontrol_new stac_hp_bass_sw_ctrl = {
5592 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 5598 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5593 .info = stac_hp_bass_gpio_info, 5599 .info = stac_hp_bass_gpio_info,
5594 .get = stac_hp_bass_gpio_get, 5600 .get = stac_hp_bass_gpio_get,
@@ -5612,7 +5618,7 @@ static int stac_add_hp_bass_switch(struct hda_codec *codec)
5612static int patch_stac92hd71bxx(struct hda_codec *codec) 5618static int patch_stac92hd71bxx(struct hda_codec *codec)
5613{ 5619{
5614 struct sigmatel_spec *spec; 5620 struct sigmatel_spec *spec;
5615 struct hda_verb *unmute_init = stac92hd71bxx_unmute_core_init; 5621 const struct hda_verb *unmute_init = stac92hd71bxx_unmute_core_init;
5616 unsigned int pin_cfg; 5622 unsigned int pin_cfg;
5617 int err = 0; 5623 int err = 0;
5618 5624
@@ -5705,9 +5711,9 @@ again:
5705 unmute_init++; 5711 unmute_init++;
5706 snd_hda_codec_set_pincfg(codec, 0x0f, 0x40f000f0); 5712 snd_hda_codec_set_pincfg(codec, 0x0f, 0x40f000f0);
5707 snd_hda_codec_set_pincfg(codec, 0x19, 0x40f000f3); 5713 snd_hda_codec_set_pincfg(codec, 0x19, 0x40f000f3);
5708 stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS - 1] = 0; 5714 spec->dmic_nids = stac92hd71bxx_dmic_5port_nids;
5709 spec->num_dmics = stac92xx_connected_ports(codec, 5715 spec->num_dmics = stac92xx_connected_ports(codec,
5710 stac92hd71bxx_dmic_nids, 5716 stac92hd71bxx_dmic_5port_nids,
5711 STAC92HD71BXX_NUM_DMICS - 1); 5717 STAC92HD71BXX_NUM_DMICS - 1);
5712 break; 5718 break;
5713 case 0x111d7603: /* 6 Port with Analog Mixer */ 5719 case 0x111d7603: /* 6 Port with Analog Mixer */
@@ -5729,15 +5735,6 @@ again:
5729 if (get_wcaps(codec, 0xa) & AC_WCAP_IN_AMP) 5735 if (get_wcaps(codec, 0xa) & AC_WCAP_IN_AMP)
5730 snd_hda_sequence_write_cache(codec, unmute_init); 5736 snd_hda_sequence_write_cache(codec, unmute_init);
5731 5737
5732 /* Some HP machines seem to have unstable codec communications
5733 * especially with ATI fglrx driver. For recovering from the
5734 * CORB/RIRB stall, allow the BUS reset and keep always sync
5735 */
5736 if (spec->board_config == STAC_HP_DV5) {
5737 codec->bus->sync_write = 1;
5738 codec->bus->allow_bus_reset = 1;
5739 }
5740
5741 spec->aloopback_ctl = stac92hd71bxx_loopback; 5738 spec->aloopback_ctl = stac92hd71bxx_loopback;
5742 spec->aloopback_mask = 0x50; 5739 spec->aloopback_mask = 0x50;
5743 spec->aloopback_shift = 0; 5740 spec->aloopback_shift = 0;
@@ -6223,31 +6220,31 @@ static int patch_stac9205(struct hda_codec *codec)
6223 * STAC9872 hack 6220 * STAC9872 hack
6224 */ 6221 */
6225 6222
6226static struct hda_verb stac9872_core_init[] = { 6223static const struct hda_verb stac9872_core_init[] = {
6227 {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */ 6224 {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */
6228 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */ 6225 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */
6229 {} 6226 {}
6230}; 6227};
6231 6228
6232static hda_nid_t stac9872_pin_nids[] = { 6229static const hda_nid_t stac9872_pin_nids[] = {
6233 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 6230 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
6234 0x11, 0x13, 0x14, 6231 0x11, 0x13, 0x14,
6235}; 6232};
6236 6233
6237static hda_nid_t stac9872_adc_nids[] = { 6234static const hda_nid_t stac9872_adc_nids[] = {
6238 0x8 /*,0x6*/ 6235 0x8 /*,0x6*/
6239}; 6236};
6240 6237
6241static hda_nid_t stac9872_mux_nids[] = { 6238static const hda_nid_t stac9872_mux_nids[] = {
6242 0x15 6239 0x15
6243}; 6240};
6244 6241
6245static unsigned long stac9872_capvols[] = { 6242static const unsigned long stac9872_capvols[] = {
6246 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), 6243 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
6247}; 6244};
6248#define stac9872_capsws stac9872_capvols 6245#define stac9872_capsws stac9872_capvols
6249 6246
6250static unsigned int stac9872_vaio_pin_configs[9] = { 6247static const unsigned int stac9872_vaio_pin_configs[9] = {
6251 0x03211020, 0x411111f0, 0x411111f0, 0x03a15030, 6248 0x03211020, 0x411111f0, 0x411111f0, 0x03a15030,
6252 0x411111f0, 0x90170110, 0x411111f0, 0x411111f0, 6249 0x411111f0, 0x90170110, 0x411111f0, 0x411111f0,
6253 0x90a7013e 6250 0x90a7013e
@@ -6258,11 +6255,11 @@ static const char * const stac9872_models[STAC_9872_MODELS] = {
6258 [STAC_9872_VAIO] = "vaio", 6255 [STAC_9872_VAIO] = "vaio",
6259}; 6256};
6260 6257
6261static unsigned int *stac9872_brd_tbl[STAC_9872_MODELS] = { 6258static const unsigned int *stac9872_brd_tbl[STAC_9872_MODELS] = {
6262 [STAC_9872_VAIO] = stac9872_vaio_pin_configs, 6259 [STAC_9872_VAIO] = stac9872_vaio_pin_configs,
6263}; 6260};
6264 6261
6265static struct snd_pci_quirk stac9872_cfg_tbl[] = { 6262static const struct snd_pci_quirk stac9872_cfg_tbl[] = {
6266 SND_PCI_QUIRK_MASK(0x104d, 0xfff0, 0x81e0, 6263 SND_PCI_QUIRK_MASK(0x104d, 0xfff0, 0x81e0,
6267 "Sony VAIO F/S", STAC_9872_VAIO), 6264 "Sony VAIO F/S", STAC_9872_VAIO),
6268 {} /* terminator */ 6265 {} /* terminator */
@@ -6316,7 +6313,7 @@ static int patch_stac9872(struct hda_codec *codec)
6316/* 6313/*
6317 * patch entries 6314 * patch entries
6318 */ 6315 */
6319static struct hda_codec_preset snd_hda_preset_sigmatel[] = { 6316static const struct hda_codec_preset snd_hda_preset_sigmatel[] = {
6320 { .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 }, 6317 { .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 },
6321 { .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x }, 6318 { .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x },
6322 { .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x }, 6319 { .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x },
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
index 0997031c48d..605c99e1e52 100644
--- a/sound/pci/hda/patch_via.c
+++ b/sound/pci/hda/patch_via.c
@@ -98,24 +98,30 @@ enum VIA_HDA_CODEC {
98 VT1716S, 98 VT1716S,
99 VT2002P, 99 VT2002P,
100 VT1812, 100 VT1812,
101 VT1802,
101 CODEC_TYPES, 102 CODEC_TYPES,
102}; 103};
103 104
105#define VT2002P_COMPATIBLE(spec) \
106 ((spec)->codec_type == VT2002P ||\
107 (spec)->codec_type == VT1812 ||\
108 (spec)->codec_type == VT1802)
109
104struct via_spec { 110struct via_spec {
105 /* codec parameterization */ 111 /* codec parameterization */
106 struct snd_kcontrol_new *mixers[6]; 112 const struct snd_kcontrol_new *mixers[6];
107 unsigned int num_mixers; 113 unsigned int num_mixers;
108 114
109 struct hda_verb *init_verbs[5]; 115 const struct hda_verb *init_verbs[5];
110 unsigned int num_iverbs; 116 unsigned int num_iverbs;
111 117
112 char *stream_name_analog; 118 char *stream_name_analog;
113 struct hda_pcm_stream *stream_analog_playback; 119 const struct hda_pcm_stream *stream_analog_playback;
114 struct hda_pcm_stream *stream_analog_capture; 120 const struct hda_pcm_stream *stream_analog_capture;
115 121
116 char *stream_name_digital; 122 char *stream_name_digital;
117 struct hda_pcm_stream *stream_digital_playback; 123 const struct hda_pcm_stream *stream_digital_playback;
118 struct hda_pcm_stream *stream_digital_capture; 124 const struct hda_pcm_stream *stream_digital_capture;
119 125
120 /* playback */ 126 /* playback */
121 struct hda_multi_out multiout; 127 struct hda_multi_out multiout;
@@ -123,7 +129,7 @@ struct via_spec {
123 129
124 /* capture */ 130 /* capture */
125 unsigned int num_adc_nids; 131 unsigned int num_adc_nids;
126 hda_nid_t *adc_nids; 132 const hda_nid_t *adc_nids;
127 hda_nid_t mux_nids[3]; 133 hda_nid_t mux_nids[3];
128 hda_nid_t dig_in_nid; 134 hda_nid_t dig_in_nid;
129 hda_nid_t dig_in_pin; 135 hda_nid_t dig_in_pin;
@@ -154,6 +160,9 @@ struct via_spec {
154 struct delayed_work vt1708_hp_work; 160 struct delayed_work vt1708_hp_work;
155 int vt1708_jack_detectect; 161 int vt1708_jack_detectect;
156 int vt1708_hp_present; 162 int vt1708_hp_present;
163
164 void (*set_widgets_power_state)(struct hda_codec *codec);
165
157#ifdef CONFIG_SND_HDA_POWER_SAVE 166#ifdef CONFIG_SND_HDA_POWER_SAVE
158 struct hda_loopback_check loopback; 167 struct hda_loopback_check loopback;
159#endif 168#endif
@@ -218,17 +227,19 @@ static enum VIA_HDA_CODEC get_codec_type(struct hda_codec *codec)
218 codec_type = VT1812; 227 codec_type = VT1812;
219 else if (dev_id == 0x0440) 228 else if (dev_id == 0x0440)
220 codec_type = VT1708S; 229 codec_type = VT1708S;
230 else if ((dev_id & 0xfff) == 0x446)
231 codec_type = VT1802;
221 else 232 else
222 codec_type = UNKNOWN; 233 codec_type = UNKNOWN;
223 return codec_type; 234 return codec_type;
224}; 235};
225 236
237#define VIA_JACK_EVENT 0x20
226#define VIA_HP_EVENT 0x01 238#define VIA_HP_EVENT 0x01
227#define VIA_GPIO_EVENT 0x02 239#define VIA_GPIO_EVENT 0x02
228#define VIA_JACK_EVENT 0x04 240#define VIA_MONO_EVENT 0x03
229#define VIA_MONO_EVENT 0x08 241#define VIA_SPEAKER_EVENT 0x04
230#define VIA_SPEAKER_EVENT 0x10 242#define VIA_BIND_HP_EVENT 0x05
231#define VIA_BIND_HP_EVENT 0x20
232 243
233enum { 244enum {
234 VIA_CTL_WIDGET_VOL, 245 VIA_CTL_WIDGET_VOL,
@@ -245,7 +256,6 @@ enum {
245}; 256};
246 257
247static void analog_low_current_mode(struct hda_codec *codec, int stream_idle); 258static void analog_low_current_mode(struct hda_codec *codec, int stream_idle);
248static void set_jack_power_state(struct hda_codec *codec);
249static int is_aa_path_mute(struct hda_codec *codec); 259static int is_aa_path_mute(struct hda_codec *codec);
250 260
251static void vt1708_start_hp_work(struct via_spec *spec) 261static void vt1708_start_hp_work(struct via_spec *spec)
@@ -271,6 +281,12 @@ static void vt1708_stop_hp_work(struct via_spec *spec)
271 cancel_delayed_work_sync(&spec->vt1708_hp_work); 281 cancel_delayed_work_sync(&spec->vt1708_hp_work);
272} 282}
273 283
284static void set_widgets_power_state(struct hda_codec *codec)
285{
286 struct via_spec *spec = codec->spec;
287 if (spec->set_widgets_power_state)
288 spec->set_widgets_power_state(codec);
289}
274 290
275static int analog_input_switch_put(struct snd_kcontrol *kcontrol, 291static int analog_input_switch_put(struct snd_kcontrol *kcontrol,
276 struct snd_ctl_elem_value *ucontrol) 292 struct snd_ctl_elem_value *ucontrol)
@@ -278,7 +294,7 @@ static int analog_input_switch_put(struct snd_kcontrol *kcontrol,
278 int change = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol); 294 int change = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
279 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 295 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
280 296
281 set_jack_power_state(codec); 297 set_widgets_power_state(codec);
282 analog_low_current_mode(snd_kcontrol_chip(kcontrol), -1); 298 analog_low_current_mode(snd_kcontrol_chip(kcontrol), -1);
283 if (snd_hda_get_bool_hint(codec, "analog_loopback_hp_detect") == 1) { 299 if (snd_hda_get_bool_hint(codec, "analog_loopback_hp_detect") == 1) {
284 if (is_aa_path_mute(codec)) 300 if (is_aa_path_mute(codec))
@@ -394,54 +410,54 @@ static int bind_pin_switch_put(struct snd_kcontrol *kcontrol,
394 .put = bind_pin_switch_put, \ 410 .put = bind_pin_switch_put, \
395 .private_value = HDA_COMPOSE_AMP_VAL(0, 3, 0, 0) } 411 .private_value = HDA_COMPOSE_AMP_VAL(0, 3, 0, 0) }
396 412
397static struct snd_kcontrol_new via_control_templates[] = { 413static const struct snd_kcontrol_new via_control_templates[] = {
398 HDA_CODEC_VOLUME(NULL, 0, 0, 0), 414 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
399 HDA_CODEC_MUTE(NULL, 0, 0, 0), 415 HDA_CODEC_MUTE(NULL, 0, 0, 0),
400 ANALOG_INPUT_MUTE, 416 ANALOG_INPUT_MUTE,
401 BIND_PIN_MUTE, 417 BIND_PIN_MUTE,
402}; 418};
403 419
404static hda_nid_t vt1708_adc_nids[2] = { 420static const hda_nid_t vt1708_adc_nids[2] = {
405 /* ADC1-2 */ 421 /* ADC1-2 */
406 0x15, 0x27 422 0x15, 0x27
407}; 423};
408 424
409static hda_nid_t vt1709_adc_nids[3] = { 425static const hda_nid_t vt1709_adc_nids[3] = {
410 /* ADC1-2 */ 426 /* ADC1-2 */
411 0x14, 0x15, 0x16 427 0x14, 0x15, 0x16
412}; 428};
413 429
414static hda_nid_t vt1708B_adc_nids[2] = { 430static const hda_nid_t vt1708B_adc_nids[2] = {
415 /* ADC1-2 */ 431 /* ADC1-2 */
416 0x13, 0x14 432 0x13, 0x14
417}; 433};
418 434
419static hda_nid_t vt1708S_adc_nids[2] = { 435static const hda_nid_t vt1708S_adc_nids[2] = {
420 /* ADC1-2 */ 436 /* ADC1-2 */
421 0x13, 0x14 437 0x13, 0x14
422}; 438};
423 439
424static hda_nid_t vt1702_adc_nids[3] = { 440static const hda_nid_t vt1702_adc_nids[3] = {
425 /* ADC1-2 */ 441 /* ADC1-2 */
426 0x12, 0x20, 0x1F 442 0x12, 0x20, 0x1F
427}; 443};
428 444
429static hda_nid_t vt1718S_adc_nids[2] = { 445static const hda_nid_t vt1718S_adc_nids[2] = {
430 /* ADC1-2 */ 446 /* ADC1-2 */
431 0x10, 0x11 447 0x10, 0x11
432}; 448};
433 449
434static hda_nid_t vt1716S_adc_nids[2] = { 450static const hda_nid_t vt1716S_adc_nids[2] = {
435 /* ADC1-2 */ 451 /* ADC1-2 */
436 0x13, 0x14 452 0x13, 0x14
437}; 453};
438 454
439static hda_nid_t vt2002P_adc_nids[2] = { 455static const hda_nid_t vt2002P_adc_nids[2] = {
440 /* ADC1-2 */ 456 /* ADC1-2 */
441 0x10, 0x11 457 0x10, 0x11
442}; 458};
443 459
444static hda_nid_t vt1812_adc_nids[2] = { 460static const hda_nid_t vt1812_adc_nids[2] = {
445 /* ADC1-2 */ 461 /* ADC1-2 */
446 0x10, 0x11 462 0x10, 0x11
447}; 463};
@@ -471,7 +487,7 @@ static int __via_add_control(struct via_spec *spec, int type, const char *name,
471 __via_add_control(spec, type, name, 0, val) 487 __via_add_control(spec, type, name, 0, val)
472 488
473static struct snd_kcontrol_new *via_clone_control(struct via_spec *spec, 489static struct snd_kcontrol_new *via_clone_control(struct via_spec *spec,
474 struct snd_kcontrol_new *tmpl) 490 const struct snd_kcontrol_new *tmpl)
475{ 491{
476 struct snd_kcontrol_new *knew; 492 struct snd_kcontrol_new *knew;
477 493
@@ -602,482 +618,6 @@ static void set_pin_power_state(struct hda_codec *codec, hda_nid_t nid,
602 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_POWER_STATE, parm); 618 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_POWER_STATE, parm);
603} 619}
604 620
605static void set_jack_power_state(struct hda_codec *codec)
606{
607 struct via_spec *spec = codec->spec;
608 int imux_is_smixer;
609 unsigned int parm;
610
611 if (spec->codec_type == VT1702) {
612 imux_is_smixer = snd_hda_codec_read(
613 codec, 0x13, 0, AC_VERB_GET_CONNECT_SEL, 0x00) == 3;
614 /* inputs */
615 /* PW 1/2/5 (14h/15h/18h) */
616 parm = AC_PWRST_D3;
617 set_pin_power_state(codec, 0x14, &parm);
618 set_pin_power_state(codec, 0x15, &parm);
619 set_pin_power_state(codec, 0x18, &parm);
620 if (imux_is_smixer)
621 parm = AC_PWRST_D0; /* SW0 = stereo mixer (idx 3) */
622 /* SW0 (13h), AIW 0/1/2 (12h/1fh/20h) */
623 snd_hda_codec_write(codec, 0x13, 0, AC_VERB_SET_POWER_STATE,
624 parm);
625 snd_hda_codec_write(codec, 0x12, 0, AC_VERB_SET_POWER_STATE,
626 parm);
627 snd_hda_codec_write(codec, 0x1f, 0, AC_VERB_SET_POWER_STATE,
628 parm);
629 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_POWER_STATE,
630 parm);
631
632 /* outputs */
633 /* PW 3/4 (16h/17h) */
634 parm = AC_PWRST_D3;
635 set_pin_power_state(codec, 0x16, &parm);
636 set_pin_power_state(codec, 0x17, &parm);
637 /* MW0 (1ah), AOW 0/1 (10h/1dh) */
638 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_POWER_STATE,
639 imux_is_smixer ? AC_PWRST_D0 : parm);
640 snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_POWER_STATE,
641 parm);
642 snd_hda_codec_write(codec, 0x1d, 0, AC_VERB_SET_POWER_STATE,
643 parm);
644 } else if (spec->codec_type == VT1708B_8CH
645 || spec->codec_type == VT1708B_4CH
646 || spec->codec_type == VT1708S) {
647 /* SW0 (17h) = stereo mixer */
648 int is_8ch = spec->codec_type != VT1708B_4CH;
649 imux_is_smixer = snd_hda_codec_read(
650 codec, 0x17, 0, AC_VERB_GET_CONNECT_SEL, 0x00)
651 == ((spec->codec_type == VT1708S) ? 5 : 0);
652 /* inputs */
653 /* PW 1/2/5 (1ah/1bh/1eh) */
654 parm = AC_PWRST_D3;
655 set_pin_power_state(codec, 0x1a, &parm);
656 set_pin_power_state(codec, 0x1b, &parm);
657 set_pin_power_state(codec, 0x1e, &parm);
658 if (imux_is_smixer)
659 parm = AC_PWRST_D0;
660 /* SW0 (17h), AIW 0/1 (13h/14h) */
661 snd_hda_codec_write(codec, 0x17, 0, AC_VERB_SET_POWER_STATE,
662 parm);
663 snd_hda_codec_write(codec, 0x13, 0, AC_VERB_SET_POWER_STATE,
664 parm);
665 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_POWER_STATE,
666 parm);
667
668 /* outputs */
669 /* PW0 (19h), SW1 (18h), AOW1 (11h) */
670 parm = AC_PWRST_D3;
671 set_pin_power_state(codec, 0x19, &parm);
672 if (spec->smart51_enabled)
673 parm = AC_PWRST_D0;
674 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_POWER_STATE,
675 parm);
676 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_POWER_STATE,
677 parm);
678
679 /* PW6 (22h), SW2 (26h), AOW2 (24h) */
680 if (is_8ch) {
681 parm = AC_PWRST_D3;
682 set_pin_power_state(codec, 0x22, &parm);
683 if (spec->smart51_enabled)
684 parm = AC_PWRST_D0;
685 snd_hda_codec_write(codec, 0x26, 0,
686 AC_VERB_SET_POWER_STATE, parm);
687 snd_hda_codec_write(codec, 0x24, 0,
688 AC_VERB_SET_POWER_STATE, parm);
689 }
690
691 /* PW 3/4/7 (1ch/1dh/23h) */
692 parm = AC_PWRST_D3;
693 /* force to D0 for internal Speaker */
694 set_pin_power_state(codec, 0x1c, &parm);
695 set_pin_power_state(codec, 0x1d, &parm);
696 if (is_8ch)
697 set_pin_power_state(codec, 0x23, &parm);
698 /* MW0 (16h), Sw3 (27h), AOW 0/3 (10h/25h) */
699 snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_POWER_STATE,
700 imux_is_smixer ? AC_PWRST_D0 : parm);
701 snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_POWER_STATE,
702 parm);
703 if (is_8ch) {
704 snd_hda_codec_write(codec, 0x25, 0,
705 AC_VERB_SET_POWER_STATE, parm);
706 snd_hda_codec_write(codec, 0x27, 0,
707 AC_VERB_SET_POWER_STATE, parm);
708 }
709 } else if (spec->codec_type == VT1718S) {
710 /* MUX6 (1eh) = stereo mixer */
711 imux_is_smixer = snd_hda_codec_read(
712 codec, 0x1e, 0, AC_VERB_GET_CONNECT_SEL, 0x00) == 5;
713 /* inputs */
714 /* PW 5/6/7 (29h/2ah/2bh) */
715 parm = AC_PWRST_D3;
716 set_pin_power_state(codec, 0x29, &parm);
717 set_pin_power_state(codec, 0x2a, &parm);
718 set_pin_power_state(codec, 0x2b, &parm);
719 if (imux_is_smixer)
720 parm = AC_PWRST_D0;
721 /* MUX6/7 (1eh/1fh), AIW 0/1 (10h/11h) */
722 snd_hda_codec_write(codec, 0x1e, 0, AC_VERB_SET_POWER_STATE,
723 parm);
724 snd_hda_codec_write(codec, 0x1f, 0, AC_VERB_SET_POWER_STATE,
725 parm);
726 snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_POWER_STATE,
727 parm);
728 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_POWER_STATE,
729 parm);
730
731 /* outputs */
732 /* PW3 (27h), MW2 (1ah), AOW3 (bh) */
733 parm = AC_PWRST_D3;
734 set_pin_power_state(codec, 0x27, &parm);
735 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_POWER_STATE,
736 parm);
737 snd_hda_codec_write(codec, 0xb, 0, AC_VERB_SET_POWER_STATE,
738 parm);
739
740 /* PW2 (26h), AOW2 (ah) */
741 parm = AC_PWRST_D3;
742 set_pin_power_state(codec, 0x26, &parm);
743 snd_hda_codec_write(codec, 0xa, 0, AC_VERB_SET_POWER_STATE,
744 parm);
745
746 /* PW0/1 (24h/25h) */
747 parm = AC_PWRST_D3;
748 set_pin_power_state(codec, 0x24, &parm);
749 set_pin_power_state(codec, 0x25, &parm);
750 if (!spec->hp_independent_mode) /* check for redirected HP */
751 set_pin_power_state(codec, 0x28, &parm);
752 snd_hda_codec_write(codec, 0x8, 0, AC_VERB_SET_POWER_STATE,
753 parm);
754 snd_hda_codec_write(codec, 0x9, 0, AC_VERB_SET_POWER_STATE,
755 parm);
756 /* MW9 (21h), Mw2 (1ah), AOW0 (8h) */
757 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_SET_POWER_STATE,
758 imux_is_smixer ? AC_PWRST_D0 : parm);
759 if (spec->hp_independent_mode) {
760 /* PW4 (28h), MW3 (1bh), MUX1(34h), AOW4 (ch) */
761 parm = AC_PWRST_D3;
762 set_pin_power_state(codec, 0x28, &parm);
763 snd_hda_codec_write(codec, 0x1b, 0,
764 AC_VERB_SET_POWER_STATE, parm);
765 snd_hda_codec_write(codec, 0x34, 0,
766 AC_VERB_SET_POWER_STATE, parm);
767 snd_hda_codec_write(codec, 0xc, 0,
768 AC_VERB_SET_POWER_STATE, parm);
769 }
770 } else if (spec->codec_type == VT1716S) {
771 unsigned int mono_out, present;
772 /* SW0 (17h) = stereo mixer */
773 imux_is_smixer = snd_hda_codec_read(
774 codec, 0x17, 0, AC_VERB_GET_CONNECT_SEL, 0x00) == 5;
775 /* inputs */
776 /* PW 1/2/5 (1ah/1bh/1eh) */
777 parm = AC_PWRST_D3;
778 set_pin_power_state(codec, 0x1a, &parm);
779 set_pin_power_state(codec, 0x1b, &parm);
780 set_pin_power_state(codec, 0x1e, &parm);
781 if (imux_is_smixer)
782 parm = AC_PWRST_D0;
783 /* SW0 (17h), AIW0(13h) */
784 snd_hda_codec_write(codec, 0x17, 0, AC_VERB_SET_POWER_STATE,
785 parm);
786 snd_hda_codec_write(codec, 0x13, 0, AC_VERB_SET_POWER_STATE,
787 parm);
788
789 parm = AC_PWRST_D3;
790 set_pin_power_state(codec, 0x1e, &parm);
791 /* PW11 (22h) */
792 if (spec->dmic_enabled)
793 set_pin_power_state(codec, 0x22, &parm);
794 else
795 snd_hda_codec_write(
796 codec, 0x22, 0,
797 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
798
799 /* SW2(26h), AIW1(14h) */
800 snd_hda_codec_write(codec, 0x26, 0, AC_VERB_SET_POWER_STATE,
801 parm);
802 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_POWER_STATE,
803 parm);
804
805 /* outputs */
806 /* PW0 (19h), SW1 (18h), AOW1 (11h) */
807 parm = AC_PWRST_D3;
808 set_pin_power_state(codec, 0x19, &parm);
809 /* Smart 5.1 PW2(1bh) */
810 if (spec->smart51_enabled)
811 set_pin_power_state(codec, 0x1b, &parm);
812 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_POWER_STATE,
813 parm);
814 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_POWER_STATE,
815 parm);
816
817 /* PW7 (23h), SW3 (27h), AOW3 (25h) */
818 parm = AC_PWRST_D3;
819 set_pin_power_state(codec, 0x23, &parm);
820 /* Smart 5.1 PW1(1ah) */
821 if (spec->smart51_enabled)
822 set_pin_power_state(codec, 0x1a, &parm);
823 snd_hda_codec_write(codec, 0x27, 0, AC_VERB_SET_POWER_STATE,
824 parm);
825
826 /* Smart 5.1 PW5(1eh) */
827 if (spec->smart51_enabled)
828 set_pin_power_state(codec, 0x1e, &parm);
829 snd_hda_codec_write(codec, 0x25, 0, AC_VERB_SET_POWER_STATE,
830 parm);
831
832 /* Mono out */
833 /* SW4(28h)->MW1(29h)-> PW12 (2ah)*/
834 present = snd_hda_jack_detect(codec, 0x1c);
835 if (present)
836 mono_out = 0;
837 else {
838 present = snd_hda_jack_detect(codec, 0x1d);
839 if (!spec->hp_independent_mode && present)
840 mono_out = 0;
841 else
842 mono_out = 1;
843 }
844 parm = mono_out ? AC_PWRST_D0 : AC_PWRST_D3;
845 snd_hda_codec_write(codec, 0x28, 0, AC_VERB_SET_POWER_STATE,
846 parm);
847 snd_hda_codec_write(codec, 0x29, 0, AC_VERB_SET_POWER_STATE,
848 parm);
849 snd_hda_codec_write(codec, 0x2a, 0, AC_VERB_SET_POWER_STATE,
850 parm);
851
852 /* PW 3/4 (1ch/1dh) */
853 parm = AC_PWRST_D3;
854 set_pin_power_state(codec, 0x1c, &parm);
855 set_pin_power_state(codec, 0x1d, &parm);
856 /* HP Independent Mode, power on AOW3 */
857 if (spec->hp_independent_mode)
858 snd_hda_codec_write(codec, 0x25, 0,
859 AC_VERB_SET_POWER_STATE, parm);
860
861 /* force to D0 for internal Speaker */
862 /* MW0 (16h), AOW0 (10h) */
863 snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_POWER_STATE,
864 imux_is_smixer ? AC_PWRST_D0 : parm);
865 snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_POWER_STATE,
866 mono_out ? AC_PWRST_D0 : parm);
867 } else if (spec->codec_type == VT2002P) {
868 unsigned int present;
869 /* MUX9 (1eh) = stereo mixer */
870 imux_is_smixer = snd_hda_codec_read(
871 codec, 0x1e, 0, AC_VERB_GET_CONNECT_SEL, 0x00) == 3;
872 /* inputs */
873 /* PW 5/6/7 (29h/2ah/2bh) */
874 parm = AC_PWRST_D3;
875 set_pin_power_state(codec, 0x29, &parm);
876 set_pin_power_state(codec, 0x2a, &parm);
877 set_pin_power_state(codec, 0x2b, &parm);
878 if (imux_is_smixer)
879 parm = AC_PWRST_D0;
880 /* MUX9/10 (1eh/1fh), AIW 0/1 (10h/11h) */
881 snd_hda_codec_write(codec, 0x1e, 0,
882 AC_VERB_SET_POWER_STATE, parm);
883 snd_hda_codec_write(codec, 0x1f, 0,
884 AC_VERB_SET_POWER_STATE, parm);
885 snd_hda_codec_write(codec, 0x10, 0,
886 AC_VERB_SET_POWER_STATE, parm);
887 snd_hda_codec_write(codec, 0x11, 0,
888 AC_VERB_SET_POWER_STATE, parm);
889
890 /* outputs */
891 /* AOW0 (8h)*/
892 snd_hda_codec_write(codec, 0x8, 0,
893 AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
894
895 /* PW4 (26h), MW4 (1ch), MUX4(37h) */
896 parm = AC_PWRST_D3;
897 set_pin_power_state(codec, 0x26, &parm);
898 snd_hda_codec_write(codec, 0x1c, 0,
899 AC_VERB_SET_POWER_STATE, parm);
900 snd_hda_codec_write(codec, 0x37,
901 0, AC_VERB_SET_POWER_STATE, parm);
902
903 /* PW1 (25h), MW1 (19h), MUX1(35h), AOW1 (9h) */
904 parm = AC_PWRST_D3;
905 set_pin_power_state(codec, 0x25, &parm);
906 snd_hda_codec_write(codec, 0x19, 0,
907 AC_VERB_SET_POWER_STATE, parm);
908 snd_hda_codec_write(codec, 0x35, 0,
909 AC_VERB_SET_POWER_STATE, parm);
910 if (spec->hp_independent_mode) {
911 snd_hda_codec_write(codec, 0x9, 0,
912 AC_VERB_SET_POWER_STATE, parm);
913 }
914
915 /* Class-D */
916 /* PW0 (24h), MW0(18h), MUX0(34h) */
917 present = snd_hda_jack_detect(codec, 0x25);
918 parm = AC_PWRST_D3;
919 set_pin_power_state(codec, 0x24, &parm);
920 if (present) {
921 snd_hda_codec_write(
922 codec, 0x18, 0,
923 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
924 snd_hda_codec_write(
925 codec, 0x34, 0,
926 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
927 } else {
928 snd_hda_codec_write(
929 codec, 0x18, 0,
930 AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
931 snd_hda_codec_write(
932 codec, 0x34, 0,
933 AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
934 }
935
936 /* Mono Out */
937 /* PW15 (31h), MW8(17h), MUX8(3bh) */
938 present = snd_hda_jack_detect(codec, 0x26);
939 parm = AC_PWRST_D3;
940 set_pin_power_state(codec, 0x31, &parm);
941 if (present) {
942 snd_hda_codec_write(
943 codec, 0x17, 0,
944 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
945 snd_hda_codec_write(
946 codec, 0x3b, 0,
947 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
948 } else {
949 snd_hda_codec_write(
950 codec, 0x17, 0,
951 AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
952 snd_hda_codec_write(
953 codec, 0x3b, 0,
954 AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
955 }
956
957 /* MW9 (21h) */
958 if (imux_is_smixer || !is_aa_path_mute(codec))
959 snd_hda_codec_write(
960 codec, 0x21, 0,
961 AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
962 else
963 snd_hda_codec_write(
964 codec, 0x21, 0,
965 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
966 } else if (spec->codec_type == VT1812) {
967 unsigned int present;
968 /* MUX10 (1eh) = stereo mixer */
969 imux_is_smixer = snd_hda_codec_read(
970 codec, 0x1e, 0, AC_VERB_GET_CONNECT_SEL, 0x00) == 5;
971 /* inputs */
972 /* PW 5/6/7 (29h/2ah/2bh) */
973 parm = AC_PWRST_D3;
974 set_pin_power_state(codec, 0x29, &parm);
975 set_pin_power_state(codec, 0x2a, &parm);
976 set_pin_power_state(codec, 0x2b, &parm);
977 if (imux_is_smixer)
978 parm = AC_PWRST_D0;
979 /* MUX10/11 (1eh/1fh), AIW 0/1 (10h/11h) */
980 snd_hda_codec_write(codec, 0x1e, 0,
981 AC_VERB_SET_POWER_STATE, parm);
982 snd_hda_codec_write(codec, 0x1f, 0,
983 AC_VERB_SET_POWER_STATE, parm);
984 snd_hda_codec_write(codec, 0x10, 0,
985 AC_VERB_SET_POWER_STATE, parm);
986 snd_hda_codec_write(codec, 0x11, 0,
987 AC_VERB_SET_POWER_STATE, parm);
988
989 /* outputs */
990 /* AOW0 (8h)*/
991 snd_hda_codec_write(codec, 0x8, 0,
992 AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
993
994 /* PW4 (28h), MW4 (18h), MUX4(38h) */
995 parm = AC_PWRST_D3;
996 set_pin_power_state(codec, 0x28, &parm);
997 snd_hda_codec_write(codec, 0x18, 0,
998 AC_VERB_SET_POWER_STATE, parm);
999 snd_hda_codec_write(codec, 0x38, 0,
1000 AC_VERB_SET_POWER_STATE, parm);
1001
1002 /* PW1 (25h), MW1 (15h), MUX1(35h), AOW1 (9h) */
1003 parm = AC_PWRST_D3;
1004 set_pin_power_state(codec, 0x25, &parm);
1005 snd_hda_codec_write(codec, 0x15, 0,
1006 AC_VERB_SET_POWER_STATE, parm);
1007 snd_hda_codec_write(codec, 0x35, 0,
1008 AC_VERB_SET_POWER_STATE, parm);
1009 if (spec->hp_independent_mode) {
1010 snd_hda_codec_write(codec, 0x9, 0,
1011 AC_VERB_SET_POWER_STATE, parm);
1012 }
1013
1014 /* Internal Speaker */
1015 /* PW0 (24h), MW0(14h), MUX0(34h) */
1016 present = snd_hda_jack_detect(codec, 0x25);
1017 parm = AC_PWRST_D3;
1018 set_pin_power_state(codec, 0x24, &parm);
1019 if (present) {
1020 snd_hda_codec_write(codec, 0x14, 0,
1021 AC_VERB_SET_POWER_STATE,
1022 AC_PWRST_D3);
1023 snd_hda_codec_write(codec, 0x34, 0,
1024 AC_VERB_SET_POWER_STATE,
1025 AC_PWRST_D3);
1026 } else {
1027 snd_hda_codec_write(codec, 0x14, 0,
1028 AC_VERB_SET_POWER_STATE,
1029 AC_PWRST_D0);
1030 snd_hda_codec_write(codec, 0x34, 0,
1031 AC_VERB_SET_POWER_STATE,
1032 AC_PWRST_D0);
1033 }
1034 /* Mono Out */
1035 /* PW13 (31h), MW13(1ch), MUX13(3ch), MW14(3eh) */
1036 present = snd_hda_jack_detect(codec, 0x28);
1037 parm = AC_PWRST_D3;
1038 set_pin_power_state(codec, 0x31, &parm);
1039 if (present) {
1040 snd_hda_codec_write(codec, 0x1c, 0,
1041 AC_VERB_SET_POWER_STATE,
1042 AC_PWRST_D3);
1043 snd_hda_codec_write(codec, 0x3c, 0,
1044 AC_VERB_SET_POWER_STATE,
1045 AC_PWRST_D3);
1046 snd_hda_codec_write(codec, 0x3e, 0,
1047 AC_VERB_SET_POWER_STATE,
1048 AC_PWRST_D3);
1049 } else {
1050 snd_hda_codec_write(codec, 0x1c, 0,
1051 AC_VERB_SET_POWER_STATE,
1052 AC_PWRST_D0);
1053 snd_hda_codec_write(codec, 0x3c, 0,
1054 AC_VERB_SET_POWER_STATE,
1055 AC_PWRST_D0);
1056 snd_hda_codec_write(codec, 0x3e, 0,
1057 AC_VERB_SET_POWER_STATE,
1058 AC_PWRST_D0);
1059 }
1060
1061 /* PW15 (33h), MW15 (1dh), MUX15(3dh) */
1062 parm = AC_PWRST_D3;
1063 set_pin_power_state(codec, 0x33, &parm);
1064 snd_hda_codec_write(codec, 0x1d, 0,
1065 AC_VERB_SET_POWER_STATE, parm);
1066 snd_hda_codec_write(codec, 0x3d, 0,
1067 AC_VERB_SET_POWER_STATE, parm);
1068
1069 /* MW9 (21h) */
1070 if (imux_is_smixer || !is_aa_path_mute(codec))
1071 snd_hda_codec_write(
1072 codec, 0x21, 0,
1073 AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
1074 else
1075 snd_hda_codec_write(
1076 codec, 0x21, 0,
1077 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
1078 }
1079}
1080
1081/* 621/*
1082 * input MUX handling 622 * input MUX handling
1083 */ 623 */
@@ -1120,7 +660,7 @@ static int via_mux_enum_put(struct snd_kcontrol *kcontrol,
1120 spec->mux_nids[adc_idx], 660 spec->mux_nids[adc_idx],
1121 &spec->cur_mux[adc_idx]); 661 &spec->cur_mux[adc_idx]);
1122 /* update jack power state */ 662 /* update jack power state */
1123 set_jack_power_state(codec); 663 set_widgets_power_state(codec);
1124 664
1125 return ret; 665 return ret;
1126} 666}
@@ -1168,6 +708,9 @@ static hda_nid_t side_mute_channel(struct via_spec *spec)
1168 case VT1709_10CH: return 0x29; 708 case VT1709_10CH: return 0x29;
1169 case VT1708B_8CH: /* fall thru */ 709 case VT1708B_8CH: /* fall thru */
1170 case VT1708S: return 0x27; 710 case VT1708S: return 0x27;
711 case VT2002P: return 0x19;
712 case VT1802: return 0x15;
713 case VT1812: return 0x15;
1171 default: return 0; 714 default: return 0;
1172 } 715 }
1173} 716}
@@ -1176,13 +719,22 @@ static int update_side_mute_status(struct hda_codec *codec)
1176{ 719{
1177 /* mute side channel */ 720 /* mute side channel */
1178 struct via_spec *spec = codec->spec; 721 struct via_spec *spec = codec->spec;
1179 unsigned int parm = spec->hp_independent_mode 722 unsigned int parm;
1180 ? AMP_OUT_MUTE : AMP_OUT_UNMUTE;
1181 hda_nid_t sw3 = side_mute_channel(spec); 723 hda_nid_t sw3 = side_mute_channel(spec);
1182 724
1183 if (sw3) 725 if (sw3) {
1184 snd_hda_codec_write(codec, sw3, 0, AC_VERB_SET_AMP_GAIN_MUTE, 726 if (VT2002P_COMPATIBLE(spec))
1185 parm); 727 parm = spec->hp_independent_mode ?
728 AMP_IN_MUTE(1) : AMP_IN_UNMUTE(1);
729 else
730 parm = spec->hp_independent_mode ?
731 AMP_OUT_MUTE : AMP_OUT_UNMUTE;
732 snd_hda_codec_write(codec, sw3, 0,
733 AC_VERB_SET_AMP_GAIN_MUTE, parm);
734 if (spec->codec_type == VT1812)
735 snd_hda_codec_write(codec, 0x1d, 0,
736 AC_VERB_SET_AMP_GAIN_MUTE, parm);
737 }
1186 return 0; 738 return 0;
1187} 739}
1188 740
@@ -1217,19 +769,18 @@ static int via_independent_hp_put(struct snd_kcontrol *kcontrol,
1217 || spec->codec_type == VT1702 769 || spec->codec_type == VT1702
1218 || spec->codec_type == VT1718S 770 || spec->codec_type == VT1718S
1219 || spec->codec_type == VT1716S 771 || spec->codec_type == VT1716S
1220 || spec->codec_type == VT2002P 772 || VT2002P_COMPATIBLE(spec)) {
1221 || spec->codec_type == VT1812) {
1222 activate_ctl(codec, "Headphone Playback Volume", 773 activate_ctl(codec, "Headphone Playback Volume",
1223 spec->hp_independent_mode); 774 spec->hp_independent_mode);
1224 activate_ctl(codec, "Headphone Playback Switch", 775 activate_ctl(codec, "Headphone Playback Switch",
1225 spec->hp_independent_mode); 776 spec->hp_independent_mode);
1226 } 777 }
1227 /* update jack power state */ 778 /* update jack power state */
1228 set_jack_power_state(codec); 779 set_widgets_power_state(codec);
1229 return 0; 780 return 0;
1230} 781}
1231 782
1232static struct snd_kcontrol_new via_hp_mixer[2] = { 783static const struct snd_kcontrol_new via_hp_mixer[2] = {
1233 { 784 {
1234 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 785 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1235 .name = "Independent HP", 786 .name = "Independent HP",
@@ -1256,6 +807,7 @@ static int via_hp_build(struct hda_codec *codec)
1256 nid = 0x34; 807 nid = 0x34;
1257 break; 808 break;
1258 case VT2002P: 809 case VT2002P:
810 case VT1802:
1259 nid = 0x35; 811 nid = 0x35;
1260 break; 812 break;
1261 case VT1812: 813 case VT1812:
@@ -1447,11 +999,11 @@ static int via_smart51_put(struct snd_kcontrol *kcontrol,
1447 } 999 }
1448 } 1000 }
1449 spec->smart51_enabled = *ucontrol->value.integer.value; 1001 spec->smart51_enabled = *ucontrol->value.integer.value;
1450 set_jack_power_state(codec); 1002 set_widgets_power_state(codec);
1451 return 1; 1003 return 1;
1452} 1004}
1453 1005
1454static struct snd_kcontrol_new via_smart51_mixer[2] = { 1006static const struct snd_kcontrol_new via_smart51_mixer[2] = {
1455 { 1007 {
1456 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1008 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1457 .name = "Smart 5.1", 1009 .name = "Smart 5.1",
@@ -1473,6 +1025,11 @@ static int via_smart51_build(struct via_spec *spec)
1473 hda_nid_t nid; 1025 hda_nid_t nid;
1474 int i; 1026 int i;
1475 1027
1028 if (!cfg)
1029 return 0;
1030 if (cfg->line_outs > 2)
1031 return 0;
1032
1476 knew = via_clone_control(spec, &via_smart51_mixer[0]); 1033 knew = via_clone_control(spec, &via_smart51_mixer[0]);
1477 if (knew == NULL) 1034 if (knew == NULL)
1478 return -ENOMEM; 1035 return -ENOMEM;
@@ -1492,7 +1049,7 @@ static int via_smart51_build(struct via_spec *spec)
1492} 1049}
1493 1050
1494/* capture mixer elements */ 1051/* capture mixer elements */
1495static struct snd_kcontrol_new vt1708_capture_mixer[] = { 1052static const struct snd_kcontrol_new vt1708_capture_mixer[] = {
1496 HDA_CODEC_VOLUME("Capture Volume", 0x15, 0x0, HDA_INPUT), 1053 HDA_CODEC_VOLUME("Capture Volume", 0x15, 0x0, HDA_INPUT),
1497 HDA_CODEC_MUTE("Capture Switch", 0x15, 0x0, HDA_INPUT), 1054 HDA_CODEC_MUTE("Capture Switch", 0x15, 0x0, HDA_INPUT),
1498 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x27, 0x0, HDA_INPUT), 1055 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x27, 0x0, HDA_INPUT),
@@ -1543,6 +1100,7 @@ static int is_aa_path_mute(struct hda_codec *codec)
1543 break; 1100 break;
1544 case VT2002P: 1101 case VT2002P:
1545 case VT1812: 1102 case VT1812:
1103 case VT1802:
1546 nid_mixer = 0x21; 1104 nid_mixer = 0x21;
1547 start_idx = 0; 1105 start_idx = 0;
1548 end_idx = 2; 1106 end_idx = 2;
@@ -1607,6 +1165,7 @@ static void analog_low_current_mode(struct hda_codec *codec, int stream_idle)
1607 break; 1165 break;
1608 case VT2002P: 1166 case VT2002P:
1609 case VT1812: 1167 case VT1812:
1168 case VT1802:
1610 verb = 0xf93; 1169 verb = 0xf93;
1611 parm = enable ? 0x00 : 0xe0; /* 0x00: 4/40x, 0xe0: 1x */ 1170 parm = enable ? 0x00 : 0xe0; /* 0x00: 4/40x, 0xe0: 1x */
1612 break; 1171 break;
@@ -1620,7 +1179,7 @@ static void analog_low_current_mode(struct hda_codec *codec, int stream_idle)
1620/* 1179/*
1621 * generic initialization of ADC, input mixers and output mixers 1180 * generic initialization of ADC, input mixers and output mixers
1622 */ 1181 */
1623static struct hda_verb vt1708_volume_init_verbs[] = { 1182static const struct hda_verb vt1708_volume_init_verbs[] = {
1624 /* 1183 /*
1625 * Unmute ADC0-1 and set the default input to mic-in 1184 * Unmute ADC0-1 and set the default input to mic-in
1626 */ 1185 */
@@ -1650,6 +1209,8 @@ static struct hda_verb vt1708_volume_init_verbs[] = {
1650 {0x20, AC_VERB_SET_CONNECT_SEL, 0}, 1209 {0x20, AC_VERB_SET_CONNECT_SEL, 0},
1651 /* PW9 Output enable */ 1210 /* PW9 Output enable */
1652 {0x25, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, 1211 {0x25, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
1212 /* power down jack detect function */
1213 {0x1, 0xf81, 0x1},
1653 { } 1214 { }
1654}; 1215};
1655 1216
@@ -1672,7 +1233,7 @@ static void playback_multi_pcm_prep_0(struct hda_codec *codec,
1672{ 1233{
1673 struct via_spec *spec = codec->spec; 1234 struct via_spec *spec = codec->spec;
1674 struct hda_multi_out *mout = &spec->multiout; 1235 struct hda_multi_out *mout = &spec->multiout;
1675 hda_nid_t *nids = mout->dac_nids; 1236 const hda_nid_t *nids = mout->dac_nids;
1676 int chs = substream->runtime->channels; 1237 int chs = substream->runtime->channels;
1677 int i; 1238 int i;
1678 1239
@@ -1741,7 +1302,7 @@ static int via_playback_multi_pcm_prepare(struct hda_pcm_stream *hinfo,
1741{ 1302{
1742 struct via_spec *spec = codec->spec; 1303 struct via_spec *spec = codec->spec;
1743 struct hda_multi_out *mout = &spec->multiout; 1304 struct hda_multi_out *mout = &spec->multiout;
1744 hda_nid_t *nids = mout->dac_nids; 1305 const hda_nid_t *nids = mout->dac_nids;
1745 1306
1746 if (substream->number == 0) 1307 if (substream->number == 0)
1747 playback_multi_pcm_prep_0(codec, stream_tag, format, 1308 playback_multi_pcm_prep_0(codec, stream_tag, format,
@@ -1762,7 +1323,7 @@ static int via_playback_multi_pcm_cleanup(struct hda_pcm_stream *hinfo,
1762{ 1323{
1763 struct via_spec *spec = codec->spec; 1324 struct via_spec *spec = codec->spec;
1764 struct hda_multi_out *mout = &spec->multiout; 1325 struct hda_multi_out *mout = &spec->multiout;
1765 hda_nid_t *nids = mout->dac_nids; 1326 const hda_nid_t *nids = mout->dac_nids;
1766 int i; 1327 int i;
1767 1328
1768 if (substream->number == 0) { 1329 if (substream->number == 0) {
@@ -1860,7 +1421,7 @@ static int via_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
1860 return 0; 1421 return 0;
1861} 1422}
1862 1423
1863static struct hda_pcm_stream vt1708_pcm_analog_playback = { 1424static const struct hda_pcm_stream vt1708_pcm_analog_playback = {
1864 .substreams = 2, 1425 .substreams = 2,
1865 .channels_min = 2, 1426 .channels_min = 2,
1866 .channels_max = 8, 1427 .channels_max = 8,
@@ -1872,7 +1433,7 @@ static struct hda_pcm_stream vt1708_pcm_analog_playback = {
1872 }, 1433 },
1873}; 1434};
1874 1435
1875static struct hda_pcm_stream vt1708_pcm_analog_s16_playback = { 1436static const struct hda_pcm_stream vt1708_pcm_analog_s16_playback = {
1876 .substreams = 2, 1437 .substreams = 2,
1877 .channels_min = 2, 1438 .channels_min = 2,
1878 .channels_max = 8, 1439 .channels_max = 8,
@@ -1889,7 +1450,7 @@ static struct hda_pcm_stream vt1708_pcm_analog_s16_playback = {
1889 }, 1450 },
1890}; 1451};
1891 1452
1892static struct hda_pcm_stream vt1708_pcm_analog_capture = { 1453static const struct hda_pcm_stream vt1708_pcm_analog_capture = {
1893 .substreams = 2, 1454 .substreams = 2,
1894 .channels_min = 2, 1455 .channels_min = 2,
1895 .channels_max = 2, 1456 .channels_max = 2,
@@ -1900,7 +1461,7 @@ static struct hda_pcm_stream vt1708_pcm_analog_capture = {
1900 }, 1461 },
1901}; 1462};
1902 1463
1903static struct hda_pcm_stream vt1708_pcm_digital_playback = { 1464static const struct hda_pcm_stream vt1708_pcm_digital_playback = {
1904 .substreams = 1, 1465 .substreams = 1,
1905 .channels_min = 2, 1466 .channels_min = 2,
1906 .channels_max = 2, 1467 .channels_max = 2,
@@ -1913,7 +1474,7 @@ static struct hda_pcm_stream vt1708_pcm_digital_playback = {
1913 }, 1474 },
1914}; 1475};
1915 1476
1916static struct hda_pcm_stream vt1708_pcm_digital_capture = { 1477static const struct hda_pcm_stream vt1708_pcm_digital_capture = {
1917 .substreams = 1, 1478 .substreams = 1,
1918 .channels_min = 2, 1479 .channels_min = 2,
1919 .channels_max = 2, 1480 .channels_max = 2,
@@ -1923,7 +1484,7 @@ static int via_build_controls(struct hda_codec *codec)
1923{ 1484{
1924 struct via_spec *spec = codec->spec; 1485 struct via_spec *spec = codec->spec;
1925 struct snd_kcontrol *kctl; 1486 struct snd_kcontrol *kctl;
1926 struct snd_kcontrol_new *knew; 1487 const struct snd_kcontrol_new *knew;
1927 int err, i; 1488 int err, i;
1928 1489
1929 for (i = 0; i < spec->num_mixers; i++) { 1490 for (i = 0; i < spec->num_mixers; i++) {
@@ -1971,7 +1532,7 @@ static int via_build_controls(struct hda_codec *codec)
1971 } 1532 }
1972 1533
1973 /* init power states */ 1534 /* init power states */
1974 set_jack_power_state(codec); 1535 set_widgets_power_state(codec);
1975 analog_low_current_mode(codec, 1); 1536 analog_low_current_mode(codec, 1);
1976 1537
1977 via_free_kctls(codec); /* no longer needed */ 1538 via_free_kctls(codec); /* no longer needed */
@@ -2135,7 +1696,7 @@ static void via_speaker_automute(struct hda_codec *codec)
2135 unsigned int hp_present; 1696 unsigned int hp_present;
2136 struct via_spec *spec = codec->spec; 1697 struct via_spec *spec = codec->spec;
2137 1698
2138 if (spec->codec_type != VT2002P && spec->codec_type != VT1812) 1699 if (!VT2002P_COMPATIBLE(spec))
2139 return; 1700 return;
2140 1701
2141 hp_present = snd_hda_jack_detect(codec, spec->autocfg.hp_pins[0]); 1702 hp_present = snd_hda_jack_detect(codec, spec->autocfg.hp_pins[0]);
@@ -2194,17 +1755,21 @@ static void via_unsol_event(struct hda_codec *codec,
2194 unsigned int res) 1755 unsigned int res)
2195{ 1756{
2196 res >>= 26; 1757 res >>= 26;
2197 if (res & VIA_HP_EVENT) 1758
1759 if (res & VIA_JACK_EVENT)
1760 set_widgets_power_state(codec);
1761
1762 res &= ~VIA_JACK_EVENT;
1763
1764 if (res == VIA_HP_EVENT)
2198 via_hp_automute(codec); 1765 via_hp_automute(codec);
2199 if (res & VIA_GPIO_EVENT) 1766 else if (res == VIA_GPIO_EVENT)
2200 via_gpio_control(codec); 1767 via_gpio_control(codec);
2201 if (res & VIA_JACK_EVENT) 1768 else if (res == VIA_MONO_EVENT)
2202 set_jack_power_state(codec);
2203 if (res & VIA_MONO_EVENT)
2204 via_mono_automute(codec); 1769 via_mono_automute(codec);
2205 if (res & VIA_SPEAKER_EVENT) 1770 else if (res == VIA_SPEAKER_EVENT)
2206 via_speaker_automute(codec); 1771 via_speaker_automute(codec);
2207 if (res & VIA_BIND_HP_EVENT) 1772 else if (res == VIA_BIND_HP_EVENT)
2208 via_hp_bind_automute(codec); 1773 via_hp_bind_automute(codec);
2209} 1774}
2210 1775
@@ -2254,7 +1819,7 @@ static int via_check_power_status(struct hda_codec *codec, hda_nid_t nid)
2254 1819
2255/* 1820/*
2256 */ 1821 */
2257static struct hda_codec_ops via_patch_ops = { 1822static const struct hda_codec_ops via_patch_ops = {
2258 .build_controls = via_build_controls, 1823 .build_controls = via_build_controls,
2259 .build_pcms = via_build_pcms, 1824 .build_pcms = via_build_pcms,
2260 .init = via_init, 1825 .init = via_init,
@@ -2284,16 +1849,16 @@ static int vt1708_auto_fill_dac_nids(struct via_spec *spec,
2284 /* config dac list */ 1849 /* config dac list */
2285 switch (i) { 1850 switch (i) {
2286 case AUTO_SEQ_FRONT: 1851 case AUTO_SEQ_FRONT:
2287 spec->multiout.dac_nids[i] = 0x10; 1852 spec->private_dac_nids[i] = 0x10;
2288 break; 1853 break;
2289 case AUTO_SEQ_CENLFE: 1854 case AUTO_SEQ_CENLFE:
2290 spec->multiout.dac_nids[i] = 0x12; 1855 spec->private_dac_nids[i] = 0x12;
2291 break; 1856 break;
2292 case AUTO_SEQ_SURROUND: 1857 case AUTO_SEQ_SURROUND:
2293 spec->multiout.dac_nids[i] = 0x11; 1858 spec->private_dac_nids[i] = 0x11;
2294 break; 1859 break;
2295 case AUTO_SEQ_SIDE: 1860 case AUTO_SEQ_SIDE:
2296 spec->multiout.dac_nids[i] = 0x13; 1861 spec->private_dac_nids[i] = 0x13;
2297 break; 1862 break;
2298 } 1863 }
2299 } 1864 }
@@ -2437,7 +2002,8 @@ static int vt1708_auto_create_hp_ctls(struct via_spec *spec, hda_nid_t pin)
2437static int vt_auto_create_analog_input_ctls(struct hda_codec *codec, 2002static int vt_auto_create_analog_input_ctls(struct hda_codec *codec,
2438 const struct auto_pin_cfg *cfg, 2003 const struct auto_pin_cfg *cfg,
2439 hda_nid_t cap_nid, 2004 hda_nid_t cap_nid,
2440 hda_nid_t pin_idxs[], int num_idxs) 2005 const hda_nid_t pin_idxs[],
2006 int num_idxs)
2441{ 2007{
2442 struct via_spec *spec = codec->spec; 2008 struct via_spec *spec = codec->spec;
2443 struct hda_input_mux *imux = &spec->private_imux[0]; 2009 struct hda_input_mux *imux = &spec->private_imux[0];
@@ -2483,13 +2049,13 @@ static int vt_auto_create_analog_input_ctls(struct hda_codec *codec,
2483static int vt1708_auto_create_analog_input_ctls(struct hda_codec *codec, 2049static int vt1708_auto_create_analog_input_ctls(struct hda_codec *codec,
2484 const struct auto_pin_cfg *cfg) 2050 const struct auto_pin_cfg *cfg)
2485{ 2051{
2486 static hda_nid_t pin_idxs[] = { 0xff, 0x24, 0x1d, 0x1e, 0x21 }; 2052 static const hda_nid_t pin_idxs[] = { 0xff, 0x24, 0x1d, 0x1e, 0x21 };
2487 return vt_auto_create_analog_input_ctls(codec, cfg, 0x17, pin_idxs, 2053 return vt_auto_create_analog_input_ctls(codec, cfg, 0x17, pin_idxs,
2488 ARRAY_SIZE(pin_idxs)); 2054 ARRAY_SIZE(pin_idxs));
2489} 2055}
2490 2056
2491#ifdef CONFIG_SND_HDA_POWER_SAVE 2057#ifdef CONFIG_SND_HDA_POWER_SAVE
2492static struct hda_amp_list vt1708_loopbacks[] = { 2058static const struct hda_amp_list vt1708_loopbacks[] = {
2493 { 0x17, HDA_INPUT, 1 }, 2059 { 0x17, HDA_INPUT, 1 },
2494 { 0x17, HDA_INPUT, 2 }, 2060 { 0x17, HDA_INPUT, 2 },
2495 { 0x17, HDA_INPUT, 3 }, 2061 { 0x17, HDA_INPUT, 3 },
@@ -2548,7 +2114,7 @@ static int vt1708_jack_detectect_put(struct snd_kcontrol *kcontrol,
2548 return change; 2114 return change;
2549} 2115}
2550 2116
2551static struct snd_kcontrol_new vt1708_jack_detectect[] = { 2117static const struct snd_kcontrol_new vt1708_jack_detectect[] = {
2552 { 2118 {
2553 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2119 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2554 .name = "Jack Detect", 2120 .name = "Jack Detect",
@@ -2623,7 +2189,8 @@ static int via_auto_init(struct hda_codec *codec)
2623 via_auto_init_multi_out(codec); 2189 via_auto_init_multi_out(codec);
2624 via_auto_init_hp_out(codec); 2190 via_auto_init_hp_out(codec);
2625 via_auto_init_analog_input(codec); 2191 via_auto_init_analog_input(codec);
2626 if (spec->codec_type == VT2002P || spec->codec_type == VT1812) { 2192
2193 if (VT2002P_COMPATIBLE(spec)) {
2627 via_hp_bind_automute(codec); 2194 via_hp_bind_automute(codec);
2628 } else { 2195 } else {
2629 via_hp_automute(codec); 2196 via_hp_automute(codec);
@@ -2727,7 +2294,7 @@ static int patch_vt1708(struct hda_codec *codec)
2727} 2294}
2728 2295
2729/* capture mixer elements */ 2296/* capture mixer elements */
2730static struct snd_kcontrol_new vt1709_capture_mixer[] = { 2297static const struct snd_kcontrol_new vt1709_capture_mixer[] = {
2731 HDA_CODEC_VOLUME("Capture Volume", 0x14, 0x0, HDA_INPUT), 2298 HDA_CODEC_VOLUME("Capture Volume", 0x14, 0x0, HDA_INPUT),
2732 HDA_CODEC_MUTE("Capture Switch", 0x14, 0x0, HDA_INPUT), 2299 HDA_CODEC_MUTE("Capture Switch", 0x14, 0x0, HDA_INPUT),
2733 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x15, 0x0, HDA_INPUT), 2300 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x15, 0x0, HDA_INPUT),
@@ -2749,7 +2316,7 @@ static struct snd_kcontrol_new vt1709_capture_mixer[] = {
2749 { } /* end */ 2316 { } /* end */
2750}; 2317};
2751 2318
2752static struct hda_verb vt1709_uniwill_init_verbs[] = { 2319static const struct hda_verb vt1709_uniwill_init_verbs[] = {
2753 {0x20, AC_VERB_SET_UNSOLICITED_ENABLE, 2320 {0x20, AC_VERB_SET_UNSOLICITED_ENABLE,
2754 AC_USRSP_EN | VIA_HP_EVENT | VIA_JACK_EVENT}, 2321 AC_USRSP_EN | VIA_HP_EVENT | VIA_JACK_EVENT},
2755 { } 2322 { }
@@ -2758,7 +2325,7 @@ static struct hda_verb vt1709_uniwill_init_verbs[] = {
2758/* 2325/*
2759 * generic initialization of ADC, input mixers and output mixers 2326 * generic initialization of ADC, input mixers and output mixers
2760 */ 2327 */
2761static struct hda_verb vt1709_10ch_volume_init_verbs[] = { 2328static const struct hda_verb vt1709_10ch_volume_init_verbs[] = {
2762 /* 2329 /*
2763 * Unmute ADC0-2 and set the default input to mic-in 2330 * Unmute ADC0-2 and set the default input to mic-in
2764 */ 2331 */
@@ -2798,7 +2365,7 @@ static struct hda_verb vt1709_10ch_volume_init_verbs[] = {
2798 { } 2365 { }
2799}; 2366};
2800 2367
2801static struct hda_pcm_stream vt1709_10ch_pcm_analog_playback = { 2368static const struct hda_pcm_stream vt1709_10ch_pcm_analog_playback = {
2802 .substreams = 1, 2369 .substreams = 1,
2803 .channels_min = 2, 2370 .channels_min = 2,
2804 .channels_max = 10, 2371 .channels_max = 10,
@@ -2810,7 +2377,7 @@ static struct hda_pcm_stream vt1709_10ch_pcm_analog_playback = {
2810 }, 2377 },
2811}; 2378};
2812 2379
2813static struct hda_pcm_stream vt1709_6ch_pcm_analog_playback = { 2380static const struct hda_pcm_stream vt1709_6ch_pcm_analog_playback = {
2814 .substreams = 1, 2381 .substreams = 1,
2815 .channels_min = 2, 2382 .channels_min = 2,
2816 .channels_max = 6, 2383 .channels_max = 6,
@@ -2822,7 +2389,7 @@ static struct hda_pcm_stream vt1709_6ch_pcm_analog_playback = {
2822 }, 2389 },
2823}; 2390};
2824 2391
2825static struct hda_pcm_stream vt1709_pcm_analog_capture = { 2392static const struct hda_pcm_stream vt1709_pcm_analog_capture = {
2826 .substreams = 2, 2393 .substreams = 2,
2827 .channels_min = 2, 2394 .channels_min = 2,
2828 .channels_max = 2, 2395 .channels_max = 2,
@@ -2833,7 +2400,7 @@ static struct hda_pcm_stream vt1709_pcm_analog_capture = {
2833 }, 2400 },
2834}; 2401};
2835 2402
2836static struct hda_pcm_stream vt1709_pcm_digital_playback = { 2403static const struct hda_pcm_stream vt1709_pcm_digital_playback = {
2837 .substreams = 1, 2404 .substreams = 1,
2838 .channels_min = 2, 2405 .channels_min = 2,
2839 .channels_max = 2, 2406 .channels_max = 2,
@@ -2844,7 +2411,7 @@ static struct hda_pcm_stream vt1709_pcm_digital_playback = {
2844 }, 2411 },
2845}; 2412};
2846 2413
2847static struct hda_pcm_stream vt1709_pcm_digital_capture = { 2414static const struct hda_pcm_stream vt1709_pcm_digital_capture = {
2848 .substreams = 1, 2415 .substreams = 1,
2849 .channels_min = 2, 2416 .channels_min = 2,
2850 .channels_max = 2, 2417 .channels_max = 2,
@@ -2871,26 +2438,26 @@ static int vt1709_auto_fill_dac_nids(struct via_spec *spec,
2871 switch (i) { 2438 switch (i) {
2872 case AUTO_SEQ_FRONT: 2439 case AUTO_SEQ_FRONT:
2873 /* AOW0 */ 2440 /* AOW0 */
2874 spec->multiout.dac_nids[i] = 0x10; 2441 spec->private_dac_nids[i] = 0x10;
2875 break; 2442 break;
2876 case AUTO_SEQ_CENLFE: 2443 case AUTO_SEQ_CENLFE:
2877 /* AOW2 */ 2444 /* AOW2 */
2878 spec->multiout.dac_nids[i] = 0x12; 2445 spec->private_dac_nids[i] = 0x12;
2879 break; 2446 break;
2880 case AUTO_SEQ_SURROUND: 2447 case AUTO_SEQ_SURROUND:
2881 /* AOW3 */ 2448 /* AOW3 */
2882 spec->multiout.dac_nids[i] = 0x11; 2449 spec->private_dac_nids[i] = 0x11;
2883 break; 2450 break;
2884 case AUTO_SEQ_SIDE: 2451 case AUTO_SEQ_SIDE:
2885 /* AOW1 */ 2452 /* AOW1 */
2886 spec->multiout.dac_nids[i] = 0x27; 2453 spec->private_dac_nids[i] = 0x27;
2887 break; 2454 break;
2888 default: 2455 default:
2889 break; 2456 break;
2890 } 2457 }
2891 } 2458 }
2892 } 2459 }
2893 spec->multiout.dac_nids[cfg->line_outs] = 0x28; /* AOW4 */ 2460 spec->private_dac_nids[cfg->line_outs] = 0x28; /* AOW4 */
2894 2461
2895 } else if (cfg->line_outs == 3) { /* 6 channels */ 2462 } else if (cfg->line_outs == 3) { /* 6 channels */
2896 for (i = 0; i < cfg->line_outs; i++) { 2463 for (i = 0; i < cfg->line_outs; i++) {
@@ -2900,15 +2467,15 @@ static int vt1709_auto_fill_dac_nids(struct via_spec *spec,
2900 switch (i) { 2467 switch (i) {
2901 case AUTO_SEQ_FRONT: 2468 case AUTO_SEQ_FRONT:
2902 /* AOW0 */ 2469 /* AOW0 */
2903 spec->multiout.dac_nids[i] = 0x10; 2470 spec->private_dac_nids[i] = 0x10;
2904 break; 2471 break;
2905 case AUTO_SEQ_CENLFE: 2472 case AUTO_SEQ_CENLFE:
2906 /* AOW2 */ 2473 /* AOW2 */
2907 spec->multiout.dac_nids[i] = 0x12; 2474 spec->private_dac_nids[i] = 0x12;
2908 break; 2475 break;
2909 case AUTO_SEQ_SURROUND: 2476 case AUTO_SEQ_SURROUND:
2910 /* AOW1 */ 2477 /* AOW1 */
2911 spec->multiout.dac_nids[i] = 0x11; 2478 spec->private_dac_nids[i] = 0x11;
2912 break; 2479 break;
2913 default: 2480 default:
2914 break; 2481 break;
@@ -3056,7 +2623,7 @@ static int vt1709_auto_create_hp_ctls(struct via_spec *spec, hda_nid_t pin)
3056static int vt1709_auto_create_analog_input_ctls(struct hda_codec *codec, 2623static int vt1709_auto_create_analog_input_ctls(struct hda_codec *codec,
3057 const struct auto_pin_cfg *cfg) 2624 const struct auto_pin_cfg *cfg)
3058{ 2625{
3059 static hda_nid_t pin_idxs[] = { 0xff, 0x23, 0x1d, 0x1e, 0x21 }; 2626 static const hda_nid_t pin_idxs[] = { 0xff, 0x23, 0x1d, 0x1e, 0x21 };
3060 return vt_auto_create_analog_input_ctls(codec, cfg, 0x18, pin_idxs, 2627 return vt_auto_create_analog_input_ctls(codec, cfg, 0x18, pin_idxs,
3061 ARRAY_SIZE(pin_idxs)); 2628 ARRAY_SIZE(pin_idxs));
3062} 2629}
@@ -3106,7 +2673,7 @@ static int vt1709_parse_auto_config(struct hda_codec *codec)
3106} 2673}
3107 2674
3108#ifdef CONFIG_SND_HDA_POWER_SAVE 2675#ifdef CONFIG_SND_HDA_POWER_SAVE
3109static struct hda_amp_list vt1709_loopbacks[] = { 2676static const struct hda_amp_list vt1709_loopbacks[] = {
3110 { 0x18, HDA_INPUT, 1 }, 2677 { 0x18, HDA_INPUT, 1 },
3111 { 0x18, HDA_INPUT, 2 }, 2678 { 0x18, HDA_INPUT, 2 },
3112 { 0x18, HDA_INPUT, 3 }, 2679 { 0x18, HDA_INPUT, 3 },
@@ -3167,7 +2734,7 @@ static int patch_vt1709_10ch(struct hda_codec *codec)
3167/* 2734/*
3168 * generic initialization of ADC, input mixers and output mixers 2735 * generic initialization of ADC, input mixers and output mixers
3169 */ 2736 */
3170static struct hda_verb vt1709_6ch_volume_init_verbs[] = { 2737static const struct hda_verb vt1709_6ch_volume_init_verbs[] = {
3171 /* 2738 /*
3172 * Unmute ADC0-2 and set the default input to mic-in 2739 * Unmute ADC0-2 and set the default input to mic-in
3173 */ 2740 */
@@ -3257,7 +2824,7 @@ static int patch_vt1709_6ch(struct hda_codec *codec)
3257} 2824}
3258 2825
3259/* capture mixer elements */ 2826/* capture mixer elements */
3260static struct snd_kcontrol_new vt1708B_capture_mixer[] = { 2827static const struct snd_kcontrol_new vt1708B_capture_mixer[] = {
3261 HDA_CODEC_VOLUME("Capture Volume", 0x13, 0x0, HDA_INPUT), 2828 HDA_CODEC_VOLUME("Capture Volume", 0x13, 0x0, HDA_INPUT),
3262 HDA_CODEC_MUTE("Capture Switch", 0x13, 0x0, HDA_INPUT), 2829 HDA_CODEC_MUTE("Capture Switch", 0x13, 0x0, HDA_INPUT),
3263 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x14, 0x0, HDA_INPUT), 2830 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x14, 0x0, HDA_INPUT),
@@ -3279,7 +2846,7 @@ static struct snd_kcontrol_new vt1708B_capture_mixer[] = {
3279/* 2846/*
3280 * generic initialization of ADC, input mixers and output mixers 2847 * generic initialization of ADC, input mixers and output mixers
3281 */ 2848 */
3282static struct hda_verb vt1708B_8ch_volume_init_verbs[] = { 2849static const struct hda_verb vt1708B_8ch_volume_init_verbs[] = {
3283 /* 2850 /*
3284 * Unmute ADC0-1 and set the default input to mic-in 2851 * Unmute ADC0-1 and set the default input to mic-in
3285 */ 2852 */
@@ -3314,7 +2881,7 @@ static struct hda_verb vt1708B_8ch_volume_init_verbs[] = {
3314 { } 2881 { }
3315}; 2882};
3316 2883
3317static struct hda_verb vt1708B_4ch_volume_init_verbs[] = { 2884static const struct hda_verb vt1708B_4ch_volume_init_verbs[] = {
3318 /* 2885 /*
3319 * Unmute ADC0-1 and set the default input to mic-in 2886 * Unmute ADC0-1 and set the default input to mic-in
3320 */ 2887 */
@@ -3349,7 +2916,7 @@ static struct hda_verb vt1708B_4ch_volume_init_verbs[] = {
3349 { } 2916 { }
3350}; 2917};
3351 2918
3352static struct hda_verb vt1708B_uniwill_init_verbs[] = { 2919static const struct hda_verb vt1708B_uniwill_init_verbs[] = {
3353 {0x1d, AC_VERB_SET_UNSOLICITED_ENABLE, 2920 {0x1d, AC_VERB_SET_UNSOLICITED_ENABLE,
3354 AC_USRSP_EN | VIA_HP_EVENT | VIA_JACK_EVENT}, 2921 AC_USRSP_EN | VIA_HP_EVENT | VIA_JACK_EVENT},
3355 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT}, 2922 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT},
@@ -3373,7 +2940,7 @@ static int via_pcm_open_close(struct hda_pcm_stream *hinfo,
3373 return 0; 2940 return 0;
3374} 2941}
3375 2942
3376static struct hda_pcm_stream vt1708B_8ch_pcm_analog_playback = { 2943static const struct hda_pcm_stream vt1708B_8ch_pcm_analog_playback = {
3377 .substreams = 2, 2944 .substreams = 2,
3378 .channels_min = 2, 2945 .channels_min = 2,
3379 .channels_max = 8, 2946 .channels_max = 8,
@@ -3386,7 +2953,7 @@ static struct hda_pcm_stream vt1708B_8ch_pcm_analog_playback = {
3386 }, 2953 },
3387}; 2954};
3388 2955
3389static struct hda_pcm_stream vt1708B_4ch_pcm_analog_playback = { 2956static const struct hda_pcm_stream vt1708B_4ch_pcm_analog_playback = {
3390 .substreams = 2, 2957 .substreams = 2,
3391 .channels_min = 2, 2958 .channels_min = 2,
3392 .channels_max = 4, 2959 .channels_max = 4,
@@ -3398,7 +2965,7 @@ static struct hda_pcm_stream vt1708B_4ch_pcm_analog_playback = {
3398 }, 2965 },
3399}; 2966};
3400 2967
3401static struct hda_pcm_stream vt1708B_pcm_analog_capture = { 2968static const struct hda_pcm_stream vt1708B_pcm_analog_capture = {
3402 .substreams = 2, 2969 .substreams = 2,
3403 .channels_min = 2, 2970 .channels_min = 2,
3404 .channels_max = 2, 2971 .channels_max = 2,
@@ -3411,7 +2978,7 @@ static struct hda_pcm_stream vt1708B_pcm_analog_capture = {
3411 }, 2978 },
3412}; 2979};
3413 2980
3414static struct hda_pcm_stream vt1708B_pcm_digital_playback = { 2981static const struct hda_pcm_stream vt1708B_pcm_digital_playback = {
3415 .substreams = 1, 2982 .substreams = 1,
3416 .channels_min = 2, 2983 .channels_min = 2,
3417 .channels_max = 2, 2984 .channels_max = 2,
@@ -3424,7 +2991,7 @@ static struct hda_pcm_stream vt1708B_pcm_digital_playback = {
3424 }, 2991 },
3425}; 2992};
3426 2993
3427static struct hda_pcm_stream vt1708B_pcm_digital_capture = { 2994static const struct hda_pcm_stream vt1708B_pcm_digital_capture = {
3428 .substreams = 1, 2995 .substreams = 1,
3429 .channels_min = 2, 2996 .channels_min = 2,
3430 .channels_max = 2, 2997 .channels_max = 2,
@@ -3447,16 +3014,16 @@ static int vt1708B_auto_fill_dac_nids(struct via_spec *spec,
3447 /* config dac list */ 3014 /* config dac list */
3448 switch (i) { 3015 switch (i) {
3449 case AUTO_SEQ_FRONT: 3016 case AUTO_SEQ_FRONT:
3450 spec->multiout.dac_nids[i] = 0x10; 3017 spec->private_dac_nids[i] = 0x10;
3451 break; 3018 break;
3452 case AUTO_SEQ_CENLFE: 3019 case AUTO_SEQ_CENLFE:
3453 spec->multiout.dac_nids[i] = 0x24; 3020 spec->private_dac_nids[i] = 0x24;
3454 break; 3021 break;
3455 case AUTO_SEQ_SURROUND: 3022 case AUTO_SEQ_SURROUND:
3456 spec->multiout.dac_nids[i] = 0x11; 3023 spec->private_dac_nids[i] = 0x11;
3457 break; 3024 break;
3458 case AUTO_SEQ_SIDE: 3025 case AUTO_SEQ_SIDE:
3459 spec->multiout.dac_nids[i] = 0x25; 3026 spec->private_dac_nids[i] = 0x25;
3460 break; 3027 break;
3461 } 3028 }
3462 } 3029 }
@@ -3588,7 +3155,7 @@ static int vt1708B_auto_create_hp_ctls(struct via_spec *spec, hda_nid_t pin)
3588static int vt1708B_auto_create_analog_input_ctls(struct hda_codec *codec, 3155static int vt1708B_auto_create_analog_input_ctls(struct hda_codec *codec,
3589 const struct auto_pin_cfg *cfg) 3156 const struct auto_pin_cfg *cfg)
3590{ 3157{
3591 static hda_nid_t pin_idxs[] = { 0xff, 0x1f, 0x1a, 0x1b, 0x1e }; 3158 static const hda_nid_t pin_idxs[] = { 0xff, 0x1f, 0x1a, 0x1b, 0x1e };
3592 return vt_auto_create_analog_input_ctls(codec, cfg, 0x16, pin_idxs, 3159 return vt_auto_create_analog_input_ctls(codec, cfg, 0x16, pin_idxs,
3593 ARRAY_SIZE(pin_idxs)); 3160 ARRAY_SIZE(pin_idxs));
3594} 3161}
@@ -3638,7 +3205,7 @@ static int vt1708B_parse_auto_config(struct hda_codec *codec)
3638} 3205}
3639 3206
3640#ifdef CONFIG_SND_HDA_POWER_SAVE 3207#ifdef CONFIG_SND_HDA_POWER_SAVE
3641static struct hda_amp_list vt1708B_loopbacks[] = { 3208static const struct hda_amp_list vt1708B_loopbacks[] = {
3642 { 0x16, HDA_INPUT, 1 }, 3209 { 0x16, HDA_INPUT, 1 },
3643 { 0x16, HDA_INPUT, 2 }, 3210 { 0x16, HDA_INPUT, 2 },
3644 { 0x16, HDA_INPUT, 3 }, 3211 { 0x16, HDA_INPUT, 3 },
@@ -3646,6 +3213,87 @@ static struct hda_amp_list vt1708B_loopbacks[] = {
3646 { } /* end */ 3213 { } /* end */
3647}; 3214};
3648#endif 3215#endif
3216
3217static void set_widgets_power_state_vt1708B(struct hda_codec *codec)
3218{
3219 struct via_spec *spec = codec->spec;
3220 int imux_is_smixer;
3221 unsigned int parm;
3222 int is_8ch = 0;
3223 if ((spec->codec_type != VT1708B_4CH) &&
3224 (codec->vendor_id != 0x11064397))
3225 is_8ch = 1;
3226
3227 /* SW0 (17h) = stereo mixer */
3228 imux_is_smixer =
3229 (snd_hda_codec_read(codec, 0x17, 0, AC_VERB_GET_CONNECT_SEL, 0x00)
3230 == ((spec->codec_type == VT1708S) ? 5 : 0));
3231 /* inputs */
3232 /* PW 1/2/5 (1ah/1bh/1eh) */
3233 parm = AC_PWRST_D3;
3234 set_pin_power_state(codec, 0x1a, &parm);
3235 set_pin_power_state(codec, 0x1b, &parm);
3236 set_pin_power_state(codec, 0x1e, &parm);
3237 if (imux_is_smixer)
3238 parm = AC_PWRST_D0;
3239 /* SW0 (17h), AIW 0/1 (13h/14h) */
3240 snd_hda_codec_write(codec, 0x17, 0, AC_VERB_SET_POWER_STATE, parm);
3241 snd_hda_codec_write(codec, 0x13, 0, AC_VERB_SET_POWER_STATE, parm);
3242 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_POWER_STATE, parm);
3243
3244 /* outputs */
3245 /* PW0 (19h), SW1 (18h), AOW1 (11h) */
3246 parm = AC_PWRST_D3;
3247 set_pin_power_state(codec, 0x19, &parm);
3248 if (spec->smart51_enabled)
3249 set_pin_power_state(codec, 0x1b, &parm);
3250 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_POWER_STATE, parm);
3251 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_POWER_STATE, parm);
3252
3253 /* PW6 (22h), SW2 (26h), AOW2 (24h) */
3254 if (is_8ch) {
3255 parm = AC_PWRST_D3;
3256 set_pin_power_state(codec, 0x22, &parm);
3257 if (spec->smart51_enabled)
3258 set_pin_power_state(codec, 0x1a, &parm);
3259 snd_hda_codec_write(codec, 0x26, 0,
3260 AC_VERB_SET_POWER_STATE, parm);
3261 snd_hda_codec_write(codec, 0x24, 0,
3262 AC_VERB_SET_POWER_STATE, parm);
3263 } else if (codec->vendor_id == 0x11064397) {
3264 /* PW7(23h), SW2(27h), AOW2(25h) */
3265 parm = AC_PWRST_D3;
3266 set_pin_power_state(codec, 0x23, &parm);
3267 if (spec->smart51_enabled)
3268 set_pin_power_state(codec, 0x1a, &parm);
3269 snd_hda_codec_write(codec, 0x27, 0,
3270 AC_VERB_SET_POWER_STATE, parm);
3271 snd_hda_codec_write(codec, 0x25, 0,
3272 AC_VERB_SET_POWER_STATE, parm);
3273 }
3274
3275 /* PW 3/4/7 (1ch/1dh/23h) */
3276 parm = AC_PWRST_D3;
3277 /* force to D0 for internal Speaker */
3278 set_pin_power_state(codec, 0x1c, &parm);
3279 set_pin_power_state(codec, 0x1d, &parm);
3280 if (is_8ch)
3281 set_pin_power_state(codec, 0x23, &parm);
3282
3283 /* MW0 (16h), Sw3 (27h), AOW 0/3 (10h/25h) */
3284 snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_POWER_STATE,
3285 imux_is_smixer ? AC_PWRST_D0 : parm);
3286 snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_POWER_STATE, parm);
3287 if (is_8ch) {
3288 snd_hda_codec_write(codec, 0x25, 0,
3289 AC_VERB_SET_POWER_STATE, parm);
3290 snd_hda_codec_write(codec, 0x27, 0,
3291 AC_VERB_SET_POWER_STATE, parm);
3292 } else if (codec->vendor_id == 0x11064397 && spec->hp_independent_mode)
3293 snd_hda_codec_write(codec, 0x25, 0,
3294 AC_VERB_SET_POWER_STATE, parm);
3295}
3296
3649static int patch_vt1708S(struct hda_codec *codec); 3297static int patch_vt1708S(struct hda_codec *codec);
3650static int patch_vt1708B_8ch(struct hda_codec *codec) 3298static int patch_vt1708B_8ch(struct hda_codec *codec)
3651{ 3299{
@@ -3696,6 +3344,8 @@ static int patch_vt1708B_8ch(struct hda_codec *codec)
3696 spec->loopback.amplist = vt1708B_loopbacks; 3344 spec->loopback.amplist = vt1708B_loopbacks;
3697#endif 3345#endif
3698 3346
3347 spec->set_widgets_power_state = set_widgets_power_state_vt1708B;
3348
3699 return 0; 3349 return 0;
3700} 3350}
3701 3351
@@ -3746,13 +3396,15 @@ static int patch_vt1708B_4ch(struct hda_codec *codec)
3746 spec->loopback.amplist = vt1708B_loopbacks; 3396 spec->loopback.amplist = vt1708B_loopbacks;
3747#endif 3397#endif
3748 3398
3399 spec->set_widgets_power_state = set_widgets_power_state_vt1708B;
3400
3749 return 0; 3401 return 0;
3750} 3402}
3751 3403
3752/* Patch for VT1708S */ 3404/* Patch for VT1708S */
3753 3405
3754/* capture mixer elements */ 3406/* capture mixer elements */
3755static struct snd_kcontrol_new vt1708S_capture_mixer[] = { 3407static const struct snd_kcontrol_new vt1708S_capture_mixer[] = {
3756 HDA_CODEC_VOLUME("Capture Volume", 0x13, 0x0, HDA_INPUT), 3408 HDA_CODEC_VOLUME("Capture Volume", 0x13, 0x0, HDA_INPUT),
3757 HDA_CODEC_MUTE("Capture Switch", 0x13, 0x0, HDA_INPUT), 3409 HDA_CODEC_MUTE("Capture Switch", 0x13, 0x0, HDA_INPUT),
3758 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x14, 0x0, HDA_INPUT), 3410 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x14, 0x0, HDA_INPUT),
@@ -3775,7 +3427,7 @@ static struct snd_kcontrol_new vt1708S_capture_mixer[] = {
3775 { } /* end */ 3427 { } /* end */
3776}; 3428};
3777 3429
3778static struct hda_verb vt1708S_volume_init_verbs[] = { 3430static const struct hda_verb vt1708S_volume_init_verbs[] = {
3779 /* Unmute ADC0-1 and set the default input to mic-in */ 3431 /* Unmute ADC0-1 and set the default input to mic-in */
3780 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 3432 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3781 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 3433 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
@@ -3801,7 +3453,7 @@ static struct hda_verb vt1708S_volume_init_verbs[] = {
3801 { } 3453 { }
3802}; 3454};
3803 3455
3804static struct hda_verb vt1708S_uniwill_init_verbs[] = { 3456static const struct hda_verb vt1708S_uniwill_init_verbs[] = {
3805 {0x1d, AC_VERB_SET_UNSOLICITED_ENABLE, 3457 {0x1d, AC_VERB_SET_UNSOLICITED_ENABLE,
3806 AC_USRSP_EN | VIA_HP_EVENT | VIA_JACK_EVENT}, 3458 AC_USRSP_EN | VIA_HP_EVENT | VIA_JACK_EVENT},
3807 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT}, 3459 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT},
@@ -3814,7 +3466,19 @@ static struct hda_verb vt1708S_uniwill_init_verbs[] = {
3814 { } 3466 { }
3815}; 3467};
3816 3468
3817static struct hda_pcm_stream vt1708S_pcm_analog_playback = { 3469static const struct hda_verb vt1705_uniwill_init_verbs[] = {
3470 {0x1d, AC_VERB_SET_UNSOLICITED_ENABLE,
3471 AC_USRSP_EN | VIA_HP_EVENT | VIA_JACK_EVENT},
3472 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT},
3473 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT},
3474 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT},
3475 {0x1c, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT},
3476 {0x1e, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT},
3477 {0x23, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT},
3478 { }
3479};
3480
3481static const struct hda_pcm_stream vt1708S_pcm_analog_playback = {
3818 .substreams = 2, 3482 .substreams = 2,
3819 .channels_min = 2, 3483 .channels_min = 2,
3820 .channels_max = 8, 3484 .channels_max = 8,
@@ -3827,7 +3491,20 @@ static struct hda_pcm_stream vt1708S_pcm_analog_playback = {
3827 }, 3491 },
3828}; 3492};
3829 3493
3830static struct hda_pcm_stream vt1708S_pcm_analog_capture = { 3494static const struct hda_pcm_stream vt1705_pcm_analog_playback = {
3495 .substreams = 2,
3496 .channels_min = 2,
3497 .channels_max = 6,
3498 .nid = 0x10, /* NID to query formats and rates */
3499 .ops = {
3500 .open = via_playback_pcm_open,
3501 .prepare = via_playback_multi_pcm_prepare,
3502 .cleanup = via_playback_multi_pcm_cleanup,
3503 .close = via_pcm_open_close
3504 },
3505};
3506
3507static const struct hda_pcm_stream vt1708S_pcm_analog_capture = {
3831 .substreams = 2, 3508 .substreams = 2,
3832 .channels_min = 2, 3509 .channels_min = 2,
3833 .channels_max = 2, 3510 .channels_max = 2,
@@ -3840,7 +3517,7 @@ static struct hda_pcm_stream vt1708S_pcm_analog_capture = {
3840 }, 3517 },
3841}; 3518};
3842 3519
3843static struct hda_pcm_stream vt1708S_pcm_digital_playback = { 3520static const struct hda_pcm_stream vt1708S_pcm_digital_playback = {
3844 .substreams = 1, 3521 .substreams = 1,
3845 .channels_min = 2, 3522 .channels_min = 2,
3846 .channels_max = 2, 3523 .channels_max = 2,
@@ -3870,16 +3547,19 @@ static int vt1708S_auto_fill_dac_nids(struct via_spec *spec,
3870 /* config dac list */ 3547 /* config dac list */
3871 switch (i) { 3548 switch (i) {
3872 case AUTO_SEQ_FRONT: 3549 case AUTO_SEQ_FRONT:
3873 spec->multiout.dac_nids[i] = 0x10; 3550 spec->private_dac_nids[i] = 0x10;
3874 break; 3551 break;
3875 case AUTO_SEQ_CENLFE: 3552 case AUTO_SEQ_CENLFE:
3876 spec->multiout.dac_nids[i] = 0x24; 3553 if (spec->codec->vendor_id == 0x11064397)
3554 spec->private_dac_nids[i] = 0x25;
3555 else
3556 spec->private_dac_nids[i] = 0x24;
3877 break; 3557 break;
3878 case AUTO_SEQ_SURROUND: 3558 case AUTO_SEQ_SURROUND:
3879 spec->multiout.dac_nids[i] = 0x11; 3559 spec->private_dac_nids[i] = 0x11;
3880 break; 3560 break;
3881 case AUTO_SEQ_SIDE: 3561 case AUTO_SEQ_SIDE:
3882 spec->multiout.dac_nids[i] = 0x25; 3562 spec->private_dac_nids[i] = 0x25;
3883 break; 3563 break;
3884 } 3564 }
3885 } 3565 }
@@ -3888,23 +3568,29 @@ static int vt1708S_auto_fill_dac_nids(struct via_spec *spec,
3888 /* for Smart 5.1, line/mic inputs double as output pins */ 3568 /* for Smart 5.1, line/mic inputs double as output pins */
3889 if (cfg->line_outs == 1) { 3569 if (cfg->line_outs == 1) {
3890 spec->multiout.num_dacs = 3; 3570 spec->multiout.num_dacs = 3;
3891 spec->multiout.dac_nids[AUTO_SEQ_SURROUND] = 0x11; 3571 spec->private_dac_nids[AUTO_SEQ_SURROUND] = 0x11;
3892 spec->multiout.dac_nids[AUTO_SEQ_CENLFE] = 0x24; 3572 if (spec->codec->vendor_id == 0x11064397)
3573 spec->private_dac_nids[AUTO_SEQ_CENLFE] = 0x25;
3574 else
3575 spec->private_dac_nids[AUTO_SEQ_CENLFE] = 0x24;
3893 } 3576 }
3894 3577
3895 return 0; 3578 return 0;
3896} 3579}
3897 3580
3898/* add playback controls from the parsed DAC table */ 3581/* add playback controls from the parsed DAC table */
3899static int vt1708S_auto_create_multi_out_ctls(struct via_spec *spec, 3582static int vt1708S_auto_create_multi_out_ctls(struct hda_codec *codec,
3900 const struct auto_pin_cfg *cfg) 3583 const struct auto_pin_cfg *cfg)
3901{ 3584{
3585 struct via_spec *spec = codec->spec;
3902 char name[32]; 3586 char name[32];
3903 static const char * const chname[4] = { 3587 static const char * const chname[4] = {
3904 "Front", "Surround", "C/LFE", "Side" 3588 "Front", "Surround", "C/LFE", "Side"
3905 }; 3589 };
3906 hda_nid_t nid_vols[] = {0x10, 0x11, 0x24, 0x25}; 3590 hda_nid_t nid_vols[2][4] = { {0x10, 0x11, 0x24, 0x25},
3907 hda_nid_t nid_mutes[] = {0x1C, 0x18, 0x26, 0x27}; 3591 {0x10, 0x11, 0x25, 0} };
3592 hda_nid_t nid_mutes[2][4] = { {0x1C, 0x18, 0x26, 0x27},
3593 {0x1C, 0x18, 0x27, 0} };
3908 hda_nid_t nid, nid_vol, nid_mute; 3594 hda_nid_t nid, nid_vol, nid_mute;
3909 int i, err; 3595 int i, err;
3910 3596
@@ -3915,8 +3601,15 @@ static int vt1708S_auto_create_multi_out_ctls(struct via_spec *spec,
3915 if (!nid && i > AUTO_SEQ_CENLFE) 3601 if (!nid && i > AUTO_SEQ_CENLFE)
3916 continue; 3602 continue;
3917 3603
3918 nid_vol = nid_vols[i]; 3604 if (codec->vendor_id == 0x11064397) {
3919 nid_mute = nid_mutes[i]; 3605 nid_vol = nid_vols[1][i];
3606 nid_mute = nid_mutes[1][i];
3607 } else {
3608 nid_vol = nid_vols[0][i];
3609 nid_mute = nid_mutes[0][i];
3610 }
3611 if (!nid_vol && !nid_mute)
3612 continue;
3920 3613
3921 if (i == AUTO_SEQ_CENLFE) { 3614 if (i == AUTO_SEQ_CENLFE) {
3922 /* Center/LFE */ 3615 /* Center/LFE */
@@ -4026,7 +3719,7 @@ static int vt1708S_auto_create_hp_ctls(struct via_spec *spec, hda_nid_t pin)
4026static int vt1708S_auto_create_analog_input_ctls(struct hda_codec *codec, 3719static int vt1708S_auto_create_analog_input_ctls(struct hda_codec *codec,
4027 const struct auto_pin_cfg *cfg) 3720 const struct auto_pin_cfg *cfg)
4028{ 3721{
4029 static hda_nid_t pin_idxs[] = { 0x1f, 0x1a, 0x1b, 0x1e, 0, 0xff }; 3722 static const hda_nid_t pin_idxs[] = { 0x1f, 0x1a, 0x1b, 0x1e, 0, 0xff };
4030 return vt_auto_create_analog_input_ctls(codec, cfg, 0x16, pin_idxs, 3723 return vt_auto_create_analog_input_ctls(codec, cfg, 0x16, pin_idxs,
4031 ARRAY_SIZE(pin_idxs)); 3724 ARRAY_SIZE(pin_idxs));
4032} 3725}
@@ -4070,7 +3763,7 @@ static int vt1708S_parse_auto_config(struct hda_codec *codec)
4070 if (!spec->autocfg.line_outs && !spec->autocfg.hp_pins[0]) 3763 if (!spec->autocfg.line_outs && !spec->autocfg.hp_pins[0])
4071 return 0; /* can't find valid BIOS pin config */ 3764 return 0; /* can't find valid BIOS pin config */
4072 3765
4073 err = vt1708S_auto_create_multi_out_ctls(spec, &spec->autocfg); 3766 err = vt1708S_auto_create_multi_out_ctls(codec, &spec->autocfg);
4074 if (err < 0) 3767 if (err < 0)
4075 return err; 3768 return err;
4076 err = vt1708S_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); 3769 err = vt1708S_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
@@ -4097,7 +3790,7 @@ static int vt1708S_parse_auto_config(struct hda_codec *codec)
4097} 3790}
4098 3791
4099#ifdef CONFIG_SND_HDA_POWER_SAVE 3792#ifdef CONFIG_SND_HDA_POWER_SAVE
4100static struct hda_amp_list vt1708S_loopbacks[] = { 3793static const struct hda_amp_list vt1708S_loopbacks[] = {
4101 { 0x16, HDA_INPUT, 1 }, 3794 { 0x16, HDA_INPUT, 1 },
4102 { 0x16, HDA_INPUT, 2 }, 3795 { 0x16, HDA_INPUT, 2 },
4103 { 0x16, HDA_INPUT, 3 }, 3796 { 0x16, HDA_INPUT, 3 },
@@ -4137,17 +3830,29 @@ static int patch_vt1708S(struct hda_codec *codec)
4137 } 3830 }
4138 3831
4139 spec->init_verbs[spec->num_iverbs++] = vt1708S_volume_init_verbs; 3832 spec->init_verbs[spec->num_iverbs++] = vt1708S_volume_init_verbs;
4140 spec->init_verbs[spec->num_iverbs++] = vt1708S_uniwill_init_verbs; 3833 if (codec->vendor_id == 0x11064397)
3834 spec->init_verbs[spec->num_iverbs++] =
3835 vt1705_uniwill_init_verbs;
3836 else
3837 spec->init_verbs[spec->num_iverbs++] =
3838 vt1708S_uniwill_init_verbs;
4141 3839
4142 if (codec->vendor_id == 0x11060440) 3840 if (codec->vendor_id == 0x11060440)
4143 spec->stream_name_analog = "VT1818S Analog"; 3841 spec->stream_name_analog = "VT1818S Analog";
3842 else if (codec->vendor_id == 0x11064397)
3843 spec->stream_name_analog = "VT1705 Analog";
4144 else 3844 else
4145 spec->stream_name_analog = "VT1708S Analog"; 3845 spec->stream_name_analog = "VT1708S Analog";
4146 spec->stream_analog_playback = &vt1708S_pcm_analog_playback; 3846 if (codec->vendor_id == 0x11064397)
3847 spec->stream_analog_playback = &vt1705_pcm_analog_playback;
3848 else
3849 spec->stream_analog_playback = &vt1708S_pcm_analog_playback;
4147 spec->stream_analog_capture = &vt1708S_pcm_analog_capture; 3850 spec->stream_analog_capture = &vt1708S_pcm_analog_capture;
4148 3851
4149 if (codec->vendor_id == 0x11060440) 3852 if (codec->vendor_id == 0x11060440)
4150 spec->stream_name_digital = "VT1818S Digital"; 3853 spec->stream_name_digital = "VT1818S Digital";
3854 else if (codec->vendor_id == 0x11064397)
3855 spec->stream_name_digital = "VT1705 Digital";
4151 else 3856 else
4152 spec->stream_name_digital = "VT1708S Digital"; 3857 spec->stream_name_digital = "VT1708S Digital";
4153 spec->stream_digital_playback = &vt1708S_pcm_digital_playback; 3858 spec->stream_digital_playback = &vt1708S_pcm_digital_playback;
@@ -4185,13 +3890,22 @@ static int patch_vt1708S(struct hda_codec *codec)
4185 spec->stream_name_analog = "VT1818S Analog"; 3890 spec->stream_name_analog = "VT1818S Analog";
4186 spec->stream_name_digital = "VT1818S Digital"; 3891 spec->stream_name_digital = "VT1818S Digital";
4187 } 3892 }
3893 /* correct names for VT1705 */
3894 if (codec->vendor_id == 0x11064397) {
3895 kfree(codec->chip_name);
3896 codec->chip_name = kstrdup("VT1705", GFP_KERNEL);
3897 snprintf(codec->bus->card->mixername,
3898 sizeof(codec->bus->card->mixername),
3899 "%s %s", codec->vendor_name, codec->chip_name);
3900 }
3901 spec->set_widgets_power_state = set_widgets_power_state_vt1708B;
4188 return 0; 3902 return 0;
4189} 3903}
4190 3904
4191/* Patch for VT1702 */ 3905/* Patch for VT1702 */
4192 3906
4193/* capture mixer elements */ 3907/* capture mixer elements */
4194static struct snd_kcontrol_new vt1702_capture_mixer[] = { 3908static const struct snd_kcontrol_new vt1702_capture_mixer[] = {
4195 HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_INPUT), 3909 HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_INPUT),
4196 HDA_CODEC_MUTE("Capture Switch", 0x12, 0x0, HDA_INPUT), 3910 HDA_CODEC_MUTE("Capture Switch", 0x12, 0x0, HDA_INPUT),
4197 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x20, 0x0, HDA_INPUT), 3911 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x20, 0x0, HDA_INPUT),
@@ -4215,7 +3929,7 @@ static struct snd_kcontrol_new vt1702_capture_mixer[] = {
4215 { } /* end */ 3929 { } /* end */
4216}; 3930};
4217 3931
4218static struct hda_verb vt1702_volume_init_verbs[] = { 3932static const struct hda_verb vt1702_volume_init_verbs[] = {
4219 /* 3933 /*
4220 * Unmute ADC0-1 and set the default input to mic-in 3934 * Unmute ADC0-1 and set the default input to mic-in
4221 */ 3935 */
@@ -4246,7 +3960,7 @@ static struct hda_verb vt1702_volume_init_verbs[] = {
4246 { } 3960 { }
4247}; 3961};
4248 3962
4249static struct hda_verb vt1702_uniwill_init_verbs[] = { 3963static const struct hda_verb vt1702_uniwill_init_verbs[] = {
4250 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, 3964 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE,
4251 AC_USRSP_EN | VIA_HP_EVENT | VIA_JACK_EVENT}, 3965 AC_USRSP_EN | VIA_HP_EVENT | VIA_JACK_EVENT},
4252 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT}, 3966 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT},
@@ -4256,7 +3970,7 @@ static struct hda_verb vt1702_uniwill_init_verbs[] = {
4256 { } 3970 { }
4257}; 3971};
4258 3972
4259static struct hda_pcm_stream vt1702_pcm_analog_playback = { 3973static const struct hda_pcm_stream vt1702_pcm_analog_playback = {
4260 .substreams = 2, 3974 .substreams = 2,
4261 .channels_min = 2, 3975 .channels_min = 2,
4262 .channels_max = 2, 3976 .channels_max = 2,
@@ -4269,7 +3983,7 @@ static struct hda_pcm_stream vt1702_pcm_analog_playback = {
4269 }, 3983 },
4270}; 3984};
4271 3985
4272static struct hda_pcm_stream vt1702_pcm_analog_capture = { 3986static const struct hda_pcm_stream vt1702_pcm_analog_capture = {
4273 .substreams = 3, 3987 .substreams = 3,
4274 .channels_min = 2, 3988 .channels_min = 2,
4275 .channels_max = 2, 3989 .channels_max = 2,
@@ -4282,7 +3996,7 @@ static struct hda_pcm_stream vt1702_pcm_analog_capture = {
4282 }, 3996 },
4283}; 3997};
4284 3998
4285static struct hda_pcm_stream vt1702_pcm_digital_playback = { 3999static const struct hda_pcm_stream vt1702_pcm_digital_playback = {
4286 .substreams = 2, 4000 .substreams = 2,
4287 .channels_min = 2, 4001 .channels_min = 2,
4288 .channels_max = 2, 4002 .channels_max = 2,
@@ -4304,7 +4018,7 @@ static int vt1702_auto_fill_dac_nids(struct via_spec *spec,
4304 4018
4305 if (cfg->line_out_pins[0]) { 4019 if (cfg->line_out_pins[0]) {
4306 /* config dac list */ 4020 /* config dac list */
4307 spec->multiout.dac_nids[0] = 0x10; 4021 spec->private_dac_nids[0] = 0x10;
4308 } 4022 }
4309 4023
4310 return 0; 4024 return 0;
@@ -4382,7 +4096,7 @@ static int vt1702_auto_create_hp_ctls(struct via_spec *spec, hda_nid_t pin)
4382static int vt1702_auto_create_analog_input_ctls(struct hda_codec *codec, 4096static int vt1702_auto_create_analog_input_ctls(struct hda_codec *codec,
4383 const struct auto_pin_cfg *cfg) 4097 const struct auto_pin_cfg *cfg)
4384{ 4098{
4385 static hda_nid_t pin_idxs[] = { 0x14, 0x15, 0x18, 0xff }; 4099 static const hda_nid_t pin_idxs[] = { 0x14, 0x15, 0x18, 0xff };
4386 return vt_auto_create_analog_input_ctls(codec, cfg, 0x1a, pin_idxs, 4100 return vt_auto_create_analog_input_ctls(codec, cfg, 0x1a, pin_idxs,
4387 ARRAY_SIZE(pin_idxs)); 4101 ARRAY_SIZE(pin_idxs));
4388} 4102}
@@ -4433,7 +4147,7 @@ static int vt1702_parse_auto_config(struct hda_codec *codec)
4433} 4147}
4434 4148
4435#ifdef CONFIG_SND_HDA_POWER_SAVE 4149#ifdef CONFIG_SND_HDA_POWER_SAVE
4436static struct hda_amp_list vt1702_loopbacks[] = { 4150static const struct hda_amp_list vt1702_loopbacks[] = {
4437 { 0x1A, HDA_INPUT, 1 }, 4151 { 0x1A, HDA_INPUT, 1 },
4438 { 0x1A, HDA_INPUT, 2 }, 4152 { 0x1A, HDA_INPUT, 2 },
4439 { 0x1A, HDA_INPUT, 3 }, 4153 { 0x1A, HDA_INPUT, 3 },
@@ -4442,6 +4156,37 @@ static struct hda_amp_list vt1702_loopbacks[] = {
4442}; 4156};
4443#endif 4157#endif
4444 4158
4159static void set_widgets_power_state_vt1702(struct hda_codec *codec)
4160{
4161 int imux_is_smixer =
4162 snd_hda_codec_read(codec, 0x13, 0, AC_VERB_GET_CONNECT_SEL, 0x00) == 3;
4163 unsigned int parm;
4164 /* inputs */
4165 /* PW 1/2/5 (14h/15h/18h) */
4166 parm = AC_PWRST_D3;
4167 set_pin_power_state(codec, 0x14, &parm);
4168 set_pin_power_state(codec, 0x15, &parm);
4169 set_pin_power_state(codec, 0x18, &parm);
4170 if (imux_is_smixer)
4171 parm = AC_PWRST_D0; /* SW0 (13h) = stereo mixer (idx 3) */
4172 /* SW0 (13h), AIW 0/1/2 (12h/1fh/20h) */
4173 snd_hda_codec_write(codec, 0x13, 0, AC_VERB_SET_POWER_STATE, parm);
4174 snd_hda_codec_write(codec, 0x12, 0, AC_VERB_SET_POWER_STATE, parm);
4175 snd_hda_codec_write(codec, 0x1f, 0, AC_VERB_SET_POWER_STATE, parm);
4176 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_POWER_STATE, parm);
4177
4178 /* outputs */
4179 /* PW 3/4 (16h/17h) */
4180 parm = AC_PWRST_D3;
4181 set_pin_power_state(codec, 0x17, &parm);
4182 set_pin_power_state(codec, 0x16, &parm);
4183 /* MW0 (1ah), AOW 0/1 (10h/1dh) */
4184 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_POWER_STATE,
4185 imux_is_smixer ? AC_PWRST_D0 : parm);
4186 snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_POWER_STATE, parm);
4187 snd_hda_codec_write(codec, 0x1d, 0, AC_VERB_SET_POWER_STATE, parm);
4188}
4189
4445static int patch_vt1702(struct hda_codec *codec) 4190static int patch_vt1702(struct hda_codec *codec)
4446{ 4191{
4447 struct via_spec *spec; 4192 struct via_spec *spec;
@@ -4488,13 +4233,14 @@ static int patch_vt1702(struct hda_codec *codec)
4488 spec->loopback.amplist = vt1702_loopbacks; 4233 spec->loopback.amplist = vt1702_loopbacks;
4489#endif 4234#endif
4490 4235
4236 spec->set_widgets_power_state = set_widgets_power_state_vt1702;
4491 return 0; 4237 return 0;
4492} 4238}
4493 4239
4494/* Patch for VT1718S */ 4240/* Patch for VT1718S */
4495 4241
4496/* capture mixer elements */ 4242/* capture mixer elements */
4497static struct snd_kcontrol_new vt1718S_capture_mixer[] = { 4243static const struct snd_kcontrol_new vt1718S_capture_mixer[] = {
4498 HDA_CODEC_VOLUME("Capture Volume", 0x10, 0x0, HDA_INPUT), 4244 HDA_CODEC_VOLUME("Capture Volume", 0x10, 0x0, HDA_INPUT),
4499 HDA_CODEC_MUTE("Capture Switch", 0x10, 0x0, HDA_INPUT), 4245 HDA_CODEC_MUTE("Capture Switch", 0x10, 0x0, HDA_INPUT),
4500 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x11, 0x0, HDA_INPUT), 4246 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x11, 0x0, HDA_INPUT),
@@ -4516,14 +4262,15 @@ static struct snd_kcontrol_new vt1718S_capture_mixer[] = {
4516 { } /* end */ 4262 { } /* end */
4517}; 4263};
4518 4264
4519static struct hda_verb vt1718S_volume_init_verbs[] = { 4265static const struct hda_verb vt1718S_volume_init_verbs[] = {
4520 /* 4266 /*
4521 * Unmute ADC0-1 and set the default input to mic-in 4267 * Unmute ADC0-1 and set the default input to mic-in
4522 */ 4268 */
4523 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 4269 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4524 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 4270 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4525 4271
4526 4272 /* Enable MW0 adjust Gain 5 */
4273 {0x1, 0xfb2, 0x10},
4527 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback 4274 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
4528 * mixer widget 4275 * mixer widget
4529 */ 4276 */
@@ -4532,7 +4279,7 @@ static struct hda_verb vt1718S_volume_init_verbs[] = {
4532 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 4279 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4533 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, 4280 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4534 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, 4281 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4535 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, 4282 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
4536 4283
4537 /* Setup default input of Front HP to MW9 */ 4284 /* Setup default input of Front HP to MW9 */
4538 {0x28, AC_VERB_SET_CONNECT_SEL, 0x1}, 4285 {0x28, AC_VERB_SET_CONNECT_SEL, 0x1},
@@ -4563,7 +4310,7 @@ static struct hda_verb vt1718S_volume_init_verbs[] = {
4563}; 4310};
4564 4311
4565 4312
4566static struct hda_verb vt1718S_uniwill_init_verbs[] = { 4313static const struct hda_verb vt1718S_uniwill_init_verbs[] = {
4567 {0x28, AC_VERB_SET_UNSOLICITED_ENABLE, 4314 {0x28, AC_VERB_SET_UNSOLICITED_ENABLE,
4568 AC_USRSP_EN | VIA_HP_EVENT | VIA_JACK_EVENT}, 4315 AC_USRSP_EN | VIA_HP_EVENT | VIA_JACK_EVENT},
4569 {0x24, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT}, 4316 {0x24, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT},
@@ -4576,7 +4323,7 @@ static struct hda_verb vt1718S_uniwill_init_verbs[] = {
4576 { } 4323 { }
4577}; 4324};
4578 4325
4579static struct hda_pcm_stream vt1718S_pcm_analog_playback = { 4326static const struct hda_pcm_stream vt1718S_pcm_analog_playback = {
4580 .substreams = 2, 4327 .substreams = 2,
4581 .channels_min = 2, 4328 .channels_min = 2,
4582 .channels_max = 10, 4329 .channels_max = 10,
@@ -4589,7 +4336,7 @@ static struct hda_pcm_stream vt1718S_pcm_analog_playback = {
4589 }, 4336 },
4590}; 4337};
4591 4338
4592static struct hda_pcm_stream vt1718S_pcm_analog_capture = { 4339static const struct hda_pcm_stream vt1718S_pcm_analog_capture = {
4593 .substreams = 2, 4340 .substreams = 2,
4594 .channels_min = 2, 4341 .channels_min = 2,
4595 .channels_max = 2, 4342 .channels_max = 2,
@@ -4602,7 +4349,7 @@ static struct hda_pcm_stream vt1718S_pcm_analog_capture = {
4602 }, 4349 },
4603}; 4350};
4604 4351
4605static struct hda_pcm_stream vt1718S_pcm_digital_playback = { 4352static const struct hda_pcm_stream vt1718S_pcm_digital_playback = {
4606 .substreams = 2, 4353 .substreams = 2,
4607 .channels_min = 2, 4354 .channels_min = 2,
4608 .channels_max = 2, 4355 .channels_max = 2,
@@ -4615,7 +4362,7 @@ static struct hda_pcm_stream vt1718S_pcm_digital_playback = {
4615 }, 4362 },
4616}; 4363};
4617 4364
4618static struct hda_pcm_stream vt1718S_pcm_digital_capture = { 4365static const struct hda_pcm_stream vt1718S_pcm_digital_capture = {
4619 .substreams = 1, 4366 .substreams = 1,
4620 .channels_min = 2, 4367 .channels_min = 2,
4621 .channels_max = 2, 4368 .channels_max = 2,
@@ -4638,16 +4385,16 @@ static int vt1718S_auto_fill_dac_nids(struct via_spec *spec,
4638 /* config dac list */ 4385 /* config dac list */
4639 switch (i) { 4386 switch (i) {
4640 case AUTO_SEQ_FRONT: 4387 case AUTO_SEQ_FRONT:
4641 spec->multiout.dac_nids[i] = 0x8; 4388 spec->private_dac_nids[i] = 0x8;
4642 break; 4389 break;
4643 case AUTO_SEQ_CENLFE: 4390 case AUTO_SEQ_CENLFE:
4644 spec->multiout.dac_nids[i] = 0xa; 4391 spec->private_dac_nids[i] = 0xa;
4645 break; 4392 break;
4646 case AUTO_SEQ_SURROUND: 4393 case AUTO_SEQ_SURROUND:
4647 spec->multiout.dac_nids[i] = 0x9; 4394 spec->private_dac_nids[i] = 0x9;
4648 break; 4395 break;
4649 case AUTO_SEQ_SIDE: 4396 case AUTO_SEQ_SIDE:
4650 spec->multiout.dac_nids[i] = 0xb; 4397 spec->private_dac_nids[i] = 0xb;
4651 break; 4398 break;
4652 } 4399 }
4653 } 4400 }
@@ -4769,7 +4516,7 @@ static int vt1718S_auto_create_hp_ctls(struct via_spec *spec, hda_nid_t pin)
4769static int vt1718S_auto_create_analog_input_ctls(struct hda_codec *codec, 4516static int vt1718S_auto_create_analog_input_ctls(struct hda_codec *codec,
4770 const struct auto_pin_cfg *cfg) 4517 const struct auto_pin_cfg *cfg)
4771{ 4518{
4772 static hda_nid_t pin_idxs[] = { 0x2c, 0x2b, 0x2a, 0x29, 0, 0xff }; 4519 static const hda_nid_t pin_idxs[] = { 0x2c, 0x2b, 0x2a, 0x29, 0, 0xff };
4773 return vt_auto_create_analog_input_ctls(codec, cfg, 0x21, pin_idxs, 4520 return vt_auto_create_analog_input_ctls(codec, cfg, 0x21, pin_idxs,
4774 ARRAY_SIZE(pin_idxs)); 4521 ARRAY_SIZE(pin_idxs));
4775} 4522}
@@ -4820,7 +4567,7 @@ static int vt1718S_parse_auto_config(struct hda_codec *codec)
4820} 4567}
4821 4568
4822#ifdef CONFIG_SND_HDA_POWER_SAVE 4569#ifdef CONFIG_SND_HDA_POWER_SAVE
4823static struct hda_amp_list vt1718S_loopbacks[] = { 4570static const struct hda_amp_list vt1718S_loopbacks[] = {
4824 { 0x21, HDA_INPUT, 1 }, 4571 { 0x21, HDA_INPUT, 1 },
4825 { 0x21, HDA_INPUT, 2 }, 4572 { 0x21, HDA_INPUT, 2 },
4826 { 0x21, HDA_INPUT, 3 }, 4573 { 0x21, HDA_INPUT, 3 },
@@ -4829,6 +4576,72 @@ static struct hda_amp_list vt1718S_loopbacks[] = {
4829}; 4576};
4830#endif 4577#endif
4831 4578
4579static void set_widgets_power_state_vt1718S(struct hda_codec *codec)
4580{
4581 struct via_spec *spec = codec->spec;
4582 int imux_is_smixer;
4583 unsigned int parm;
4584 /* MUX6 (1eh) = stereo mixer */
4585 imux_is_smixer =
4586 snd_hda_codec_read(codec, 0x1e, 0, AC_VERB_GET_CONNECT_SEL, 0x00) == 5;
4587 /* inputs */
4588 /* PW 5/6/7 (29h/2ah/2bh) */
4589 parm = AC_PWRST_D3;
4590 set_pin_power_state(codec, 0x29, &parm);
4591 set_pin_power_state(codec, 0x2a, &parm);
4592 set_pin_power_state(codec, 0x2b, &parm);
4593 if (imux_is_smixer)
4594 parm = AC_PWRST_D0;
4595 /* MUX6/7 (1eh/1fh), AIW 0/1 (10h/11h) */
4596 snd_hda_codec_write(codec, 0x1e, 0, AC_VERB_SET_POWER_STATE, parm);
4597 snd_hda_codec_write(codec, 0x1f, 0, AC_VERB_SET_POWER_STATE, parm);
4598 snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_POWER_STATE, parm);
4599 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_POWER_STATE, parm);
4600
4601 /* outputs */
4602 /* PW3 (27h), MW2 (1ah), AOW3 (bh) */
4603 parm = AC_PWRST_D3;
4604 set_pin_power_state(codec, 0x27, &parm);
4605 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_POWER_STATE, parm);
4606 snd_hda_codec_write(codec, 0xb, 0, AC_VERB_SET_POWER_STATE, parm);
4607
4608 /* PW2 (26h), AOW2 (ah) */
4609 parm = AC_PWRST_D3;
4610 set_pin_power_state(codec, 0x26, &parm);
4611 if (spec->smart51_enabled)
4612 set_pin_power_state(codec, 0x2b, &parm);
4613 snd_hda_codec_write(codec, 0xa, 0, AC_VERB_SET_POWER_STATE, parm);
4614
4615 /* PW0 (24h), AOW0 (8h) */
4616 parm = AC_PWRST_D3;
4617 set_pin_power_state(codec, 0x24, &parm);
4618 if (!spec->hp_independent_mode) /* check for redirected HP */
4619 set_pin_power_state(codec, 0x28, &parm);
4620 snd_hda_codec_write(codec, 0x8, 0, AC_VERB_SET_POWER_STATE, parm);
4621 /* MW9 (21h), Mw2 (1ah), AOW0 (8h) */
4622 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_SET_POWER_STATE,
4623 imux_is_smixer ? AC_PWRST_D0 : parm);
4624
4625 /* PW1 (25h), AOW1 (9h) */
4626 parm = AC_PWRST_D3;
4627 set_pin_power_state(codec, 0x25, &parm);
4628 if (spec->smart51_enabled)
4629 set_pin_power_state(codec, 0x2a, &parm);
4630 snd_hda_codec_write(codec, 0x9, 0, AC_VERB_SET_POWER_STATE, parm);
4631
4632 if (spec->hp_independent_mode) {
4633 /* PW4 (28h), MW3 (1bh), MUX1(34h), AOW4 (ch) */
4634 parm = AC_PWRST_D3;
4635 set_pin_power_state(codec, 0x28, &parm);
4636 snd_hda_codec_write(codec, 0x1b, 0,
4637 AC_VERB_SET_POWER_STATE, parm);
4638 snd_hda_codec_write(codec, 0x34, 0,
4639 AC_VERB_SET_POWER_STATE, parm);
4640 snd_hda_codec_write(codec, 0xc, 0,
4641 AC_VERB_SET_POWER_STATE, parm);
4642 }
4643}
4644
4832static int patch_vt1718S(struct hda_codec *codec) 4645static int patch_vt1718S(struct hda_codec *codec)
4833{ 4646{
4834 struct via_spec *spec; 4647 struct via_spec *spec;
@@ -4890,6 +4703,8 @@ static int patch_vt1718S(struct hda_codec *codec)
4890 spec->loopback.amplist = vt1718S_loopbacks; 4703 spec->loopback.amplist = vt1718S_loopbacks;
4891#endif 4704#endif
4892 4705
4706 spec->set_widgets_power_state = set_widgets_power_state_vt1718S;
4707
4893 return 0; 4708 return 0;
4894} 4709}
4895 4710
@@ -4929,13 +4744,12 @@ static int vt1716s_dmic_put(struct snd_kcontrol *kcontrol,
4929 snd_hda_codec_write(codec, 0x26, 0, 4744 snd_hda_codec_write(codec, 0x26, 0,
4930 AC_VERB_SET_CONNECT_SEL, index); 4745 AC_VERB_SET_CONNECT_SEL, index);
4931 spec->dmic_enabled = index; 4746 spec->dmic_enabled = index;
4932 set_jack_power_state(codec); 4747 set_widgets_power_state(codec);
4933
4934 return 1; 4748 return 1;
4935} 4749}
4936 4750
4937/* capture mixer elements */ 4751/* capture mixer elements */
4938static struct snd_kcontrol_new vt1716S_capture_mixer[] = { 4752static const struct snd_kcontrol_new vt1716S_capture_mixer[] = {
4939 HDA_CODEC_VOLUME("Capture Volume", 0x13, 0x0, HDA_INPUT), 4753 HDA_CODEC_VOLUME("Capture Volume", 0x13, 0x0, HDA_INPUT),
4940 HDA_CODEC_MUTE("Capture Switch", 0x13, 0x0, HDA_INPUT), 4754 HDA_CODEC_MUTE("Capture Switch", 0x13, 0x0, HDA_INPUT),
4941 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x14, 0x0, HDA_INPUT), 4755 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x14, 0x0, HDA_INPUT),
@@ -4954,7 +4768,7 @@ static struct snd_kcontrol_new vt1716S_capture_mixer[] = {
4954 { } /* end */ 4768 { } /* end */
4955}; 4769};
4956 4770
4957static struct snd_kcontrol_new vt1716s_dmic_mixer[] = { 4771static const struct snd_kcontrol_new vt1716s_dmic_mixer[] = {
4958 HDA_CODEC_VOLUME("Digital Mic Capture Volume", 0x22, 0x0, HDA_INPUT), 4772 HDA_CODEC_VOLUME("Digital Mic Capture Volume", 0x22, 0x0, HDA_INPUT),
4959 { 4773 {
4960 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 4774 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -4970,12 +4784,12 @@ static struct snd_kcontrol_new vt1716s_dmic_mixer[] = {
4970 4784
4971 4785
4972/* mono-out mixer elements */ 4786/* mono-out mixer elements */
4973static struct snd_kcontrol_new vt1716S_mono_out_mixer[] = { 4787static const struct snd_kcontrol_new vt1716S_mono_out_mixer[] = {
4974 HDA_CODEC_MUTE("Mono Playback Switch", 0x2a, 0x0, HDA_OUTPUT), 4788 HDA_CODEC_MUTE("Mono Playback Switch", 0x2a, 0x0, HDA_OUTPUT),
4975 { } /* end */ 4789 { } /* end */
4976}; 4790};
4977 4791
4978static struct hda_verb vt1716S_volume_init_verbs[] = { 4792static const struct hda_verb vt1716S_volume_init_verbs[] = {
4979 /* 4793 /*
4980 * Unmute ADC0-1 and set the default input to mic-in 4794 * Unmute ADC0-1 and set the default input to mic-in
4981 */ 4795 */
@@ -5024,7 +4838,7 @@ static struct hda_verb vt1716S_volume_init_verbs[] = {
5024}; 4838};
5025 4839
5026 4840
5027static struct hda_verb vt1716S_uniwill_init_verbs[] = { 4841static const struct hda_verb vt1716S_uniwill_init_verbs[] = {
5028 {0x1d, AC_VERB_SET_UNSOLICITED_ENABLE, 4842 {0x1d, AC_VERB_SET_UNSOLICITED_ENABLE,
5029 AC_USRSP_EN | VIA_HP_EVENT | VIA_JACK_EVENT}, 4843 AC_USRSP_EN | VIA_HP_EVENT | VIA_JACK_EVENT},
5030 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT}, 4844 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT},
@@ -5037,7 +4851,7 @@ static struct hda_verb vt1716S_uniwill_init_verbs[] = {
5037 { } 4851 { }
5038}; 4852};
5039 4853
5040static struct hda_pcm_stream vt1716S_pcm_analog_playback = { 4854static const struct hda_pcm_stream vt1716S_pcm_analog_playback = {
5041 .substreams = 2, 4855 .substreams = 2,
5042 .channels_min = 2, 4856 .channels_min = 2,
5043 .channels_max = 6, 4857 .channels_max = 6,
@@ -5050,7 +4864,7 @@ static struct hda_pcm_stream vt1716S_pcm_analog_playback = {
5050 }, 4864 },
5051}; 4865};
5052 4866
5053static struct hda_pcm_stream vt1716S_pcm_analog_capture = { 4867static const struct hda_pcm_stream vt1716S_pcm_analog_capture = {
5054 .substreams = 2, 4868 .substreams = 2,
5055 .channels_min = 2, 4869 .channels_min = 2,
5056 .channels_max = 2, 4870 .channels_max = 2,
@@ -5063,7 +4877,7 @@ static struct hda_pcm_stream vt1716S_pcm_analog_capture = {
5063 }, 4877 },
5064}; 4878};
5065 4879
5066static struct hda_pcm_stream vt1716S_pcm_digital_playback = { 4880static const struct hda_pcm_stream vt1716S_pcm_digital_playback = {
5067 .substreams = 2, 4881 .substreams = 2,
5068 .channels_min = 2, 4882 .channels_min = 2,
5069 .channels_max = 2, 4883 .channels_max = 2,
@@ -5092,13 +4906,13 @@ static int vt1716S_auto_fill_dac_nids(struct via_spec *spec,
5092 /* config dac list */ 4906 /* config dac list */
5093 switch (i) { 4907 switch (i) {
5094 case AUTO_SEQ_FRONT: 4908 case AUTO_SEQ_FRONT:
5095 spec->multiout.dac_nids[i] = 0x10; 4909 spec->private_dac_nids[i] = 0x10;
5096 break; 4910 break;
5097 case AUTO_SEQ_CENLFE: 4911 case AUTO_SEQ_CENLFE:
5098 spec->multiout.dac_nids[i] = 0x25; 4912 spec->private_dac_nids[i] = 0x25;
5099 break; 4913 break;
5100 case AUTO_SEQ_SURROUND: 4914 case AUTO_SEQ_SURROUND:
5101 spec->multiout.dac_nids[i] = 0x11; 4915 spec->private_dac_nids[i] = 0x11;
5102 break; 4916 break;
5103 } 4917 }
5104 } 4918 }
@@ -5233,7 +5047,7 @@ static int vt1716S_auto_create_hp_ctls(struct via_spec *spec, hda_nid_t pin)
5233static int vt1716S_auto_create_analog_input_ctls(struct hda_codec *codec, 5047static int vt1716S_auto_create_analog_input_ctls(struct hda_codec *codec,
5234 const struct auto_pin_cfg *cfg) 5048 const struct auto_pin_cfg *cfg)
5235{ 5049{
5236 static hda_nid_t pin_idxs[] = { 0x1f, 0x1a, 0x1b, 0x1e, 0, 0xff }; 5050 static const hda_nid_t pin_idxs[] = { 0x1f, 0x1a, 0x1b, 0x1e, 0, 0xff };
5237 return vt_auto_create_analog_input_ctls(codec, cfg, 0x16, pin_idxs, 5051 return vt_auto_create_analog_input_ctls(codec, cfg, 0x16, pin_idxs,
5238 ARRAY_SIZE(pin_idxs)); 5052 ARRAY_SIZE(pin_idxs));
5239} 5053}
@@ -5280,7 +5094,7 @@ static int vt1716S_parse_auto_config(struct hda_codec *codec)
5280} 5094}
5281 5095
5282#ifdef CONFIG_SND_HDA_POWER_SAVE 5096#ifdef CONFIG_SND_HDA_POWER_SAVE
5283static struct hda_amp_list vt1716S_loopbacks[] = { 5097static const struct hda_amp_list vt1716S_loopbacks[] = {
5284 { 0x16, HDA_INPUT, 1 }, 5098 { 0x16, HDA_INPUT, 1 },
5285 { 0x16, HDA_INPUT, 2 }, 5099 { 0x16, HDA_INPUT, 2 },
5286 { 0x16, HDA_INPUT, 3 }, 5100 { 0x16, HDA_INPUT, 3 },
@@ -5289,6 +5103,99 @@ static struct hda_amp_list vt1716S_loopbacks[] = {
5289}; 5103};
5290#endif 5104#endif
5291 5105
5106static void set_widgets_power_state_vt1716S(struct hda_codec *codec)
5107{
5108 struct via_spec *spec = codec->spec;
5109 int imux_is_smixer;
5110 unsigned int parm;
5111 unsigned int mono_out, present;
5112 /* SW0 (17h) = stereo mixer */
5113 imux_is_smixer =
5114 (snd_hda_codec_read(codec, 0x17, 0,
5115 AC_VERB_GET_CONNECT_SEL, 0x00) == 5);
5116 /* inputs */
5117 /* PW 1/2/5 (1ah/1bh/1eh) */
5118 parm = AC_PWRST_D3;
5119 set_pin_power_state(codec, 0x1a, &parm);
5120 set_pin_power_state(codec, 0x1b, &parm);
5121 set_pin_power_state(codec, 0x1e, &parm);
5122 if (imux_is_smixer)
5123 parm = AC_PWRST_D0;
5124 /* SW0 (17h), AIW0(13h) */
5125 snd_hda_codec_write(codec, 0x17, 0, AC_VERB_SET_POWER_STATE, parm);
5126 snd_hda_codec_write(codec, 0x13, 0, AC_VERB_SET_POWER_STATE, parm);
5127
5128 parm = AC_PWRST_D3;
5129 set_pin_power_state(codec, 0x1e, &parm);
5130 /* PW11 (22h) */
5131 if (spec->dmic_enabled)
5132 set_pin_power_state(codec, 0x22, &parm);
5133 else
5134 snd_hda_codec_write(codec, 0x22, 0,
5135 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
5136
5137 /* SW2(26h), AIW1(14h) */
5138 snd_hda_codec_write(codec, 0x26, 0, AC_VERB_SET_POWER_STATE, parm);
5139 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_POWER_STATE, parm);
5140
5141 /* outputs */
5142 /* PW0 (19h), SW1 (18h), AOW1 (11h) */
5143 parm = AC_PWRST_D3;
5144 set_pin_power_state(codec, 0x19, &parm);
5145 /* Smart 5.1 PW2(1bh) */
5146 if (spec->smart51_enabled)
5147 set_pin_power_state(codec, 0x1b, &parm);
5148 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_POWER_STATE, parm);
5149 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_POWER_STATE, parm);
5150
5151 /* PW7 (23h), SW3 (27h), AOW3 (25h) */
5152 parm = AC_PWRST_D3;
5153 set_pin_power_state(codec, 0x23, &parm);
5154 /* Smart 5.1 PW1(1ah) */
5155 if (spec->smart51_enabled)
5156 set_pin_power_state(codec, 0x1a, &parm);
5157 snd_hda_codec_write(codec, 0x27, 0, AC_VERB_SET_POWER_STATE, parm);
5158
5159 /* Smart 5.1 PW5(1eh) */
5160 if (spec->smart51_enabled)
5161 set_pin_power_state(codec, 0x1e, &parm);
5162 snd_hda_codec_write(codec, 0x25, 0, AC_VERB_SET_POWER_STATE, parm);
5163
5164 /* Mono out */
5165 /* SW4(28h)->MW1(29h)-> PW12 (2ah)*/
5166 present = snd_hda_jack_detect(codec, 0x1c);
5167
5168 if (present)
5169 mono_out = 0;
5170 else {
5171 present = snd_hda_jack_detect(codec, 0x1d);
5172 if (!spec->hp_independent_mode && present)
5173 mono_out = 0;
5174 else
5175 mono_out = 1;
5176 }
5177 parm = mono_out ? AC_PWRST_D0 : AC_PWRST_D3;
5178 snd_hda_codec_write(codec, 0x28, 0, AC_VERB_SET_POWER_STATE, parm);
5179 snd_hda_codec_write(codec, 0x29, 0, AC_VERB_SET_POWER_STATE, parm);
5180 snd_hda_codec_write(codec, 0x2a, 0, AC_VERB_SET_POWER_STATE, parm);
5181
5182 /* PW 3/4 (1ch/1dh) */
5183 parm = AC_PWRST_D3;
5184 set_pin_power_state(codec, 0x1c, &parm);
5185 set_pin_power_state(codec, 0x1d, &parm);
5186 /* HP Independent Mode, power on AOW3 */
5187 if (spec->hp_independent_mode)
5188 snd_hda_codec_write(codec, 0x25, 0,
5189 AC_VERB_SET_POWER_STATE, parm);
5190
5191 /* force to D0 for internal Speaker */
5192 /* MW0 (16h), AOW0 (10h) */
5193 snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_POWER_STATE,
5194 imux_is_smixer ? AC_PWRST_D0 : parm);
5195 snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_POWER_STATE,
5196 mono_out ? AC_PWRST_D0 : parm);
5197}
5198
5292static int patch_vt1716S(struct hda_codec *codec) 5199static int patch_vt1716S(struct hda_codec *codec)
5293{ 5200{
5294 struct via_spec *spec; 5201 struct via_spec *spec;
@@ -5343,13 +5250,14 @@ static int patch_vt1716S(struct hda_codec *codec)
5343 spec->loopback.amplist = vt1716S_loopbacks; 5250 spec->loopback.amplist = vt1716S_loopbacks;
5344#endif 5251#endif
5345 5252
5253 spec->set_widgets_power_state = set_widgets_power_state_vt1716S;
5346 return 0; 5254 return 0;
5347} 5255}
5348 5256
5349/* for vt2002P */ 5257/* for vt2002P */
5350 5258
5351/* capture mixer elements */ 5259/* capture mixer elements */
5352static struct snd_kcontrol_new vt2002P_capture_mixer[] = { 5260static const struct snd_kcontrol_new vt2002P_capture_mixer[] = {
5353 HDA_CODEC_VOLUME("Capture Volume", 0x10, 0x0, HDA_INPUT), 5261 HDA_CODEC_VOLUME("Capture Volume", 0x10, 0x0, HDA_INPUT),
5354 HDA_CODEC_MUTE("Capture Switch", 0x10, 0x0, HDA_INPUT), 5262 HDA_CODEC_MUTE("Capture Switch", 0x10, 0x0, HDA_INPUT),
5355 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x11, 0x0, HDA_INPUT), 5263 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x11, 0x0, HDA_INPUT),
@@ -5372,7 +5280,11 @@ static struct snd_kcontrol_new vt2002P_capture_mixer[] = {
5372 { } /* end */ 5280 { } /* end */
5373}; 5281};
5374 5282
5375static struct hda_verb vt2002P_volume_init_verbs[] = { 5283static const struct hda_verb vt2002P_volume_init_verbs[] = {
5284 /* Class-D speaker related verbs */
5285 {0x1, 0xfe0, 0x4},
5286 {0x1, 0xfe9, 0x80},
5287 {0x1, 0xfe2, 0x22},
5376 /* 5288 /*
5377 * Unmute ADC0-1 and set the default input to mic-in 5289 * Unmute ADC0-1 and set the default input to mic-in
5378 */ 5290 */
@@ -5423,9 +5335,60 @@ static struct hda_verb vt2002P_volume_init_verbs[] = {
5423 {0x1, 0xfb8, 0x88}, 5335 {0x1, 0xfb8, 0x88},
5424 { } 5336 { }
5425}; 5337};
5338static const struct hda_verb vt1802_volume_init_verbs[] = {
5339 /*
5340 * Unmute ADC0-1 and set the default input to mic-in
5341 */
5342 {0x8, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5343 {0x9, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5344
5345
5346 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5347 * mixer widget
5348 */
5349 /* Amp Indices: CD = 1, Mic1 = 2, Line = 3, Mic2 = 4 */
5350 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5351 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5352 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5353 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5354 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5355
5356 /* MUX Indices: Mic = 0 */
5357 {0x1e, AC_VERB_SET_CONNECT_SEL, 0},
5358 {0x1f, AC_VERB_SET_CONNECT_SEL, 0},
5359
5360 /* PW9 Output enable */
5361 {0x2d, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_OUT_EN},
5362
5363 /* Enable Boost Volume backdoor */
5364 {0x1, 0xfb9, 0x24},
5365
5366 /* MW0/1/4/8: un-mute index 0 (MUXx), un-mute index 1 (MW9) */
5367 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5368 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5369 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5370 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5371 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5372 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5373 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5374 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5375
5376 /* set MUX0/1/4/8 = 0 (AOW0) */
5377 {0x34, AC_VERB_SET_CONNECT_SEL, 0},
5378 {0x35, AC_VERB_SET_CONNECT_SEL, 0},
5379 {0x38, AC_VERB_SET_CONNECT_SEL, 0},
5380 {0x3c, AC_VERB_SET_CONNECT_SEL, 0},
5381
5382 /* set PW0 index=0 (MW0) */
5383 {0x24, AC_VERB_SET_CONNECT_SEL, 0},
5384
5385 /* Enable AOW0 to MW9 */
5386 {0x1, 0xfb8, 0x88},
5387 { }
5388};
5426 5389
5427 5390
5428static struct hda_verb vt2002P_uniwill_init_verbs[] = { 5391static const struct hda_verb vt2002P_uniwill_init_verbs[] = {
5429 {0x25, AC_VERB_SET_UNSOLICITED_ENABLE, 5392 {0x25, AC_VERB_SET_UNSOLICITED_ENABLE,
5430 AC_USRSP_EN | VIA_JACK_EVENT | VIA_BIND_HP_EVENT}, 5393 AC_USRSP_EN | VIA_JACK_EVENT | VIA_BIND_HP_EVENT},
5431 {0x26, AC_VERB_SET_UNSOLICITED_ENABLE, 5394 {0x26, AC_VERB_SET_UNSOLICITED_ENABLE,
@@ -5435,8 +5398,18 @@ static struct hda_verb vt2002P_uniwill_init_verbs[] = {
5435 {0x2b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT}, 5398 {0x2b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT},
5436 { } 5399 { }
5437}; 5400};
5401static const struct hda_verb vt1802_uniwill_init_verbs[] = {
5402 {0x25, AC_VERB_SET_UNSOLICITED_ENABLE,
5403 AC_USRSP_EN | VIA_JACK_EVENT | VIA_BIND_HP_EVENT},
5404 {0x28, AC_VERB_SET_UNSOLICITED_ENABLE,
5405 AC_USRSP_EN | VIA_JACK_EVENT | VIA_BIND_HP_EVENT},
5406 {0x29, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT},
5407 {0x2a, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT},
5408 {0x2b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT},
5409 { }
5410};
5438 5411
5439static struct hda_pcm_stream vt2002P_pcm_analog_playback = { 5412static const struct hda_pcm_stream vt2002P_pcm_analog_playback = {
5440 .substreams = 2, 5413 .substreams = 2,
5441 .channels_min = 2, 5414 .channels_min = 2,
5442 .channels_max = 2, 5415 .channels_max = 2,
@@ -5449,7 +5422,7 @@ static struct hda_pcm_stream vt2002P_pcm_analog_playback = {
5449 }, 5422 },
5450}; 5423};
5451 5424
5452static struct hda_pcm_stream vt2002P_pcm_analog_capture = { 5425static const struct hda_pcm_stream vt2002P_pcm_analog_capture = {
5453 .substreams = 2, 5426 .substreams = 2,
5454 .channels_min = 2, 5427 .channels_min = 2,
5455 .channels_max = 2, 5428 .channels_max = 2,
@@ -5462,7 +5435,7 @@ static struct hda_pcm_stream vt2002P_pcm_analog_capture = {
5462 }, 5435 },
5463}; 5436};
5464 5437
5465static struct hda_pcm_stream vt2002P_pcm_digital_playback = { 5438static const struct hda_pcm_stream vt2002P_pcm_digital_playback = {
5466 .substreams = 1, 5439 .substreams = 1,
5467 .channels_min = 2, 5440 .channels_min = 2,
5468 .channels_max = 2, 5441 .channels_max = 2,
@@ -5482,7 +5455,7 @@ static int vt2002P_auto_fill_dac_nids(struct via_spec *spec,
5482 spec->multiout.num_dacs = 1; 5455 spec->multiout.num_dacs = 1;
5483 spec->multiout.dac_nids = spec->private_dac_nids; 5456 spec->multiout.dac_nids = spec->private_dac_nids;
5484 if (cfg->line_out_pins[0]) 5457 if (cfg->line_out_pins[0])
5485 spec->multiout.dac_nids[0] = 0x8; 5458 spec->private_dac_nids[0] = 0x8;
5486 return 0; 5459 return 0;
5487} 5460}
5488 5461
@@ -5491,10 +5464,15 @@ static int vt2002P_auto_create_multi_out_ctls(struct via_spec *spec,
5491 const struct auto_pin_cfg *cfg) 5464 const struct auto_pin_cfg *cfg)
5492{ 5465{
5493 int err; 5466 int err;
5467 hda_nid_t sw_nid;
5494 5468
5495 if (!cfg->line_out_pins[0]) 5469 if (!cfg->line_out_pins[0])
5496 return -1; 5470 return -1;
5497 5471
5472 if (spec->codec_type == VT1802)
5473 sw_nid = 0x28;
5474 else
5475 sw_nid = 0x26;
5498 5476
5499 /* Line-Out: PortE */ 5477 /* Line-Out: PortE */
5500 err = via_add_control(spec, VIA_CTL_WIDGET_VOL, 5478 err = via_add_control(spec, VIA_CTL_WIDGET_VOL,
@@ -5504,7 +5482,7 @@ static int vt2002P_auto_create_multi_out_ctls(struct via_spec *spec,
5504 return err; 5482 return err;
5505 err = via_add_control(spec, VIA_CTL_WIDGET_BIND_PIN_MUTE, 5483 err = via_add_control(spec, VIA_CTL_WIDGET_BIND_PIN_MUTE,
5506 "Master Front Playback Switch", 5484 "Master Front Playback Switch",
5507 HDA_COMPOSE_AMP_VAL(0x26, 3, 0, HDA_OUTPUT)); 5485 HDA_COMPOSE_AMP_VAL(sw_nid, 3, 0, HDA_OUTPUT));
5508 if (err < 0) 5486 if (err < 0)
5509 return err; 5487 return err;
5510 5488
@@ -5544,7 +5522,7 @@ static int vt2002P_auto_create_analog_input_ctls(struct hda_codec *codec,
5544{ 5522{
5545 struct via_spec *spec = codec->spec; 5523 struct via_spec *spec = codec->spec;
5546 struct hda_input_mux *imux = &spec->private_imux[0]; 5524 struct hda_input_mux *imux = &spec->private_imux[0];
5547 static hda_nid_t pin_idxs[] = { 0x2b, 0x2a, 0x29, 0xff }; 5525 static const hda_nid_t pin_idxs[] = { 0x2b, 0x2a, 0x29, 0xff };
5548 int err; 5526 int err;
5549 5527
5550 err = vt_auto_create_analog_input_ctls(codec, cfg, 0x21, pin_idxs, 5528 err = vt_auto_create_analog_input_ctls(codec, cfg, 0x21, pin_idxs,
@@ -5605,7 +5583,7 @@ static int vt2002P_parse_auto_config(struct hda_codec *codec)
5605} 5583}
5606 5584
5607#ifdef CONFIG_SND_HDA_POWER_SAVE 5585#ifdef CONFIG_SND_HDA_POWER_SAVE
5608static struct hda_amp_list vt2002P_loopbacks[] = { 5586static const struct hda_amp_list vt2002P_loopbacks[] = {
5609 { 0x21, HDA_INPUT, 0 }, 5587 { 0x21, HDA_INPUT, 0 },
5610 { 0x21, HDA_INPUT, 1 }, 5588 { 0x21, HDA_INPUT, 1 },
5611 { 0x21, HDA_INPUT, 2 }, 5589 { 0x21, HDA_INPUT, 2 },
@@ -5613,6 +5591,116 @@ static struct hda_amp_list vt2002P_loopbacks[] = {
5613}; 5591};
5614#endif 5592#endif
5615 5593
5594static void set_widgets_power_state_vt2002P(struct hda_codec *codec)
5595{
5596 struct via_spec *spec = codec->spec;
5597 int imux_is_smixer;
5598 unsigned int parm;
5599 unsigned int present;
5600 /* MUX9 (1eh) = stereo mixer */
5601 imux_is_smixer =
5602 snd_hda_codec_read(codec, 0x1e, 0, AC_VERB_GET_CONNECT_SEL, 0x00) == 3;
5603 /* inputs */
5604 /* PW 5/6/7 (29h/2ah/2bh) */
5605 parm = AC_PWRST_D3;
5606 set_pin_power_state(codec, 0x29, &parm);
5607 set_pin_power_state(codec, 0x2a, &parm);
5608 set_pin_power_state(codec, 0x2b, &parm);
5609 parm = AC_PWRST_D0;
5610 /* MUX9/10 (1eh/1fh), AIW 0/1 (10h/11h) */
5611 snd_hda_codec_write(codec, 0x1e, 0, AC_VERB_SET_POWER_STATE, parm);
5612 snd_hda_codec_write(codec, 0x1f, 0, AC_VERB_SET_POWER_STATE, parm);
5613 snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_POWER_STATE, parm);
5614 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_POWER_STATE, parm);
5615
5616 /* outputs */
5617 /* AOW0 (8h)*/
5618 snd_hda_codec_write(codec, 0x8, 0, AC_VERB_SET_POWER_STATE, parm);
5619
5620 if (spec->codec_type == VT1802) {
5621 /* PW4 (28h), MW4 (18h), MUX4(38h) */
5622 parm = AC_PWRST_D3;
5623 set_pin_power_state(codec, 0x28, &parm);
5624 snd_hda_codec_write(codec, 0x18, 0,
5625 AC_VERB_SET_POWER_STATE, parm);
5626 snd_hda_codec_write(codec, 0x38, 0,
5627 AC_VERB_SET_POWER_STATE, parm);
5628 } else {
5629 /* PW4 (26h), MW4 (1ch), MUX4(37h) */
5630 parm = AC_PWRST_D3;
5631 set_pin_power_state(codec, 0x26, &parm);
5632 snd_hda_codec_write(codec, 0x1c, 0,
5633 AC_VERB_SET_POWER_STATE, parm);
5634 snd_hda_codec_write(codec, 0x37, 0,
5635 AC_VERB_SET_POWER_STATE, parm);
5636 }
5637
5638 if (spec->codec_type == VT1802) {
5639 /* PW1 (25h), MW1 (15h), MUX1(35h), AOW1 (9h) */
5640 parm = AC_PWRST_D3;
5641 set_pin_power_state(codec, 0x25, &parm);
5642 snd_hda_codec_write(codec, 0x15, 0,
5643 AC_VERB_SET_POWER_STATE, parm);
5644 snd_hda_codec_write(codec, 0x35, 0,
5645 AC_VERB_SET_POWER_STATE, parm);
5646 } else {
5647 /* PW1 (25h), MW1 (19h), MUX1(35h), AOW1 (9h) */
5648 parm = AC_PWRST_D3;
5649 set_pin_power_state(codec, 0x25, &parm);
5650 snd_hda_codec_write(codec, 0x19, 0,
5651 AC_VERB_SET_POWER_STATE, parm);
5652 snd_hda_codec_write(codec, 0x35, 0,
5653 AC_VERB_SET_POWER_STATE, parm);
5654 }
5655
5656 if (spec->hp_independent_mode)
5657 snd_hda_codec_write(codec, 0x9, 0,
5658 AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
5659
5660 /* Class-D */
5661 /* PW0 (24h), MW0(18h/14h), MUX0(34h) */
5662 present = snd_hda_jack_detect(codec, 0x25);
5663
5664 parm = AC_PWRST_D3;
5665 set_pin_power_state(codec, 0x24, &parm);
5666 parm = present ? AC_PWRST_D3 : AC_PWRST_D0;
5667 if (spec->codec_type == VT1802)
5668 snd_hda_codec_write(codec, 0x14, 0,
5669 AC_VERB_SET_POWER_STATE, parm);
5670 else
5671 snd_hda_codec_write(codec, 0x18, 0,
5672 AC_VERB_SET_POWER_STATE, parm);
5673 snd_hda_codec_write(codec, 0x34, 0, AC_VERB_SET_POWER_STATE, parm);
5674
5675 /* Mono Out */
5676 present = snd_hda_jack_detect(codec, 0x26);
5677
5678 parm = present ? AC_PWRST_D3 : AC_PWRST_D0;
5679 if (spec->codec_type == VT1802) {
5680 /* PW15 (33h), MW8(1ch), MUX8(3ch) */
5681 snd_hda_codec_write(codec, 0x33, 0,
5682 AC_VERB_SET_POWER_STATE, parm);
5683 snd_hda_codec_write(codec, 0x1c, 0,
5684 AC_VERB_SET_POWER_STATE, parm);
5685 snd_hda_codec_write(codec, 0x3c, 0,
5686 AC_VERB_SET_POWER_STATE, parm);
5687 } else {
5688 /* PW15 (31h), MW8(17h), MUX8(3bh) */
5689 snd_hda_codec_write(codec, 0x31, 0,
5690 AC_VERB_SET_POWER_STATE, parm);
5691 snd_hda_codec_write(codec, 0x17, 0,
5692 AC_VERB_SET_POWER_STATE, parm);
5693 snd_hda_codec_write(codec, 0x3b, 0,
5694 AC_VERB_SET_POWER_STATE, parm);
5695 }
5696 /* MW9 (21h) */
5697 if (imux_is_smixer || !is_aa_path_mute(codec))
5698 snd_hda_codec_write(codec, 0x21, 0,
5699 AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
5700 else
5701 snd_hda_codec_write(codec, 0x21, 0,
5702 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
5703}
5616 5704
5617/* patch for vt2002P */ 5705/* patch for vt2002P */
5618static int patch_vt2002P(struct hda_codec *codec) 5706static int patch_vt2002P(struct hda_codec *codec)
@@ -5635,14 +5723,31 @@ static int patch_vt2002P(struct hda_codec *codec)
5635 "from BIOS. Using genenic mode...\n"); 5723 "from BIOS. Using genenic mode...\n");
5636 } 5724 }
5637 5725
5638 spec->init_verbs[spec->num_iverbs++] = vt2002P_volume_init_verbs; 5726 if (spec->codec_type == VT1802)
5639 spec->init_verbs[spec->num_iverbs++] = vt2002P_uniwill_init_verbs; 5727 spec->init_verbs[spec->num_iverbs++] =
5728 vt1802_volume_init_verbs;
5729 else
5730 spec->init_verbs[spec->num_iverbs++] =
5731 vt2002P_volume_init_verbs;
5732
5733 if (spec->codec_type == VT1802)
5734 spec->init_verbs[spec->num_iverbs++] =
5735 vt1802_uniwill_init_verbs;
5736 else
5737 spec->init_verbs[spec->num_iverbs++] =
5738 vt2002P_uniwill_init_verbs;
5640 5739
5641 spec->stream_name_analog = "VT2002P Analog"; 5740 if (spec->codec_type == VT1802)
5741 spec->stream_name_analog = "VT1802 Analog";
5742 else
5743 spec->stream_name_analog = "VT2002P Analog";
5642 spec->stream_analog_playback = &vt2002P_pcm_analog_playback; 5744 spec->stream_analog_playback = &vt2002P_pcm_analog_playback;
5643 spec->stream_analog_capture = &vt2002P_pcm_analog_capture; 5745 spec->stream_analog_capture = &vt2002P_pcm_analog_capture;
5644 5746
5645 spec->stream_name_digital = "VT2002P Digital"; 5747 if (spec->codec_type == VT1802)
5748 spec->stream_name_digital = "VT1802 Digital";
5749 else
5750 spec->stream_name_digital = "VT2002P Digital";
5646 spec->stream_digital_playback = &vt2002P_pcm_digital_playback; 5751 spec->stream_digital_playback = &vt2002P_pcm_digital_playback;
5647 5752
5648 if (!spec->adc_nids && spec->input_mux) { 5753 if (!spec->adc_nids && spec->input_mux) {
@@ -5664,13 +5769,14 @@ static int patch_vt2002P(struct hda_codec *codec)
5664 spec->loopback.amplist = vt2002P_loopbacks; 5769 spec->loopback.amplist = vt2002P_loopbacks;
5665#endif 5770#endif
5666 5771
5772 spec->set_widgets_power_state = set_widgets_power_state_vt2002P;
5667 return 0; 5773 return 0;
5668} 5774}
5669 5775
5670/* for vt1812 */ 5776/* for vt1812 */
5671 5777
5672/* capture mixer elements */ 5778/* capture mixer elements */
5673static struct snd_kcontrol_new vt1812_capture_mixer[] = { 5779static const struct snd_kcontrol_new vt1812_capture_mixer[] = {
5674 HDA_CODEC_VOLUME("Capture Volume", 0x10, 0x0, HDA_INPUT), 5780 HDA_CODEC_VOLUME("Capture Volume", 0x10, 0x0, HDA_INPUT),
5675 HDA_CODEC_MUTE("Capture Switch", 0x10, 0x0, HDA_INPUT), 5781 HDA_CODEC_MUTE("Capture Switch", 0x10, 0x0, HDA_INPUT),
5676 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x11, 0x0, HDA_INPUT), 5782 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x11, 0x0, HDA_INPUT),
@@ -5692,7 +5798,7 @@ static struct snd_kcontrol_new vt1812_capture_mixer[] = {
5692 { } /* end */ 5798 { } /* end */
5693}; 5799};
5694 5800
5695static struct hda_verb vt1812_volume_init_verbs[] = { 5801static const struct hda_verb vt1812_volume_init_verbs[] = {
5696 /* 5802 /*
5697 * Unmute ADC0-1 and set the default input to mic-in 5803 * Unmute ADC0-1 and set the default input to mic-in
5698 */ 5804 */
@@ -5745,7 +5851,7 @@ static struct hda_verb vt1812_volume_init_verbs[] = {
5745}; 5851};
5746 5852
5747 5853
5748static struct hda_verb vt1812_uniwill_init_verbs[] = { 5854static const struct hda_verb vt1812_uniwill_init_verbs[] = {
5749 {0x33, AC_VERB_SET_UNSOLICITED_ENABLE, 5855 {0x33, AC_VERB_SET_UNSOLICITED_ENABLE,
5750 AC_USRSP_EN | VIA_JACK_EVENT | VIA_BIND_HP_EVENT}, 5856 AC_USRSP_EN | VIA_JACK_EVENT | VIA_BIND_HP_EVENT},
5751 {0x25, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT }, 5857 {0x25, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT },
@@ -5757,7 +5863,7 @@ static struct hda_verb vt1812_uniwill_init_verbs[] = {
5757 { } 5863 { }
5758}; 5864};
5759 5865
5760static struct hda_pcm_stream vt1812_pcm_analog_playback = { 5866static const struct hda_pcm_stream vt1812_pcm_analog_playback = {
5761 .substreams = 2, 5867 .substreams = 2,
5762 .channels_min = 2, 5868 .channels_min = 2,
5763 .channels_max = 2, 5869 .channels_max = 2,
@@ -5770,7 +5876,7 @@ static struct hda_pcm_stream vt1812_pcm_analog_playback = {
5770 }, 5876 },
5771}; 5877};
5772 5878
5773static struct hda_pcm_stream vt1812_pcm_analog_capture = { 5879static const struct hda_pcm_stream vt1812_pcm_analog_capture = {
5774 .substreams = 2, 5880 .substreams = 2,
5775 .channels_min = 2, 5881 .channels_min = 2,
5776 .channels_max = 2, 5882 .channels_max = 2,
@@ -5783,7 +5889,7 @@ static struct hda_pcm_stream vt1812_pcm_analog_capture = {
5783 }, 5889 },
5784}; 5890};
5785 5891
5786static struct hda_pcm_stream vt1812_pcm_digital_playback = { 5892static const struct hda_pcm_stream vt1812_pcm_digital_playback = {
5787 .substreams = 1, 5893 .substreams = 1,
5788 .channels_min = 2, 5894 .channels_min = 2,
5789 .channels_max = 2, 5895 .channels_max = 2,
@@ -5802,7 +5908,7 @@ static int vt1812_auto_fill_dac_nids(struct via_spec *spec,
5802 spec->multiout.num_dacs = 1; 5908 spec->multiout.num_dacs = 1;
5803 spec->multiout.dac_nids = spec->private_dac_nids; 5909 spec->multiout.dac_nids = spec->private_dac_nids;
5804 if (cfg->line_out_pins[0]) 5910 if (cfg->line_out_pins[0])
5805 spec->multiout.dac_nids[0] = 0x8; 5911 spec->private_dac_nids[0] = 0x8;
5806 return 0; 5912 return 0;
5807} 5913}
5808 5914
@@ -5865,7 +5971,7 @@ static int vt1812_auto_create_analog_input_ctls(struct hda_codec *codec,
5865{ 5971{
5866 struct via_spec *spec = codec->spec; 5972 struct via_spec *spec = codec->spec;
5867 struct hda_input_mux *imux = &spec->private_imux[0]; 5973 struct hda_input_mux *imux = &spec->private_imux[0];
5868 static hda_nid_t pin_idxs[] = { 0x2b, 0x2a, 0x29, 0, 0, 0xff }; 5974 static const hda_nid_t pin_idxs[] = { 0x2b, 0x2a, 0x29, 0, 0, 0xff };
5869 int err; 5975 int err;
5870 5976
5871 err = vt_auto_create_analog_input_ctls(codec, cfg, 0x21, pin_idxs, 5977 err = vt_auto_create_analog_input_ctls(codec, cfg, 0x21, pin_idxs,
@@ -5927,7 +6033,7 @@ static int vt1812_parse_auto_config(struct hda_codec *codec)
5927} 6033}
5928 6034
5929#ifdef CONFIG_SND_HDA_POWER_SAVE 6035#ifdef CONFIG_SND_HDA_POWER_SAVE
5930static struct hda_amp_list vt1812_loopbacks[] = { 6036static const struct hda_amp_list vt1812_loopbacks[] = {
5931 { 0x21, HDA_INPUT, 0 }, 6037 { 0x21, HDA_INPUT, 0 },
5932 { 0x21, HDA_INPUT, 1 }, 6038 { 0x21, HDA_INPUT, 1 },
5933 { 0x21, HDA_INPUT, 2 }, 6039 { 0x21, HDA_INPUT, 2 },
@@ -5935,6 +6041,97 @@ static struct hda_amp_list vt1812_loopbacks[] = {
5935}; 6041};
5936#endif 6042#endif
5937 6043
6044static void set_widgets_power_state_vt1812(struct hda_codec *codec)
6045{
6046 struct via_spec *spec = codec->spec;
6047 int imux_is_smixer =
6048 snd_hda_codec_read(codec, 0x13, 0, AC_VERB_GET_CONNECT_SEL, 0x00) == 3;
6049 unsigned int parm;
6050 unsigned int present;
6051 /* MUX10 (1eh) = stereo mixer */
6052 imux_is_smixer =
6053 snd_hda_codec_read(codec, 0x1e, 0, AC_VERB_GET_CONNECT_SEL, 0x00) == 5;
6054 /* inputs */
6055 /* PW 5/6/7 (29h/2ah/2bh) */
6056 parm = AC_PWRST_D3;
6057 set_pin_power_state(codec, 0x29, &parm);
6058 set_pin_power_state(codec, 0x2a, &parm);
6059 set_pin_power_state(codec, 0x2b, &parm);
6060 parm = AC_PWRST_D0;
6061 /* MUX10/11 (1eh/1fh), AIW 0/1 (10h/11h) */
6062 snd_hda_codec_write(codec, 0x1e, 0, AC_VERB_SET_POWER_STATE, parm);
6063 snd_hda_codec_write(codec, 0x1f, 0, AC_VERB_SET_POWER_STATE, parm);
6064 snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_POWER_STATE, parm);
6065 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_POWER_STATE, parm);
6066
6067 /* outputs */
6068 /* AOW0 (8h)*/
6069 snd_hda_codec_write(codec, 0x8, 0,
6070 AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
6071
6072 /* PW4 (28h), MW4 (18h), MUX4(38h) */
6073 parm = AC_PWRST_D3;
6074 set_pin_power_state(codec, 0x28, &parm);
6075 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_POWER_STATE, parm);
6076 snd_hda_codec_write(codec, 0x38, 0, AC_VERB_SET_POWER_STATE, parm);
6077
6078 /* PW1 (25h), MW1 (15h), MUX1(35h), AOW1 (9h) */
6079 parm = AC_PWRST_D3;
6080 set_pin_power_state(codec, 0x25, &parm);
6081 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_POWER_STATE, parm);
6082 snd_hda_codec_write(codec, 0x35, 0, AC_VERB_SET_POWER_STATE, parm);
6083 if (spec->hp_independent_mode)
6084 snd_hda_codec_write(codec, 0x9, 0,
6085 AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
6086
6087 /* Internal Speaker */
6088 /* PW0 (24h), MW0(14h), MUX0(34h) */
6089 present = snd_hda_jack_detect(codec, 0x25);
6090
6091 parm = AC_PWRST_D3;
6092 set_pin_power_state(codec, 0x24, &parm);
6093 if (present) {
6094 snd_hda_codec_write(codec, 0x14, 0,
6095 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
6096 snd_hda_codec_write(codec, 0x34, 0,
6097 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
6098 } else {
6099 snd_hda_codec_write(codec, 0x14, 0,
6100 AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
6101 snd_hda_codec_write(codec, 0x34, 0,
6102 AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
6103 }
6104
6105
6106 /* Mono Out */
6107 /* PW13 (31h), MW13(1ch), MUX13(3ch), MW14(3eh) */
6108 present = snd_hda_jack_detect(codec, 0x28);
6109
6110 parm = AC_PWRST_D3;
6111 set_pin_power_state(codec, 0x31, &parm);
6112 if (present) {
6113 snd_hda_codec_write(codec, 0x1c, 0,
6114 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
6115 snd_hda_codec_write(codec, 0x3c, 0,
6116 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
6117 snd_hda_codec_write(codec, 0x3e, 0,
6118 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
6119 } else {
6120 snd_hda_codec_write(codec, 0x1c, 0,
6121 AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
6122 snd_hda_codec_write(codec, 0x3c, 0,
6123 AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
6124 snd_hda_codec_write(codec, 0x3e, 0,
6125 AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
6126 }
6127
6128 /* PW15 (33h), MW15 (1dh), MUX15(3dh) */
6129 parm = AC_PWRST_D3;
6130 set_pin_power_state(codec, 0x33, &parm);
6131 snd_hda_codec_write(codec, 0x1d, 0, AC_VERB_SET_POWER_STATE, parm);
6132 snd_hda_codec_write(codec, 0x3d, 0, AC_VERB_SET_POWER_STATE, parm);
6133
6134}
5938 6135
5939/* patch for vt1812 */ 6136/* patch for vt1812 */
5940static int patch_vt1812(struct hda_codec *codec) 6137static int patch_vt1812(struct hda_codec *codec)
@@ -5988,13 +6185,14 @@ static int patch_vt1812(struct hda_codec *codec)
5988 spec->loopback.amplist = vt1812_loopbacks; 6185 spec->loopback.amplist = vt1812_loopbacks;
5989#endif 6186#endif
5990 6187
6188 spec->set_widgets_power_state = set_widgets_power_state_vt1812;
5991 return 0; 6189 return 0;
5992} 6190}
5993 6191
5994/* 6192/*
5995 * patch entries 6193 * patch entries
5996 */ 6194 */
5997static struct hda_codec_preset snd_hda_preset_via[] = { 6195static const struct hda_codec_preset snd_hda_preset_via[] = {
5998 { .id = 0x11061708, .name = "VT1708", .patch = patch_vt1708}, 6196 { .id = 0x11061708, .name = "VT1708", .patch = patch_vt1708},
5999 { .id = 0x11061709, .name = "VT1708", .patch = patch_vt1708}, 6197 { .id = 0x11061709, .name = "VT1708", .patch = patch_vt1708},
6000 { .id = 0x1106170a, .name = "VT1708", .patch = patch_vt1708}, 6198 { .id = 0x1106170a, .name = "VT1708", .patch = patch_vt1708},
@@ -6039,7 +6237,7 @@ static struct hda_codec_preset snd_hda_preset_via[] = {
6039 .patch = patch_vt1708S}, 6237 .patch = patch_vt1708S},
6040 { .id = 0x11063397, .name = "VT1708S", 6238 { .id = 0x11063397, .name = "VT1708S",
6041 .patch = patch_vt1708S}, 6239 .patch = patch_vt1708S},
6042 { .id = 0x11064397, .name = "VT1708S", 6240 { .id = 0x11064397, .name = "VT1705",
6043 .patch = patch_vt1708S}, 6241 .patch = patch_vt1708S},
6044 { .id = 0x11065397, .name = "VT1708S", 6242 { .id = 0x11065397, .name = "VT1708S",
6045 .patch = patch_vt1708S}, 6243 .patch = patch_vt1708S},
@@ -6080,6 +6278,10 @@ static struct hda_codec_preset snd_hda_preset_via[] = {
6080 { .id = 0x11060448, .name = "VT1812", .patch = patch_vt1812}, 6278 { .id = 0x11060448, .name = "VT1812", .patch = patch_vt1812},
6081 { .id = 0x11060440, .name = "VT1818S", 6279 { .id = 0x11060440, .name = "VT1818S",
6082 .patch = patch_vt1708S}, 6280 .patch = patch_vt1708S},
6281 { .id = 0x11060446, .name = "VT1802",
6282 .patch = patch_vt2002P},
6283 { .id = 0x11068446, .name = "VT1802",
6284 .patch = patch_vt2002P},
6083 {} /* terminator */ 6285 {} /* terminator */
6084}; 6286};
6085 6287