Lines Matching full:codec
3 * Universal Interface for Intel High Definition Audio Codec
99 static void parse_user_hints(struct hda_codec *codec) in parse_user_hints() argument
101 struct hda_gen_spec *spec = codec->spec; in parse_user_hints()
104 val = snd_hda_get_bool_hint(codec, "jack_detect"); in parse_user_hints()
106 codec->no_jack_detect = !val; in parse_user_hints()
107 val = snd_hda_get_bool_hint(codec, "inv_jack_detect"); in parse_user_hints()
109 codec->inv_jack_detect = !!val; in parse_user_hints()
110 val = snd_hda_get_bool_hint(codec, "trigger_sense"); in parse_user_hints()
112 codec->no_trigger_sense = !val; in parse_user_hints()
113 val = snd_hda_get_bool_hint(codec, "inv_eapd"); in parse_user_hints()
115 codec->inv_eapd = !!val; in parse_user_hints()
116 val = snd_hda_get_bool_hint(codec, "pcm_format_first"); in parse_user_hints()
118 codec->pcm_format_first = !!val; in parse_user_hints()
119 val = snd_hda_get_bool_hint(codec, "sticky_stream"); in parse_user_hints()
121 codec->no_sticky_stream = !val; in parse_user_hints()
122 val = snd_hda_get_bool_hint(codec, "spdif_status_reset"); in parse_user_hints()
124 codec->spdif_status_reset = !!val; in parse_user_hints()
125 val = snd_hda_get_bool_hint(codec, "pin_amp_workaround"); in parse_user_hints()
127 codec->pin_amp_workaround = !!val; in parse_user_hints()
128 val = snd_hda_get_bool_hint(codec, "single_adc_amp"); in parse_user_hints()
130 codec->single_adc_amp = !!val; in parse_user_hints()
131 val = snd_hda_get_bool_hint(codec, "power_save_node"); in parse_user_hints()
133 codec->power_save_node = !!val; in parse_user_hints()
135 val = snd_hda_get_bool_hint(codec, "auto_mute"); in parse_user_hints()
138 val = snd_hda_get_bool_hint(codec, "auto_mic"); in parse_user_hints()
141 val = snd_hda_get_bool_hint(codec, "line_in_auto_switch"); in parse_user_hints()
144 val = snd_hda_get_bool_hint(codec, "auto_mute_via_amp"); in parse_user_hints()
147 val = snd_hda_get_bool_hint(codec, "need_dac_fix"); in parse_user_hints()
150 val = snd_hda_get_bool_hint(codec, "primary_hp"); in parse_user_hints()
153 val = snd_hda_get_bool_hint(codec, "multi_io"); in parse_user_hints()
156 val = snd_hda_get_bool_hint(codec, "multi_cap_vol"); in parse_user_hints()
159 val = snd_hda_get_bool_hint(codec, "inv_dmic_split"); in parse_user_hints()
162 val = snd_hda_get_bool_hint(codec, "indep_hp"); in parse_user_hints()
165 val = snd_hda_get_bool_hint(codec, "add_stereo_mix_input"); in parse_user_hints()
169 val = snd_hda_get_bool_hint(codec, "add_out_jack_modes"); in parse_user_hints()
172 val = snd_hda_get_bool_hint(codec, "add_in_jack_modes"); in parse_user_hints()
175 val = snd_hda_get_bool_hint(codec, "add_jack_modes"); in parse_user_hints()
178 val = snd_hda_get_bool_hint(codec, "power_down_unused"); in parse_user_hints()
181 val = snd_hda_get_bool_hint(codec, "add_hp_mic"); in parse_user_hints()
184 val = snd_hda_get_bool_hint(codec, "hp_mic_detect"); in parse_user_hints()
187 val = snd_hda_get_bool_hint(codec, "vmaster"); in parse_user_hints()
191 if (!snd_hda_get_int_hint(codec, "mixer_nid", &val)) in parse_user_hints()
199 #define update_pin_ctl(codec, pin, val) \ argument
200 snd_hda_codec_write_cache(codec, pin, 0, \
204 static inline void restore_pin_ctl(struct hda_codec *codec, hda_nid_t pin) in restore_pin_ctl() argument
206 update_pin_ctl(codec, pin, snd_hda_codec_get_pin_target(codec, pin)); in restore_pin_ctl()
210 static void set_pin_target(struct hda_codec *codec, hda_nid_t pin, in set_pin_target() argument
215 val = snd_hda_correct_pin_ctl(codec, pin, val); in set_pin_target()
216 snd_hda_codec_set_pin_target(codec, pin, val); in set_pin_target()
218 update_pin_ctl(codec, pin, val); in set_pin_target()
222 static void set_pin_targets(struct hda_codec *codec, int num_pins, in set_pin_targets() argument
227 set_pin_target(codec, pins[i], val, false); in set_pin_targets()
250 static struct nid_path *get_nid_path(struct hda_codec *codec, in get_nid_path() argument
254 struct hda_gen_spec *spec = codec->spec; in get_nid_path()
275 * @codec: the HDA codec
281 int snd_hda_get_path_idx(struct hda_codec *codec, struct nid_path *path) in snd_hda_get_path_idx() argument
283 struct hda_gen_spec *spec = codec->spec; in snd_hda_get_path_idx()
299 * @codec: the HDA codec
302 struct nid_path *snd_hda_get_path_from_idx(struct hda_codec *codec, int idx) in snd_hda_get_path_from_idx() argument
304 struct hda_gen_spec *spec = codec->spec; in snd_hda_get_path_from_idx()
313 static bool is_dac_already_used(struct hda_codec *codec, hda_nid_t nid) in is_dac_already_used() argument
315 struct hda_gen_spec *spec = codec->spec; in is_dac_already_used()
327 static bool is_reachable_path(struct hda_codec *codec, in is_reachable_path() argument
332 return snd_hda_get_conn_index(codec, to_nid, from_nid, true) >= 0; in is_reachable_path()
339 static bool is_ctl_used(struct hda_codec *codec, unsigned int val, int type) in is_ctl_used() argument
341 struct hda_gen_spec *spec = codec->spec; in is_ctl_used()
354 static bool is_ctl_associated(struct hda_codec *codec, hda_nid_t nid, in is_ctl_associated() argument
358 return is_ctl_used(codec, val, type); in is_ctl_associated()
361 static void print_nid_path(struct hda_codec *codec, in print_nid_path() argument
374 codec_dbg(codec, "%s path: depth=%d '%s'\n", pfx, path->depth, buf); in print_nid_path()
378 static bool __parse_nid_path(struct hda_codec *codec, in __parse_nid_path() argument
391 nums = snd_hda_get_conn_list(codec, to_nid, &conn); in __parse_nid_path()
398 get_wcaps_type(get_wcaps(codec, conn[i])) != AC_WID_AUD_OUT || in __parse_nid_path()
399 is_dac_already_used(codec, conn[i])) in __parse_nid_path()
410 type = get_wcaps_type(get_wcaps(codec, conn[i])); in __parse_nid_path()
414 if (__parse_nid_path(codec, from_nid, conn[i], in __parse_nid_path()
423 if (nums > 1 && get_wcaps_type(get_wcaps(codec, to_nid)) != AC_WID_AUD_MIX) in __parse_nid_path()
432 * @codec: the HDA codec
448 static bool snd_hda_parse_nid_path(struct hda_codec *codec, hda_nid_t from_nid, in snd_hda_parse_nid_path() argument
452 if (__parse_nid_path(codec, from_nid, to_nid, anchor_nid, path, 1)) { in snd_hda_parse_nid_path()
463 * @codec: the HDA codec
471 snd_hda_add_new_path(struct hda_codec *codec, hda_nid_t from_nid, in snd_hda_add_new_path() argument
474 struct hda_gen_spec *spec = codec->spec; in snd_hda_add_new_path()
477 if (from_nid && to_nid && !is_reachable_path(codec, from_nid, to_nid)) in snd_hda_add_new_path()
481 path = get_nid_path(codec, from_nid, to_nid, anchor_nid); in snd_hda_add_new_path()
489 if (snd_hda_parse_nid_path(codec, from_nid, to_nid, anchor_nid, path)) in snd_hda_add_new_path()
498 static void invalidate_nid_path(struct hda_codec *codec, int idx) in invalidate_nid_path() argument
500 struct nid_path *path = snd_hda_get_path_from_idx(codec, idx); in invalidate_nid_path()
506 /* return a DAC if paired to the given pin by codec driver */
507 static hda_nid_t get_preferred_dac(struct hda_codec *codec, hda_nid_t pin) in get_preferred_dac() argument
509 struct hda_gen_spec *spec = codec->spec; in get_preferred_dac()
521 static hda_nid_t look_for_dac(struct hda_codec *codec, hda_nid_t pin, in look_for_dac() argument
524 struct hda_gen_spec *spec = codec->spec; in look_for_dac()
530 if (!nid || is_dac_already_used(codec, nid)) in look_for_dac()
532 cap_digital = !!(get_wcaps(codec, nid) & AC_WCAP_DIGITAL); in look_for_dac()
535 if (is_reachable_path(codec, nid, pin)) in look_for_dac()
549 static bool same_amp_caps(struct hda_codec *codec, hda_nid_t nid1, in same_amp_caps() argument
552 if (!(get_wcaps(codec, nid1) & (1 << (dir + 1)))) in same_amp_caps()
553 return !(get_wcaps(codec, nid2) & (1 << (dir + 1))); in same_amp_caps()
554 return (query_amp_caps(codec, nid1, dir) == in same_amp_caps()
555 query_amp_caps(codec, nid2, dir)); in same_amp_caps()
559 static hda_nid_t look_for_out_mute_nid(struct hda_codec *codec, in look_for_out_mute_nid() argument
565 if (nid_has_mute(codec, path->path[i], HDA_OUTPUT)) in look_for_out_mute_nid()
568 nid_has_mute(codec, path->path[i], HDA_INPUT)) in look_for_out_mute_nid()
575 static hda_nid_t look_for_out_vol_nid(struct hda_codec *codec, in look_for_out_vol_nid() argument
578 struct hda_gen_spec *spec = codec->spec; in look_for_out_vol_nid()
585 if (nid_has_volume(codec, nid, HDA_OUTPUT)) in look_for_out_vol_nid()
596 static bool has_amp_in(struct hda_codec *codec, struct nid_path *path, int idx) in has_amp_in() argument
599 unsigned int caps = get_wcaps(codec, nid); in has_amp_in()
610 static bool has_amp_out(struct hda_codec *codec, struct nid_path *path, int idx) in has_amp_out() argument
613 unsigned int caps = get_wcaps(codec, nid); in has_amp_out()
624 static bool is_active_nid(struct hda_codec *codec, hda_nid_t nid, in is_active_nid() argument
627 struct hda_gen_spec *spec = codec->spec; in is_active_nid()
628 int type = get_wcaps_type(get_wcaps(codec, nid)); in is_active_nid()
632 if (nid == codec->core.afg) in is_active_nid()
638 if (codec->power_save_node) { in is_active_nid()
659 #define is_active_nid_for_any(codec, nid) \ argument
660 is_active_nid(codec, nid, HDA_OUTPUT, -1)
663 static int get_amp_val_to_activate(struct hda_codec *codec, hda_nid_t nid, in get_amp_val_to_activate() argument
681 static bool is_stereo_amps(struct hda_codec *codec, hda_nid_t nid, int dir) in is_stereo_amps() argument
683 unsigned int wcaps = get_wcaps(codec, nid); in is_stereo_amps()
690 if (snd_hda_get_num_conns(codec, nid) != 1) in is_stereo_amps()
692 if (snd_hda_get_connections(codec, nid, &conn, 1) < 0) in is_stereo_amps()
694 return !!(get_wcaps(codec, conn) & AC_WCAP_STEREO); in is_stereo_amps()
698 static void init_amp(struct hda_codec *codec, hda_nid_t nid, int dir, int idx) in init_amp() argument
700 unsigned int caps = query_amp_caps(codec, nid, dir); in init_amp()
701 int val = get_amp_val_to_activate(codec, nid, dir, caps, false); in init_amp()
703 if (is_stereo_amps(codec, nid, dir)) in init_amp()
704 snd_hda_codec_amp_init_stereo(codec, nid, dir, idx, 0xff, val); in init_amp()
706 snd_hda_codec_amp_init(codec, nid, 0, dir, idx, 0xff, val); in init_amp()
710 static int update_amp(struct hda_codec *codec, hda_nid_t nid, int dir, int idx, in update_amp() argument
713 if (is_stereo_amps(codec, nid, dir)) in update_amp()
714 return snd_hda_codec_amp_stereo(codec, nid, dir, idx, in update_amp()
717 return snd_hda_codec_amp_update(codec, nid, 0, dir, idx, in update_amp()
724 static unsigned int get_amp_mask_to_modify(struct hda_codec *codec, in get_amp_mask_to_modify() argument
731 if (is_ctl_associated(codec, nid, dir, idx, NID_PATH_MUTE_CTL)) in get_amp_mask_to_modify()
735 if (is_ctl_associated(codec, nid, dir, idx, NID_PATH_VOL_CTL) || in get_amp_mask_to_modify()
736 is_ctl_associated(codec, nid, dir, idx, NID_PATH_BOOST_CTL)) in get_amp_mask_to_modify()
742 static void activate_amp(struct hda_codec *codec, hda_nid_t nid, int dir, in activate_amp() argument
748 caps = query_amp_caps(codec, nid, dir); in activate_amp()
749 val = get_amp_val_to_activate(codec, nid, dir, caps, enable); in activate_amp()
750 mask = get_amp_mask_to_modify(codec, nid, dir, idx_to_check, caps); in activate_amp()
755 update_amp(codec, nid, dir, idx, mask, val); in activate_amp()
758 static void check_and_activate_amp(struct hda_codec *codec, hda_nid_t nid, in check_and_activate_amp() argument
763 if (!enable && is_active_nid(codec, nid, dir, idx_to_check)) in check_and_activate_amp()
765 activate_amp(codec, nid, dir, idx, idx_to_check, enable); in check_and_activate_amp()
768 static void activate_amp_out(struct hda_codec *codec, struct nid_path *path, in activate_amp_out() argument
772 init_amp(codec, nid, HDA_OUTPUT, 0); in activate_amp_out()
773 check_and_activate_amp(codec, nid, HDA_OUTPUT, 0, 0, enable); in activate_amp_out()
776 static void activate_amp_in(struct hda_codec *codec, struct nid_path *path, in activate_amp_in() argument
779 struct hda_gen_spec *spec = codec->spec; in activate_amp_in()
785 nums = snd_hda_get_conn_list(codec, nid, &conn); in activate_amp_in()
788 type = get_wcaps_type(get_wcaps(codec, nid)); in activate_amp_in()
790 (type == AC_WID_AUD_IN && codec->single_adc_amp)) { in activate_amp_in()
797 init_amp(codec, nid, HDA_INPUT, n); in activate_amp_in()
808 activate_amp(codec, nid, HDA_INPUT, n, n, false); in activate_amp_in()
812 check_and_activate_amp(codec, nid, HDA_INPUT, n, idx, enable); in activate_amp_in()
817 static hda_nid_t path_power_update(struct hda_codec *codec, in path_power_update() argument
826 if (!(get_wcaps(codec, nid) & AC_WCAP_POWER)) in path_power_update()
828 if (nid == codec->core.afg) in path_power_update()
830 if (!allow_powerdown || is_active_nid_for_any(codec, nid)) in path_power_update()
834 power = snd_hda_codec_read(codec, nid, 0, in path_power_update()
837 snd_hda_codec_write(codec, nid, 0, in path_power_update()
848 snd_hdac_regmap_sync_node(&codec->core, nid); in path_power_update()
856 static void sync_power_state_change(struct hda_codec *codec, hda_nid_t nid) in sync_power_state_change() argument
860 snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_POWER_STATE, 0); in sync_power_state_change()
866 * @codec: the HDA codec
873 void snd_hda_activate_path(struct hda_codec *codec, struct nid_path *path, in snd_hda_activate_path() argument
876 struct hda_gen_spec *spec = codec->spec; in snd_hda_activate_path()
882 if (enable && (spec->power_down_unused || codec->power_save_node)) in snd_hda_activate_path()
883 path_power_update(codec, path, codec->power_save_node); in snd_hda_activate_path()
889 snd_hda_codec_write_cache(codec, nid, 0, in snd_hda_activate_path()
892 if (has_amp_in(codec, path, i)) in snd_hda_activate_path()
893 activate_amp_in(codec, path, i, enable, add_aamix); in snd_hda_activate_path()
894 if (has_amp_out(codec, path, i)) in snd_hda_activate_path()
895 activate_amp_out(codec, path, i, enable); in snd_hda_activate_path()
901 static void path_power_down_sync(struct hda_codec *codec, struct nid_path *path) in path_power_down_sync() argument
903 struct hda_gen_spec *spec = codec->spec; in path_power_down_sync()
905 if (!(spec->power_down_unused || codec->power_save_node) || path->active) in path_power_down_sync()
907 sync_power_state_change(codec, path_power_update(codec, path, true)); in path_power_down_sync()
911 static void set_pin_eapd(struct hda_codec *codec, hda_nid_t pin, bool enable) in set_pin_eapd() argument
913 struct hda_gen_spec *spec = codec->spec; in set_pin_eapd()
915 !(snd_hda_query_pin_caps(codec, pin) & AC_PINCAP_EAPD)) in set_pin_eapd()
919 if (codec->inv_eapd) in set_pin_eapd()
921 snd_hda_codec_write_cache(codec, pin, 0, in set_pin_eapd()
927 static void resume_path_from_idx(struct hda_codec *codec, int path_idx) in resume_path_from_idx() argument
929 struct nid_path *path = snd_hda_get_path_from_idx(codec, path_idx); in resume_path_from_idx()
931 snd_hda_activate_path(codec, path, path->active, false); in resume_path_from_idx()
1008 static int add_vol_ctl(struct hda_codec *codec, const char *pfx, int cidx, in add_vol_ctl() argument
1018 return __add_pb_vol_ctrl(codec->spec, HDA_CTL_WIDGET_VOL, pfx, cidx, val); in add_vol_ctl()
1022 static int get_default_ch_nums(struct hda_codec *codec, struct nid_path *path, in get_default_ch_nums() argument
1028 if (nid && (get_wcaps(codec, nid) & AC_WCAP_STEREO)) in get_default_ch_nums()
1034 static int add_stereo_vol(struct hda_codec *codec, const char *pfx, int cidx, in add_stereo_vol() argument
1037 int chs = get_default_ch_nums(codec, path, NID_PATH_VOL_CTL); in add_stereo_vol()
1038 return add_vol_ctl(codec, pfx, cidx, chs, path); in add_stereo_vol()
1044 static int add_sw_ctl(struct hda_codec *codec, const char *pfx, int cidx, in add_sw_ctl() argument
1058 int nums = snd_hda_get_num_conns(codec, nid); in add_sw_ctl()
1064 return __add_pb_sw_ctrl(codec->spec, type, pfx, cidx, val); in add_sw_ctl()
1067 static int add_stereo_sw(struct hda_codec *codec, const char *pfx, in add_stereo_sw() argument
1070 int chs = get_default_ch_nums(codec, path, NID_PATH_MUTE_CTL); in add_stereo_sw()
1071 return add_sw_ctl(codec, pfx, cidx, chs, path); in add_stereo_sw()
1078 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in sync_auto_mute_bits() local
1079 struct hda_gen_spec *spec = codec->spec; in sync_auto_mute_bits()
1105 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in hda_gen_bind_mute_get() local
1109 mutex_lock(&codec->control_mutex); in hda_gen_bind_mute_get()
1114 mutex_unlock(&codec->control_mutex); in hda_gen_bind_mute_get()
1121 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in hda_gen_bind_mute_put() local
1127 mutex_lock(&codec->control_mutex); in hda_gen_bind_mute_put()
1139 mutex_unlock(&codec->control_mutex); in hda_gen_bind_mute_put()
1144 static bool path_has_mixer(struct hda_codec *codec, int path_idx, int ctl_type) in path_has_mixer() argument
1146 struct nid_path *path = snd_hda_get_path_from_idx(codec, path_idx); in path_has_mixer()
1155 static const char *get_line_out_pfx(struct hda_codec *codec, int ch, in get_line_out_pfx() argument
1158 struct hda_gen_spec *spec = codec->spec; in get_line_out_pfx()
1163 !codec->force_pin_prefix && in get_line_out_pfx()
1171 !codec->force_pin_prefix && in get_line_out_pfx()
1185 !path_has_mixer(codec, spec->hp_paths[0], ctl_type)) in get_line_out_pfx()
1197 !path_has_mixer(codec, spec->speaker_paths[0], ctl_type)) in get_line_out_pfx()
1208 bool hp_lo_shared = !path_has_mixer(codec, spec->hp_paths[0], ctl_type); in get_line_out_pfx()
1209 bool spk_lo_shared = !path_has_mixer(codec, spec->speaker_paths[0], ctl_type); in get_line_out_pfx()
1266 static int assign_out_path_ctls(struct hda_codec *codec, struct nid_path *path) in assign_out_path_ctls() argument
1268 struct hda_gen_spec *spec = codec->spec; in assign_out_path_ctls()
1280 nid = look_for_out_vol_nid(codec, path); in assign_out_path_ctls()
1285 if (is_ctl_used(codec, val, NID_PATH_VOL_CTL)) in assign_out_path_ctls()
1291 nid = look_for_out_mute_nid(codec, path); in assign_out_path_ctls()
1293 unsigned int wid_type = get_wcaps_type(get_wcaps(codec, nid)); in assign_out_path_ctls()
1295 nid_has_mute(codec, nid, HDA_OUTPUT)) in assign_out_path_ctls()
1299 if (is_ctl_used(codec, val, NID_PATH_MUTE_CTL)) in assign_out_path_ctls()
1329 static hda_nid_t get_primary_out(struct hda_codec *codec, int idx) in get_primary_out() argument
1331 struct hda_gen_spec *spec = codec->spec; in get_primary_out()
1343 static inline hda_nid_t try_dac(struct hda_codec *codec, in try_dac() argument
1346 return is_reachable_path(codec, dac, pin) ? dac : 0; in try_dac()
1350 static int try_assign_dacs(struct hda_codec *codec, int num_outs, in try_assign_dacs() argument
1355 struct hda_gen_spec *spec = codec->spec; in try_assign_dacs()
1368 path = snd_hda_get_path_from_idx(codec, path_idx[i]); in try_assign_dacs()
1370 badness += assign_out_path_ctls(codec, path); in try_assign_dacs()
1375 dacs[i] = get_preferred_dac(codec, pin); in try_assign_dacs()
1377 if (is_dac_already_used(codec, dacs[i])) in try_assign_dacs()
1384 dacs[i] = look_for_dac(codec, pin, false); in try_assign_dacs()
1388 if (is_reachable_path(codec, dacs[j], pin)) { in try_assign_dacs()
1391 invalidate_nid_path(codec, path_idx[j]); in try_assign_dacs()
1400 dac = try_dac(codec, get_primary_out(codec, i), pin); in try_assign_dacs()
1402 dac = try_dac(codec, dacs[0], pin); in try_assign_dacs()
1404 dac = try_dac(codec, get_primary_out(codec, i), pin); in try_assign_dacs()
1412 } else if (is_reachable_path(codec, spec->private_dac_nids[0], pin)) { in try_assign_dacs()
1422 path = snd_hda_add_new_path(codec, dac, pin, -spec->mixer_nid); in try_assign_dacs()
1425 path = snd_hda_add_new_path(codec, dac, pin, 0); in try_assign_dacs()
1431 /* print_nid_path(codec, "output", path); */ in try_assign_dacs()
1433 path_idx[i] = snd_hda_get_path_idx(codec, path); in try_assign_dacs()
1434 badness += assign_out_path_ctls(codec, path); in try_assign_dacs()
1442 static hda_nid_t get_dac_if_single(struct hda_codec *codec, hda_nid_t pin) in get_dac_if_single() argument
1444 struct hda_gen_spec *spec = codec->spec; in get_dac_if_single()
1450 if (!nid || is_dac_already_used(codec, nid)) in get_dac_if_single()
1452 if (is_reachable_path(codec, nid, pin)) { in get_dac_if_single()
1462 static bool can_be_multiio_pin(struct hda_codec *codec, in can_be_multiio_pin() argument
1467 defcfg = snd_hda_codec_get_pincfg(codec, nid); in can_be_multiio_pin()
1472 caps = snd_hda_query_pin_caps(codec, nid); in can_be_multiio_pin()
1479 static int count_multiio_pins(struct hda_codec *codec, hda_nid_t reference_pin) in count_multiio_pins() argument
1481 struct hda_gen_spec *spec = codec->spec; in count_multiio_pins()
1483 unsigned int defcfg = snd_hda_codec_get_pincfg(codec, reference_pin); in count_multiio_pins()
1492 if (can_be_multiio_pin(codec, location, in count_multiio_pins()
1508 static int fill_multi_ios(struct hda_codec *codec, in fill_multi_ios() argument
1512 struct hda_gen_spec *spec = codec->spec; in fill_multi_ios()
1515 unsigned int defcfg = snd_hda_codec_get_pincfg(codec, reference_pin); in fill_multi_ios()
1524 num_pins = count_multiio_pins(codec, reference_pin); in fill_multi_ios()
1535 if (!can_be_multiio_pin(codec, location, nid)) in fill_multi_ios()
1545 dac = get_dac_if_single(codec, nid); in fill_multi_ios()
1547 dac = look_for_dac(codec, nid, false); in fill_multi_ios()
1552 path = snd_hda_add_new_path(codec, dac, nid, in fill_multi_ios()
1558 /* print_nid_path(codec, "multiio", path); */ in fill_multi_ios()
1562 snd_hda_get_path_idx(codec, path); in fill_multi_ios()
1586 path = snd_hda_get_path_from_idx(codec, spec->out_paths[cfg->line_outs + i]); in fill_multi_ios()
1587 badness += assign_out_path_ctls(codec, path); in fill_multi_ios()
1594 static bool map_singles(struct hda_codec *codec, int outs, in map_singles() argument
1597 struct hda_gen_spec *spec = codec->spec; in map_singles()
1605 dac = get_dac_if_single(codec, pins[i]); in map_singles()
1608 path = snd_hda_add_new_path(codec, dac, pins[i], in map_singles()
1611 path = snd_hda_add_new_path(codec, dac, pins[i], 0); in map_singles()
1615 /* print_nid_path(codec, "output", path); */ in map_singles()
1617 path_idx[i] = snd_hda_get_path_idx(codec, path); in map_singles()
1630 static int check_aamix_out_path(struct hda_codec *codec, int path_idx) in check_aamix_out_path() argument
1632 struct hda_gen_spec *spec = codec->spec; in check_aamix_out_path()
1636 path = snd_hda_get_path_from_idx(codec, path_idx); in check_aamix_out_path()
1643 path = snd_hda_add_new_path(codec, dac, pin, spec->mixer_nid); in check_aamix_out_path()
1654 path = snd_hda_add_new_path(codec, dac, pin, in check_aamix_out_path()
1659 /* print_nid_path(codec, "output-aamix", path); */ in check_aamix_out_path()
1662 return snd_hda_get_path_idx(codec, path); in check_aamix_out_path()
1666 static bool indep_hp_possible(struct hda_codec *codec) in indep_hp_possible() argument
1668 struct hda_gen_spec *spec = codec->spec; in indep_hp_possible()
1677 path = snd_hda_get_path_from_idx(codec, idx); in indep_hp_possible()
1689 path = snd_hda_get_path_from_idx(codec, spec->out_paths[i]); in indep_hp_possible()
1694 path = snd_hda_get_path_from_idx(codec, spec->speaker_paths[i]); in indep_hp_possible()
1705 static void refill_shared_dacs(struct hda_codec *codec, int num_outs, in refill_shared_dacs() argument
1714 path = snd_hda_get_path_from_idx(codec, path_idx[i]); in refill_shared_dacs()
1722 static int fill_and_eval_dacs(struct hda_codec *codec, in fill_and_eval_dacs() argument
1726 struct hda_gen_spec *spec = codec->spec; in fill_and_eval_dacs()
1755 mapped = map_singles(codec, cfg->line_outs, in fill_and_eval_dacs()
1759 mapped |= map_singles(codec, cfg->hp_outs, in fill_and_eval_dacs()
1763 mapped |= map_singles(codec, cfg->speaker_outs, in fill_and_eval_dacs()
1770 err = fill_multi_ios(codec, cfg->line_out_pins[0], true); in fill_and_eval_dacs()
1777 badness += try_assign_dacs(codec, cfg->line_outs, cfg->line_out_pins, in fill_and_eval_dacs()
1784 err = fill_multi_ios(codec, cfg->line_out_pins[0], false); in fill_and_eval_dacs()
1791 err = try_assign_dacs(codec, cfg->hp_outs, cfg->hp_pins, in fill_and_eval_dacs()
1800 err = try_assign_dacs(codec, cfg->speaker_outs, in fill_and_eval_dacs()
1811 err = fill_multi_ios(codec, cfg->line_out_pins[0], false); in fill_and_eval_dacs()
1819 check_aamix_out_path(codec, spec->out_paths[0]); in fill_and_eval_dacs()
1822 check_aamix_out_path(codec, spec->hp_paths[0]); in fill_and_eval_dacs()
1825 check_aamix_out_path(codec, spec->speaker_paths[0]); in fill_and_eval_dacs()
1830 if (count_multiio_pins(codec, cfg->hp_pins[0]) >= 2) in fill_and_eval_dacs()
1858 if (spec->indep_hp && !indep_hp_possible(codec)) in fill_and_eval_dacs()
1863 refill_shared_dacs(codec, cfg->hp_outs, in fill_and_eval_dacs()
1867 refill_shared_dacs(codec, cfg->speaker_outs, in fill_and_eval_dacs()
1878 codec_dbg(codec, fmt, ##__VA_ARGS__)
1881 do { if (0) codec_dbg(codec, fmt, ##__VA_ARGS__); } while (0)
1885 static inline void print_nid_path_idx(struct hda_codec *codec, in print_nid_path_idx() argument
1890 path = snd_hda_get_path_from_idx(codec, idx); in print_nid_path_idx()
1892 print_nid_path(codec, pfx, path); in print_nid_path_idx()
1895 static void debug_show_configs(struct hda_codec *codec, in debug_show_configs() argument
1898 struct hda_gen_spec *spec = codec->spec; in debug_show_configs()
1911 print_nid_path_idx(codec, " out", spec->out_paths[i]); in debug_show_configs()
1918 print_nid_path_idx(codec, " mio", in debug_show_configs()
1929 print_nid_path_idx(codec, " hp ", spec->hp_paths[i]); in debug_show_configs()
1939 print_nid_path_idx(codec, " spk", spec->speaker_paths[i]); in debug_show_configs()
1941 print_nid_path_idx(codec, " mix", spec->aamix_out_paths[i]); in debug_show_configs()
1944 #define debug_show_configs(codec, cfg) /* NOP */ argument
1947 /* find all available DACs of the codec */
1948 static void fill_all_dac_nids(struct hda_codec *codec) in fill_all_dac_nids() argument
1950 struct hda_gen_spec *spec = codec->spec; in fill_all_dac_nids()
1955 for_each_hda_codec_node(nid, codec) { in fill_all_dac_nids()
1956 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_AUD_OUT) in fill_all_dac_nids()
1959 codec_err(codec, "Too many DACs!\n"); in fill_all_dac_nids()
1966 static int parse_output_paths(struct hda_codec *codec) in parse_output_paths() argument
1968 struct hda_gen_spec *spec = codec->spec; in parse_output_paths()
1984 badness = fill_and_eval_dacs(codec, fill_hardwired, in parse_output_paths()
1993 debug_show_configs(codec, cfg); in parse_output_paths()
2045 fill_and_eval_dacs(codec, best_wired, best_mio); in parse_output_paths()
2049 debug_show_configs(codec, cfg); in parse_output_paths()
2053 path = snd_hda_get_path_from_idx(codec, spec->out_paths[0]); in parse_output_paths()
2055 spec->vmaster_nid = look_for_out_vol_nid(codec, path); in parse_output_paths()
2057 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, in parse_output_paths()
2069 set_pin_targets(codec, cfg->line_outs, cfg->line_out_pins, val); in parse_output_paths()
2071 set_pin_targets(codec, cfg->hp_outs, cfg->hp_pins, PIN_HP); in parse_output_paths()
2074 set_pin_targets(codec, cfg->speaker_outs, in parse_output_paths()
2079 if (spec->indep_hp && !indep_hp_possible(codec)) in parse_output_paths()
2087 static int create_multi_out_ctls(struct hda_codec *codec, in create_multi_out_ctls() argument
2090 struct hda_gen_spec *spec = codec->spec; in create_multi_out_ctls()
2102 path = snd_hda_get_path_from_idx(codec, spec->out_paths[i]); in create_multi_out_ctls()
2106 name = get_line_out_pfx(codec, i, &index, NID_PATH_VOL_CTL); in create_multi_out_ctls()
2109 err = add_vol_ctl(codec, "Center", 0, 1, path); in create_multi_out_ctls()
2112 err = add_vol_ctl(codec, "LFE", 0, 2, path); in create_multi_out_ctls()
2116 err = add_stereo_vol(codec, name, index, path); in create_multi_out_ctls()
2121 name = get_line_out_pfx(codec, i, &index, NID_PATH_MUTE_CTL); in create_multi_out_ctls()
2123 err = add_sw_ctl(codec, "Center", 0, 1, path); in create_multi_out_ctls()
2126 err = add_sw_ctl(codec, "LFE", 0, 2, path); in create_multi_out_ctls()
2130 err = add_stereo_sw(codec, name, index, path); in create_multi_out_ctls()
2138 static int create_extra_out(struct hda_codec *codec, int path_idx, in create_extra_out() argument
2144 path = snd_hda_get_path_from_idx(codec, path_idx); in create_extra_out()
2147 err = add_stereo_vol(codec, pfx, cidx, path); in create_extra_out()
2150 err = add_stereo_sw(codec, pfx, cidx, path); in create_extra_out()
2157 static int create_extra_outs(struct hda_codec *codec, int num_pins, in create_extra_outs() argument
2177 err = create_extra_out(codec, paths[i], name, idx); in create_extra_outs()
2184 static int create_hp_out_ctls(struct hda_codec *codec) in create_hp_out_ctls() argument
2186 struct hda_gen_spec *spec = codec->spec; in create_hp_out_ctls()
2187 return create_extra_outs(codec, spec->autocfg.hp_outs, in create_hp_out_ctls()
2192 static int create_speaker_out_ctls(struct hda_codec *codec) in create_speaker_out_ctls() argument
2194 struct hda_gen_spec *spec = codec->spec; in create_speaker_out_ctls()
2195 return create_extra_outs(codec, spec->autocfg.speaker_outs, in create_speaker_out_ctls()
2204 static void call_hp_automute(struct hda_codec *codec,
2215 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in indep_hp_get() local
2216 struct hda_gen_spec *spec = codec->spec; in indep_hp_get()
2221 static void update_aamix_paths(struct hda_codec *codec, bool do_mix,
2228 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in indep_hp_put() local
2229 struct hda_gen_spec *spec = codec->spec; in indep_hp_put()
2249 update_aamix_paths(codec, spec->aamix_mode, in indep_hp_put()
2254 update_aamix_paths(codec, spec->aamix_mode, in indep_hp_put()
2266 call_hp_automute(codec, NULL); in indep_hp_put()
2283 static int create_indep_hp_ctls(struct hda_codec *codec) in create_indep_hp_ctls() argument
2285 struct hda_gen_spec *spec = codec->spec; in create_indep_hp_ctls()
2313 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in ch_mode_info() local
2314 struct hda_gen_spec *spec = codec->spec; in ch_mode_info()
2330 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in ch_mode_get() local
2331 struct hda_gen_spec *spec = codec->spec; in ch_mode_get()
2338 get_multiio_path(struct hda_codec *codec, int idx) in get_multiio_path() argument
2340 struct hda_gen_spec *spec = codec->spec; in get_multiio_path()
2341 return snd_hda_get_path_from_idx(codec, in get_multiio_path()
2345 static void update_automute_all(struct hda_codec *codec);
2355 static int set_multi_io(struct hda_codec *codec, int idx, bool output) in set_multi_io() argument
2357 struct hda_gen_spec *spec = codec->spec; in set_multi_io()
2361 path = get_multiio_path(codec, idx); in set_multi_io()
2369 set_pin_target(codec, nid, PIN_OUT, true); in set_multi_io()
2370 snd_hda_activate_path(codec, path, true, aamix_default(spec)); in set_multi_io()
2371 set_pin_eapd(codec, nid, true); in set_multi_io()
2373 set_pin_eapd(codec, nid, false); in set_multi_io()
2374 snd_hda_activate_path(codec, path, false, aamix_default(spec)); in set_multi_io()
2375 set_pin_target(codec, nid, spec->multi_io[idx].ctl_in, true); in set_multi_io()
2376 path_power_down_sync(codec, path); in set_multi_io()
2380 update_automute_all(codec); in set_multi_io()
2388 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in ch_mode_put() local
2389 struct hda_gen_spec *spec = codec->spec; in ch_mode_put()
2399 set_multi_io(codec, i, i < ch); in ch_mode_put()
2415 static int create_multi_channel_mode(struct hda_codec *codec) in create_multi_channel_mode() argument
2417 struct hda_gen_spec *spec = codec->spec; in create_multi_channel_mode()
2435 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in loopback_mixing_get() local
2436 struct hda_gen_spec *spec = codec->spec; in loopback_mixing_get()
2441 static void update_aamix_paths(struct hda_codec *codec, bool do_mix, in update_aamix_paths() argument
2445 struct hda_gen_spec *spec = codec->spec; in update_aamix_paths()
2448 nomix_path = snd_hda_get_path_from_idx(codec, nomix_path_idx); in update_aamix_paths()
2449 mix_path = snd_hda_get_path_from_idx(codec, mix_path_idx); in update_aamix_paths()
2461 snd_hda_activate_path(codec, nomix_path, false, true); in update_aamix_paths()
2462 snd_hda_activate_path(codec, mix_path, true, true); in update_aamix_paths()
2463 path_power_down_sync(codec, nomix_path); in update_aamix_paths()
2465 snd_hda_activate_path(codec, mix_path, false, false); in update_aamix_paths()
2466 snd_hda_activate_path(codec, nomix_path, true, false); in update_aamix_paths()
2467 path_power_down_sync(codec, mix_path); in update_aamix_paths()
2472 static void update_output_paths(struct hda_codec *codec, int num_outs, in update_output_paths() argument
2475 struct hda_gen_spec *spec = codec->spec; in update_output_paths()
2480 path = snd_hda_get_path_from_idx(codec, paths[i]); in update_output_paths()
2482 snd_hda_activate_path(codec, path, path->active, in update_output_paths()
2490 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in loopback_mixing_put() local
2491 struct hda_gen_spec *spec = codec->spec; in loopback_mixing_put()
2499 update_aamix_paths(codec, val, spec->out_paths[0], in loopback_mixing_put()
2502 update_aamix_paths(codec, val, spec->hp_paths[0], in loopback_mixing_put()
2505 update_aamix_paths(codec, val, spec->speaker_paths[0], in loopback_mixing_put()
2509 update_output_paths(codec, cfg->line_outs, spec->out_paths); in loopback_mixing_put()
2511 update_output_paths(codec, cfg->hp_outs, spec->hp_paths); in loopback_mixing_put()
2513 update_output_paths(codec, cfg->speaker_outs, in loopback_mixing_put()
2527 static int create_loopback_mixing_ctl(struct hda_codec *codec) in create_loopback_mixing_ctl() argument
2529 struct hda_gen_spec *spec = codec->spec; in create_loopback_mixing_ctl()
2543 static void call_update_outputs(struct hda_codec *codec);
2546 static void update_hp_mic(struct hda_codec *codec, int adc_mux, bool force) in update_hp_mic() argument
2548 struct hda_gen_spec *spec = codec->spec; in update_hp_mic()
2557 val = snd_hda_codec_get_pin_target(codec, pin); in update_hp_mic()
2567 val = snd_hda_get_default_vref(codec, pin); in update_hp_mic()
2568 /* if the HP pin doesn't support VREF and the codec driver gives an in update_hp_mic()
2573 unsigned int vref_val = snd_hda_get_default_vref(codec, vref_pin); in update_hp_mic()
2575 snd_hda_set_pin_ctl_cache(codec, vref_pin, in update_hp_mic()
2584 set_pin_target(codec, pin, val, true); in update_hp_mic()
2585 call_hp_automute(codec, NULL); in update_hp_mic()
2590 static int create_hp_mic(struct hda_codec *codec) in create_hp_mic() argument
2592 struct hda_gen_spec *spec = codec->spec; in create_hp_mic()
2606 defcfg = snd_hda_codec_get_pincfg(codec, cfg->inputs[0].pin); in create_hp_mic()
2624 if (!(snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_IN)) in create_hp_mic()
2635 codec_dbg(codec, "Enable shared I/O jack on NID 0x%x\n", nid); in create_hp_mic()
2643 static int create_hp_mic_jack_mode(struct hda_codec *codec, hda_nid_t pin);
2658 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in out_jack_mode_get() local
2660 if (snd_hda_codec_get_pin_target(codec, nid) == PIN_HP) in out_jack_mode_get()
2670 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in out_jack_mode_put() local
2675 if (snd_hda_codec_get_pin_target(codec, nid) == val) in out_jack_mode_put()
2677 snd_hda_set_pin_ctl_cache(codec, nid, val); in out_jack_mode_put()
2688 static bool find_kctl_name(struct hda_codec *codec, const char *name, int idx) in find_kctl_name() argument
2690 struct hda_gen_spec *spec = codec->spec; in find_kctl_name()
2701 static void get_jack_mode_name(struct hda_codec *codec, hda_nid_t pin, in get_jack_mode_name() argument
2704 struct hda_gen_spec *spec = codec->spec; in get_jack_mode_name()
2707 snd_hda_get_pin_label(codec, pin, &spec->autocfg, name, name_len, &idx); in get_jack_mode_name()
2710 for (; find_kctl_name(codec, name, idx); idx++) in get_jack_mode_name()
2714 static int get_out_jack_num_items(struct hda_codec *codec, hda_nid_t pin) in get_out_jack_num_items() argument
2716 struct hda_gen_spec *spec = codec->spec; in get_out_jack_num_items()
2718 unsigned int pincap = snd_hda_query_pin_caps(codec, pin); in get_out_jack_num_items()
2725 static int create_out_jack_modes(struct hda_codec *codec, int num_pins, in create_out_jack_modes() argument
2728 struct hda_gen_spec *spec = codec->spec; in create_out_jack_modes()
2735 if (get_out_jack_num_items(codec, pin) > 1) { in create_out_jack_modes()
2738 get_jack_mode_name(codec, pin, name, sizeof(name)); in create_out_jack_modes()
2762 static unsigned int get_vref_caps(struct hda_codec *codec, hda_nid_t pin) in get_vref_caps() argument
2766 pincap = snd_hda_query_pin_caps(codec, pin); in get_vref_caps()
2805 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in in_jack_mode_info() local
2807 unsigned int vref_caps = get_vref_caps(codec, nid); in in_jack_mode_info()
2820 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in in_jack_mode_get() local
2822 unsigned int vref_caps = get_vref_caps(codec, nid); in in_jack_mode_get()
2825 idx = snd_hda_codec_get_pin_target(codec, nid) & AC_PINCTL_VREFEN; in in_jack_mode_get()
2833 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in in_jack_mode_put() local
2835 unsigned int vref_caps = get_vref_caps(codec, nid); in in_jack_mode_put()
2838 val = snd_hda_codec_get_pin_target(codec, nid); in in_jack_mode_put()
2845 snd_hda_set_pin_ctl_cache(codec, nid, val); in in_jack_mode_put()
2856 static int get_in_jack_num_items(struct hda_codec *codec, hda_nid_t pin) in get_in_jack_num_items() argument
2858 struct hda_gen_spec *spec = codec->spec; in get_in_jack_num_items()
2861 nitems = hweight32(get_vref_caps(codec, pin)); in get_in_jack_num_items()
2865 static int create_in_jack_mode(struct hda_codec *codec, hda_nid_t pin) in create_in_jack_mode() argument
2867 struct hda_gen_spec *spec = codec->spec; in create_in_jack_mode()
2876 defcfg = snd_hda_codec_get_pincfg(codec, pin); in create_in_jack_mode()
2881 if (get_in_jack_num_items(codec, pin) <= 1) in create_in_jack_mode()
2884 get_jack_mode_name(codec, pin, name, sizeof(name)); in create_in_jack_mode()
2898 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in hp_mic_jack_mode_info() local
2900 int out_jacks = get_out_jack_num_items(codec, nid); in hp_mic_jack_mode_info()
2901 int in_jacks = get_in_jack_num_items(codec, nid); in hp_mic_jack_mode_info()
2919 unsigned int vref_caps = get_vref_caps(codec, nid); in hp_mic_jack_mode_info()
2929 static int get_cur_hp_mic_jack_mode(struct hda_codec *codec, hda_nid_t nid) in get_cur_hp_mic_jack_mode() argument
2931 int out_jacks = get_out_jack_num_items(codec, nid); in get_cur_hp_mic_jack_mode()
2932 int in_jacks = get_in_jack_num_items(codec, nid); in get_cur_hp_mic_jack_mode()
2933 unsigned int val = snd_hda_codec_get_pin_target(codec, nid); in get_cur_hp_mic_jack_mode()
2942 unsigned int vref_caps = get_vref_caps(codec, nid); in get_cur_hp_mic_jack_mode()
2953 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in hp_mic_jack_mode_get() local
2956 get_cur_hp_mic_jack_mode(codec, nid); in hp_mic_jack_mode_get()
2963 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in hp_mic_jack_mode_put() local
2965 int out_jacks = get_out_jack_num_items(codec, nid); in hp_mic_jack_mode_put()
2966 int in_jacks = get_in_jack_num_items(codec, nid); in hp_mic_jack_mode_put()
2969 oldval = get_cur_hp_mic_jack_mode(codec, nid); in hp_mic_jack_mode_put()
2982 unsigned int vref_caps = get_vref_caps(codec, nid); in hp_mic_jack_mode_put()
2983 val = snd_hda_codec_get_pin_target(codec, nid); in hp_mic_jack_mode_put()
2987 val = snd_hda_get_default_vref(codec, nid) | PIN_IN; in hp_mic_jack_mode_put()
2989 snd_hda_set_pin_ctl_cache(codec, nid, val); in hp_mic_jack_mode_put()
2990 call_hp_automute(codec, NULL); in hp_mic_jack_mode_put()
3002 static int create_hp_mic_jack_mode(struct hda_codec *codec, hda_nid_t pin) in create_hp_mic_jack_mode() argument
3004 struct hda_gen_spec *spec = codec->spec; in create_hp_mic_jack_mode()
3038 static bool look_for_mix_leaf_ctls(struct hda_codec *codec, hda_nid_t mix_nid, in look_for_mix_leaf_ctls() argument
3046 idx = snd_hda_get_conn_index(codec, mix_nid, pin, true); in look_for_mix_leaf_ctls()
3051 if (nid_has_volume(codec, mix_nid, HDA_INPUT)) in look_for_mix_leaf_ctls()
3053 if (nid_has_mute(codec, mix_nid, HDA_INPUT)) in look_for_mix_leaf_ctls()
3059 num_conns = snd_hda_get_conn_list(codec, mix_nid, &list); in look_for_mix_leaf_ctls()
3063 if (!*mix_val && nid_has_volume(codec, nid, HDA_OUTPUT) && in look_for_mix_leaf_ctls()
3064 !is_ctl_associated(codec, nid, HDA_OUTPUT, 0, NID_PATH_VOL_CTL)) in look_for_mix_leaf_ctls()
3066 if (!*mute_val && nid_has_mute(codec, nid, HDA_OUTPUT) && in look_for_mix_leaf_ctls()
3067 !is_ctl_associated(codec, nid, HDA_OUTPUT, 0, NID_PATH_MUTE_CTL)) in look_for_mix_leaf_ctls()
3074 static int new_analog_input(struct hda_codec *codec, int input_idx, in new_analog_input() argument
3078 struct hda_gen_spec *spec = codec->spec; in new_analog_input()
3083 if (!look_for_mix_leaf_ctls(codec, mix_nid, pin, &mix_val, &mute_val)) in new_analog_input()
3086 path = snd_hda_add_new_path(codec, pin, mix_nid, 0); in new_analog_input()
3089 print_nid_path(codec, "loopback", path); in new_analog_input()
3090 spec->loopback_paths[input_idx] = snd_hda_get_path_idx(codec, path); in new_analog_input()
3115 path = snd_hda_add_new_path(codec, spec->mixer_nid, in new_analog_input()
3118 print_nid_path(codec, "loopback-merge", path); in new_analog_input()
3123 snd_hda_get_path_idx(codec, path); in new_analog_input()
3130 static int is_input_pin(struct hda_codec *codec, hda_nid_t nid) in is_input_pin() argument
3132 unsigned int pincap = snd_hda_query_pin_caps(codec, nid); in is_input_pin()
3136 /* Parse the codec tree and retrieve ADCs */
3137 static int fill_adc_nids(struct hda_codec *codec) in fill_adc_nids() argument
3139 struct hda_gen_spec *spec = codec->spec; in fill_adc_nids()
3145 for_each_hda_codec_node(nid, codec) { in fill_adc_nids()
3146 unsigned int caps = get_wcaps(codec, nid); in fill_adc_nids()
3167 static int check_dyn_adc_switch(struct hda_codec *codec) in check_dyn_adc_switch() argument
3169 struct hda_gen_spec *spec = codec->spec; in check_dyn_adc_switch()
3198 codec_dbg(codec, "enabling ADC switching\n"); in check_dyn_adc_switch()
3209 invalidate_nid_path(codec, in check_dyn_adc_switch()
3223 codec_dbg(codec, "reducing to a single ADC\n"); in check_dyn_adc_switch()
3235 static int parse_capture_source(struct hda_codec *codec, hda_nid_t pin, in parse_capture_source() argument
3239 struct hda_gen_spec *spec = codec->spec; in parse_capture_source()
3249 if (!is_reachable_path(codec, pin, adc)) in parse_capture_source()
3251 path = snd_hda_add_new_path(codec, pin, adc, anchor); in parse_capture_source()
3254 print_nid_path(codec, "input", path); in parse_capture_source()
3256 snd_hda_get_path_idx(codec, path); in parse_capture_source()
3262 snd_hda_add_imux_item(codec, imux, label, cfg_idx, NULL); in parse_capture_source()
3277 static int fill_input_pin_labels(struct hda_codec *codec) in fill_input_pin_labels() argument
3279 struct hda_gen_spec *spec = codec->spec; in fill_input_pin_labels()
3288 if (!is_input_pin(codec, pin)) in fill_input_pin_labels()
3291 label = hda_get_autocfg_input_label(codec, cfg, i); in fill_input_pin_labels()
3310 static int create_input_ctls(struct hda_codec *codec) in create_input_ctls() argument
3312 struct hda_gen_spec *spec = codec->spec; in create_input_ctls()
3319 num_adcs = fill_adc_nids(codec); in create_input_ctls()
3323 err = fill_input_pin_labels(codec); in create_input_ctls()
3331 if (!is_input_pin(codec, pin)) in create_input_ctls()
3336 val |= snd_hda_get_default_vref(codec, pin); in create_input_ctls()
3338 !snd_hda_codec_get_pin_target(codec, pin)) in create_input_ctls()
3339 set_pin_target(codec, pin, val, false); in create_input_ctls()
3342 if (is_reachable_path(codec, pin, mixer)) { in create_input_ctls()
3343 err = new_analog_input(codec, i, pin, in create_input_ctls()
3352 err = parse_capture_source(codec, pin, i, num_adcs, in create_input_ctls()
3358 err = create_in_jack_mode(codec, pin); in create_input_ctls()
3366 err = parse_capture_source(codec, mixer, CFG_IDX_MIX, num_adcs, in create_input_ctls()
3383 static struct nid_path *get_input_path(struct hda_codec *codec, int adc_idx, int imux_idx) in get_input_path() argument
3385 struct hda_gen_spec *spec = codec->spec; in get_input_path()
3396 return snd_hda_get_path_from_idx(codec, spec->input_paths[imux_idx][adc_idx]); in get_input_path()
3399 static int mux_select(struct hda_codec *codec, unsigned int adc_idx,
3405 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in mux_enum_info() local
3406 struct hda_gen_spec *spec = codec->spec; in mux_enum_info()
3413 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in mux_enum_get() local
3414 struct hda_gen_spec *spec = codec->spec; in mux_enum_get()
3425 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in mux_enum_put() local
3427 return mux_select(codec, adc_idx, in mux_enum_put()
3451 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in cap_put_caller() local
3452 struct hda_gen_spec *spec = codec->spec; in cap_put_caller()
3459 mutex_lock(&codec->control_mutex); in cap_put_caller()
3461 path = get_input_path(codec, adc_idx, i); in cap_put_caller()
3469 mutex_unlock(&codec->control_mutex); in cap_put_caller()
3471 spec->cap_sync_hook(codec, kcontrol, ucontrol); in cap_put_caller()
3520 static int parse_capvol_in_path(struct hda_codec *codec, struct nid_path *path) in parse_capvol_in_path() argument
3532 if (nid_has_volume(codec, nid, HDA_OUTPUT)) in parse_capvol_in_path()
3535 else if (nid_has_volume(codec, nid, HDA_INPUT)) { in parse_capvol_in_path()
3537 if (!depth && codec->single_adc_amp) in parse_capvol_in_path()
3544 if (nid_has_mute(codec, nid, HDA_OUTPUT)) in parse_capvol_in_path()
3547 else if (nid_has_mute(codec, nid, HDA_INPUT)) { in parse_capvol_in_path()
3549 if (!depth && codec->single_adc_amp) in parse_capvol_in_path()
3559 static bool is_inv_dmic_pin(struct hda_codec *codec, hda_nid_t nid) in is_inv_dmic_pin() argument
3561 struct hda_gen_spec *spec = codec->spec; in is_inv_dmic_pin()
3573 val = snd_hda_codec_get_pincfg(codec, nid); in is_inv_dmic_pin()
3583 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in cap_single_sw_put() local
3584 struct hda_gen_spec *spec = codec->spec; in cap_single_sw_put()
3592 spec->cap_sync_hook(codec, kcontrol, ucontrol); in cap_single_sw_put()
3597 static int add_single_cap_ctl(struct hda_codec *codec, const char *label, in add_single_cap_ctl() argument
3601 struct hda_gen_spec *spec = codec->spec; in add_single_cap_ctl()
3643 static int create_single_cap_vol_ctl(struct hda_codec *codec, int idx, in create_single_cap_vol_ctl() argument
3648 err = add_single_cap_ctl(codec, NULL, idx, false, vol_ctl, inv_dmic); in create_single_cap_vol_ctl()
3651 err = add_single_cap_ctl(codec, NULL, idx, true, sw_ctl, inv_dmic); in create_single_cap_vol_ctl()
3658 static int create_bind_cap_vol_ctl(struct hda_codec *codec, int idx, in create_bind_cap_vol_ctl() argument
3661 struct hda_gen_spec *spec = codec->spec; in create_bind_cap_vol_ctl()
3684 static unsigned int get_first_cap_ctl(struct hda_codec *codec, int idx, int type) in get_first_cap_ctl() argument
3690 path = get_input_path(codec, 0, idx); in get_first_cap_ctl()
3697 path = get_input_path(codec, 0, i); in get_first_cap_ctl()
3705 static int create_multi_cap_vol_ctl(struct hda_codec *codec) in create_multi_cap_vol_ctl() argument
3707 struct hda_gen_spec *spec = codec->spec; in create_multi_cap_vol_ctl()
3718 inv_dmic = is_inv_dmic_pin(codec, spec->imux_pins[i]); in create_multi_cap_vol_ctl()
3721 err = add_single_cap_ctl(codec, in create_multi_cap_vol_ctl()
3725 get_first_cap_ctl(codec, i, type), in create_multi_cap_vol_ctl()
3734 static int create_capture_mixers(struct hda_codec *codec) in create_capture_mixers() argument
3736 struct hda_gen_spec *spec = codec->spec; in create_capture_mixers()
3764 path = get_input_path(codec, n, i); in create_capture_mixers()
3767 parse_capvol_in_path(codec, path); in create_capture_mixers()
3772 if (!same_amp_caps(codec, vol, in create_capture_mixers()
3780 if (!same_amp_caps(codec, sw, in create_capture_mixers()
3784 if (is_inv_dmic_pin(codec, spec->imux_pins[i])) in create_capture_mixers()
3789 err = create_single_cap_vol_ctl(codec, n, vol, sw, in create_capture_mixers()
3792 err = create_bind_cap_vol_ctl(codec, n, vol, sw); in create_capture_mixers()
3794 err = create_multi_cap_vol_ctl(codec); in create_capture_mixers()
3807 static bool check_boost_vol(struct hda_codec *codec, hda_nid_t nid, in check_boost_vol() argument
3812 if (!nid_has_volume(codec, nid, dir) || in check_boost_vol()
3813 is_ctl_associated(codec, nid, dir, idx, NID_PATH_VOL_CTL) || in check_boost_vol()
3814 is_ctl_associated(codec, nid, dir, idx, NID_PATH_BOOST_CTL)) in check_boost_vol()
3817 step = (query_amp_caps(codec, nid, dir) & AC_AMPCAP_STEP_SIZE) in check_boost_vol()
3825 static unsigned int look_for_boost_amp(struct hda_codec *codec, in look_for_boost_amp() argument
3836 if (depth && check_boost_vol(codec, nid, HDA_OUTPUT, 0)) { in look_for_boost_amp()
3839 } else if (check_boost_vol(codec, nid, HDA_INPUT, in look_for_boost_amp()
3850 static int parse_mic_boost(struct hda_codec *codec) in parse_mic_boost() argument
3852 struct hda_gen_spec *spec = codec->spec; in parse_mic_boost()
3874 path = get_input_path(codec, 0, i); in parse_mic_boost()
3878 val = look_for_boost_amp(codec, path); in parse_mic_boost()
3899 static int create_mute_led_cdev(struct hda_codec *codec, in create_mute_led_cdev() argument
3906 cdev = devm_kzalloc(&codec->core.dev, sizeof(*cdev), GFP_KERNEL); in create_mute_led_cdev()
3917 return devm_led_classdev_register(&codec->core.dev, cdev); in create_mute_led_cdev()
3927 * @codec: the HDA codec
3930 int snd_hda_gen_add_mute_led_cdev(struct hda_codec *codec, in snd_hda_gen_add_mute_led_cdev() argument
3934 struct hda_gen_spec *spec = codec->spec; in snd_hda_gen_add_mute_led_cdev()
3938 err = create_mute_led_cdev(codec, callback, false); in snd_hda_gen_add_mute_led_cdev()
3940 codec_warn(codec, "failed to create a mute LED cdev\n"); in snd_hda_gen_add_mute_led_cdev()
3946 codec_err(codec, "vmaster hook already present before cdev!\n"); in snd_hda_gen_add_mute_led_cdev()
3964 static void call_micmute_led_update(struct hda_codec *codec) in call_micmute_led_update() argument
3966 struct hda_gen_spec *spec = codec->spec; in call_micmute_led_update()
3992 static void update_micmute_led(struct hda_codec *codec, in update_micmute_led() argument
3996 struct hda_gen_spec *spec = codec->spec; in update_micmute_led()
4000 spec->micmute_led.old_hook(codec, kcontrol, ucontrol); in update_micmute_led()
4012 call_micmute_led_update(codec); in update_micmute_led()
4029 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in micmute_led_mode_get() local
4030 struct hda_gen_spec *spec = codec->spec; in micmute_led_mode_get()
4039 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in micmute_led_mode_put() local
4040 struct hda_gen_spec *spec = codec->spec; in micmute_led_mode_put()
4049 call_micmute_led_update(codec); in micmute_led_mode_put()
4062 static int add_micmute_led_hook(struct hda_codec *codec) in add_micmute_led_hook() argument
4064 struct hda_gen_spec *spec = codec->spec; in add_micmute_led_hook()
4078 * @codec: the HDA codec
4081 * Called from the codec drivers for offering the mic mute LED controls.
4090 int snd_hda_gen_add_micmute_led_cdev(struct hda_codec *codec, in snd_hda_gen_add_micmute_led_cdev() argument
4097 err = create_mute_led_cdev(codec, callback, true); in snd_hda_gen_add_micmute_led_cdev()
4099 codec_warn(codec, "failed to create a mic-mute LED cdev\n"); in snd_hda_gen_add_micmute_led_cdev()
4104 return add_micmute_led_hook(codec); in snd_hda_gen_add_micmute_led_cdev()
4112 static void parse_digital(struct hda_codec *codec) in parse_digital() argument
4114 struct hda_gen_spec *spec = codec->spec; in parse_digital()
4123 dig_nid = look_for_dac(codec, pin, true); in parse_digital()
4126 path = snd_hda_add_new_path(codec, dig_nid, pin, 0); in parse_digital()
4129 print_nid_path(codec, "digout", path); in parse_digital()
4132 spec->digout_paths[i] = snd_hda_get_path_idx(codec, path); in parse_digital()
4133 set_pin_target(codec, pin, PIN_OUT, false); in parse_digital()
4148 for_each_hda_codec_node(dig_nid, codec) { in parse_digital()
4149 unsigned int wcaps = get_wcaps(codec, dig_nid); in parse_digital()
4154 path = snd_hda_add_new_path(codec, pin, dig_nid, 0); in parse_digital()
4156 print_nid_path(codec, "digin", path); in parse_digital()
4160 spec->digin_path = snd_hda_get_path_idx(codec, path); in parse_digital()
4161 set_pin_target(codec, pin, PIN_IN, false); in parse_digital()
4173 static bool dyn_adc_pcm_resetup(struct hda_codec *codec, int cur);
4176 static int mux_select(struct hda_codec *codec, unsigned int adc_idx, in mux_select() argument
4179 struct hda_gen_spec *spec = codec->spec; in mux_select()
4192 old_path = get_input_path(codec, adc_idx, spec->cur_mux[adc_idx]); in mux_select()
4196 snd_hda_activate_path(codec, old_path, false, false); in mux_select()
4201 update_hp_mic(codec, adc_idx, false); in mux_select()
4204 dyn_adc_pcm_resetup(codec, idx); in mux_select()
4206 path = get_input_path(codec, adc_idx, idx); in mux_select()
4211 snd_hda_activate_path(codec, path, true, false); in mux_select()
4213 spec->cap_sync_hook(codec, NULL, NULL); in mux_select()
4214 path_power_down_sync(codec, old_path); in mux_select()
4223 static hda_nid_t set_path_power(struct hda_codec *codec, hda_nid_t nid, in set_path_power() argument
4226 struct hda_gen_spec *spec = codec->spec; in set_path_power()
4245 last = path_power_update(codec, path, true); in set_path_power()
4255 static bool detect_pin_state(struct hda_codec *codec, hda_nid_t pin) in detect_pin_state() argument
4257 if (!is_jack_detectable(codec, pin)) in detect_pin_state()
4259 return snd_hda_jack_detect_state(codec, pin) != HDA_JACK_NOT_PRESENT; in detect_pin_state()
4268 static hda_nid_t set_pin_power_jack(struct hda_codec *codec, hda_nid_t pin, in set_pin_power_jack() argument
4273 if (!codec->power_save_node) in set_pin_power_jack()
4276 on = detect_pin_state(codec, pin); in set_pin_power_jack()
4280 return set_path_power(codec, pin, on, -1); in set_pin_power_jack()
4283 static void pin_power_callback(struct hda_codec *codec, in pin_power_callback() argument
4288 sync_power_state_change(codec, in pin_power_callback()
4289 set_pin_power_jack(codec, jack->nid, on)); in pin_power_callback()
4293 static void pin_power_up_callback(struct hda_codec *codec, in pin_power_up_callback() argument
4296 pin_power_callback(codec, jack, true); in pin_power_up_callback()
4300 static void pin_power_down_callback(struct hda_codec *codec, in pin_power_down_callback() argument
4303 pin_power_callback(codec, jack, false); in pin_power_down_callback()
4307 static void add_pin_power_ctls(struct hda_codec *codec, int num_pins, in add_pin_power_ctls() argument
4315 if (is_jack_detectable(codec, pins[i])) in add_pin_power_ctls()
4316 snd_hda_jack_detect_enable_callback(codec, pins[i], cb); in add_pin_power_ctls()
4318 set_path_power(codec, pins[i], true, -1); in add_pin_power_ctls()
4325 static void add_all_pin_power_ctls(struct hda_codec *codec, bool on) in add_all_pin_power_ctls() argument
4327 struct hda_gen_spec *spec = codec->spec; in add_all_pin_power_ctls()
4331 if (!codec->power_save_node) in add_all_pin_power_ctls()
4333 add_pin_power_ctls(codec, cfg->line_outs, cfg->line_out_pins, on); in add_all_pin_power_ctls()
4335 add_pin_power_ctls(codec, cfg->hp_outs, cfg->hp_pins, on); in add_all_pin_power_ctls()
4337 add_pin_power_ctls(codec, cfg->speaker_outs, cfg->speaker_pins, on); in add_all_pin_power_ctls()
4339 add_pin_power_ctls(codec, 1, &cfg->inputs[i].pin, on); in add_all_pin_power_ctls()
4343 static void sync_pin_power_ctls(struct hda_codec *codec, int num_pins, in sync_pin_power_ctls() argument
4349 if (is_jack_detectable(codec, pins[i])) in sync_pin_power_ctls()
4350 set_pin_power_jack(codec, pins[i], -1); in sync_pin_power_ctls()
4354 static void sync_all_pin_power_ctls(struct hda_codec *codec) in sync_all_pin_power_ctls() argument
4356 struct hda_gen_spec *spec = codec->spec; in sync_all_pin_power_ctls()
4360 if (!codec->power_save_node) in sync_all_pin_power_ctls()
4362 sync_pin_power_ctls(codec, cfg->line_outs, cfg->line_out_pins); in sync_all_pin_power_ctls()
4364 sync_pin_power_ctls(codec, cfg->hp_outs, cfg->hp_pins); in sync_all_pin_power_ctls()
4366 sync_pin_power_ctls(codec, cfg->speaker_outs, cfg->speaker_pins); in sync_all_pin_power_ctls()
4368 sync_pin_power_ctls(codec, 1, &cfg->inputs[i].pin); in sync_all_pin_power_ctls()
4372 static int add_fake_paths(struct hda_codec *codec, hda_nid_t nid, in add_fake_paths() argument
4375 struct hda_gen_spec *spec = codec->spec; in add_fake_paths()
4382 if (get_nid_path(codec, nid, pins[i], 0)) in add_fake_paths()
4397 static int add_fake_beep_paths(struct hda_codec *codec) in add_fake_beep_paths() argument
4399 struct hda_gen_spec *spec = codec->spec; in add_fake_beep_paths()
4404 if (!codec->power_save_node || !nid) in add_fake_beep_paths()
4406 err = add_fake_paths(codec, nid, cfg->line_outs, cfg->line_out_pins); in add_fake_beep_paths()
4410 err = add_fake_paths(codec, nid, cfg->hp_outs, cfg->hp_pins); in add_fake_beep_paths()
4415 err = add_fake_paths(codec, nid, cfg->speaker_outs, in add_fake_beep_paths()
4426 set_path_power(beep->codec, beep->nid, -1, on); in beep_power_hook()
4431 * @codec: the HDA codec
4434 int snd_hda_gen_fix_pin_power(struct hda_codec *codec, hda_nid_t pin) in snd_hda_gen_fix_pin_power() argument
4436 struct hda_gen_spec *spec = codec->spec; in snd_hda_gen_fix_pin_power()
4457 static bool detect_jacks(struct hda_codec *codec, int num_pins, const hda_nid_t *pins) in detect_jacks() argument
4467 if (snd_hda_codec_get_pin_target(codec, nid) & AC_PINCTL_IN_EN) in detect_jacks()
4469 if (snd_hda_jack_detect_state(codec, nid) == HDA_JACK_PRESENT) in detect_jacks()
4476 static void do_automute(struct hda_codec *codec, int num_pins, const hda_nid_t *pins, in do_automute() argument
4479 struct hda_gen_spec *spec = codec->spec; in do_automute()
4488 oldval = snd_hda_codec_get_pin_target(codec, nid); in do_automute()
4496 path = snd_hda_get_path_from_idx(codec, paths[i]); in do_automute()
4522 update_pin_ctl(codec, nid, val); in do_automute()
4525 set_pin_eapd(codec, nid, !mute); in do_automute()
4526 if (codec->power_save_node) { in do_automute()
4529 on = detect_pin_state(codec, nid); in do_automute()
4530 set_path_power(codec, nid, on, -1); in do_automute()
4537 * @codec: the HDA codec
4541 void snd_hda_gen_update_outputs(struct hda_codec *codec) in snd_hda_gen_update_outputs() argument
4543 struct hda_gen_spec *spec = codec->spec; in snd_hda_gen_update_outputs()
4555 do_automute(codec, ARRAY_SIZE(spec->autocfg.hp_pins), in snd_hda_gen_update_outputs()
4568 do_automute(codec, ARRAY_SIZE(spec->autocfg.speaker_pins), in snd_hda_gen_update_outputs()
4583 do_automute(codec, ARRAY_SIZE(spec->autocfg.line_out_pins), in snd_hda_gen_update_outputs()
4588 static void call_update_outputs(struct hda_codec *codec) in call_update_outputs() argument
4590 struct hda_gen_spec *spec = codec->spec; in call_update_outputs()
4592 spec->automute_hook(codec); in call_update_outputs()
4594 snd_hda_gen_update_outputs(codec); in call_update_outputs()
4597 if (spec->auto_mute_via_amp && !codec->bus->shutdown) in call_update_outputs()
4603 * @codec: the HDA codec
4606 void snd_hda_gen_hp_automute(struct hda_codec *codec, in snd_hda_gen_hp_automute() argument
4609 struct hda_gen_spec *spec = codec->spec; in snd_hda_gen_hp_automute()
4619 spec->hp_jack_present = detect_jacks(codec, num_pins, pins); in snd_hda_gen_hp_automute()
4622 call_update_outputs(codec); in snd_hda_gen_hp_automute()
4628 * @codec: the HDA codec
4631 void snd_hda_gen_line_automute(struct hda_codec *codec, in snd_hda_gen_line_automute() argument
4634 struct hda_gen_spec *spec = codec->spec; in snd_hda_gen_line_automute()
4643 detect_jacks(codec, ARRAY_SIZE(spec->autocfg.line_out_pins), in snd_hda_gen_line_automute()
4647 call_update_outputs(codec); in snd_hda_gen_line_automute()
4653 * @codec: the HDA codec
4656 void snd_hda_gen_mic_autoswitch(struct hda_codec *codec, in snd_hda_gen_mic_autoswitch() argument
4659 struct hda_gen_spec *spec = codec->spec; in snd_hda_gen_mic_autoswitch()
4668 if (snd_hda_codec_get_pin_target(codec, pin) & AC_PINCTL_OUT_EN) in snd_hda_gen_mic_autoswitch()
4670 if (snd_hda_jack_detect_state(codec, pin) == HDA_JACK_PRESENT) { in snd_hda_gen_mic_autoswitch()
4671 mux_select(codec, 0, spec->am_entry[i].idx); in snd_hda_gen_mic_autoswitch()
4675 mux_select(codec, 0, spec->am_entry[0].idx); in snd_hda_gen_mic_autoswitch()
4680 static void call_hp_automute(struct hda_codec *codec, in call_hp_automute() argument
4683 struct hda_gen_spec *spec = codec->spec; in call_hp_automute()
4685 spec->hp_automute_hook(codec, jack); in call_hp_automute()
4687 snd_hda_gen_hp_automute(codec, jack); in call_hp_automute()
4690 static void call_line_automute(struct hda_codec *codec, in call_line_automute() argument
4693 struct hda_gen_spec *spec = codec->spec; in call_line_automute()
4695 spec->line_automute_hook(codec, jack); in call_line_automute()
4697 snd_hda_gen_line_automute(codec, jack); in call_line_automute()
4700 static void call_mic_autoswitch(struct hda_codec *codec, in call_mic_autoswitch() argument
4703 struct hda_gen_spec *spec = codec->spec; in call_mic_autoswitch()
4705 spec->mic_autoswitch_hook(codec, jack); in call_mic_autoswitch()
4707 snd_hda_gen_mic_autoswitch(codec, jack); in call_mic_autoswitch()
4711 static void update_automute_all(struct hda_codec *codec) in update_automute_all() argument
4713 call_hp_automute(codec, NULL); in update_automute_all()
4714 call_line_automute(codec, NULL); in update_automute_all()
4715 call_mic_autoswitch(codec, NULL); in update_automute_all()
4724 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in automute_mode_info() local
4725 struct hda_gen_spec *spec = codec->spec; in automute_mode_info()
4738 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in automute_mode_get() local
4739 struct hda_gen_spec *spec = codec->spec; in automute_mode_get()
4753 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in automute_mode_put() local
4754 struct hda_gen_spec *spec = codec->spec; in automute_mode_put()
4787 call_update_outputs(codec); in automute_mode_put()
4799 static int add_automute_mode_enum(struct hda_codec *codec) in add_automute_mode_enum() argument
4801 struct hda_gen_spec *spec = codec->spec; in add_automute_mode_enum()
4812 static int check_auto_mute_availability(struct hda_codec *codec) in check_auto_mute_availability() argument
4814 struct hda_gen_spec *spec = codec->spec; in check_auto_mute_availability()
4847 if (!is_jack_detectable(codec, nid)) in check_auto_mute_availability()
4849 codec_dbg(codec, "Enable HP auto-muting on NID 0x%x\n", nid); in check_auto_mute_availability()
4850 snd_hda_jack_detect_enable_callback(codec, nid, in check_auto_mute_availability()
4859 if (!is_jack_detectable(codec, nid)) in check_auto_mute_availability()
4861 codec_dbg(codec, "Enable Line-Out auto-muting on NID 0x%x\n", nid); in check_auto_mute_availability()
4862 snd_hda_jack_detect_enable_callback(codec, nid, in check_auto_mute_availability()
4877 err = add_automute_mode_enum(codec); in check_auto_mute_availability()
4885 static bool auto_mic_check_imux(struct hda_codec *codec) in auto_mic_check_imux() argument
4887 struct hda_gen_spec *spec = codec->spec; in auto_mic_check_imux()
4902 snd_hda_jack_detect_enable_callback(codec, in auto_mic_check_imux()
4919 static int check_auto_mic_availability(struct hda_codec *codec) in check_auto_mic_availability() argument
4921 struct hda_gen_spec *spec = codec->spec; in check_auto_mic_availability()
4934 attr = snd_hda_codec_get_pincfg(codec, nid); in check_auto_mic_availability()
4951 if (!is_jack_detectable(codec, nid)) in check_auto_mic_availability()
4973 if (!auto_mic_check_imux(codec)) in check_auto_mic_availability()
4979 codec_dbg(codec, "Enable auto-mic switch on NID 0x%x/0x%x/0x%x\n", in check_auto_mic_availability()
4990 * @codec: the HDA codec
4994 unsigned int snd_hda_gen_path_power_filter(struct hda_codec *codec, in snd_hda_gen_path_power_filter() argument
4998 struct hda_gen_spec *spec = codec->spec; in snd_hda_gen_path_power_filter()
5000 if (!spec->power_down_unused && !codec->power_save_node) in snd_hda_gen_path_power_filter()
5002 if (power_state != AC_PWRST_D0 || nid == codec->core.afg) in snd_hda_gen_path_power_filter()
5004 if (get_wcaps_type(get_wcaps(codec, nid)) >= AC_WID_POWER) in snd_hda_gen_path_power_filter()
5006 if (is_active_nid_for_any(codec, nid)) in snd_hda_gen_path_power_filter()
5013 static void mute_all_mixer_nid(struct hda_codec *codec, hda_nid_t mix) in mute_all_mixer_nid() argument
5019 nums = snd_hda_get_conn_list(codec, mix, &conn); in mute_all_mixer_nid()
5020 has_amp = nid_has_mute(codec, mix, HDA_INPUT); in mute_all_mixer_nid()
5023 update_amp(codec, mix, HDA_INPUT, i, in mute_all_mixer_nid()
5025 else if (nid_has_volume(codec, conn[i], HDA_OUTPUT)) in mute_all_mixer_nid()
5026 update_amp(codec, conn[i], HDA_OUTPUT, 0, in mute_all_mixer_nid()
5033 * @codec: the HDA codec
5039 void snd_hda_gen_stream_pm(struct hda_codec *codec, hda_nid_t nid, bool on) in snd_hda_gen_stream_pm() argument
5041 if (codec->power_save_node) in snd_hda_gen_stream_pm()
5042 set_path_power(codec, nid, -1, on); in snd_hda_gen_stream_pm()
5049 * @codec: the HDA codec
5055 int snd_hda_gen_parse_auto_config(struct hda_codec *codec, in snd_hda_gen_parse_auto_config() argument
5058 struct hda_gen_spec *spec = codec->spec; in snd_hda_gen_parse_auto_config()
5061 parse_user_hints(codec); in snd_hda_gen_parse_auto_config()
5076 fill_all_dac_nids(codec); in snd_hda_gen_parse_auto_config()
5102 err = parse_output_paths(codec); in snd_hda_gen_parse_auto_config()
5105 err = create_multi_channel_mode(codec); in snd_hda_gen_parse_auto_config()
5108 err = create_multi_out_ctls(codec, cfg); in snd_hda_gen_parse_auto_config()
5111 err = create_hp_out_ctls(codec); in snd_hda_gen_parse_auto_config()
5114 err = create_speaker_out_ctls(codec); in snd_hda_gen_parse_auto_config()
5117 err = create_indep_hp_ctls(codec); in snd_hda_gen_parse_auto_config()
5120 err = create_loopback_mixing_ctl(codec); in snd_hda_gen_parse_auto_config()
5123 err = create_hp_mic(codec); in snd_hda_gen_parse_auto_config()
5126 err = create_input_ctls(codec); in snd_hda_gen_parse_auto_config()
5131 add_all_pin_power_ctls(codec, false); in snd_hda_gen_parse_auto_config()
5144 err = check_auto_mute_availability(codec); in snd_hda_gen_parse_auto_config()
5148 err = check_dyn_adc_switch(codec); in snd_hda_gen_parse_auto_config()
5152 err = check_auto_mic_availability(codec); in snd_hda_gen_parse_auto_config()
5160 err = parse_capture_source(codec, spec->mixer_nid, in snd_hda_gen_parse_auto_config()
5168 err = create_capture_mixers(codec); in snd_hda_gen_parse_auto_config()
5172 err = parse_mic_boost(codec); in snd_hda_gen_parse_auto_config()
5182 err = create_hp_mic_jack_mode(codec, spec->hp_mic_pin); in snd_hda_gen_parse_auto_config()
5189 err = create_out_jack_modes(codec, cfg->line_outs, in snd_hda_gen_parse_auto_config()
5195 err = create_out_jack_modes(codec, cfg->hp_outs, in snd_hda_gen_parse_auto_config()
5203 add_all_pin_power_ctls(codec, true); in snd_hda_gen_parse_auto_config()
5207 mute_all_mixer_nid(codec, spec->mixer_nid); in snd_hda_gen_parse_auto_config()
5210 parse_digital(codec); in snd_hda_gen_parse_auto_config()
5212 if (spec->power_down_unused || codec->power_save_node) { in snd_hda_gen_parse_auto_config()
5213 if (!codec->power_filter) in snd_hda_gen_parse_auto_config()
5214 codec->power_filter = snd_hda_gen_path_power_filter; in snd_hda_gen_parse_auto_config()
5215 if (!codec->patch_ops.stream_pm) in snd_hda_gen_parse_auto_config()
5216 codec->patch_ops.stream_pm = snd_hda_gen_stream_pm; in snd_hda_gen_parse_auto_config()
5220 err = snd_hda_attach_beep_device(codec, spec->beep_nid); in snd_hda_gen_parse_auto_config()
5223 if (codec->beep && codec->power_save_node) { in snd_hda_gen_parse_auto_config()
5224 err = add_fake_beep_paths(codec); in snd_hda_gen_parse_auto_config()
5227 codec->beep->power_hook = beep_power_hook; in snd_hda_gen_parse_auto_config()
5253 * @codec: the HDA codec
5257 int snd_hda_gen_build_controls(struct hda_codec *codec) in snd_hda_gen_build_controls() argument
5259 struct hda_gen_spec *spec = codec->spec; in snd_hda_gen_build_controls()
5263 err = snd_hda_add_new_ctls(codec, spec->kctls.list); in snd_hda_gen_build_controls()
5269 err = snd_hda_create_dig_out_ctls(codec, in snd_hda_gen_build_controls()
5276 err = snd_hda_create_spdif_share_sw(codec, in snd_hda_gen_build_controls()
5284 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); in snd_hda_gen_build_controls()
5291 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { in snd_hda_gen_build_controls()
5292 err = snd_hda_add_vmaster(codec, "Master Playback Volume", in snd_hda_gen_build_controls()
5299 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { in snd_hda_gen_build_controls()
5300 err = __snd_hda_add_vmaster(codec, "Master Playback Switch", in snd_hda_gen_build_controls()
5307 snd_hda_add_vmaster_hook(codec, &spec->vmaster_mute, in snd_hda_gen_build_controls()
5315 err = snd_hda_jack_add_kctls(codec, &spec->autocfg); in snd_hda_gen_build_controls()
5329 struct hda_codec *codec, in call_pcm_playback_hook() argument
5333 struct hda_gen_spec *spec = codec->spec; in call_pcm_playback_hook()
5335 spec->pcm_playback_hook(hinfo, codec, substream, action); in call_pcm_playback_hook()
5339 struct hda_codec *codec, in call_pcm_capture_hook() argument
5343 struct hda_gen_spec *spec = codec->spec; in call_pcm_capture_hook()
5345 spec->pcm_capture_hook(hinfo, codec, substream, action); in call_pcm_capture_hook()
5352 struct hda_codec *codec, in playback_pcm_open() argument
5355 struct hda_gen_spec *spec = codec->spec; in playback_pcm_open()
5359 err = snd_hda_multi_out_analog_open(codec, in playback_pcm_open()
5364 call_pcm_playback_hook(hinfo, codec, substream, in playback_pcm_open()
5372 struct hda_codec *codec, in playback_pcm_prepare() argument
5377 struct hda_gen_spec *spec = codec->spec; in playback_pcm_prepare()
5380 err = snd_hda_multi_out_analog_prepare(codec, &spec->multiout, in playback_pcm_prepare()
5383 call_pcm_playback_hook(hinfo, codec, substream, in playback_pcm_prepare()
5389 struct hda_codec *codec, in playback_pcm_cleanup() argument
5392 struct hda_gen_spec *spec = codec->spec; in playback_pcm_cleanup()
5395 err = snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); in playback_pcm_cleanup()
5397 call_pcm_playback_hook(hinfo, codec, substream, in playback_pcm_cleanup()
5403 struct hda_codec *codec, in playback_pcm_close() argument
5406 struct hda_gen_spec *spec = codec->spec; in playback_pcm_close()
5409 call_pcm_playback_hook(hinfo, codec, substream, in playback_pcm_close()
5416 struct hda_codec *codec, in capture_pcm_open() argument
5419 call_pcm_capture_hook(hinfo, codec, substream, HDA_GEN_PCM_ACT_OPEN); in capture_pcm_open()
5424 struct hda_codec *codec, in capture_pcm_prepare() argument
5429 snd_hda_codec_setup_stream(codec, hinfo->nid, stream_tag, 0, format); in capture_pcm_prepare()
5430 call_pcm_capture_hook(hinfo, codec, substream, in capture_pcm_prepare()
5436 struct hda_codec *codec, in capture_pcm_cleanup() argument
5439 snd_hda_codec_cleanup_stream(codec, hinfo->nid); in capture_pcm_cleanup()
5440 call_pcm_capture_hook(hinfo, codec, substream, in capture_pcm_cleanup()
5446 struct hda_codec *codec, in capture_pcm_close() argument
5449 call_pcm_capture_hook(hinfo, codec, substream, HDA_GEN_PCM_ACT_CLOSE); in capture_pcm_close()
5454 struct hda_codec *codec, in alt_playback_pcm_open() argument
5457 struct hda_gen_spec *spec = codec->spec; in alt_playback_pcm_open()
5465 call_pcm_playback_hook(hinfo, codec, substream, in alt_playback_pcm_open()
5472 struct hda_codec *codec, in alt_playback_pcm_close() argument
5475 struct hda_gen_spec *spec = codec->spec; in alt_playback_pcm_close()
5478 call_pcm_playback_hook(hinfo, codec, substream, in alt_playback_pcm_close()
5485 struct hda_codec *codec, in alt_playback_pcm_prepare() argument
5490 snd_hda_codec_setup_stream(codec, hinfo->nid, stream_tag, 0, format); in alt_playback_pcm_prepare()
5491 call_pcm_playback_hook(hinfo, codec, substream, in alt_playback_pcm_prepare()
5497 struct hda_codec *codec, in alt_playback_pcm_cleanup() argument
5500 snd_hda_codec_cleanup_stream(codec, hinfo->nid); in alt_playback_pcm_cleanup()
5501 call_pcm_playback_hook(hinfo, codec, substream, in alt_playback_pcm_cleanup()
5510 struct hda_codec *codec, in dig_playback_pcm_open() argument
5513 struct hda_gen_spec *spec = codec->spec; in dig_playback_pcm_open()
5514 return snd_hda_multi_out_dig_open(codec, &spec->multiout); in dig_playback_pcm_open()
5518 struct hda_codec *codec, in dig_playback_pcm_prepare() argument
5523 struct hda_gen_spec *spec = codec->spec; in dig_playback_pcm_prepare()
5524 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, in dig_playback_pcm_prepare()
5529 struct hda_codec *codec, in dig_playback_pcm_cleanup() argument
5532 struct hda_gen_spec *spec = codec->spec; in dig_playback_pcm_cleanup()
5533 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); in dig_playback_pcm_cleanup()
5537 struct hda_codec *codec, in dig_playback_pcm_close() argument
5540 struct hda_gen_spec *spec = codec->spec; in dig_playback_pcm_close()
5541 return snd_hda_multi_out_dig_close(codec, &spec->multiout); in dig_playback_pcm_close()
5551 struct hda_codec *codec, in alt_capture_pcm_prepare() argument
5556 struct hda_gen_spec *spec = codec->spec; in alt_capture_pcm_prepare()
5558 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], in alt_capture_pcm_prepare()
5560 call_pcm_capture_hook(hinfo, codec, substream, in alt_capture_pcm_prepare()
5566 struct hda_codec *codec, in alt_capture_pcm_cleanup() argument
5569 struct hda_gen_spec *spec = codec->spec; in alt_capture_pcm_cleanup()
5571 snd_hda_codec_cleanup_stream(codec, in alt_capture_pcm_cleanup()
5573 call_pcm_capture_hook(hinfo, codec, substream, in alt_capture_pcm_cleanup()
5662 static bool dyn_adc_pcm_resetup(struct hda_codec *codec, int cur) in dyn_adc_pcm_resetup() argument
5664 struct hda_gen_spec *spec = codec->spec; in dyn_adc_pcm_resetup()
5669 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); in dyn_adc_pcm_resetup()
5671 snd_hda_codec_setup_stream(codec, new_adc, in dyn_adc_pcm_resetup()
5681 struct hda_codec *codec, in dyn_adc_capture_pcm_prepare() argument
5686 struct hda_gen_spec *spec = codec->spec; in dyn_adc_capture_pcm_prepare()
5690 snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format); in dyn_adc_capture_pcm_prepare()
5691 call_pcm_capture_hook(hinfo, codec, substream, HDA_GEN_PCM_ACT_PREPARE); in dyn_adc_capture_pcm_prepare()
5696 struct hda_codec *codec, in dyn_adc_capture_pcm_cleanup() argument
5699 struct hda_gen_spec *spec = codec->spec; in dyn_adc_capture_pcm_cleanup()
5700 snd_hda_codec_cleanup_stream(codec, spec->cur_adc); in dyn_adc_capture_pcm_cleanup()
5702 call_pcm_capture_hook(hinfo, codec, substream, HDA_GEN_PCM_ACT_CLEANUP); in dyn_adc_capture_pcm_cleanup()
5765 * @codec: the HDA codec
5769 int snd_hda_gen_build_pcms(struct hda_codec *codec) in snd_hda_gen_build_pcms() argument
5771 struct hda_gen_spec *spec = codec->spec; in snd_hda_gen_build_pcms()
5780 " Analog", codec->core.chip_name); in snd_hda_gen_build_pcms()
5781 info = snd_hda_codec_pcm_new(codec, "%s", spec->stream_name_analog); in snd_hda_gen_build_pcms()
5811 " Digital", codec->core.chip_name); in snd_hda_gen_build_pcms()
5812 info = snd_hda_codec_pcm_new(codec, "%s", in snd_hda_gen_build_pcms()
5816 codec->follower_dig_outs = spec->multiout.follower_dig_outs; in snd_hda_gen_build_pcms()
5846 " Alt Analog", codec->core.chip_name); in snd_hda_gen_build_pcms()
5847 info = snd_hda_codec_pcm_new(codec, "%s", in snd_hda_gen_build_pcms()
5883 static void set_output_and_unmute(struct hda_codec *codec, int path_idx) in set_output_and_unmute() argument
5888 path = snd_hda_get_path_from_idx(codec, path_idx); in set_output_and_unmute()
5892 restore_pin_ctl(codec, pin); in set_output_and_unmute()
5893 snd_hda_activate_path(codec, path, path->active, in set_output_and_unmute()
5894 aamix_default(codec->spec)); in set_output_and_unmute()
5895 set_pin_eapd(codec, pin, path->active); in set_output_and_unmute()
5899 static void init_multi_out(struct hda_codec *codec) in init_multi_out() argument
5901 struct hda_gen_spec *spec = codec->spec; in init_multi_out()
5905 set_output_and_unmute(codec, spec->out_paths[i]); in init_multi_out()
5909 static void __init_extra_out(struct hda_codec *codec, int num_outs, int *paths) in __init_extra_out() argument
5914 set_output_and_unmute(codec, paths[i]); in __init_extra_out()
5918 static void init_extra_out(struct hda_codec *codec) in init_extra_out() argument
5920 struct hda_gen_spec *spec = codec->spec; in init_extra_out()
5923 __init_extra_out(codec, spec->autocfg.hp_outs, spec->hp_paths); in init_extra_out()
5925 __init_extra_out(codec, spec->autocfg.speaker_outs, in init_extra_out()
5930 static void init_multi_io(struct hda_codec *codec) in init_multi_io() argument
5932 struct hda_gen_spec *spec = codec->spec; in init_multi_io()
5938 path = get_multiio_path(codec, i); in init_multi_io()
5943 snd_hda_codec_get_pin_target(codec, pin); in init_multi_io()
5944 snd_hda_activate_path(codec, path, path->active, in init_multi_io()
5949 static void init_aamix_paths(struct hda_codec *codec) in init_aamix_paths() argument
5951 struct hda_gen_spec *spec = codec->spec; in init_aamix_paths()
5957 update_aamix_paths(codec, spec->aamix_mode, spec->out_paths[0], in init_aamix_paths()
5960 update_aamix_paths(codec, spec->aamix_mode, spec->hp_paths[0], in init_aamix_paths()
5963 update_aamix_paths(codec, spec->aamix_mode, spec->speaker_paths[0], in init_aamix_paths()
5969 static void init_analog_input(struct hda_codec *codec) in init_analog_input() argument
5971 struct hda_gen_spec *spec = codec->spec; in init_analog_input()
5977 if (is_input_pin(codec, nid)) in init_analog_input()
5978 restore_pin_ctl(codec, nid); in init_analog_input()
5982 resume_path_from_idx(codec, spec->loopback_paths[i]); in init_analog_input()
5983 resume_path_from_idx(codec, spec->loopback_merge_path); in init_analog_input()
5989 static void init_input_src(struct hda_codec *codec) in init_input_src() argument
5991 struct hda_gen_spec *spec = codec->spec; in init_input_src()
6003 path = get_input_path(codec, c, i); in init_input_src()
6008 snd_hda_activate_path(codec, path, active, false); in init_input_src()
6012 update_hp_mic(codec, c, true); in init_input_src()
6016 spec->cap_sync_hook(codec, NULL, NULL); in init_input_src()
6020 static void init_digital(struct hda_codec *codec) in init_digital() argument
6022 struct hda_gen_spec *spec = codec->spec; in init_digital()
6027 set_output_and_unmute(codec, spec->digout_paths[i]); in init_digital()
6030 restore_pin_ctl(codec, pin); in init_digital()
6031 resume_path_from_idx(codec, spec->digin_path); in init_digital()
6038 static void clear_unsol_on_unused_pins(struct hda_codec *codec) in clear_unsol_on_unused_pins() argument
6043 snd_array_for_each(&codec->init_pins, i, pin) { in clear_unsol_on_unused_pins()
6045 if (is_jack_detectable(codec, nid) && in clear_unsol_on_unused_pins()
6046 !snd_hda_jack_tbl_get(codec, nid)) in clear_unsol_on_unused_pins()
6047 snd_hda_codec_write_cache(codec, nid, 0, in clear_unsol_on_unused_pins()
6054 * @codec: the HDA codec
6058 int snd_hda_gen_init(struct hda_codec *codec) in snd_hda_gen_init() argument
6060 struct hda_gen_spec *spec = codec->spec; in snd_hda_gen_init()
6063 spec->init_hook(codec); in snd_hda_gen_init()
6066 snd_hda_apply_verbs(codec); in snd_hda_gen_init()
6068 init_multi_out(codec); in snd_hda_gen_init()
6069 init_extra_out(codec); in snd_hda_gen_init()
6070 init_multi_io(codec); in snd_hda_gen_init()
6071 init_aamix_paths(codec); in snd_hda_gen_init()
6072 init_analog_input(codec); in snd_hda_gen_init()
6073 init_input_src(codec); in snd_hda_gen_init()
6074 init_digital(codec); in snd_hda_gen_init()
6076 clear_unsol_on_unused_pins(codec); in snd_hda_gen_init()
6078 sync_all_pin_power_ctls(codec); in snd_hda_gen_init()
6081 update_automute_all(codec); in snd_hda_gen_init()
6083 snd_hda_regmap_sync(codec); in snd_hda_gen_init()
6088 hda_call_check_power_status(codec, 0x01); in snd_hda_gen_init()
6095 * @codec: the HDA codec
6099 void snd_hda_gen_free(struct hda_codec *codec) in snd_hda_gen_free() argument
6101 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_FREE); in snd_hda_gen_free()
6102 snd_hda_gen_spec_free(codec->spec); in snd_hda_gen_free()
6103 kfree(codec->spec); in snd_hda_gen_free()
6104 codec->spec = NULL; in snd_hda_gen_free()
6109 * snd_hda_gen_reboot_notify - Make codec enter D3 before rebooting
6110 * @codec: the HDA codec
6114 void snd_hda_gen_reboot_notify(struct hda_codec *codec) in snd_hda_gen_reboot_notify() argument
6116 /* Make the codec enter D3 to avoid spurious noises from the internal in snd_hda_gen_reboot_notify()
6119 snd_hda_codec_set_power_to_all(codec, codec->core.afg, AC_PWRST_D3); in snd_hda_gen_reboot_notify()
6120 snd_hda_codec_write(codec, codec->core.afg, 0, in snd_hda_gen_reboot_notify()
6129 * @codec: the HDA codec
6134 int snd_hda_gen_check_power_status(struct hda_codec *codec, hda_nid_t nid) in snd_hda_gen_check_power_status() argument
6136 struct hda_gen_spec *spec = codec->spec; in snd_hda_gen_check_power_status()
6137 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); in snd_hda_gen_check_power_status()
6144 * the generic codec support
6160 * snd_hda_parse_generic_codec - Generic codec parser
6161 * @codec: the HDA codec
6163 static int snd_hda_parse_generic_codec(struct hda_codec *codec) in snd_hda_parse_generic_codec() argument
6172 codec->spec = spec; in snd_hda_parse_generic_codec()
6174 err = snd_hda_parse_pin_defcfg(codec, &spec->autocfg, NULL, 0); in snd_hda_parse_generic_codec()
6178 err = snd_hda_gen_parse_auto_config(codec, &spec->autocfg); in snd_hda_parse_generic_codec()
6182 codec->patch_ops = generic_patch_ops; in snd_hda_parse_generic_codec()
6186 snd_hda_gen_free(codec); in snd_hda_parse_generic_codec()
6203 MODULE_DESCRIPTION("Generic HD-audio codec parser");