Lines Matching refs:spec

81 #define VT2002P_COMPATIBLE(spec) \  argument
82 ((spec)->codec_type == VT2002P ||\
83 (spec)->codec_type == VT1812 ||\
84 (spec)->codec_type == VT1802)
235 struct via_spec *spec; in via_new_spec() local
237 spec = kzalloc(sizeof(*spec), GFP_KERNEL); in via_new_spec()
238 if (spec == NULL) in via_new_spec()
241 mutex_init(&spec->config_mutex); in via_new_spec()
242 codec->spec = spec; in via_new_spec()
243 spec->codec = codec; in via_new_spec()
244 spec->codec_type = get_codec_type(codec); in via_new_spec()
246 if (spec->codec_type == VT1708BCE) in via_new_spec()
247 spec->codec_type = VT1708S; in via_new_spec()
248 return spec; in via_new_spec()
317 static void vt1708_stop_hp_work(struct via_spec *spec) in vt1708_stop_hp_work() argument
319 if (spec->codec_type != VT1708 || spec->autocfg.hp_pins[0] == 0) in vt1708_stop_hp_work()
321 if (spec->hp_work_active) { in vt1708_stop_hp_work()
322 snd_hda_codec_write(spec->codec, 0x1, 0, 0xf81, 1); in vt1708_stop_hp_work()
323 cancel_delayed_work_sync(&spec->vt1708_hp_work); in vt1708_stop_hp_work()
324 spec->hp_work_active = 0; in vt1708_stop_hp_work()
328 static void vt1708_update_hp_work(struct via_spec *spec) in vt1708_update_hp_work() argument
330 if (spec->codec_type != VT1708 || spec->autocfg.hp_pins[0] == 0) in vt1708_update_hp_work()
332 if (spec->vt1708_jack_detect && in vt1708_update_hp_work()
333 (spec->active_streams || hp_detect_with_aa(spec->codec))) { in vt1708_update_hp_work()
334 if (!spec->hp_work_active) { in vt1708_update_hp_work()
335 snd_hda_codec_write(spec->codec, 0x1, 0, 0xf81, 0); in vt1708_update_hp_work()
336 schedule_delayed_work(&spec->vt1708_hp_work, in vt1708_update_hp_work()
338 spec->hp_work_active = 1; in vt1708_update_hp_work()
340 } else if (!hp_detect_with_aa(spec->codec)) in vt1708_update_hp_work()
341 vt1708_stop_hp_work(spec); in vt1708_update_hp_work()
346 struct via_spec *spec = codec->spec; in set_widgets_power_state() local
347 if (spec->set_widgets_power_state) in set_widgets_power_state()
348 spec->set_widgets_power_state(codec); in set_widgets_power_state()
359 vt1708_update_hp_work(codec->spec); in analog_input_switch_put()
381 static struct snd_kcontrol_new *__via_clone_ctl(struct via_spec *spec, in __via_clone_ctl() argument
387 snd_array_init(&spec->kctls, sizeof(*knew), 32); in __via_clone_ctl()
388 knew = snd_array_new(&spec->kctls); in __via_clone_ctl()
402 static int __via_add_control(struct via_spec *spec, int type, const char *name, in __via_add_control() argument
407 knew = __via_clone_ctl(spec, &via_control_templates[type], name); in __via_add_control()
417 #define via_add_control(spec, type, name, val) \ argument
418 __via_add_control(spec, type, name, 0, val)
420 #define via_clone_control(spec, tmpl) __via_clone_ctl(spec, tmpl, NULL) argument
424 struct via_spec *spec = codec->spec; in via_free_kctls() local
426 if (spec->kctls.list) { in via_free_kctls()
427 struct snd_kcontrol_new *kctl = spec->kctls.list; in via_free_kctls()
429 for (i = 0; i < spec->kctls.used; i++) in via_free_kctls()
432 snd_array_free(&spec->kctls); in via_free_kctls()
436 static int via_new_analog_input(struct via_spec *spec, const char *ctlname, in via_new_analog_input() argument
443 err = __via_add_control(spec, VIA_CTL_WIDGET_VOL, name, type_idx, in via_new_analog_input()
448 err = __via_add_control(spec, VIA_CTL_WIDGET_ANALOG_MUTE, name, type_idx, in via_new_analog_input()
502 struct via_spec *spec = codec->spec; in activate_output_path() local
515 if (!force && (dst == spec->aa_mix_nid)) in activate_output_path()
568 struct via_spec *spec = codec->spec; in via_auto_init_multi_out() local
572 for (i = 0; i < spec->autocfg.line_outs + spec->smart51_nums; i++) { in via_auto_init_multi_out()
573 path = &spec->out_path[i]; in via_auto_init_multi_out()
574 if (!i && spec->aamix_mode && spec->out_mix_path.depth) in via_auto_init_multi_out()
575 path = &spec->out_mix_path; in via_auto_init_multi_out()
583 struct via_spec *spec = codec->spec; in deactivate_hp_paths() local
584 int shared = spec->hp_indep_shared; in deactivate_hp_paths()
586 if (spec->hp_independent_mode) { in deactivate_hp_paths()
587 activate_output_path(codec, &spec->hp_path, false, false); in deactivate_hp_paths()
588 activate_output_path(codec, &spec->hp_mix_path, false, false); in deactivate_hp_paths()
590 activate_output_path(codec, &spec->out_path[shared], in deactivate_hp_paths()
592 } else if (spec->aamix_mode || !spec->hp_path.depth) { in deactivate_hp_paths()
593 activate_output_path(codec, &spec->hp_indep_path, false, false); in deactivate_hp_paths()
594 activate_output_path(codec, &spec->hp_path, false, false); in deactivate_hp_paths()
596 activate_output_path(codec, &spec->hp_indep_path, false, false); in deactivate_hp_paths()
597 activate_output_path(codec, &spec->hp_mix_path, false, false); in deactivate_hp_paths()
603 struct via_spec *spec = codec->spec; in via_auto_init_hp_out() local
605 if (!spec->hp_path.depth) { in via_auto_init_hp_out()
606 via_auto_init_output(codec, &spec->hp_mix_path, PIN_HP); in via_auto_init_hp_out()
610 if (spec->hp_independent_mode) in via_auto_init_hp_out()
611 via_auto_init_output(codec, &spec->hp_indep_path, PIN_HP); in via_auto_init_hp_out()
612 else if (spec->aamix_mode) in via_auto_init_hp_out()
613 via_auto_init_output(codec, &spec->hp_mix_path, PIN_HP); in via_auto_init_hp_out()
615 via_auto_init_output(codec, &spec->hp_path, PIN_HP); in via_auto_init_hp_out()
620 struct via_spec *spec = codec->spec; in via_auto_init_speaker_out() local
622 if (!spec->autocfg.speaker_outs) in via_auto_init_speaker_out()
624 if (!spec->speaker_path.depth) { in via_auto_init_speaker_out()
625 via_auto_init_output(codec, &spec->speaker_mix_path, PIN_OUT); in via_auto_init_speaker_out()
628 if (!spec->aamix_mode) { in via_auto_init_speaker_out()
629 activate_output_path(codec, &spec->speaker_mix_path, in via_auto_init_speaker_out()
631 via_auto_init_output(codec, &spec->speaker_path, PIN_OUT); in via_auto_init_speaker_out()
633 activate_output_path(codec, &spec->speaker_path, false, false); in via_auto_init_speaker_out()
634 via_auto_init_output(codec, &spec->speaker_mix_path, PIN_OUT); in via_auto_init_speaker_out()
643 struct via_spec *spec = codec->spec; in via_auto_init_analog_input() local
644 const struct auto_pin_cfg *cfg = &spec->autocfg; in via_auto_init_analog_input()
650 for (i = 0; i < spec->num_adc_nids; i++) { in via_auto_init_analog_input()
651 hda_nid_t nid = spec->adc_nids[i]; in via_auto_init_analog_input()
655 snd_hda_codec_write(codec, spec->adc_nids[i], 0, in via_auto_init_analog_input()
663 if (spec->smart51_enabled && is_smart51_pins(codec, nid)) in via_auto_init_analog_input()
674 for (i = 0; i < spec->num_adc_nids; i++) { in via_auto_init_analog_input()
675 int adc_idx = spec->inputs[spec->cur_mux[i]].adc_idx; in via_auto_init_analog_input()
677 if (i > 0 && !spec->mux_nids[i]) in via_auto_init_analog_input()
679 if (spec->mux_nids[adc_idx]) { in via_auto_init_analog_input()
680 int mux_idx = spec->inputs[spec->cur_mux[i]].mux_idx; in via_auto_init_analog_input()
681 snd_hda_codec_write(codec, spec->mux_nids[adc_idx], 0, in via_auto_init_analog_input()
685 if (spec->dyn_adc_switch) in via_auto_init_analog_input()
690 if (!spec->aa_mix_nid) in via_auto_init_analog_input()
692 num_conns = snd_hda_get_connections(codec, spec->aa_mix_nid, conn, in via_auto_init_analog_input()
697 snd_hda_codec_write(codec, spec->aa_mix_nid, 0, in via_auto_init_analog_input()
720 struct via_spec *spec = codec->spec; in set_pin_power_state() local
723 no_presence |= spec->no_pin_power_ctl; in set_pin_power_state()
726 if ((spec->smart51_enabled && is_smart51_pins(codec, nid)) in set_pin_power_state()
758 struct via_spec *spec = codec->spec; in via_pin_power_ctl_get() local
759 ucontrol->value.enumerated.item[0] = !spec->no_pin_power_ctl; in via_pin_power_ctl_get()
767 struct via_spec *spec = codec->spec; in via_pin_power_ctl_put() local
770 if (val == spec->no_pin_power_ctl) in via_pin_power_ctl_put()
772 spec->no_pin_power_ctl = val; in via_pin_power_ctl_put()
806 struct via_spec *spec = codec->spec; in via_independent_hp_get() local
808 ucontrol->value.enumerated.item[0] = spec->hp_independent_mode; in via_independent_hp_get()
813 static void setup_playback_multi_pcm(struct via_spec *spec) in setup_playback_multi_pcm() argument
815 const struct auto_pin_cfg *cfg = &spec->autocfg; in setup_playback_multi_pcm()
816 spec->multiout.num_dacs = cfg->line_outs + spec->smart51_nums; in setup_playback_multi_pcm()
817 spec->multiout.hp_nid = 0; in setup_playback_multi_pcm()
818 if (!spec->hp_independent_mode) { in setup_playback_multi_pcm()
819 if (!spec->hp_indep_shared) in setup_playback_multi_pcm()
820 spec->multiout.hp_nid = spec->hp_dac_nid; in setup_playback_multi_pcm()
822 if (spec->hp_indep_shared) in setup_playback_multi_pcm()
823 spec->multiout.num_dacs = cfg->line_outs - 1; in setup_playback_multi_pcm()
832 struct via_spec *spec = codec->spec; in switch_indep_hp_dacs() local
833 int shared = spec->hp_indep_shared; in switch_indep_hp_dacs()
836 if (!spec->opened_streams) in switch_indep_hp_dacs()
839 shared_dac = shared ? spec->multiout.dac_nids[shared] : 0; in switch_indep_hp_dacs()
840 hp_dac = spec->hp_dac_nid; in switch_indep_hp_dacs()
841 if (spec->hp_independent_mode) { in switch_indep_hp_dacs()
843 if (spec->active_streams & STREAM_MULTI_OUT) { in switch_indep_hp_dacs()
847 if (spec->active_streams & STREAM_INDEP_HP) in switch_indep_hp_dacs()
849 spec->cur_hp_stream_tag, 0, in switch_indep_hp_dacs()
850 spec->cur_hp_format); in switch_indep_hp_dacs()
853 if (spec->active_streams & STREAM_INDEP_HP) in switch_indep_hp_dacs()
855 if (spec->active_streams & STREAM_MULTI_OUT) { in switch_indep_hp_dacs()
866 spec->cur_dac_stream_tag, ch, in switch_indep_hp_dacs()
867 spec->cur_dac_format); in switch_indep_hp_dacs()
870 setup_playback_multi_pcm(spec); in switch_indep_hp_dacs()
877 struct via_spec *spec = codec->spec; in via_independent_hp_put() local
880 mutex_lock(&spec->config_mutex); in via_independent_hp_put()
882 if (spec->hp_independent_mode == cur) { in via_independent_hp_put()
883 mutex_unlock(&spec->config_mutex); in via_independent_hp_put()
886 spec->hp_independent_mode = cur; in via_independent_hp_put()
887 shared = spec->hp_indep_shared; in via_independent_hp_put()
890 activate_output_path(codec, &spec->hp_indep_path, true, false); in via_independent_hp_put()
893 activate_output_path(codec, &spec->out_path[shared], in via_independent_hp_put()
895 if (spec->aamix_mode || !spec->hp_path.depth) in via_independent_hp_put()
896 activate_output_path(codec, &spec->hp_mix_path, in via_independent_hp_put()
899 activate_output_path(codec, &spec->hp_path, in via_independent_hp_put()
904 mutex_unlock(&spec->config_mutex); in via_independent_hp_put()
922 struct via_spec *spec = codec->spec; in via_hp_build() local
926 nid = spec->autocfg.hp_pins[0]; in via_hp_build()
927 knew = via_clone_control(spec, &via_hp_mixer); in via_hp_build()
938 struct via_spec *spec = codec->spec; in notify_aa_path_ctls() local
941 for (i = 0; i < spec->smart51_nums; i++) { in notify_aa_path_ctls()
946 sprintf(id.name, "%s Playback Volume", spec->smart51_labels[i]); in notify_aa_path_ctls()
957 struct via_spec *spec = codec->spec; in mute_aa_path() local
962 for (i = 0; i < spec->smart51_nums; i++) { in mute_aa_path()
963 if (spec->smart51_idxs[i] < 0) in mute_aa_path()
965 snd_hda_codec_amp_stereo(codec, spec->aa_mix_nid, in mute_aa_path()
966 HDA_INPUT, spec->smart51_idxs[i], in mute_aa_path()
973 struct via_spec *spec = codec->spec; in is_smart51_pins() local
976 for (i = 0; i < spec->smart51_nums; i++) in is_smart51_pins()
977 if (spec->smart51_pins[i] == pin) in is_smart51_pins()
986 struct via_spec *spec = codec->spec; in via_smart51_get() local
988 *ucontrol->value.integer.value = spec->smart51_enabled; in via_smart51_get()
996 struct via_spec *spec = codec->spec; in via_smart51_put() local
1001 for (i = 0; i < spec->smart51_nums; i++) { in via_smart51_put()
1002 hda_nid_t nid = spec->smart51_pins[i]; in via_smart51_put()
1017 spec->smart51_enabled = *ucontrol->value.integer.value; in via_smart51_put()
1033 struct via_spec *spec = codec->spec; in via_smart51_build() local
1035 if (!spec->smart51_nums) in via_smart51_build()
1037 if (!via_clone_control(spec, &via_smart51_mixer)) in via_smart51_build()
1045 struct via_spec *spec = codec->spec; in is_aa_path_mute() local
1049 for (i = 0; i < spec->num_loopbacks; i++) { in is_aa_path_mute()
1050 p = &spec->loopback_list[i]; in is_aa_path_mute()
1064 struct via_spec *spec = codec->spec; in __analog_low_current_mode() local
1068 if (spec->no_pin_power_ctl) in __analog_low_current_mode()
1071 enable = is_aa_path_mute(codec) && !spec->opened_streams; in __analog_low_current_mode()
1072 if (enable == spec->alc_mode && !force) in __analog_low_current_mode()
1074 spec->alc_mode = enable; in __analog_low_current_mode()
1077 switch (spec->codec_type) { in __analog_low_current_mode()
1122 struct via_spec *spec = codec->spec; in set_stream_open() local
1125 spec->opened_streams |= bit; in set_stream_open()
1127 spec->opened_streams &= ~bit; in set_stream_open()
1135 struct via_spec *spec = codec->spec; in via_playback_multi_pcm_open() local
1136 const struct auto_pin_cfg *cfg = &spec->autocfg; in via_playback_multi_pcm_open()
1139 spec->multiout.num_dacs = cfg->line_outs + spec->smart51_nums; in via_playback_multi_pcm_open()
1140 spec->multiout.max_channels = spec->multiout.num_dacs * 2; in via_playback_multi_pcm_open()
1142 err = snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, in via_playback_multi_pcm_open()
1163 struct via_spec *spec = codec->spec; in via_playback_hp_pcm_open() local
1165 if (snd_BUG_ON(!spec->hp_dac_nid)) in via_playback_hp_pcm_open()
1185 struct via_spec *spec = codec->spec; in via_playback_multi_pcm_prepare() local
1187 mutex_lock(&spec->config_mutex); in via_playback_multi_pcm_prepare()
1188 setup_playback_multi_pcm(spec); in via_playback_multi_pcm_prepare()
1189 snd_hda_multi_out_analog_prepare(codec, &spec->multiout, stream_tag, in via_playback_multi_pcm_prepare()
1192 spec->active_streams |= STREAM_MULTI_OUT; in via_playback_multi_pcm_prepare()
1193 spec->cur_dac_stream_tag = stream_tag; in via_playback_multi_pcm_prepare()
1194 spec->cur_dac_format = format; in via_playback_multi_pcm_prepare()
1195 mutex_unlock(&spec->config_mutex); in via_playback_multi_pcm_prepare()
1196 vt1708_update_hp_work(spec); in via_playback_multi_pcm_prepare()
1206 struct via_spec *spec = codec->spec; in via_playback_hp_pcm_prepare() local
1208 mutex_lock(&spec->config_mutex); in via_playback_hp_pcm_prepare()
1209 if (spec->hp_independent_mode) in via_playback_hp_pcm_prepare()
1210 snd_hda_codec_setup_stream(codec, spec->hp_dac_nid, in via_playback_hp_pcm_prepare()
1212 spec->active_streams |= STREAM_INDEP_HP; in via_playback_hp_pcm_prepare()
1213 spec->cur_hp_stream_tag = stream_tag; in via_playback_hp_pcm_prepare()
1214 spec->cur_hp_format = format; in via_playback_hp_pcm_prepare()
1215 mutex_unlock(&spec->config_mutex); in via_playback_hp_pcm_prepare()
1216 vt1708_update_hp_work(spec); in via_playback_hp_pcm_prepare()
1224 struct via_spec *spec = codec->spec; in via_playback_multi_pcm_cleanup() local
1226 mutex_lock(&spec->config_mutex); in via_playback_multi_pcm_cleanup()
1227 snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); in via_playback_multi_pcm_cleanup()
1228 spec->active_streams &= ~STREAM_MULTI_OUT; in via_playback_multi_pcm_cleanup()
1229 mutex_unlock(&spec->config_mutex); in via_playback_multi_pcm_cleanup()
1230 vt1708_update_hp_work(spec); in via_playback_multi_pcm_cleanup()
1238 struct via_spec *spec = codec->spec; in via_playback_hp_pcm_cleanup() local
1240 mutex_lock(&spec->config_mutex); in via_playback_hp_pcm_cleanup()
1241 if (spec->hp_independent_mode) in via_playback_hp_pcm_cleanup()
1242 snd_hda_codec_setup_stream(codec, spec->hp_dac_nid, 0, 0, 0); in via_playback_hp_pcm_cleanup()
1243 spec->active_streams &= ~STREAM_INDEP_HP; in via_playback_hp_pcm_cleanup()
1244 mutex_unlock(&spec->config_mutex); in via_playback_hp_pcm_cleanup()
1245 vt1708_update_hp_work(spec); in via_playback_hp_pcm_cleanup()
1256 struct via_spec *spec = codec->spec; in via_dig_playback_pcm_open() local
1257 return snd_hda_multi_out_dig_open(codec, &spec->multiout); in via_dig_playback_pcm_open()
1264 struct via_spec *spec = codec->spec; in via_dig_playback_pcm_close() local
1265 return snd_hda_multi_out_dig_close(codec, &spec->multiout); in via_dig_playback_pcm_close()
1274 struct via_spec *spec = codec->spec; in via_dig_playback_pcm_prepare() local
1275 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, in via_dig_playback_pcm_prepare()
1283 struct via_spec *spec = codec->spec; in via_dig_playback_pcm_cleanup() local
1284 snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); in via_dig_playback_pcm_cleanup()
1297 struct via_spec *spec = codec->spec; in via_capture_pcm_prepare() local
1299 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], in via_capture_pcm_prepare()
1308 struct via_spec *spec = codec->spec; in via_capture_pcm_cleanup() local
1309 snd_hda_codec_cleanup_stream(codec, spec->adc_nids[substream->number]); in via_capture_pcm_cleanup()
1320 struct via_spec *spec = codec->spec; in via_dyn_adc_capture_pcm_prepare() local
1321 int adc_idx = spec->inputs[spec->cur_mux[0]].adc_idx; in via_dyn_adc_capture_pcm_prepare()
1323 mutex_lock(&spec->config_mutex); in via_dyn_adc_capture_pcm_prepare()
1324 spec->cur_adc = spec->adc_nids[adc_idx]; in via_dyn_adc_capture_pcm_prepare()
1325 spec->cur_adc_stream_tag = stream_tag; in via_dyn_adc_capture_pcm_prepare()
1326 spec->cur_adc_format = format; in via_dyn_adc_capture_pcm_prepare()
1327 snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format); in via_dyn_adc_capture_pcm_prepare()
1328 mutex_unlock(&spec->config_mutex); in via_dyn_adc_capture_pcm_prepare()
1336 struct via_spec *spec = codec->spec; in via_dyn_adc_capture_pcm_cleanup() local
1338 mutex_lock(&spec->config_mutex); in via_dyn_adc_capture_pcm_cleanup()
1339 snd_hda_codec_cleanup_stream(codec, spec->cur_adc); in via_dyn_adc_capture_pcm_cleanup()
1340 spec->cur_adc = 0; in via_dyn_adc_capture_pcm_cleanup()
1341 mutex_unlock(&spec->config_mutex); in via_dyn_adc_capture_pcm_cleanup()
1348 struct via_spec *spec = codec->spec; in via_dyn_adc_pcm_resetup() local
1349 int adc_idx = spec->inputs[cur].adc_idx; in via_dyn_adc_pcm_resetup()
1350 hda_nid_t adc = spec->adc_nids[adc_idx]; in via_dyn_adc_pcm_resetup()
1353 mutex_lock(&spec->config_mutex); in via_dyn_adc_pcm_resetup()
1354 if (spec->cur_adc && spec->cur_adc != adc) { in via_dyn_adc_pcm_resetup()
1356 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); in via_dyn_adc_pcm_resetup()
1357 spec->cur_adc = adc; in via_dyn_adc_pcm_resetup()
1359 spec->cur_adc_stream_tag, 0, in via_dyn_adc_pcm_resetup()
1360 spec->cur_adc_format); in via_dyn_adc_pcm_resetup()
1363 mutex_unlock(&spec->config_mutex); in via_dyn_adc_pcm_resetup()
1463 struct via_spec *spec = codec->spec; in via_build_controls() local
1467 spec->no_pin_power_ctl = 1; in via_build_controls()
1468 if (spec->set_widgets_power_state) in via_build_controls()
1469 if (!via_clone_control(spec, &via_pin_power_ctl_enum)) in via_build_controls()
1472 for (i = 0; i < spec->num_mixers; i++) { in via_build_controls()
1473 err = snd_hda_add_new_ctls(codec, spec->mixers[i]); in via_build_controls()
1478 if (spec->multiout.dig_out_nid) { in via_build_controls()
1480 spec->multiout.dig_out_nid, in via_build_controls()
1481 spec->multiout.dig_out_nid); in via_build_controls()
1485 &spec->multiout); in via_build_controls()
1488 spec->multiout.share_spdif = 1; in via_build_controls()
1490 if (spec->dig_in_nid) { in via_build_controls()
1491 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); in via_build_controls()
1499 snd_hda_set_vmaster_tlv(codec, spec->multiout.dac_nids[0], in via_build_controls()
1518 if (!spec->mux_nids[i]) in via_build_controls()
1520 err = snd_hda_add_nid(codec, kctl, i, spec->mux_nids[i]); in via_build_controls()
1527 err = snd_hda_jack_add_kctls(codec, &spec->autocfg); in via_build_controls()
1536 struct via_spec *spec = codec->spec; in via_build_pcms() local
1537 struct hda_pcm *info = spec->pcm_rec; in via_build_pcms()
1542 if (spec->multiout.num_dacs || spec->num_adc_nids) { in via_build_pcms()
1543 snprintf(spec->stream_name_analog, in via_build_pcms()
1544 sizeof(spec->stream_name_analog), in via_build_pcms()
1546 info->name = spec->stream_name_analog; in via_build_pcms()
1548 if (spec->multiout.num_dacs) { in via_build_pcms()
1549 if (!spec->stream_analog_playback) in via_build_pcms()
1550 spec->stream_analog_playback = in via_build_pcms()
1553 *spec->stream_analog_playback; in via_build_pcms()
1555 spec->multiout.dac_nids[0]; in via_build_pcms()
1557 spec->multiout.max_channels; in via_build_pcms()
1560 if (!spec->stream_analog_capture) { in via_build_pcms()
1561 if (spec->dyn_adc_switch) in via_build_pcms()
1562 spec->stream_analog_capture = in via_build_pcms()
1565 spec->stream_analog_capture = in via_build_pcms()
1568 if (spec->num_adc_nids) { in via_build_pcms()
1570 *spec->stream_analog_capture; in via_build_pcms()
1572 spec->adc_nids[0]; in via_build_pcms()
1573 if (!spec->dyn_adc_switch) in via_build_pcms()
1575 spec->num_adc_nids; in via_build_pcms()
1581 if (spec->multiout.dig_out_nid || spec->dig_in_nid) { in via_build_pcms()
1582 snprintf(spec->stream_name_digital, in via_build_pcms()
1583 sizeof(spec->stream_name_digital), in via_build_pcms()
1585 info->name = spec->stream_name_digital; in via_build_pcms()
1587 if (spec->multiout.dig_out_nid) { in via_build_pcms()
1588 if (!spec->stream_digital_playback) in via_build_pcms()
1589 spec->stream_digital_playback = in via_build_pcms()
1592 *spec->stream_digital_playback; in via_build_pcms()
1594 spec->multiout.dig_out_nid; in via_build_pcms()
1596 if (spec->dig_in_nid) { in via_build_pcms()
1597 if (!spec->stream_digital_capture) in via_build_pcms()
1598 spec->stream_digital_capture = in via_build_pcms()
1601 *spec->stream_digital_capture; in via_build_pcms()
1603 spec->dig_in_nid; in via_build_pcms()
1609 if (spec->hp_dac_nid) { in via_build_pcms()
1610 snprintf(spec->stream_name_hp, sizeof(spec->stream_name_hp), in via_build_pcms()
1612 info->name = spec->stream_name_hp; in via_build_pcms()
1615 spec->hp_dac_nid; in via_build_pcms()
1624 struct via_spec *spec = codec->spec; in via_free() local
1626 if (!spec) in via_free()
1630 vt1708_stop_hp_work(spec); in via_free()
1631 kfree(spec->bind_cap_vol); in via_free()
1632 kfree(spec->bind_cap_sw); in via_free()
1633 kfree(spec); in via_free()
1658 struct via_spec *spec = codec->spec; in via_line_automute() local
1660 if (!spec->autocfg.speaker_outs) in via_line_automute()
1664 spec->autocfg.line_out_pins[0]); in via_line_automute()
1665 toggle_output_mutes(codec, spec->autocfg.speaker_outs, in via_line_automute()
1666 spec->autocfg.speaker_pins, in via_line_automute()
1675 struct via_spec *spec = codec->spec; in via_hp_automute() local
1677 if (!spec->hp_independent_mode && spec->autocfg.hp_pins[0] && in via_hp_automute()
1678 (spec->codec_type != VT1708 || spec->vt1708_jack_detect)) in via_hp_automute()
1679 present = snd_hda_jack_detect(codec, spec->autocfg.hp_pins[0]); in via_hp_automute()
1681 if (spec->smart51_enabled) in via_hp_automute()
1682 nums = spec->autocfg.line_outs + spec->smart51_nums; in via_hp_automute()
1684 nums = spec->autocfg.line_outs; in via_hp_automute()
1685 toggle_output_mutes(codec, nums, spec->autocfg.line_out_pins, present); in via_hp_automute()
1697 struct via_spec *spec = codec->spec; in via_gpio_control() local
1712 snd_hda_codec_write(codec, spec->autocfg.line_out_pins[0], 0, in via_gpio_control()
1731 snd_hda_codec_write(codec, spec->autocfg.line_out_pins[0], 0, in via_gpio_control()
1759 struct via_spec *spec = codec->spec; in via_suspend() local
1760 vt1708_stop_hp_work(spec); in via_suspend()
1768 struct via_spec *spec = codec->spec; in via_check_power_status() local
1769 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); in via_check_power_status()
1794 struct via_spec *spec = codec->spec; in is_empty_dac() local
1797 for (i = 0; i < spec->multiout.num_dacs; i++) { in is_empty_dac()
1798 if (spec->multiout.dac_nids[i] == dac) in is_empty_dac()
1801 if (spec->hp_dac_nid == dac) in is_empty_dac()
1810 struct via_spec *spec = codec->spec; in __parse_output_path() local
1814 if (nid == spec->aa_mix_nid) { in __parse_output_path()
1826 if (!(spec->aa_mix_nid && with_aa_mix == 1)) in __parse_output_path()
1869 struct via_spec *spec = codec->spec; in via_auto_fill_dac_nids() local
1870 const struct auto_pin_cfg *cfg = &spec->autocfg; in via_auto_fill_dac_nids()
1874 spec->multiout.num_dacs = 0; in via_auto_fill_dac_nids()
1875 spec->multiout.dac_nids = spec->private_dac_nids; in via_auto_fill_dac_nids()
1881 if (parse_output_path(codec, nid, 0, 0, &spec->out_path[i])) in via_auto_fill_dac_nids()
1882 dac = spec->out_path[i].path[0]; in via_auto_fill_dac_nids()
1884 &spec->out_mix_path)) in via_auto_fill_dac_nids()
1885 dac = spec->out_mix_path.path[0]; in via_auto_fill_dac_nids()
1887 spec->private_dac_nids[spec->multiout.num_dacs++] = dac; in via_auto_fill_dac_nids()
1889 if (!spec->out_path[0].depth && spec->out_mix_path.depth) { in via_auto_fill_dac_nids()
1890 spec->out_path[0] = spec->out_mix_path; in via_auto_fill_dac_nids()
1891 spec->out_mix_path.depth = 0; in via_auto_fill_dac_nids()
1899 struct via_spec *spec = codec->spec; in create_ch_ctls() local
1918 err = via_add_control(spec, VIA_CTL_WIDGET_VOL, name, in create_ch_ctls()
1935 err = via_add_control(spec, VIA_CTL_WIDGET_MUTE, name, in create_ch_ctls()
1946 struct via_spec *spec = codec->spec; in mangle_smart51() local
1947 struct auto_pin_cfg *cfg = &spec->autocfg; in mangle_smart51()
1974 spec->smart51_pins[spec->smart51_nums++] = pin; in mangle_smart51()
1992 struct via_spec *spec = codec->spec; in via_auto_create_multi_out_ctls() local
1993 struct auto_pin_cfg *cfg = &spec->autocfg; in via_auto_create_multi_out_ctls()
2010 if (spec->multiout.num_dacs < 3) { in via_auto_create_multi_out_ctls()
2011 spec->smart51_nums = 0; in via_auto_create_multi_out_ctls()
2017 dac = spec->multiout.dac_nids[i]; in via_auto_create_multi_out_ctls()
2020 path = spec->out_path + i; in via_auto_create_multi_out_ctls()
2037 if (path != spec->out_path + i) in via_auto_create_multi_out_ctls()
2038 copy_path_mixer_ctls(&spec->out_path[i], path); in via_auto_create_multi_out_ctls()
2039 if (path == spec->out_path && spec->out_mix_path.depth) in via_auto_create_multi_out_ctls()
2040 copy_path_mixer_ctls(&spec->out_mix_path, path); in via_auto_create_multi_out_ctls()
2043 idx = get_connection_index(codec, spec->aa_mix_nid, in via_auto_create_multi_out_ctls()
2044 spec->multiout.dac_nids[0]); in via_auto_create_multi_out_ctls()
2048 name = spec->out_mix_path.depth ? in via_auto_create_multi_out_ctls()
2050 err = via_add_control(spec, VIA_CTL_WIDGET_VOL, name, in via_auto_create_multi_out_ctls()
2051 HDA_COMPOSE_AMP_VAL(spec->aa_mix_nid, 3, in via_auto_create_multi_out_ctls()
2055 name = spec->out_mix_path.depth ? in via_auto_create_multi_out_ctls()
2057 err = via_add_control(spec, VIA_CTL_WIDGET_MUTE, name, in via_auto_create_multi_out_ctls()
2058 HDA_COMPOSE_AMP_VAL(spec->aa_mix_nid, 3, in via_auto_create_multi_out_ctls()
2071 struct via_spec *spec = codec->spec; in via_auto_create_hp_ctls() local
2079 if (!parse_output_path(codec, pin, 0, 0, &spec->hp_indep_path)) { in via_auto_create_hp_ctls()
2081 if (i < spec->multiout.num_dacs && in via_auto_create_hp_ctls()
2083 spec->multiout.dac_nids[i], 0, in via_auto_create_hp_ctls()
2084 &spec->hp_indep_path)) { in via_auto_create_hp_ctls()
2085 spec->hp_indep_shared = i; in via_auto_create_hp_ctls()
2090 if (spec->hp_indep_path.depth) { in via_auto_create_hp_ctls()
2091 spec->hp_dac_nid = spec->hp_indep_path.path[0]; in via_auto_create_hp_ctls()
2092 if (!spec->hp_indep_shared) in via_auto_create_hp_ctls()
2093 spec->hp_path = spec->hp_indep_path; in via_auto_create_hp_ctls()
2096 if (!spec->hp_path.depth) in via_auto_create_hp_ctls()
2098 spec->multiout.dac_nids[HDA_FRONT], 0, in via_auto_create_hp_ctls()
2099 &spec->hp_path); in via_auto_create_hp_ctls()
2101 if (!parse_output_path(codec, pin, spec->multiout.dac_nids[HDA_FRONT], in via_auto_create_hp_ctls()
2102 1, &spec->hp_mix_path) && !spec->hp_path.depth) in via_auto_create_hp_ctls()
2105 if (spec->hp_path.depth) { in via_auto_create_hp_ctls()
2106 path = &spec->hp_path; in via_auto_create_hp_ctls()
2109 path = &spec->hp_mix_path; in via_auto_create_hp_ctls()
2116 copy_path_mixer_ctls(&spec->hp_mix_path, path); in via_auto_create_hp_ctls()
2118 copy_path_mixer_ctls(&spec->hp_path, path); in via_auto_create_hp_ctls()
2119 if (spec->hp_indep_path.depth) in via_auto_create_hp_ctls()
2120 copy_path_mixer_ctls(&spec->hp_indep_path, path); in via_auto_create_hp_ctls()
2126 struct via_spec *spec = codec->spec; in via_auto_create_speaker_ctls() local
2132 pin = spec->autocfg.speaker_pins[0]; in via_auto_create_speaker_ctls()
2133 if (!spec->autocfg.speaker_outs || !pin) in via_auto_create_speaker_ctls()
2136 if (parse_output_path(codec, pin, 0, 0, &spec->speaker_path)) in via_auto_create_speaker_ctls()
2137 dac = spec->speaker_path.path[0]; in via_auto_create_speaker_ctls()
2140 spec->multiout.dac_nids[HDA_FRONT], 0, in via_auto_create_speaker_ctls()
2141 &spec->speaker_path); in via_auto_create_speaker_ctls()
2142 if (!parse_output_path(codec, pin, spec->multiout.dac_nids[HDA_FRONT], in via_auto_create_speaker_ctls()
2143 1, &spec->speaker_mix_path) && !dac) in via_auto_create_speaker_ctls()
2147 if (!spec->out_mix_path.depth && spec->speaker_mix_path.depth) in via_auto_create_speaker_ctls()
2150 spec->speaker_dac_nid = dac; in via_auto_create_speaker_ctls()
2151 spec->multiout.extra_out_nid[0] = dac; in via_auto_create_speaker_ctls()
2153 path = &spec->speaker_path; in via_auto_create_speaker_ctls()
2156 path = &spec->speaker_mix_path; in via_auto_create_speaker_ctls()
2163 copy_path_mixer_ctls(&spec->speaker_mix_path, path); in via_auto_create_speaker_ctls()
2165 copy_path_mixer_ctls(&spec->speaker_path, path); in via_auto_create_speaker_ctls()
2175 struct via_spec *spec = codec->spec; in via_aamix_ctl_get() local
2176 ucontrol->value.enumerated.item[0] = spec->aamix_mode; in via_aamix_ctl_get()
2196 struct via_spec *spec = codec->spec; in via_aamix_ctl_put() local
2199 if (val == spec->aamix_mode) in via_aamix_ctl_put()
2201 spec->aamix_mode = val; in via_aamix_ctl_put()
2203 update_aamix_paths(codec, val, &spec->out_path[0], &spec->out_mix_path); in via_aamix_ctl_put()
2205 if (!spec->hp_independent_mode) { in via_aamix_ctl_put()
2206 update_aamix_paths(codec, val, &spec->hp_path, in via_aamix_ctl_put()
2207 &spec->hp_mix_path); in via_aamix_ctl_put()
2210 update_aamix_paths(codec, val, &spec->speaker_path, in via_aamix_ctl_put()
2211 &spec->speaker_mix_path); in via_aamix_ctl_put()
2225 struct via_spec *spec = codec->spec; in via_auto_create_loopback_switch() local
2227 if (!spec->aa_mix_nid) in via_auto_create_loopback_switch()
2229 if (!(spec->out_mix_path.depth || spec->hp_mix_path.depth || in via_auto_create_loopback_switch()
2230 spec->speaker_path.depth)) in via_auto_create_loopback_switch()
2232 if (!via_clone_control(spec, &via_aamix_ctl_enum)) in via_auto_create_loopback_switch()
2240 struct via_spec *spec = codec->spec; in via_fill_adcs() local
2252 if (spec->num_adc_nids >= ARRAY_SIZE(spec->adc_nids)) in via_fill_adcs()
2254 spec->adc_nids[spec->num_adc_nids++] = nid; in via_fill_adcs()
2264 struct via_spec *spec = codec->spec; in via_mux_enum_info() local
2268 uinfo->value.enumerated.items = spec->num_inputs; in via_mux_enum_info()
2269 if (uinfo->value.enumerated.item >= spec->num_inputs) in via_mux_enum_info()
2270 uinfo->value.enumerated.item = spec->num_inputs - 1; in via_mux_enum_info()
2272 spec->inputs[uinfo->value.enumerated.item].label); in via_mux_enum_info()
2280 struct via_spec *spec = codec->spec; in via_mux_enum_get() local
2283 ucontrol->value.enumerated.item[0] = spec->cur_mux[idx]; in via_mux_enum_get()
2291 struct via_spec *spec = codec->spec; in via_mux_enum_put() local
2297 if (cur < 0 || cur >= spec->num_inputs) in via_mux_enum_put()
2299 if (spec->cur_mux[idx] == cur) in via_mux_enum_put()
2301 spec->cur_mux[idx] = cur; in via_mux_enum_put()
2302 if (spec->dyn_adc_switch) { in via_mux_enum_put()
2303 int adc_idx = spec->inputs[cur].adc_idx; in via_mux_enum_put()
2304 mux = spec->mux_nids[adc_idx]; in via_mux_enum_put()
2307 mux = spec->mux_nids[idx]; in via_mux_enum_put()
2317 spec->inputs[cur].mux_idx); in via_mux_enum_put()
2339 struct via_spec *spec = codec->spec; in create_input_src_ctls() local
2342 if (spec->num_inputs <= 1 || !count) in create_input_src_ctls()
2345 knew = via_clone_control(spec, &via_input_src_ctl); in create_input_src_ctls()
2353 static void add_loopback_list(struct via_spec *spec, hda_nid_t mix, int idx) in add_loopback_list() argument
2357 if (spec->num_loopbacks >= ARRAY_SIZE(spec->loopback_list) - 1) in add_loopback_list()
2359 list = spec->loopback_list + spec->num_loopbacks; in add_loopback_list()
2363 spec->num_loopbacks++; in add_loopback_list()
2364 spec->loopback.amplist = spec->loopback_list; in add_loopback_list()
2376 struct via_spec *spec = codec->spec; in add_input_route() local
2379 spec->inputs[spec->num_inputs].adc_idx = -1; in add_input_route()
2380 spec->inputs[spec->num_inputs].pin = pin; in add_input_route()
2381 for (c = 0; c < spec->num_adc_nids; c++) { in add_input_route()
2382 if (spec->mux_nids[c]) { in add_input_route()
2383 idx = get_connection_index(codec, spec->mux_nids[c], in add_input_route()
2387 spec->inputs[spec->num_inputs].mux_idx = idx; in add_input_route()
2389 if (!is_reachable_nid(codec, spec->adc_nids[c], pin)) in add_input_route()
2392 spec->inputs[spec->num_inputs].adc_idx = c; in add_input_route()
2394 if (!spec->dyn_adc_switch && in add_input_route()
2395 spec->num_inputs > 0 && spec->inputs[0].adc_idx != c) { in add_input_route()
2398 spec->dyn_adc_switch = 1; in add_input_route()
2410 struct via_spec *spec = codec->spec; in parse_analog_inputs() local
2411 const struct auto_pin_cfg *cfg = &spec->autocfg; in parse_analog_inputs()
2424 spec->inputs[spec->num_inputs++].label = in parse_analog_inputs()
2429 if (spec->aa_mix_nid && in parse_analog_inputs()
2430 add_input_route(codec, spec->aa_mix_nid)) in parse_analog_inputs()
2431 spec->inputs[spec->num_inputs++].label = "Stereo Mixer"; in parse_analog_inputs()
2439 struct via_spec *spec = codec->spec; in create_loopback_ctls() local
2440 const struct auto_pin_cfg *cfg = &spec->autocfg; in create_loopback_ctls()
2445 if (!spec->aa_mix_nid) in create_loopback_ctls()
2457 idx = get_connection_index(codec, spec->aa_mix_nid, pin); in create_loopback_ctls()
2459 err = via_new_analog_input(spec, label, type_idx, in create_loopback_ctls()
2460 idx, spec->aa_mix_nid); in create_loopback_ctls()
2463 add_loopback_list(spec, spec->aa_mix_nid, idx); in create_loopback_ctls()
2467 for (j = 0; j < spec->smart51_nums; j++) { in create_loopback_ctls()
2468 if (spec->smart51_pins[j] == pin) { in create_loopback_ctls()
2469 spec->smart51_idxs[j] = idx; in create_loopback_ctls()
2470 spec->smart51_labels[j] = label; in create_loopback_ctls()
2481 struct via_spec *spec = codec->spec; in create_mic_boost_ctls() local
2482 const struct auto_pin_cfg *cfg = &spec->autocfg; in create_mic_boost_ctls()
2505 err = __via_add_control(spec, VIA_CTL_WIDGET_VOL, name, type_idx, in create_mic_boost_ctls()
2516 struct via_spec *spec = codec->spec; in create_multi_adc_ctls() local
2520 for (i = 0; i < spec->num_adc_nids; i++) { in create_multi_adc_ctls()
2521 hda_nid_t adc = spec->adc_nids[i]; in create_multi_adc_ctls()
2522 err = __via_add_control(spec, VIA_CTL_WIDGET_VOL, in create_multi_adc_ctls()
2528 err = __via_add_control(spec, VIA_CTL_WIDGET_MUTE, in create_multi_adc_ctls()
2537 for (i = 0; i < spec->num_adc_nids; i++) in create_multi_adc_ctls()
2538 if (!spec->mux_nids[i]) in create_multi_adc_ctls()
2552 static int init_bind_ctl(struct via_spec *spec, struct hda_bind_ctls **ctl_ret, in init_bind_ctl() argument
2562 for (i = 0; i < spec->num_adc_nids; i++) in init_bind_ctl()
2564 HDA_COMPOSE_AMP_VAL(spec->adc_nids[i], 3, 0, HDA_INPUT); in init_bind_ctl()
2572 struct via_spec *spec = codec->spec; in create_dyn_adc_ctls() local
2577 err = init_bind_ctl(spec, &spec->bind_cap_vol, &snd_hda_bind_vol); in create_dyn_adc_ctls()
2580 err = init_bind_ctl(spec, &spec->bind_cap_sw, &snd_hda_bind_sw); in create_dyn_adc_ctls()
2585 knew = via_clone_control(spec, &via_bind_cap_vol_ctl); in create_dyn_adc_ctls()
2588 knew->private_value = (long)spec->bind_cap_vol; in create_dyn_adc_ctls()
2590 knew = via_clone_control(spec, &via_bind_cap_sw_ctl); in create_dyn_adc_ctls()
2593 knew->private_value = (long)spec->bind_cap_sw; in create_dyn_adc_ctls()
2605 struct via_spec *spec = codec->spec; in via_auto_create_analog_input_ctls() local
2611 if (spec->dyn_adc_switch) in via_auto_create_analog_input_ctls()
2647 struct via_spec *spec = codec->spec; in vt1708_jack_detect_get() local
2649 if (spec->codec_type != VT1708) in vt1708_jack_detect_get()
2651 ucontrol->value.integer.value[0] = spec->vt1708_jack_detect; in vt1708_jack_detect_get()
2659 struct via_spec *spec = codec->spec; in vt1708_jack_detect_put() local
2662 if (spec->codec_type != VT1708) in vt1708_jack_detect_put()
2665 if (spec->vt1708_jack_detect == val) in vt1708_jack_detect_put()
2667 spec->vt1708_jack_detect = val; in vt1708_jack_detect_put()
2668 if (spec->vt1708_jack_detect && in vt1708_jack_detect_put()
2674 vt1708_update_hp_work(spec); in vt1708_jack_detect_put()
2692 struct via_spec *spec = codec->spec; in via_parse_auto_config() local
2695 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL); in via_parse_auto_config()
2698 if (!spec->autocfg.line_outs && !spec->autocfg.hp_pins[0]) in via_parse_auto_config()
2704 err = via_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); in via_parse_auto_config()
2717 spec->multiout.max_channels = spec->multiout.num_dacs * 2; in via_parse_auto_config()
2722 if (spec->kctls.list) in via_parse_auto_config()
2723 spec->mixers[spec->num_mixers++] = spec->kctls.list; in via_parse_auto_config()
2726 if (spec->hp_dac_nid && spec->hp_mix_path.depth) { in via_parse_auto_config()
2737 if (spec->slave_dig_outs[0]) in via_parse_auto_config()
2738 codec->slave_dig_outs = spec->slave_dig_outs; in via_parse_auto_config()
2745 struct via_spec *spec = codec->spec; in via_auto_init_dig_outs() local
2746 if (spec->multiout.dig_out_nid) in via_auto_init_dig_outs()
2747 init_output_pin(codec, spec->autocfg.dig_out_pins[0], PIN_OUT); in via_auto_init_dig_outs()
2748 if (spec->slave_dig_outs[0]) in via_auto_init_dig_outs()
2749 init_output_pin(codec, spec->autocfg.dig_out_pins[1], PIN_OUT); in via_auto_init_dig_outs()
2754 struct via_spec *spec = codec->spec; in via_auto_init_dig_in() local
2755 if (!spec->dig_in_nid) in via_auto_init_dig_in()
2757 snd_hda_codec_write(codec, spec->autocfg.dig_in_pin, 0, in via_auto_init_dig_in()
2764 struct via_spec *spec = codec->spec; in via_auto_init_unsol_event() local
2765 struct auto_pin_cfg *cfg = &spec->autocfg; in via_auto_init_unsol_event()
2793 struct via_spec *spec = codec->spec; in via_init() local
2796 for (i = 0; i < spec->num_iverbs; i++) in via_init()
2797 snd_hda_sequence_write(codec, spec->init_verbs[i]); in via_init()
2813 vt1708_update_hp_work(spec); in via_init()
2821 struct via_spec *spec = container_of(work, struct via_spec, in vt1708_update_hp_jack_state() local
2823 if (spec->codec_type != VT1708) in vt1708_update_hp_jack_state()
2825 snd_hda_jack_set_dirty_all(spec->codec); in vt1708_update_hp_jack_state()
2827 if (spec->vt1708_hp_present in vt1708_update_hp_jack_state()
2828 != snd_hda_jack_detect(spec->codec, spec->autocfg.hp_pins[0])) { in vt1708_update_hp_jack_state()
2829 spec->vt1708_hp_present ^= 1; in vt1708_update_hp_jack_state()
2830 via_hp_automute(spec->codec); in vt1708_update_hp_jack_state()
2832 if (spec->vt1708_jack_detect) in vt1708_update_hp_jack_state()
2833 schedule_delayed_work(&spec->vt1708_hp_work, in vt1708_update_hp_jack_state()
2839 struct via_spec *spec = codec->spec; in get_mux_nids() local
2844 for (i = 0; i < spec->num_adc_nids; i++) { in get_mux_nids()
2845 nid = spec->adc_nids[i]; in get_mux_nids()
2855 spec->mux_nids[i] = nid; in get_mux_nids()
2866 struct via_spec *spec; in patch_vt1708() local
2870 spec = via_new_spec(codec); in patch_vt1708()
2871 if (spec == NULL) in patch_vt1708()
2874 spec->aa_mix_nid = 0x17; in patch_vt1708()
2888 if (!via_clone_control(spec, &vt1708_jack_detect_ctl)) in patch_vt1708()
2893 spec->stream_analog_playback = &vt1708_pcm_analog_s16_playback; in patch_vt1708()
2895 spec->init_verbs[spec->num_iverbs++] = vt1708_init_verbs; in patch_vt1708()
2899 INIT_DELAYED_WORK(&spec->vt1708_hp_work, vt1708_update_hp_jack_state); in patch_vt1708()
2905 struct via_spec *spec; in patch_vt1709() local
2909 spec = via_new_spec(codec); in patch_vt1709()
2910 if (spec == NULL) in patch_vt1709()
2913 spec->aa_mix_nid = 0x18; in patch_vt1709()
2928 struct via_spec *spec = codec->spec; in set_widgets_power_state_vt1708B() local
2932 if ((spec->codec_type != VT1708B_4CH) && in set_widgets_power_state_vt1708B()
2939 == ((spec->codec_type == VT1708S) ? 5 : 0)); in set_widgets_power_state_vt1708B()
2957 if (spec->smart51_enabled) in set_widgets_power_state_vt1708B()
2966 if (spec->smart51_enabled) in set_widgets_power_state_vt1708B()
2974 if (spec->smart51_enabled) in set_widgets_power_state_vt1708B()
2994 } else if (codec->vendor_id == 0x11064397 && spec->hp_independent_mode) in set_widgets_power_state_vt1708B()
3001 struct via_spec *spec; in patch_vt1708B() local
3008 spec = via_new_spec(codec); in patch_vt1708B()
3009 if (spec == NULL) in patch_vt1708B()
3012 spec->aa_mix_nid = 0x16; in patch_vt1708B()
3023 spec->set_widgets_power_state = set_widgets_power_state_vt1708B; in patch_vt1708B()
3040 struct via_spec *spec = codec->spec; in fill_dig_outs() local
3043 for (i = 0; i < spec->autocfg.dig_outs; i++) { in fill_dig_outs()
3047 nid = spec->autocfg.dig_out_pins[i]; in fill_dig_outs()
3053 if (!spec->multiout.dig_out_nid) in fill_dig_outs()
3054 spec->multiout.dig_out_nid = nid; in fill_dig_outs()
3056 spec->slave_dig_outs[0] = nid; in fill_dig_outs()
3064 struct via_spec *spec = codec->spec; in fill_dig_in() local
3068 if (!spec->autocfg.dig_in_pin) in fill_dig_in()
3081 spec->autocfg.dig_in_pin); in fill_dig_in()
3083 spec->dig_in_nid = dig_nid; in fill_dig_in()
3101 struct via_spec *spec; in patch_vt1708S() local
3105 spec = via_new_spec(codec); in patch_vt1708S()
3106 if (spec == NULL) in patch_vt1708S()
3109 spec->aa_mix_nid = 0x16; in patch_vt1708S()
3120 spec->init_verbs[spec->num_iverbs++] = vt1708S_init_verbs; in patch_vt1708S()
3140 spec->set_widgets_power_state = set_widgets_power_state_vt1708B; in patch_vt1708S()
3186 struct via_spec *spec; in patch_vt1702() local
3190 spec = via_new_spec(codec); in patch_vt1702()
3191 if (spec == NULL) in patch_vt1702()
3194 spec->aa_mix_nid = 0x1a; in patch_vt1702()
3210 spec->init_verbs[spec->num_iverbs++] = vt1702_init_verbs; in patch_vt1702()
3214 spec->set_widgets_power_state = set_widgets_power_state_vt1702; in patch_vt1702()
3231 struct via_spec *spec = codec->spec; in set_widgets_power_state_vt1718S() local
3261 if (spec->smart51_enabled) in set_widgets_power_state_vt1718S()
3268 if (!spec->hp_independent_mode) /* check for redirected HP */ in set_widgets_power_state_vt1718S()
3271 if (!spec->hp_independent_mode && parm2 != AC_PWRST_D3) in set_widgets_power_state_vt1718S()
3280 if (spec->smart51_enabled) in set_widgets_power_state_vt1718S()
3284 if (spec->hp_independent_mode) { in set_widgets_power_state_vt1718S()
3299 struct via_spec *spec = codec->spec; in add_secret_dac_path() local
3304 if (!spec->aa_mix_nid) in add_secret_dac_path()
3306 nums = snd_hda_get_connections(codec, spec->aa_mix_nid, conn, in add_secret_dac_path()
3321 spec->aa_mix_nid, in add_secret_dac_path()
3331 struct via_spec *spec; in patch_vt1718S() local
3335 spec = via_new_spec(codec); in patch_vt1718S()
3336 if (spec == NULL) in patch_vt1718S()
3339 spec->aa_mix_nid = 0x21; in patch_vt1718S()
3351 spec->init_verbs[spec->num_iverbs++] = vt1718S_init_verbs; in patch_vt1718S()
3355 spec->set_widgets_power_state = set_widgets_power_state_vt1718S; in patch_vt1718S()
3390 struct via_spec *spec = codec->spec; in vt1716s_dmic_put() local
3395 spec->dmic_enabled = index; in vt1716s_dmic_put()
3433 struct via_spec *spec = codec->spec; in set_widgets_power_state_vt1716S() local
3456 if (spec->dmic_enabled) in set_widgets_power_state_vt1716S()
3470 if (spec->smart51_enabled) in set_widgets_power_state_vt1716S()
3479 if (spec->smart51_enabled) in set_widgets_power_state_vt1716S()
3484 if (spec->smart51_enabled) in set_widgets_power_state_vt1716S()
3496 if (!spec->hp_independent_mode && present) in set_widgets_power_state_vt1716S()
3511 if (spec->hp_independent_mode) in set_widgets_power_state_vt1716S()
3522 struct via_spec *spec; in patch_vt1716S() local
3526 spec = via_new_spec(codec); in patch_vt1716S()
3527 if (spec == NULL) in patch_vt1716S()
3530 spec->aa_mix_nid = 0x16; in patch_vt1716S()
3541 spec->init_verbs[spec->num_iverbs++] = vt1716S_init_verbs; in patch_vt1716S()
3543 spec->mixers[spec->num_mixers] = vt1716s_dmic_mixer; in patch_vt1716S()
3544 spec->num_mixers++; in patch_vt1716S()
3546 spec->mixers[spec->num_mixers++] = vt1716S_mono_out_mixer; in patch_vt1716S()
3550 spec->set_widgets_power_state = set_widgets_power_state_vt1716S; in patch_vt1716S()
3578 struct via_spec *spec = codec->spec; in set_widgets_power_state_vt2002P() local
3602 if (spec->codec_type == VT1802) { in set_widgets_power_state_vt2002P()
3616 if (spec->codec_type == VT1802) { in set_widgets_power_state_vt2002P()
3630 if (spec->hp_independent_mode) in set_widgets_power_state_vt2002P()
3640 if (spec->codec_type == VT1802) in set_widgets_power_state_vt2002P()
3650 if (spec->codec_type == VT1802) { in set_widgets_power_state_vt2002P()
3683 struct via_spec *spec; in patch_vt2002P() local
3687 spec = via_new_spec(codec); in patch_vt2002P()
3688 if (spec == NULL) in patch_vt2002P()
3691 spec->aa_mix_nid = 0x21; in patch_vt2002P()
3694 if (spec->codec_type == VT1802) in patch_vt2002P()
3705 if (spec->codec_type == VT1802) in patch_vt2002P()
3706 spec->init_verbs[spec->num_iverbs++] = vt1802_init_verbs; in patch_vt2002P()
3708 spec->init_verbs[spec->num_iverbs++] = vt2002P_init_verbs; in patch_vt2002P()
3712 spec->set_widgets_power_state = set_widgets_power_state_vt2002P; in patch_vt2002P()
3728 struct via_spec *spec = codec->spec; in set_widgets_power_state_vt1812() local
3759 if (spec->hp_independent_mode) in set_widgets_power_state_vt1812()
3804 struct via_spec *spec; in patch_vt1812() local
3808 spec = via_new_spec(codec); in patch_vt1812()
3809 if (spec == NULL) in patch_vt1812()
3812 spec->aa_mix_nid = 0x21; in patch_vt1812()
3824 spec->init_verbs[spec->num_iverbs++] = vt1812_init_verbs; in patch_vt1812()
3828 spec->set_widgets_power_state = set_widgets_power_state_vt1812; in patch_vt1812()