diff options
Diffstat (limited to 'sound/pci/hda/patch_via.c')
-rw-r--r-- | sound/pci/hda/patch_via.c | 1526 |
1 files changed, 864 insertions, 662 deletions
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index 0997031c48d2..605c99e1e520 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 | |||
104 | struct via_spec { | 110 | struct 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 | ||
233 | enum { | 244 | enum { |
234 | VIA_CTL_WIDGET_VOL, | 245 | VIA_CTL_WIDGET_VOL, |
@@ -245,7 +256,6 @@ enum { | |||
245 | }; | 256 | }; |
246 | 257 | ||
247 | static void analog_low_current_mode(struct hda_codec *codec, int stream_idle); | 258 | static void analog_low_current_mode(struct hda_codec *codec, int stream_idle); |
248 | static void set_jack_power_state(struct hda_codec *codec); | ||
249 | static int is_aa_path_mute(struct hda_codec *codec); | 259 | static int is_aa_path_mute(struct hda_codec *codec); |
250 | 260 | ||
251 | static void vt1708_start_hp_work(struct via_spec *spec) | 261 | static 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 | ||
284 | static 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 | ||
275 | static int analog_input_switch_put(struct snd_kcontrol *kcontrol, | 291 | static 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 | ||
397 | static struct snd_kcontrol_new via_control_templates[] = { | 413 | static 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 | ||
404 | static hda_nid_t vt1708_adc_nids[2] = { | 420 | static const hda_nid_t vt1708_adc_nids[2] = { |
405 | /* ADC1-2 */ | 421 | /* ADC1-2 */ |
406 | 0x15, 0x27 | 422 | 0x15, 0x27 |
407 | }; | 423 | }; |
408 | 424 | ||
409 | static hda_nid_t vt1709_adc_nids[3] = { | 425 | static 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 | ||
414 | static hda_nid_t vt1708B_adc_nids[2] = { | 430 | static const hda_nid_t vt1708B_adc_nids[2] = { |
415 | /* ADC1-2 */ | 431 | /* ADC1-2 */ |
416 | 0x13, 0x14 | 432 | 0x13, 0x14 |
417 | }; | 433 | }; |
418 | 434 | ||
419 | static hda_nid_t vt1708S_adc_nids[2] = { | 435 | static const hda_nid_t vt1708S_adc_nids[2] = { |
420 | /* ADC1-2 */ | 436 | /* ADC1-2 */ |
421 | 0x13, 0x14 | 437 | 0x13, 0x14 |
422 | }; | 438 | }; |
423 | 439 | ||
424 | static hda_nid_t vt1702_adc_nids[3] = { | 440 | static 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 | ||
429 | static hda_nid_t vt1718S_adc_nids[2] = { | 445 | static const hda_nid_t vt1718S_adc_nids[2] = { |
430 | /* ADC1-2 */ | 446 | /* ADC1-2 */ |
431 | 0x10, 0x11 | 447 | 0x10, 0x11 |
432 | }; | 448 | }; |
433 | 449 | ||
434 | static hda_nid_t vt1716S_adc_nids[2] = { | 450 | static const hda_nid_t vt1716S_adc_nids[2] = { |
435 | /* ADC1-2 */ | 451 | /* ADC1-2 */ |
436 | 0x13, 0x14 | 452 | 0x13, 0x14 |
437 | }; | 453 | }; |
438 | 454 | ||
439 | static hda_nid_t vt2002P_adc_nids[2] = { | 455 | static const hda_nid_t vt2002P_adc_nids[2] = { |
440 | /* ADC1-2 */ | 456 | /* ADC1-2 */ |
441 | 0x10, 0x11 | 457 | 0x10, 0x11 |
442 | }; | 458 | }; |
443 | 459 | ||
444 | static hda_nid_t vt1812_adc_nids[2] = { | 460 | static 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 | ||
473 | static struct snd_kcontrol_new *via_clone_control(struct via_spec *spec, | 489 | static 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 | ||
605 | static 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 | ||
1232 | static struct snd_kcontrol_new via_hp_mixer[2] = { | 783 | static 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 | ||
1454 | static struct snd_kcontrol_new via_smart51_mixer[2] = { | 1006 | static 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 */ |
1495 | static struct snd_kcontrol_new vt1708_capture_mixer[] = { | 1052 | static 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 | */ |
1623 | static struct hda_verb vt1708_volume_init_verbs[] = { | 1182 | static 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 | ||
1863 | static struct hda_pcm_stream vt1708_pcm_analog_playback = { | 1424 | static 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 | ||
1875 | static struct hda_pcm_stream vt1708_pcm_analog_s16_playback = { | 1436 | static 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 | ||
1892 | static struct hda_pcm_stream vt1708_pcm_analog_capture = { | 1453 | static 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 | ||
1903 | static struct hda_pcm_stream vt1708_pcm_digital_playback = { | 1464 | static 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 | ||
1916 | static struct hda_pcm_stream vt1708_pcm_digital_capture = { | 1477 | static 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 | */ |
2257 | static struct hda_codec_ops via_patch_ops = { | 1822 | static 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) | |||
2437 | static int vt_auto_create_analog_input_ctls(struct hda_codec *codec, | 2002 | static 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, | |||
2483 | static int vt1708_auto_create_analog_input_ctls(struct hda_codec *codec, | 2049 | static 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 |
2492 | static struct hda_amp_list vt1708_loopbacks[] = { | 2058 | static 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 | ||
2551 | static struct snd_kcontrol_new vt1708_jack_detectect[] = { | 2117 | static 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 */ |
2730 | static struct snd_kcontrol_new vt1709_capture_mixer[] = { | 2297 | static 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 | ||
2752 | static struct hda_verb vt1709_uniwill_init_verbs[] = { | 2319 | static 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 | */ |
2761 | static struct hda_verb vt1709_10ch_volume_init_verbs[] = { | 2328 | static 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 | ||
2801 | static struct hda_pcm_stream vt1709_10ch_pcm_analog_playback = { | 2368 | static 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 | ||
2813 | static struct hda_pcm_stream vt1709_6ch_pcm_analog_playback = { | 2380 | static 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 | ||
2825 | static struct hda_pcm_stream vt1709_pcm_analog_capture = { | 2392 | static 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 | ||
2836 | static struct hda_pcm_stream vt1709_pcm_digital_playback = { | 2403 | static 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 | ||
2847 | static struct hda_pcm_stream vt1709_pcm_digital_capture = { | 2414 | static 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) | |||
3056 | static int vt1709_auto_create_analog_input_ctls(struct hda_codec *codec, | 2623 | static 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 |
3109 | static struct hda_amp_list vt1709_loopbacks[] = { | 2676 | static 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 | */ |
3170 | static struct hda_verb vt1709_6ch_volume_init_verbs[] = { | 2737 | static 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 */ |
3260 | static struct snd_kcontrol_new vt1708B_capture_mixer[] = { | 2827 | static 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 | */ |
3282 | static struct hda_verb vt1708B_8ch_volume_init_verbs[] = { | 2849 | static 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 | ||
3317 | static struct hda_verb vt1708B_4ch_volume_init_verbs[] = { | 2884 | static 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 | ||
3352 | static struct hda_verb vt1708B_uniwill_init_verbs[] = { | 2919 | static 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 | ||
3376 | static struct hda_pcm_stream vt1708B_8ch_pcm_analog_playback = { | 2943 | static 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 | ||
3389 | static struct hda_pcm_stream vt1708B_4ch_pcm_analog_playback = { | 2956 | static 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 | ||
3401 | static struct hda_pcm_stream vt1708B_pcm_analog_capture = { | 2968 | static 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 | ||
3414 | static struct hda_pcm_stream vt1708B_pcm_digital_playback = { | 2981 | static 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 | ||
3427 | static struct hda_pcm_stream vt1708B_pcm_digital_capture = { | 2994 | static 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) | |||
3588 | static int vt1708B_auto_create_analog_input_ctls(struct hda_codec *codec, | 3155 | static 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 |
3641 | static struct hda_amp_list vt1708B_loopbacks[] = { | 3208 | static 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 | |||
3217 | static 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 | |||
3649 | static int patch_vt1708S(struct hda_codec *codec); | 3297 | static int patch_vt1708S(struct hda_codec *codec); |
3650 | static int patch_vt1708B_8ch(struct hda_codec *codec) | 3298 | static 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 */ |
3755 | static struct snd_kcontrol_new vt1708S_capture_mixer[] = { | 3407 | static 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 | ||
3778 | static struct hda_verb vt1708S_volume_init_verbs[] = { | 3430 | static 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 | ||
3804 | static struct hda_verb vt1708S_uniwill_init_verbs[] = { | 3456 | static 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 | ||
3817 | static struct hda_pcm_stream vt1708S_pcm_analog_playback = { | 3469 | static 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 | |||
3481 | static 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 | ||
3830 | static struct hda_pcm_stream vt1708S_pcm_analog_capture = { | 3494 | static 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 | |||
3507 | static 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 | ||
3843 | static struct hda_pcm_stream vt1708S_pcm_digital_playback = { | 3520 | static 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 */ |
3899 | static int vt1708S_auto_create_multi_out_ctls(struct via_spec *spec, | 3582 | static 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) | |||
4026 | static int vt1708S_auto_create_analog_input_ctls(struct hda_codec *codec, | 3719 | static 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 |
4100 | static struct hda_amp_list vt1708S_loopbacks[] = { | 3793 | static 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 */ |
4194 | static struct snd_kcontrol_new vt1702_capture_mixer[] = { | 3908 | static 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 | ||
4218 | static struct hda_verb vt1702_volume_init_verbs[] = { | 3932 | static 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 | ||
4249 | static struct hda_verb vt1702_uniwill_init_verbs[] = { | 3963 | static 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 | ||
4259 | static struct hda_pcm_stream vt1702_pcm_analog_playback = { | 3973 | static 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 | ||
4272 | static struct hda_pcm_stream vt1702_pcm_analog_capture = { | 3986 | static 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 | ||
4285 | static struct hda_pcm_stream vt1702_pcm_digital_playback = { | 3999 | static 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) | |||
4382 | static int vt1702_auto_create_analog_input_ctls(struct hda_codec *codec, | 4096 | static 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 |
4436 | static struct hda_amp_list vt1702_loopbacks[] = { | 4150 | static 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 | ||
4159 | static 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 | |||
4445 | static int patch_vt1702(struct hda_codec *codec) | 4190 | static 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 */ |
4497 | static struct snd_kcontrol_new vt1718S_capture_mixer[] = { | 4243 | static 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 | ||
4519 | static struct hda_verb vt1718S_volume_init_verbs[] = { | 4265 | static 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 | ||
4566 | static struct hda_verb vt1718S_uniwill_init_verbs[] = { | 4313 | static 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 | ||
4579 | static struct hda_pcm_stream vt1718S_pcm_analog_playback = { | 4326 | static 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 | ||
4592 | static struct hda_pcm_stream vt1718S_pcm_analog_capture = { | 4339 | static 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 | ||
4605 | static struct hda_pcm_stream vt1718S_pcm_digital_playback = { | 4352 | static 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 | ||
4618 | static struct hda_pcm_stream vt1718S_pcm_digital_capture = { | 4365 | static 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) | |||
4769 | static int vt1718S_auto_create_analog_input_ctls(struct hda_codec *codec, | 4516 | static 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 |
4823 | static struct hda_amp_list vt1718S_loopbacks[] = { | 4570 | static 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 | ||
4579 | static 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 | |||
4832 | static int patch_vt1718S(struct hda_codec *codec) | 4645 | static 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 */ |
4938 | static struct snd_kcontrol_new vt1716S_capture_mixer[] = { | 4752 | static 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 | ||
4957 | static struct snd_kcontrol_new vt1716s_dmic_mixer[] = { | 4771 | static 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 */ |
4973 | static struct snd_kcontrol_new vt1716S_mono_out_mixer[] = { | 4787 | static 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 | ||
4978 | static struct hda_verb vt1716S_volume_init_verbs[] = { | 4792 | static 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 | ||
5027 | static struct hda_verb vt1716S_uniwill_init_verbs[] = { | 4841 | static 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 | ||
5040 | static struct hda_pcm_stream vt1716S_pcm_analog_playback = { | 4854 | static 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 | ||
5053 | static struct hda_pcm_stream vt1716S_pcm_analog_capture = { | 4867 | static 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 | ||
5066 | static struct hda_pcm_stream vt1716S_pcm_digital_playback = { | 4880 | static 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) | |||
5233 | static int vt1716S_auto_create_analog_input_ctls(struct hda_codec *codec, | 5047 | static 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 |
5283 | static struct hda_amp_list vt1716S_loopbacks[] = { | 5097 | static 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 | ||
5106 | static 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 | |||
5292 | static int patch_vt1716S(struct hda_codec *codec) | 5199 | static 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 */ |
5352 | static struct snd_kcontrol_new vt2002P_capture_mixer[] = { | 5260 | static 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 | ||
5375 | static struct hda_verb vt2002P_volume_init_verbs[] = { | 5283 | static 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 | }; |
5338 | static 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 | ||
5428 | static struct hda_verb vt2002P_uniwill_init_verbs[] = { | 5391 | static 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 | }; |
5401 | static 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 | ||
5439 | static struct hda_pcm_stream vt2002P_pcm_analog_playback = { | 5412 | static 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 | ||
5452 | static struct hda_pcm_stream vt2002P_pcm_analog_capture = { | 5425 | static 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 | ||
5465 | static struct hda_pcm_stream vt2002P_pcm_digital_playback = { | 5438 | static 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 |
5608 | static struct hda_amp_list vt2002P_loopbacks[] = { | 5586 | static 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 | ||
5594 | static 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 */ |
5618 | static int patch_vt2002P(struct hda_codec *codec) | 5706 | static 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 */ |
5673 | static struct snd_kcontrol_new vt1812_capture_mixer[] = { | 5779 | static 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 | ||
5695 | static struct hda_verb vt1812_volume_init_verbs[] = { | 5801 | static 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 | ||
5748 | static struct hda_verb vt1812_uniwill_init_verbs[] = { | 5854 | static 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 | ||
5760 | static struct hda_pcm_stream vt1812_pcm_analog_playback = { | 5866 | static 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 | ||
5773 | static struct hda_pcm_stream vt1812_pcm_analog_capture = { | 5879 | static 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 | ||
5786 | static struct hda_pcm_stream vt1812_pcm_digital_playback = { | 5892 | static 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 |
5930 | static struct hda_amp_list vt1812_loopbacks[] = { | 6036 | static 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 | ||
6044 | static 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 */ |
5940 | static int patch_vt1812(struct hda_codec *codec) | 6137 | static 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 | */ |
5997 | static struct hda_codec_preset snd_hda_preset_via[] = { | 6195 | static 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 | ||