Lines Matching full:codec
3 * Universal Interface for Intel High Definition Audio Codec
105 static void parse_user_hints(struct hda_codec *codec) in parse_user_hints() argument
107 struct hda_gen_spec *spec = codec->spec; in parse_user_hints()
110 val = snd_hda_get_bool_hint(codec, "jack_detect"); in parse_user_hints()
112 codec->no_jack_detect = !val; in parse_user_hints()
113 val = snd_hda_get_bool_hint(codec, "inv_jack_detect"); in parse_user_hints()
115 codec->inv_jack_detect = !!val; in parse_user_hints()
116 val = snd_hda_get_bool_hint(codec, "trigger_sense"); in parse_user_hints()
118 codec->no_trigger_sense = !val; in parse_user_hints()
119 val = snd_hda_get_bool_hint(codec, "inv_eapd"); in parse_user_hints()
121 codec->inv_eapd = !!val; in parse_user_hints()
122 val = snd_hda_get_bool_hint(codec, "pcm_format_first"); in parse_user_hints()
124 codec->pcm_format_first = !!val; in parse_user_hints()
125 val = snd_hda_get_bool_hint(codec, "sticky_stream"); in parse_user_hints()
127 codec->no_sticky_stream = !val; in parse_user_hints()
128 val = snd_hda_get_bool_hint(codec, "spdif_status_reset"); in parse_user_hints()
130 codec->spdif_status_reset = !!val; in parse_user_hints()
131 val = snd_hda_get_bool_hint(codec, "pin_amp_workaround"); in parse_user_hints()
133 codec->pin_amp_workaround = !!val; in parse_user_hints()
134 val = snd_hda_get_bool_hint(codec, "single_adc_amp"); in parse_user_hints()
136 codec->single_adc_amp = !!val; in parse_user_hints()
137 val = snd_hda_get_bool_hint(codec, "power_save_node"); in parse_user_hints()
139 codec->power_save_node = !!val; in parse_user_hints()
141 val = snd_hda_get_bool_hint(codec, "auto_mute"); in parse_user_hints()
144 val = snd_hda_get_bool_hint(codec, "auto_mic"); in parse_user_hints()
147 val = snd_hda_get_bool_hint(codec, "line_in_auto_switch"); in parse_user_hints()
150 val = snd_hda_get_bool_hint(codec, "auto_mute_via_amp"); in parse_user_hints()
153 val = snd_hda_get_bool_hint(codec, "need_dac_fix"); in parse_user_hints()
156 val = snd_hda_get_bool_hint(codec, "primary_hp"); in parse_user_hints()
159 val = snd_hda_get_bool_hint(codec, "multi_io"); in parse_user_hints()
162 val = snd_hda_get_bool_hint(codec, "multi_cap_vol"); in parse_user_hints()
165 val = snd_hda_get_bool_hint(codec, "inv_dmic_split"); in parse_user_hints()
168 val = snd_hda_get_bool_hint(codec, "indep_hp"); in parse_user_hints()
171 val = snd_hda_get_bool_hint(codec, "add_stereo_mix_input"); in parse_user_hints()
175 val = snd_hda_get_bool_hint(codec, "add_out_jack_modes"); in parse_user_hints()
178 val = snd_hda_get_bool_hint(codec, "add_in_jack_modes"); in parse_user_hints()
181 val = snd_hda_get_bool_hint(codec, "add_jack_modes"); in parse_user_hints()
184 val = snd_hda_get_bool_hint(codec, "power_down_unused"); in parse_user_hints()
187 val = snd_hda_get_bool_hint(codec, "add_hp_mic"); in parse_user_hints()
190 val = snd_hda_get_bool_hint(codec, "hp_mic_detect"); in parse_user_hints()
193 val = snd_hda_get_bool_hint(codec, "vmaster"); in parse_user_hints()
197 if (!snd_hda_get_int_hint(codec, "mixer_nid", &val)) in parse_user_hints()
205 #define update_pin_ctl(codec, pin, val) \ argument
206 snd_hda_codec_write_cache(codec, pin, 0, \
210 static inline void restore_pin_ctl(struct hda_codec *codec, hda_nid_t pin) in restore_pin_ctl() argument
212 update_pin_ctl(codec, pin, snd_hda_codec_get_pin_target(codec, pin)); in restore_pin_ctl()
216 static void set_pin_target(struct hda_codec *codec, hda_nid_t pin, in set_pin_target() argument
221 val = snd_hda_correct_pin_ctl(codec, pin, val); in set_pin_target()
222 snd_hda_codec_set_pin_target(codec, pin, val); in set_pin_target()
224 update_pin_ctl(codec, pin, val); in set_pin_target()
228 static void set_pin_targets(struct hda_codec *codec, int num_pins, in set_pin_targets() argument
233 set_pin_target(codec, pins[i], val, false); in set_pin_targets()
256 static struct nid_path *get_nid_path(struct hda_codec *codec, in get_nid_path() argument
260 struct hda_gen_spec *spec = codec->spec; in get_nid_path()
281 * @codec: the HDA codec
287 int snd_hda_get_path_idx(struct hda_codec *codec, struct nid_path *path) in snd_hda_get_path_idx() argument
289 struct hda_gen_spec *spec = codec->spec; in snd_hda_get_path_idx()
305 * @codec: the HDA codec
308 struct nid_path *snd_hda_get_path_from_idx(struct hda_codec *codec, int idx) in snd_hda_get_path_from_idx() argument
310 struct hda_gen_spec *spec = codec->spec; in snd_hda_get_path_from_idx()
319 static bool is_dac_already_used(struct hda_codec *codec, hda_nid_t nid) in is_dac_already_used() argument
321 struct hda_gen_spec *spec = codec->spec; in is_dac_already_used()
333 static bool is_reachable_path(struct hda_codec *codec, in is_reachable_path() argument
338 return snd_hda_get_conn_index(codec, to_nid, from_nid, true) >= 0; in is_reachable_path()
345 static bool is_ctl_used(struct hda_codec *codec, unsigned int val, int type) in is_ctl_used() argument
347 struct hda_gen_spec *spec = codec->spec; in is_ctl_used()
360 static bool is_ctl_associated(struct hda_codec *codec, hda_nid_t nid, in is_ctl_associated() argument
364 return is_ctl_used(codec, val, type); in is_ctl_associated()
367 static void print_nid_path(struct hda_codec *codec, in print_nid_path() argument
380 codec_dbg(codec, "%s path: depth=%d '%s'\n", pfx, path->depth, buf); in print_nid_path()
384 static bool __parse_nid_path(struct hda_codec *codec, in __parse_nid_path() argument
397 nums = snd_hda_get_conn_list(codec, to_nid, &conn); in __parse_nid_path()
404 get_wcaps_type(get_wcaps(codec, conn[i])) != AC_WID_AUD_OUT || in __parse_nid_path()
405 is_dac_already_used(codec, conn[i])) in __parse_nid_path()
416 type = get_wcaps_type(get_wcaps(codec, conn[i])); in __parse_nid_path()
420 if (__parse_nid_path(codec, from_nid, conn[i], in __parse_nid_path()
429 if (nums > 1 && get_wcaps_type(get_wcaps(codec, to_nid)) != AC_WID_AUD_MIX) in __parse_nid_path()
438 * @codec: the HDA codec
454 static bool snd_hda_parse_nid_path(struct hda_codec *codec, hda_nid_t from_nid, in snd_hda_parse_nid_path() argument
458 if (__parse_nid_path(codec, from_nid, to_nid, anchor_nid, path, 1)) { in snd_hda_parse_nid_path()
469 * @codec: the HDA codec
477 snd_hda_add_new_path(struct hda_codec *codec, hda_nid_t from_nid, in snd_hda_add_new_path() argument
480 struct hda_gen_spec *spec = codec->spec; in snd_hda_add_new_path()
483 if (from_nid && to_nid && !is_reachable_path(codec, from_nid, to_nid)) in snd_hda_add_new_path()
487 path = get_nid_path(codec, from_nid, to_nid, anchor_nid); in snd_hda_add_new_path()
495 if (snd_hda_parse_nid_path(codec, from_nid, to_nid, anchor_nid, path)) in snd_hda_add_new_path()
504 static void invalidate_nid_path(struct hda_codec *codec, int idx) in invalidate_nid_path() argument
506 struct nid_path *path = snd_hda_get_path_from_idx(codec, idx); in invalidate_nid_path()
512 /* return a DAC if paired to the given pin by codec driver */
513 static hda_nid_t get_preferred_dac(struct hda_codec *codec, hda_nid_t pin) in get_preferred_dac() argument
515 struct hda_gen_spec *spec = codec->spec; in get_preferred_dac()
527 static hda_nid_t look_for_dac(struct hda_codec *codec, hda_nid_t pin, in look_for_dac() argument
530 struct hda_gen_spec *spec = codec->spec; in look_for_dac()
536 if (!nid || is_dac_already_used(codec, nid)) in look_for_dac()
538 cap_digital = !!(get_wcaps(codec, nid) & AC_WCAP_DIGITAL); in look_for_dac()
541 if (is_reachable_path(codec, nid, pin)) in look_for_dac()
555 static bool same_amp_caps(struct hda_codec *codec, hda_nid_t nid1, in same_amp_caps() argument
558 if (!(get_wcaps(codec, nid1) & (1 << (dir + 1)))) in same_amp_caps()
559 return !(get_wcaps(codec, nid2) & (1 << (dir + 1))); in same_amp_caps()
560 return (query_amp_caps(codec, nid1, dir) == in same_amp_caps()
561 query_amp_caps(codec, nid2, dir)); in same_amp_caps()
565 static hda_nid_t look_for_out_mute_nid(struct hda_codec *codec, in look_for_out_mute_nid() argument
571 if (nid_has_mute(codec, path->path[i], HDA_OUTPUT)) in look_for_out_mute_nid()
574 nid_has_mute(codec, path->path[i], HDA_INPUT)) in look_for_out_mute_nid()
581 static hda_nid_t look_for_out_vol_nid(struct hda_codec *codec, in look_for_out_vol_nid() argument
584 struct hda_gen_spec *spec = codec->spec; in look_for_out_vol_nid()
591 if (nid_has_volume(codec, nid, HDA_OUTPUT)) in look_for_out_vol_nid()
602 static bool has_amp_in(struct hda_codec *codec, struct nid_path *path, int idx) in has_amp_in() argument
605 unsigned int caps = get_wcaps(codec, nid); in has_amp_in()
616 static bool has_amp_out(struct hda_codec *codec, struct nid_path *path, int idx) in has_amp_out() argument
619 unsigned int caps = get_wcaps(codec, nid); in has_amp_out()
630 static bool is_active_nid(struct hda_codec *codec, hda_nid_t nid, in is_active_nid() argument
633 struct hda_gen_spec *spec = codec->spec; in is_active_nid()
634 int type = get_wcaps_type(get_wcaps(codec, nid)); in is_active_nid()
638 if (nid == codec->core.afg) in is_active_nid()
644 if (codec->power_save_node) { in is_active_nid()
665 #define is_active_nid_for_any(codec, nid) \ argument
666 is_active_nid(codec, nid, HDA_OUTPUT, -1)
669 static int get_amp_val_to_activate(struct hda_codec *codec, hda_nid_t nid, in get_amp_val_to_activate() argument
687 static bool is_stereo_amps(struct hda_codec *codec, hda_nid_t nid, int dir) in is_stereo_amps() argument
689 unsigned int wcaps = get_wcaps(codec, nid); in is_stereo_amps()
696 if (snd_hda_get_num_conns(codec, nid) != 1) in is_stereo_amps()
698 if (snd_hda_get_connections(codec, nid, &conn, 1) < 0) in is_stereo_amps()
700 return !!(get_wcaps(codec, conn) & AC_WCAP_STEREO); in is_stereo_amps()
704 static void init_amp(struct hda_codec *codec, hda_nid_t nid, int dir, int idx) in init_amp() argument
706 unsigned int caps = query_amp_caps(codec, nid, dir); in init_amp()
707 int val = get_amp_val_to_activate(codec, nid, dir, caps, false); in init_amp()
709 if (is_stereo_amps(codec, nid, dir)) in init_amp()
710 snd_hda_codec_amp_init_stereo(codec, nid, dir, idx, 0xff, val); in init_amp()
712 snd_hda_codec_amp_init(codec, nid, 0, dir, idx, 0xff, val); in init_amp()
716 static int update_amp(struct hda_codec *codec, hda_nid_t nid, int dir, int idx, in update_amp() argument
719 if (is_stereo_amps(codec, nid, dir)) in update_amp()
720 return snd_hda_codec_amp_stereo(codec, nid, dir, idx, in update_amp()
723 return snd_hda_codec_amp_update(codec, nid, 0, dir, idx, in update_amp()
730 static unsigned int get_amp_mask_to_modify(struct hda_codec *codec, in get_amp_mask_to_modify() argument
737 if (is_ctl_associated(codec, nid, dir, idx, NID_PATH_MUTE_CTL)) in get_amp_mask_to_modify()
741 if (is_ctl_associated(codec, nid, dir, idx, NID_PATH_VOL_CTL) || in get_amp_mask_to_modify()
742 is_ctl_associated(codec, nid, dir, idx, NID_PATH_BOOST_CTL)) in get_amp_mask_to_modify()
748 static void activate_amp(struct hda_codec *codec, hda_nid_t nid, int dir, in activate_amp() argument
754 caps = query_amp_caps(codec, nid, dir); in activate_amp()
755 val = get_amp_val_to_activate(codec, nid, dir, caps, enable); in activate_amp()
756 mask = get_amp_mask_to_modify(codec, nid, dir, idx_to_check, caps); in activate_amp()
761 update_amp(codec, nid, dir, idx, mask, val); in activate_amp()
764 static void check_and_activate_amp(struct hda_codec *codec, hda_nid_t nid, in check_and_activate_amp() argument
769 if (!enable && is_active_nid(codec, nid, dir, idx_to_check)) in check_and_activate_amp()
771 activate_amp(codec, nid, dir, idx, idx_to_check, enable); in check_and_activate_amp()
774 static void activate_amp_out(struct hda_codec *codec, struct nid_path *path, in activate_amp_out() argument
778 init_amp(codec, nid, HDA_OUTPUT, 0); in activate_amp_out()
779 check_and_activate_amp(codec, nid, HDA_OUTPUT, 0, 0, enable); in activate_amp_out()
782 static void activate_amp_in(struct hda_codec *codec, struct nid_path *path, in activate_amp_in() argument
785 struct hda_gen_spec *spec = codec->spec; in activate_amp_in()
791 nums = snd_hda_get_conn_list(codec, nid, &conn); in activate_amp_in()
794 type = get_wcaps_type(get_wcaps(codec, nid)); in activate_amp_in()
796 (type == AC_WID_AUD_IN && codec->single_adc_amp)) { in activate_amp_in()
803 init_amp(codec, nid, HDA_INPUT, n); in activate_amp_in()
814 activate_amp(codec, nid, HDA_INPUT, n, n, false); in activate_amp_in()
818 check_and_activate_amp(codec, nid, HDA_INPUT, n, idx, enable); in activate_amp_in()
823 static hda_nid_t path_power_update(struct hda_codec *codec, in path_power_update() argument
832 if (!(get_wcaps(codec, nid) & AC_WCAP_POWER)) in path_power_update()
834 if (nid == codec->core.afg) in path_power_update()
836 if (!allow_powerdown || is_active_nid_for_any(codec, nid)) in path_power_update()
840 power = snd_hda_codec_read(codec, nid, 0, in path_power_update()
843 snd_hda_codec_write(codec, nid, 0, in path_power_update()
854 snd_hdac_regmap_sync_node(&codec->core, nid); in path_power_update()
862 static void sync_power_state_change(struct hda_codec *codec, hda_nid_t nid) in sync_power_state_change() argument
866 snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_POWER_STATE, 0); in sync_power_state_change()
872 * @codec: the HDA codec
879 void snd_hda_activate_path(struct hda_codec *codec, struct nid_path *path, in snd_hda_activate_path() argument
882 struct hda_gen_spec *spec = codec->spec; in snd_hda_activate_path()
888 if (enable && (spec->power_down_unused || codec->power_save_node)) in snd_hda_activate_path()
889 path_power_update(codec, path, codec->power_save_node); in snd_hda_activate_path()
895 snd_hda_codec_write_cache(codec, nid, 0, in snd_hda_activate_path()
898 if (has_amp_in(codec, path, i)) in snd_hda_activate_path()
899 activate_amp_in(codec, path, i, enable, add_aamix); in snd_hda_activate_path()
900 if (has_amp_out(codec, path, i)) in snd_hda_activate_path()
901 activate_amp_out(codec, path, i, enable); in snd_hda_activate_path()
907 static void path_power_down_sync(struct hda_codec *codec, struct nid_path *path) in path_power_down_sync() argument
909 struct hda_gen_spec *spec = codec->spec; in path_power_down_sync()
911 if (!(spec->power_down_unused || codec->power_save_node) || path->active) in path_power_down_sync()
913 sync_power_state_change(codec, path_power_update(codec, path, true)); in path_power_down_sync()
917 static void set_pin_eapd(struct hda_codec *codec, hda_nid_t pin, bool enable) in set_pin_eapd() argument
919 struct hda_gen_spec *spec = codec->spec; in set_pin_eapd()
921 !(snd_hda_query_pin_caps(codec, pin) & AC_PINCAP_EAPD)) in set_pin_eapd()
925 if (codec->inv_eapd) in set_pin_eapd()
927 snd_hda_codec_write_cache(codec, pin, 0, in set_pin_eapd()
933 static void resume_path_from_idx(struct hda_codec *codec, int path_idx) in resume_path_from_idx() argument
935 struct nid_path *path = snd_hda_get_path_from_idx(codec, path_idx); in resume_path_from_idx()
937 snd_hda_activate_path(codec, path, path->active, false); in resume_path_from_idx()
1020 static int add_vol_ctl(struct hda_codec *codec, const char *pfx, int cidx, in add_vol_ctl() argument
1030 return __add_pb_vol_ctrl(codec->spec, HDA_CTL_WIDGET_VOL, pfx, cidx, val); in add_vol_ctl()
1034 static int get_default_ch_nums(struct hda_codec *codec, struct nid_path *path, in get_default_ch_nums() argument
1040 if (nid && (get_wcaps(codec, nid) & AC_WCAP_STEREO)) in get_default_ch_nums()
1046 static int add_stereo_vol(struct hda_codec *codec, const char *pfx, int cidx, in add_stereo_vol() argument
1049 int chs = get_default_ch_nums(codec, path, NID_PATH_VOL_CTL); in add_stereo_vol()
1050 return add_vol_ctl(codec, pfx, cidx, chs, path); in add_stereo_vol()
1056 static int add_sw_ctl(struct hda_codec *codec, const char *pfx, int cidx, in add_sw_ctl() argument
1070 int nums = snd_hda_get_num_conns(codec, nid); in add_sw_ctl()
1076 return __add_pb_sw_ctrl(codec->spec, type, pfx, cidx, val); in add_sw_ctl()
1079 static int add_stereo_sw(struct hda_codec *codec, const char *pfx, in add_stereo_sw() argument
1082 int chs = get_default_ch_nums(codec, path, NID_PATH_MUTE_CTL); in add_stereo_sw()
1083 return add_sw_ctl(codec, pfx, cidx, chs, path); in add_stereo_sw()
1090 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in sync_auto_mute_bits() local
1091 struct hda_gen_spec *spec = codec->spec; in sync_auto_mute_bits()
1117 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in hda_gen_bind_mute_get() local
1121 mutex_lock(&codec->control_mutex); in hda_gen_bind_mute_get()
1126 mutex_unlock(&codec->control_mutex); in hda_gen_bind_mute_get()
1133 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in hda_gen_bind_mute_put() local
1139 mutex_lock(&codec->control_mutex); in hda_gen_bind_mute_put()
1151 mutex_unlock(&codec->control_mutex); in hda_gen_bind_mute_put()
1156 static bool path_has_mixer(struct hda_codec *codec, int path_idx, int ctl_type) in path_has_mixer() argument
1158 struct nid_path *path = snd_hda_get_path_from_idx(codec, path_idx); in path_has_mixer()
1167 static const char *get_line_out_pfx(struct hda_codec *codec, int ch, in get_line_out_pfx() argument
1170 struct hda_gen_spec *spec = codec->spec; in get_line_out_pfx()
1175 !codec->force_pin_prefix && in get_line_out_pfx()
1183 !codec->force_pin_prefix && in get_line_out_pfx()
1197 !path_has_mixer(codec, spec->hp_paths[0], ctl_type)) in get_line_out_pfx()
1209 !path_has_mixer(codec, spec->speaker_paths[0], ctl_type)) in get_line_out_pfx()
1224 spk_lo_shared = !path_has_mixer(codec, in get_line_out_pfx()
1227 hp_lo_shared = !path_has_mixer(codec, spec->hp_paths[0], ctl_type); in get_line_out_pfx()
1285 static int assign_out_path_ctls(struct hda_codec *codec, struct nid_path *path) in assign_out_path_ctls() argument
1287 struct hda_gen_spec *spec = codec->spec; in assign_out_path_ctls()
1299 nid = look_for_out_vol_nid(codec, path); in assign_out_path_ctls()
1304 if (is_ctl_used(codec, val, NID_PATH_VOL_CTL)) in assign_out_path_ctls()
1310 nid = look_for_out_mute_nid(codec, path); in assign_out_path_ctls()
1312 unsigned int wid_type = get_wcaps_type(get_wcaps(codec, nid)); in assign_out_path_ctls()
1314 nid_has_mute(codec, nid, HDA_OUTPUT)) in assign_out_path_ctls()
1318 if (is_ctl_used(codec, val, NID_PATH_MUTE_CTL)) in assign_out_path_ctls()
1348 static hda_nid_t get_primary_out(struct hda_codec *codec, int idx) in get_primary_out() argument
1350 struct hda_gen_spec *spec = codec->spec; in get_primary_out()
1362 static inline hda_nid_t try_dac(struct hda_codec *codec, in try_dac() argument
1365 return is_reachable_path(codec, dac, pin) ? dac : 0; in try_dac()
1369 static int try_assign_dacs(struct hda_codec *codec, int num_outs, in try_assign_dacs() argument
1374 struct hda_gen_spec *spec = codec->spec; in try_assign_dacs()
1387 path = snd_hda_get_path_from_idx(codec, path_idx[i]); in try_assign_dacs()
1389 badness += assign_out_path_ctls(codec, path); in try_assign_dacs()
1394 dacs[i] = get_preferred_dac(codec, pin); in try_assign_dacs()
1396 if (is_dac_already_used(codec, dacs[i])) in try_assign_dacs()
1403 dacs[i] = look_for_dac(codec, pin, false); in try_assign_dacs()
1407 if (is_reachable_path(codec, dacs[j], pin)) { in try_assign_dacs()
1410 invalidate_nid_path(codec, path_idx[j]); in try_assign_dacs()
1419 dac = try_dac(codec, get_primary_out(codec, i), pin); in try_assign_dacs()
1421 dac = try_dac(codec, dacs[0], pin); in try_assign_dacs()
1423 dac = try_dac(codec, get_primary_out(codec, i), pin); in try_assign_dacs()
1431 } else if (is_reachable_path(codec, spec->private_dac_nids[0], pin)) { in try_assign_dacs()
1441 path = snd_hda_add_new_path(codec, dac, pin, -spec->mixer_nid); in try_assign_dacs()
1444 path = snd_hda_add_new_path(codec, dac, pin, 0); in try_assign_dacs()
1450 /* print_nid_path(codec, "output", path); */ in try_assign_dacs()
1452 path_idx[i] = snd_hda_get_path_idx(codec, path); in try_assign_dacs()
1453 badness += assign_out_path_ctls(codec, path); in try_assign_dacs()
1461 static hda_nid_t get_dac_if_single(struct hda_codec *codec, hda_nid_t pin) in get_dac_if_single() argument
1463 struct hda_gen_spec *spec = codec->spec; in get_dac_if_single()
1469 if (!nid || is_dac_already_used(codec, nid)) in get_dac_if_single()
1471 if (is_reachable_path(codec, nid, pin)) { in get_dac_if_single()
1481 static bool can_be_multiio_pin(struct hda_codec *codec, in can_be_multiio_pin() argument
1486 defcfg = snd_hda_codec_get_pincfg(codec, nid); in can_be_multiio_pin()
1491 caps = snd_hda_query_pin_caps(codec, nid); in can_be_multiio_pin()
1498 static int count_multiio_pins(struct hda_codec *codec, hda_nid_t reference_pin) in count_multiio_pins() argument
1500 struct hda_gen_spec *spec = codec->spec; in count_multiio_pins()
1502 unsigned int defcfg = snd_hda_codec_get_pincfg(codec, reference_pin); in count_multiio_pins()
1511 if (can_be_multiio_pin(codec, location, in count_multiio_pins()
1527 static int fill_multi_ios(struct hda_codec *codec, in fill_multi_ios() argument
1531 struct hda_gen_spec *spec = codec->spec; in fill_multi_ios()
1534 unsigned int defcfg = snd_hda_codec_get_pincfg(codec, reference_pin); in fill_multi_ios()
1543 num_pins = count_multiio_pins(codec, reference_pin); in fill_multi_ios()
1554 if (!can_be_multiio_pin(codec, location, nid)) in fill_multi_ios()
1564 dac = get_dac_if_single(codec, nid); in fill_multi_ios()
1566 dac = look_for_dac(codec, nid, false); in fill_multi_ios()
1571 path = snd_hda_add_new_path(codec, dac, nid, in fill_multi_ios()
1577 /* print_nid_path(codec, "multiio", path); */ in fill_multi_ios()
1581 snd_hda_get_path_idx(codec, path); in fill_multi_ios()
1605 path = snd_hda_get_path_from_idx(codec, spec->out_paths[cfg->line_outs + i]); in fill_multi_ios()
1606 badness += assign_out_path_ctls(codec, path); in fill_multi_ios()
1613 static bool map_singles(struct hda_codec *codec, int outs, in map_singles() argument
1616 struct hda_gen_spec *spec = codec->spec; in map_singles()
1624 dac = get_dac_if_single(codec, pins[i]); in map_singles()
1627 path = snd_hda_add_new_path(codec, dac, pins[i], in map_singles()
1630 path = snd_hda_add_new_path(codec, dac, pins[i], 0); in map_singles()
1634 /* print_nid_path(codec, "output", path); */ in map_singles()
1636 path_idx[i] = snd_hda_get_path_idx(codec, path); in map_singles()
1649 static int check_aamix_out_path(struct hda_codec *codec, int path_idx) in check_aamix_out_path() argument
1651 struct hda_gen_spec *spec = codec->spec; in check_aamix_out_path()
1655 path = snd_hda_get_path_from_idx(codec, path_idx); in check_aamix_out_path()
1662 path = snd_hda_add_new_path(codec, dac, pin, spec->mixer_nid); in check_aamix_out_path()
1673 path = snd_hda_add_new_path(codec, dac, pin, in check_aamix_out_path()
1678 /* print_nid_path(codec, "output-aamix", path); */ in check_aamix_out_path()
1681 return snd_hda_get_path_idx(codec, path); in check_aamix_out_path()
1685 static bool indep_hp_possible(struct hda_codec *codec) in indep_hp_possible() argument
1687 struct hda_gen_spec *spec = codec->spec; in indep_hp_possible()
1696 path = snd_hda_get_path_from_idx(codec, idx); in indep_hp_possible()
1708 path = snd_hda_get_path_from_idx(codec, spec->out_paths[i]); in indep_hp_possible()
1713 path = snd_hda_get_path_from_idx(codec, spec->speaker_paths[i]); in indep_hp_possible()
1724 static void refill_shared_dacs(struct hda_codec *codec, int num_outs, in refill_shared_dacs() argument
1733 path = snd_hda_get_path_from_idx(codec, path_idx[i]); in refill_shared_dacs()
1741 static int fill_and_eval_dacs(struct hda_codec *codec, in fill_and_eval_dacs() argument
1745 struct hda_gen_spec *spec = codec->spec; in fill_and_eval_dacs()
1774 mapped = map_singles(codec, cfg->line_outs, in fill_and_eval_dacs()
1778 mapped |= map_singles(codec, cfg->hp_outs, in fill_and_eval_dacs()
1782 mapped |= map_singles(codec, cfg->speaker_outs, in fill_and_eval_dacs()
1789 err = fill_multi_ios(codec, cfg->line_out_pins[0], true); in fill_and_eval_dacs()
1796 badness += try_assign_dacs(codec, cfg->line_outs, cfg->line_out_pins, in fill_and_eval_dacs()
1803 err = fill_multi_ios(codec, cfg->line_out_pins[0], false); in fill_and_eval_dacs()
1810 err = try_assign_dacs(codec, cfg->hp_outs, cfg->hp_pins, in fill_and_eval_dacs()
1819 err = try_assign_dacs(codec, cfg->speaker_outs, in fill_and_eval_dacs()
1830 err = fill_multi_ios(codec, cfg->line_out_pins[0], false); in fill_and_eval_dacs()
1838 check_aamix_out_path(codec, spec->out_paths[0]); in fill_and_eval_dacs()
1841 check_aamix_out_path(codec, spec->hp_paths[0]); in fill_and_eval_dacs()
1844 check_aamix_out_path(codec, spec->speaker_paths[0]); in fill_and_eval_dacs()
1849 if (count_multiio_pins(codec, cfg->hp_pins[0]) >= 2) in fill_and_eval_dacs()
1877 if (spec->indep_hp && !indep_hp_possible(codec)) in fill_and_eval_dacs()
1882 refill_shared_dacs(codec, cfg->hp_outs, in fill_and_eval_dacs()
1886 refill_shared_dacs(codec, cfg->speaker_outs, in fill_and_eval_dacs()
1897 codec_dbg(codec, fmt, ##__VA_ARGS__)
1900 do { if (0) codec_dbg(codec, fmt, ##__VA_ARGS__); } while (0)
1904 static inline void print_nid_path_idx(struct hda_codec *codec, in print_nid_path_idx() argument
1909 path = snd_hda_get_path_from_idx(codec, idx); in print_nid_path_idx()
1911 print_nid_path(codec, pfx, path); in print_nid_path_idx()
1914 static void debug_show_configs(struct hda_codec *codec, in debug_show_configs() argument
1917 struct hda_gen_spec *spec = codec->spec; in debug_show_configs()
1930 print_nid_path_idx(codec, " out", spec->out_paths[i]); in debug_show_configs()
1937 print_nid_path_idx(codec, " mio", in debug_show_configs()
1948 print_nid_path_idx(codec, " hp ", spec->hp_paths[i]); in debug_show_configs()
1958 print_nid_path_idx(codec, " spk", spec->speaker_paths[i]); in debug_show_configs()
1960 print_nid_path_idx(codec, " mix", spec->aamix_out_paths[i]); in debug_show_configs()
1963 #define debug_show_configs(codec, cfg) /* NOP */ argument
1966 /* find all available DACs of the codec */
1967 static void fill_all_dac_nids(struct hda_codec *codec) in fill_all_dac_nids() argument
1969 struct hda_gen_spec *spec = codec->spec; in fill_all_dac_nids()
1974 for_each_hda_codec_node(nid, codec) { in fill_all_dac_nids()
1975 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_AUD_OUT) in fill_all_dac_nids()
1978 codec_err(codec, "Too many DACs!\n"); in fill_all_dac_nids()
1985 static int parse_output_paths(struct hda_codec *codec) in parse_output_paths() argument
1987 struct hda_gen_spec *spec = codec->spec; in parse_output_paths()
2003 badness = fill_and_eval_dacs(codec, fill_hardwired, in parse_output_paths()
2012 debug_show_configs(codec, cfg); in parse_output_paths()
2064 fill_and_eval_dacs(codec, best_wired, best_mio); in parse_output_paths()
2068 debug_show_configs(codec, cfg); in parse_output_paths()
2072 path = snd_hda_get_path_from_idx(codec, spec->out_paths[0]); in parse_output_paths()
2074 spec->vmaster_nid = look_for_out_vol_nid(codec, path); in parse_output_paths()
2076 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, in parse_output_paths()
2088 set_pin_targets(codec, cfg->line_outs, cfg->line_out_pins, val); in parse_output_paths()
2090 set_pin_targets(codec, cfg->hp_outs, cfg->hp_pins, PIN_HP); in parse_output_paths()
2093 set_pin_targets(codec, cfg->speaker_outs, in parse_output_paths()
2098 if (spec->indep_hp && !indep_hp_possible(codec)) in parse_output_paths()
2106 static int create_multi_out_ctls(struct hda_codec *codec, in create_multi_out_ctls() argument
2109 struct hda_gen_spec *spec = codec->spec; in create_multi_out_ctls()
2121 path = snd_hda_get_path_from_idx(codec, spec->out_paths[i]); in create_multi_out_ctls()
2125 name = get_line_out_pfx(codec, i, &index, NID_PATH_VOL_CTL); in create_multi_out_ctls()
2128 err = add_vol_ctl(codec, "Center", 0, 1, path); in create_multi_out_ctls()
2131 err = add_vol_ctl(codec, "LFE", 0, 2, path); in create_multi_out_ctls()
2135 err = add_stereo_vol(codec, name, index, path); in create_multi_out_ctls()
2140 name = get_line_out_pfx(codec, i, &index, NID_PATH_MUTE_CTL); in create_multi_out_ctls()
2142 err = add_sw_ctl(codec, "Center", 0, 1, path); in create_multi_out_ctls()
2145 err = add_sw_ctl(codec, "LFE", 0, 2, path); in create_multi_out_ctls()
2149 err = add_stereo_sw(codec, name, index, path); in create_multi_out_ctls()
2157 static int create_extra_out(struct hda_codec *codec, int path_idx, in create_extra_out() argument
2163 path = snd_hda_get_path_from_idx(codec, path_idx); in create_extra_out()
2166 err = add_stereo_vol(codec, pfx, cidx, path); in create_extra_out()
2169 err = add_stereo_sw(codec, pfx, cidx, path); in create_extra_out()
2176 static int create_extra_outs(struct hda_codec *codec, int num_pins, in create_extra_outs() argument
2196 err = create_extra_out(codec, paths[i], name, idx); in create_extra_outs()
2203 static int create_hp_out_ctls(struct hda_codec *codec) in create_hp_out_ctls() argument
2205 struct hda_gen_spec *spec = codec->spec; in create_hp_out_ctls()
2206 return create_extra_outs(codec, spec->autocfg.hp_outs, in create_hp_out_ctls()
2211 static int create_speaker_out_ctls(struct hda_codec *codec) in create_speaker_out_ctls() argument
2213 struct hda_gen_spec *spec = codec->spec; in create_speaker_out_ctls()
2214 return create_extra_outs(codec, spec->autocfg.speaker_outs, in create_speaker_out_ctls()
2223 static void call_hp_automute(struct hda_codec *codec,
2234 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in indep_hp_get() local
2235 struct hda_gen_spec *spec = codec->spec; in indep_hp_get()
2240 static void update_aamix_paths(struct hda_codec *codec, bool do_mix,
2247 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in indep_hp_put() local
2248 struct hda_gen_spec *spec = codec->spec; in indep_hp_put()
2268 update_aamix_paths(codec, spec->aamix_mode, in indep_hp_put()
2273 update_aamix_paths(codec, spec->aamix_mode, in indep_hp_put()
2285 call_hp_automute(codec, NULL); in indep_hp_put()
2302 static int create_indep_hp_ctls(struct hda_codec *codec) in create_indep_hp_ctls() argument
2304 struct hda_gen_spec *spec = codec->spec; in create_indep_hp_ctls()
2332 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in ch_mode_info() local
2333 struct hda_gen_spec *spec = codec->spec; in ch_mode_info()
2349 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in ch_mode_get() local
2350 struct hda_gen_spec *spec = codec->spec; in ch_mode_get()
2357 get_multiio_path(struct hda_codec *codec, int idx) in get_multiio_path() argument
2359 struct hda_gen_spec *spec = codec->spec; in get_multiio_path()
2360 return snd_hda_get_path_from_idx(codec, in get_multiio_path()
2364 static void update_automute_all(struct hda_codec *codec);
2374 static int set_multi_io(struct hda_codec *codec, int idx, bool output) in set_multi_io() argument
2376 struct hda_gen_spec *spec = codec->spec; in set_multi_io()
2380 path = get_multiio_path(codec, idx); in set_multi_io()
2388 set_pin_target(codec, nid, PIN_OUT, true); in set_multi_io()
2389 snd_hda_activate_path(codec, path, true, aamix_default(spec)); in set_multi_io()
2390 set_pin_eapd(codec, nid, true); in set_multi_io()
2392 set_pin_eapd(codec, nid, false); in set_multi_io()
2393 snd_hda_activate_path(codec, path, false, aamix_default(spec)); in set_multi_io()
2394 set_pin_target(codec, nid, spec->multi_io[idx].ctl_in, true); in set_multi_io()
2395 path_power_down_sync(codec, path); in set_multi_io()
2399 update_automute_all(codec); in set_multi_io()
2407 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in ch_mode_put() local
2408 struct hda_gen_spec *spec = codec->spec; in ch_mode_put()
2418 set_multi_io(codec, i, i < ch); in ch_mode_put()
2434 static int create_multi_channel_mode(struct hda_codec *codec) in create_multi_channel_mode() argument
2436 struct hda_gen_spec *spec = codec->spec; in create_multi_channel_mode()
2454 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in loopback_mixing_get() local
2455 struct hda_gen_spec *spec = codec->spec; in loopback_mixing_get()
2460 static void update_aamix_paths(struct hda_codec *codec, bool do_mix, in update_aamix_paths() argument
2464 struct hda_gen_spec *spec = codec->spec; in update_aamix_paths()
2467 nomix_path = snd_hda_get_path_from_idx(codec, nomix_path_idx); in update_aamix_paths()
2468 mix_path = snd_hda_get_path_from_idx(codec, mix_path_idx); in update_aamix_paths()
2480 snd_hda_activate_path(codec, nomix_path, false, true); in update_aamix_paths()
2481 snd_hda_activate_path(codec, mix_path, true, true); in update_aamix_paths()
2482 path_power_down_sync(codec, nomix_path); in update_aamix_paths()
2484 snd_hda_activate_path(codec, mix_path, false, false); in update_aamix_paths()
2485 snd_hda_activate_path(codec, nomix_path, true, false); in update_aamix_paths()
2486 path_power_down_sync(codec, mix_path); in update_aamix_paths()
2491 static void update_output_paths(struct hda_codec *codec, int num_outs, in update_output_paths() argument
2494 struct hda_gen_spec *spec = codec->spec; in update_output_paths()
2499 path = snd_hda_get_path_from_idx(codec, paths[i]); in update_output_paths()
2501 snd_hda_activate_path(codec, path, path->active, in update_output_paths()
2509 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in loopback_mixing_put() local
2510 struct hda_gen_spec *spec = codec->spec; in loopback_mixing_put()
2518 update_aamix_paths(codec, val, spec->out_paths[0], in loopback_mixing_put()
2521 update_aamix_paths(codec, val, spec->hp_paths[0], in loopback_mixing_put()
2524 update_aamix_paths(codec, val, spec->speaker_paths[0], in loopback_mixing_put()
2528 update_output_paths(codec, cfg->line_outs, spec->out_paths); in loopback_mixing_put()
2530 update_output_paths(codec, cfg->hp_outs, spec->hp_paths); in loopback_mixing_put()
2532 update_output_paths(codec, cfg->speaker_outs, in loopback_mixing_put()
2546 static int create_loopback_mixing_ctl(struct hda_codec *codec) in create_loopback_mixing_ctl() argument
2548 struct hda_gen_spec *spec = codec->spec; in create_loopback_mixing_ctl()
2562 static void call_update_outputs(struct hda_codec *codec);
2565 static void update_hp_mic(struct hda_codec *codec, int adc_mux, bool force) in update_hp_mic() argument
2567 struct hda_gen_spec *spec = codec->spec; in update_hp_mic()
2576 val = snd_hda_codec_get_pin_target(codec, pin); in update_hp_mic()
2586 val = snd_hda_get_default_vref(codec, pin); in update_hp_mic()
2587 /* if the HP pin doesn't support VREF and the codec driver gives an in update_hp_mic()
2592 unsigned int vref_val = snd_hda_get_default_vref(codec, vref_pin); in update_hp_mic()
2594 snd_hda_set_pin_ctl_cache(codec, vref_pin, in update_hp_mic()
2603 set_pin_target(codec, pin, val, true); in update_hp_mic()
2604 call_hp_automute(codec, NULL); in update_hp_mic()
2609 static int create_hp_mic(struct hda_codec *codec) in create_hp_mic() argument
2611 struct hda_gen_spec *spec = codec->spec; in create_hp_mic()
2625 defcfg = snd_hda_codec_get_pincfg(codec, cfg->inputs[0].pin); in create_hp_mic()
2643 if (!(snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_IN)) in create_hp_mic()
2654 codec_dbg(codec, "Enable shared I/O jack on NID 0x%x\n", nid); in create_hp_mic()
2662 static int create_hp_mic_jack_mode(struct hda_codec *codec, hda_nid_t pin);
2677 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in out_jack_mode_get() local
2679 if (snd_hda_codec_get_pin_target(codec, nid) == PIN_HP) in out_jack_mode_get()
2689 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in out_jack_mode_put() local
2694 if (snd_hda_codec_get_pin_target(codec, nid) == val) in out_jack_mode_put()
2696 snd_hda_set_pin_ctl_cache(codec, nid, val); in out_jack_mode_put()
2707 static bool find_kctl_name(struct hda_codec *codec, const char *name, int idx) in find_kctl_name() argument
2709 struct hda_gen_spec *spec = codec->spec; in find_kctl_name()
2720 static void get_jack_mode_name(struct hda_codec *codec, hda_nid_t pin, in get_jack_mode_name() argument
2723 struct hda_gen_spec *spec = codec->spec; in get_jack_mode_name()
2726 snd_hda_get_pin_label(codec, pin, &spec->autocfg, name, name_len, &idx); in get_jack_mode_name()
2729 for (; find_kctl_name(codec, name, idx); idx++) in get_jack_mode_name()
2733 static int get_out_jack_num_items(struct hda_codec *codec, hda_nid_t pin) in get_out_jack_num_items() argument
2735 struct hda_gen_spec *spec = codec->spec; in get_out_jack_num_items()
2737 unsigned int pincap = snd_hda_query_pin_caps(codec, pin); in get_out_jack_num_items()
2744 static int create_out_jack_modes(struct hda_codec *codec, int num_pins, in create_out_jack_modes() argument
2747 struct hda_gen_spec *spec = codec->spec; in create_out_jack_modes()
2754 if (get_out_jack_num_items(codec, pin) > 1) { in create_out_jack_modes()
2757 get_jack_mode_name(codec, pin, name, sizeof(name)); in create_out_jack_modes()
2781 static unsigned int get_vref_caps(struct hda_codec *codec, hda_nid_t pin) in get_vref_caps() argument
2785 pincap = snd_hda_query_pin_caps(codec, pin); in get_vref_caps()
2824 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in in_jack_mode_info() local
2826 unsigned int vref_caps = get_vref_caps(codec, nid); in in_jack_mode_info()
2839 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in in_jack_mode_get() local
2841 unsigned int vref_caps = get_vref_caps(codec, nid); in in_jack_mode_get()
2844 idx = snd_hda_codec_get_pin_target(codec, nid) & AC_PINCTL_VREFEN; in in_jack_mode_get()
2852 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in in_jack_mode_put() local
2854 unsigned int vref_caps = get_vref_caps(codec, nid); in in_jack_mode_put()
2857 val = snd_hda_codec_get_pin_target(codec, nid); in in_jack_mode_put()
2864 snd_hda_set_pin_ctl_cache(codec, nid, val); in in_jack_mode_put()
2875 static int get_in_jack_num_items(struct hda_codec *codec, hda_nid_t pin) in get_in_jack_num_items() argument
2877 struct hda_gen_spec *spec = codec->spec; in get_in_jack_num_items()
2880 nitems = hweight32(get_vref_caps(codec, pin)); in get_in_jack_num_items()
2884 static int create_in_jack_mode(struct hda_codec *codec, hda_nid_t pin) in create_in_jack_mode() argument
2886 struct hda_gen_spec *spec = codec->spec; in create_in_jack_mode()
2895 defcfg = snd_hda_codec_get_pincfg(codec, pin); in create_in_jack_mode()
2900 if (get_in_jack_num_items(codec, pin) <= 1) in create_in_jack_mode()
2903 get_jack_mode_name(codec, pin, name, sizeof(name)); in create_in_jack_mode()
2917 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in hp_mic_jack_mode_info() local
2919 int out_jacks = get_out_jack_num_items(codec, nid); in hp_mic_jack_mode_info()
2920 int in_jacks = get_in_jack_num_items(codec, nid); in hp_mic_jack_mode_info()
2938 unsigned int vref_caps = get_vref_caps(codec, nid); in hp_mic_jack_mode_info()
2948 static int get_cur_hp_mic_jack_mode(struct hda_codec *codec, hda_nid_t nid) in get_cur_hp_mic_jack_mode() argument
2950 int out_jacks = get_out_jack_num_items(codec, nid); in get_cur_hp_mic_jack_mode()
2951 int in_jacks = get_in_jack_num_items(codec, nid); in get_cur_hp_mic_jack_mode()
2952 unsigned int val = snd_hda_codec_get_pin_target(codec, nid); in get_cur_hp_mic_jack_mode()
2961 unsigned int vref_caps = get_vref_caps(codec, nid); in get_cur_hp_mic_jack_mode()
2972 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in hp_mic_jack_mode_get() local
2975 get_cur_hp_mic_jack_mode(codec, nid); in hp_mic_jack_mode_get()
2982 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in hp_mic_jack_mode_put() local
2984 int out_jacks = get_out_jack_num_items(codec, nid); in hp_mic_jack_mode_put()
2985 int in_jacks = get_in_jack_num_items(codec, nid); in hp_mic_jack_mode_put()
2988 oldval = get_cur_hp_mic_jack_mode(codec, nid); in hp_mic_jack_mode_put()
3001 unsigned int vref_caps = get_vref_caps(codec, nid); in hp_mic_jack_mode_put()
3002 val = snd_hda_codec_get_pin_target(codec, nid); in hp_mic_jack_mode_put()
3006 val = snd_hda_get_default_vref(codec, nid) | PIN_IN; in hp_mic_jack_mode_put()
3008 snd_hda_set_pin_ctl_cache(codec, nid, val); in hp_mic_jack_mode_put()
3009 call_hp_automute(codec, NULL); in hp_mic_jack_mode_put()
3021 static int create_hp_mic_jack_mode(struct hda_codec *codec, hda_nid_t pin) in create_hp_mic_jack_mode() argument
3023 struct hda_gen_spec *spec = codec->spec; in create_hp_mic_jack_mode()
3057 static bool look_for_mix_leaf_ctls(struct hda_codec *codec, hda_nid_t mix_nid, in look_for_mix_leaf_ctls() argument
3065 idx = snd_hda_get_conn_index(codec, mix_nid, pin, true); in look_for_mix_leaf_ctls()
3070 if (nid_has_volume(codec, mix_nid, HDA_INPUT)) in look_for_mix_leaf_ctls()
3072 if (nid_has_mute(codec, mix_nid, HDA_INPUT)) in look_for_mix_leaf_ctls()
3078 num_conns = snd_hda_get_conn_list(codec, mix_nid, &list); in look_for_mix_leaf_ctls()
3082 if (!*mix_val && nid_has_volume(codec, nid, HDA_OUTPUT) && in look_for_mix_leaf_ctls()
3083 !is_ctl_associated(codec, nid, HDA_OUTPUT, 0, NID_PATH_VOL_CTL)) in look_for_mix_leaf_ctls()
3085 if (!*mute_val && nid_has_mute(codec, nid, HDA_OUTPUT) && in look_for_mix_leaf_ctls()
3086 !is_ctl_associated(codec, nid, HDA_OUTPUT, 0, NID_PATH_MUTE_CTL)) in look_for_mix_leaf_ctls()
3093 static int new_analog_input(struct hda_codec *codec, int input_idx, in new_analog_input() argument
3097 struct hda_gen_spec *spec = codec->spec; in new_analog_input()
3102 if (!look_for_mix_leaf_ctls(codec, mix_nid, pin, &mix_val, &mute_val)) in new_analog_input()
3105 path = snd_hda_add_new_path(codec, pin, mix_nid, 0); in new_analog_input()
3108 print_nid_path(codec, "loopback", path); in new_analog_input()
3109 spec->loopback_paths[input_idx] = snd_hda_get_path_idx(codec, path); in new_analog_input()
3134 path = snd_hda_add_new_path(codec, spec->mixer_nid, in new_analog_input()
3137 print_nid_path(codec, "loopback-merge", path); in new_analog_input()
3142 snd_hda_get_path_idx(codec, path); in new_analog_input()
3149 static int is_input_pin(struct hda_codec *codec, hda_nid_t nid) in is_input_pin() argument
3151 unsigned int pincap = snd_hda_query_pin_caps(codec, nid); in is_input_pin()
3155 /* Parse the codec tree and retrieve ADCs */
3156 static int fill_adc_nids(struct hda_codec *codec) in fill_adc_nids() argument
3158 struct hda_gen_spec *spec = codec->spec; in fill_adc_nids()
3164 for_each_hda_codec_node(nid, codec) { in fill_adc_nids()
3165 unsigned int caps = get_wcaps(codec, nid); in fill_adc_nids()
3186 static int check_dyn_adc_switch(struct hda_codec *codec) in check_dyn_adc_switch() argument
3188 struct hda_gen_spec *spec = codec->spec; in check_dyn_adc_switch()
3217 codec_dbg(codec, "enabling ADC switching\n"); in check_dyn_adc_switch()
3228 invalidate_nid_path(codec, in check_dyn_adc_switch()
3242 codec_dbg(codec, "reducing to a single ADC\n"); in check_dyn_adc_switch()
3254 static int parse_capture_source(struct hda_codec *codec, hda_nid_t pin, in parse_capture_source() argument
3258 struct hda_gen_spec *spec = codec->spec; in parse_capture_source()
3268 if (!is_reachable_path(codec, pin, adc)) in parse_capture_source()
3270 path = snd_hda_add_new_path(codec, pin, adc, anchor); in parse_capture_source()
3273 print_nid_path(codec, "input", path); in parse_capture_source()
3275 snd_hda_get_path_idx(codec, path); in parse_capture_source()
3281 snd_hda_add_imux_item(codec, imux, label, cfg_idx, NULL); in parse_capture_source()
3296 static int fill_input_pin_labels(struct hda_codec *codec) in fill_input_pin_labels() argument
3298 struct hda_gen_spec *spec = codec->spec; in fill_input_pin_labels()
3307 if (!is_input_pin(codec, pin)) in fill_input_pin_labels()
3310 label = hda_get_autocfg_input_label(codec, cfg, i); in fill_input_pin_labels()
3329 static int create_input_ctls(struct hda_codec *codec) in create_input_ctls() argument
3331 struct hda_gen_spec *spec = codec->spec; in create_input_ctls()
3338 num_adcs = fill_adc_nids(codec); in create_input_ctls()
3342 err = fill_input_pin_labels(codec); in create_input_ctls()
3350 if (!is_input_pin(codec, pin)) in create_input_ctls()
3355 val |= snd_hda_get_default_vref(codec, pin); in create_input_ctls()
3357 !snd_hda_codec_get_pin_target(codec, pin)) in create_input_ctls()
3358 set_pin_target(codec, pin, val, false); in create_input_ctls()
3361 if (is_reachable_path(codec, pin, mixer)) { in create_input_ctls()
3362 err = new_analog_input(codec, i, pin, in create_input_ctls()
3371 err = parse_capture_source(codec, pin, i, num_adcs, in create_input_ctls()
3377 err = create_in_jack_mode(codec, pin); in create_input_ctls()
3385 err = parse_capture_source(codec, mixer, CFG_IDX_MIX, num_adcs, in create_input_ctls()
3402 static struct nid_path *get_input_path(struct hda_codec *codec, int adc_idx, int imux_idx) in get_input_path() argument
3404 struct hda_gen_spec *spec = codec->spec; in get_input_path()
3415 return snd_hda_get_path_from_idx(codec, spec->input_paths[imux_idx][adc_idx]); in get_input_path()
3418 static int mux_select(struct hda_codec *codec, unsigned int adc_idx,
3424 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in mux_enum_info() local
3425 struct hda_gen_spec *spec = codec->spec; in mux_enum_info()
3432 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in mux_enum_get() local
3433 struct hda_gen_spec *spec = codec->spec; in mux_enum_get()
3444 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in mux_enum_put() local
3446 return mux_select(codec, adc_idx, in mux_enum_put()
3470 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in cap_put_caller() local
3471 struct hda_gen_spec *spec = codec->spec; in cap_put_caller()
3478 mutex_lock(&codec->control_mutex); in cap_put_caller()
3480 path = get_input_path(codec, adc_idx, i); in cap_put_caller()
3492 mutex_unlock(&codec->control_mutex); in cap_put_caller()
3494 spec->cap_sync_hook(codec, kcontrol, ucontrol); in cap_put_caller()
3544 static int parse_capvol_in_path(struct hda_codec *codec, struct nid_path *path) in parse_capvol_in_path() argument
3556 if (nid_has_volume(codec, nid, HDA_OUTPUT)) in parse_capvol_in_path()
3559 else if (nid_has_volume(codec, nid, HDA_INPUT)) { in parse_capvol_in_path()
3561 if (!depth && codec->single_adc_amp) in parse_capvol_in_path()
3568 if (nid_has_mute(codec, nid, HDA_OUTPUT)) in parse_capvol_in_path()
3571 else if (nid_has_mute(codec, nid, HDA_INPUT)) { in parse_capvol_in_path()
3573 if (!depth && codec->single_adc_amp) in parse_capvol_in_path()
3583 static bool is_inv_dmic_pin(struct hda_codec *codec, hda_nid_t nid) in is_inv_dmic_pin() argument
3585 struct hda_gen_spec *spec = codec->spec; in is_inv_dmic_pin()
3597 val = snd_hda_codec_get_pincfg(codec, nid); in is_inv_dmic_pin()
3607 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in cap_single_sw_put() local
3608 struct hda_gen_spec *spec = codec->spec; in cap_single_sw_put()
3616 spec->cap_sync_hook(codec, kcontrol, ucontrol); in cap_single_sw_put()
3621 static int add_single_cap_ctl(struct hda_codec *codec, const char *label, in add_single_cap_ctl() argument
3625 struct hda_gen_spec *spec = codec->spec; in add_single_cap_ctl()
3673 static int create_single_cap_vol_ctl(struct hda_codec *codec, int idx, in create_single_cap_vol_ctl() argument
3678 err = add_single_cap_ctl(codec, NULL, idx, false, vol_ctl, inv_dmic); in create_single_cap_vol_ctl()
3681 err = add_single_cap_ctl(codec, NULL, idx, true, sw_ctl, inv_dmic); in create_single_cap_vol_ctl()
3688 static int create_bind_cap_vol_ctl(struct hda_codec *codec, int idx, in create_bind_cap_vol_ctl() argument
3691 struct hda_gen_spec *spec = codec->spec; in create_bind_cap_vol_ctl()
3716 static unsigned int get_first_cap_ctl(struct hda_codec *codec, int idx, int type) in get_first_cap_ctl() argument
3722 path = get_input_path(codec, 0, idx); in get_first_cap_ctl()
3729 path = get_input_path(codec, 0, i); in get_first_cap_ctl()
3737 static int create_multi_cap_vol_ctl(struct hda_codec *codec) in create_multi_cap_vol_ctl() argument
3739 struct hda_gen_spec *spec = codec->spec; in create_multi_cap_vol_ctl()
3750 inv_dmic = is_inv_dmic_pin(codec, spec->imux_pins[i]); in create_multi_cap_vol_ctl()
3753 err = add_single_cap_ctl(codec, in create_multi_cap_vol_ctl()
3757 get_first_cap_ctl(codec, i, type), in create_multi_cap_vol_ctl()
3766 static int create_capture_mixers(struct hda_codec *codec) in create_capture_mixers() argument
3768 struct hda_gen_spec *spec = codec->spec; in create_capture_mixers()
3796 path = get_input_path(codec, n, i); in create_capture_mixers()
3799 parse_capvol_in_path(codec, path); in create_capture_mixers()
3804 if (!same_amp_caps(codec, vol, in create_capture_mixers()
3812 if (!same_amp_caps(codec, sw, in create_capture_mixers()
3816 if (is_inv_dmic_pin(codec, spec->imux_pins[i])) in create_capture_mixers()
3821 err = create_single_cap_vol_ctl(codec, n, vol, sw, in create_capture_mixers()
3824 err = create_bind_cap_vol_ctl(codec, n, vol, sw); in create_capture_mixers()
3826 err = create_multi_cap_vol_ctl(codec); in create_capture_mixers()
3839 static bool check_boost_vol(struct hda_codec *codec, hda_nid_t nid, in check_boost_vol() argument
3844 if (!nid_has_volume(codec, nid, dir) || in check_boost_vol()
3845 is_ctl_associated(codec, nid, dir, idx, NID_PATH_VOL_CTL) || in check_boost_vol()
3846 is_ctl_associated(codec, nid, dir, idx, NID_PATH_BOOST_CTL)) in check_boost_vol()
3849 step = (query_amp_caps(codec, nid, dir) & AC_AMPCAP_STEP_SIZE) in check_boost_vol()
3857 static unsigned int look_for_boost_amp(struct hda_codec *codec, in look_for_boost_amp() argument
3868 if (depth && check_boost_vol(codec, nid, HDA_OUTPUT, 0)) { in look_for_boost_amp()
3871 } else if (check_boost_vol(codec, nid, HDA_INPUT, in look_for_boost_amp()
3882 static int parse_mic_boost(struct hda_codec *codec) in parse_mic_boost() argument
3884 struct hda_gen_spec *spec = codec->spec; in parse_mic_boost()
3906 path = get_input_path(codec, 0, i); in parse_mic_boost()
3910 val = look_for_boost_amp(codec, path); in parse_mic_boost()
3931 static int create_mute_led_cdev(struct hda_codec *codec, in create_mute_led_cdev() argument
3936 struct hda_gen_spec *spec = codec->spec; in create_mute_led_cdev()
3941 cdev = devm_kzalloc(&codec->core.dev, sizeof(*cdev), GFP_KERNEL); in create_mute_led_cdev()
3951 err = led_classdev_register(&codec->core.dev, cdev); in create_mute_led_cdev()
3960 * @codec: the HDA codec
3963 int snd_hda_gen_add_mute_led_cdev(struct hda_codec *codec, in snd_hda_gen_add_mute_led_cdev() argument
3967 struct hda_gen_spec *spec = codec->spec; in snd_hda_gen_add_mute_led_cdev()
3971 err = create_mute_led_cdev(codec, callback, false); in snd_hda_gen_add_mute_led_cdev()
3973 codec_warn(codec, "failed to create a mute LED cdev\n"); in snd_hda_gen_add_mute_led_cdev()
3979 codec_err(codec, "vmaster hook already present before cdev!\n"); in snd_hda_gen_add_mute_led_cdev()
3988 * @codec: the HDA codec
3991 * Called from the codec drivers for offering the mic mute LED controls.
4000 int snd_hda_gen_add_micmute_led_cdev(struct hda_codec *codec, in snd_hda_gen_add_micmute_led_cdev() argument
4004 struct hda_gen_spec *spec = codec->spec; in snd_hda_gen_add_micmute_led_cdev()
4008 err = create_mute_led_cdev(codec, callback, true); in snd_hda_gen_add_micmute_led_cdev()
4010 codec_warn(codec, "failed to create a mic-mute LED cdev\n"); in snd_hda_gen_add_micmute_led_cdev()
4024 static void parse_digital(struct hda_codec *codec) in parse_digital() argument
4026 struct hda_gen_spec *spec = codec->spec; in parse_digital()
4035 dig_nid = look_for_dac(codec, pin, true); in parse_digital()
4038 path = snd_hda_add_new_path(codec, dig_nid, pin, 0); in parse_digital()
4041 print_nid_path(codec, "digout", path); in parse_digital()
4044 spec->digout_paths[i] = snd_hda_get_path_idx(codec, path); in parse_digital()
4045 set_pin_target(codec, pin, PIN_OUT, false); in parse_digital()
4060 for_each_hda_codec_node(dig_nid, codec) { in parse_digital()
4061 unsigned int wcaps = get_wcaps(codec, dig_nid); in parse_digital()
4066 path = snd_hda_add_new_path(codec, pin, dig_nid, 0); in parse_digital()
4068 print_nid_path(codec, "digin", path); in parse_digital()
4072 spec->digin_path = snd_hda_get_path_idx(codec, path); in parse_digital()
4073 set_pin_target(codec, pin, PIN_IN, false); in parse_digital()
4085 static bool dyn_adc_pcm_resetup(struct hda_codec *codec, int cur);
4088 static int mux_select(struct hda_codec *codec, unsigned int adc_idx, in mux_select() argument
4091 struct hda_gen_spec *spec = codec->spec; in mux_select()
4104 old_path = get_input_path(codec, adc_idx, spec->cur_mux[adc_idx]); in mux_select()
4108 snd_hda_activate_path(codec, old_path, false, false); in mux_select()
4113 update_hp_mic(codec, adc_idx, false); in mux_select()
4116 dyn_adc_pcm_resetup(codec, idx); in mux_select()
4118 path = get_input_path(codec, adc_idx, idx); in mux_select()
4123 snd_hda_activate_path(codec, path, true, false); in mux_select()
4125 spec->cap_sync_hook(codec, NULL, NULL); in mux_select()
4126 path_power_down_sync(codec, old_path); in mux_select()
4135 static hda_nid_t set_path_power(struct hda_codec *codec, hda_nid_t nid, in set_path_power() argument
4138 struct hda_gen_spec *spec = codec->spec; in set_path_power()
4157 last = path_power_update(codec, path, true); in set_path_power()
4167 static bool detect_pin_state(struct hda_codec *codec, hda_nid_t pin) in detect_pin_state() argument
4169 if (!is_jack_detectable(codec, pin)) in detect_pin_state()
4171 return snd_hda_jack_detect_state(codec, pin) != HDA_JACK_NOT_PRESENT; in detect_pin_state()
4180 static hda_nid_t set_pin_power_jack(struct hda_codec *codec, hda_nid_t pin, in set_pin_power_jack() argument
4185 if (!codec->power_save_node) in set_pin_power_jack()
4188 on = detect_pin_state(codec, pin); in set_pin_power_jack()
4192 return set_path_power(codec, pin, on, -1); in set_pin_power_jack()
4195 static void pin_power_callback(struct hda_codec *codec, in pin_power_callback() argument
4200 sync_power_state_change(codec, in pin_power_callback()
4201 set_pin_power_jack(codec, jack->nid, on)); in pin_power_callback()
4205 static void pin_power_up_callback(struct hda_codec *codec, in pin_power_up_callback() argument
4208 pin_power_callback(codec, jack, true); in pin_power_up_callback()
4212 static void pin_power_down_callback(struct hda_codec *codec, in pin_power_down_callback() argument
4215 pin_power_callback(codec, jack, false); in pin_power_down_callback()
4219 static void add_pin_power_ctls(struct hda_codec *codec, int num_pins, in add_pin_power_ctls() argument
4227 if (is_jack_detectable(codec, pins[i])) in add_pin_power_ctls()
4228 snd_hda_jack_detect_enable_callback(codec, pins[i], cb); in add_pin_power_ctls()
4230 set_path_power(codec, pins[i], true, -1); in add_pin_power_ctls()
4237 static void add_all_pin_power_ctls(struct hda_codec *codec, bool on) in add_all_pin_power_ctls() argument
4239 struct hda_gen_spec *spec = codec->spec; in add_all_pin_power_ctls()
4243 if (!codec->power_save_node) in add_all_pin_power_ctls()
4245 add_pin_power_ctls(codec, cfg->line_outs, cfg->line_out_pins, on); in add_all_pin_power_ctls()
4247 add_pin_power_ctls(codec, cfg->hp_outs, cfg->hp_pins, on); in add_all_pin_power_ctls()
4249 add_pin_power_ctls(codec, cfg->speaker_outs, cfg->speaker_pins, on); in add_all_pin_power_ctls()
4251 add_pin_power_ctls(codec, 1, &cfg->inputs[i].pin, on); in add_all_pin_power_ctls()
4255 static void sync_pin_power_ctls(struct hda_codec *codec, int num_pins, in sync_pin_power_ctls() argument
4261 if (is_jack_detectable(codec, pins[i])) in sync_pin_power_ctls()
4262 set_pin_power_jack(codec, pins[i], -1); in sync_pin_power_ctls()
4266 static void sync_all_pin_power_ctls(struct hda_codec *codec) in sync_all_pin_power_ctls() argument
4268 struct hda_gen_spec *spec = codec->spec; in sync_all_pin_power_ctls()
4272 if (!codec->power_save_node) in sync_all_pin_power_ctls()
4274 sync_pin_power_ctls(codec, cfg->line_outs, cfg->line_out_pins); in sync_all_pin_power_ctls()
4276 sync_pin_power_ctls(codec, cfg->hp_outs, cfg->hp_pins); in sync_all_pin_power_ctls()
4278 sync_pin_power_ctls(codec, cfg->speaker_outs, cfg->speaker_pins); in sync_all_pin_power_ctls()
4280 sync_pin_power_ctls(codec, 1, &cfg->inputs[i].pin); in sync_all_pin_power_ctls()
4284 static int add_fake_paths(struct hda_codec *codec, hda_nid_t nid, in add_fake_paths() argument
4287 struct hda_gen_spec *spec = codec->spec; in add_fake_paths()
4294 if (get_nid_path(codec, nid, pins[i], 0)) in add_fake_paths()
4309 static int add_fake_beep_paths(struct hda_codec *codec) in add_fake_beep_paths() argument
4311 struct hda_gen_spec *spec = codec->spec; in add_fake_beep_paths()
4316 if (!codec->power_save_node || !nid) in add_fake_beep_paths()
4318 err = add_fake_paths(codec, nid, cfg->line_outs, cfg->line_out_pins); in add_fake_beep_paths()
4322 err = add_fake_paths(codec, nid, cfg->hp_outs, cfg->hp_pins); in add_fake_beep_paths()
4327 err = add_fake_paths(codec, nid, cfg->speaker_outs, in add_fake_beep_paths()
4338 set_path_power(beep->codec, beep->nid, -1, on); in beep_power_hook()
4343 * @codec: the HDA codec
4346 int snd_hda_gen_fix_pin_power(struct hda_codec *codec, hda_nid_t pin) in snd_hda_gen_fix_pin_power() argument
4348 struct hda_gen_spec *spec = codec->spec; in snd_hda_gen_fix_pin_power()
4369 static bool detect_jacks(struct hda_codec *codec, int num_pins, const hda_nid_t *pins) in detect_jacks() argument
4379 if (snd_hda_codec_get_pin_target(codec, nid) & AC_PINCTL_IN_EN) in detect_jacks()
4381 if (snd_hda_jack_detect_state(codec, nid) == HDA_JACK_PRESENT) in detect_jacks()
4388 static void do_automute(struct hda_codec *codec, int num_pins, const hda_nid_t *pins, in do_automute() argument
4391 struct hda_gen_spec *spec = codec->spec; in do_automute()
4400 oldval = snd_hda_codec_get_pin_target(codec, nid); in do_automute()
4408 path = snd_hda_get_path_from_idx(codec, paths[i]); in do_automute()
4434 update_pin_ctl(codec, nid, val); in do_automute()
4437 set_pin_eapd(codec, nid, !mute); in do_automute()
4438 if (codec->power_save_node) { in do_automute()
4441 on = detect_pin_state(codec, nid); in do_automute()
4442 set_path_power(codec, nid, on, -1); in do_automute()
4449 * @codec: the HDA codec
4453 void snd_hda_gen_update_outputs(struct hda_codec *codec) in snd_hda_gen_update_outputs() argument
4455 struct hda_gen_spec *spec = codec->spec; in snd_hda_gen_update_outputs()
4467 do_automute(codec, ARRAY_SIZE(spec->autocfg.hp_pins), in snd_hda_gen_update_outputs()
4480 do_automute(codec, ARRAY_SIZE(spec->autocfg.speaker_pins), in snd_hda_gen_update_outputs()
4495 do_automute(codec, ARRAY_SIZE(spec->autocfg.line_out_pins), in snd_hda_gen_update_outputs()
4500 static void call_update_outputs(struct hda_codec *codec) in call_update_outputs() argument
4502 struct hda_gen_spec *spec = codec->spec; in call_update_outputs()
4504 spec->automute_hook(codec); in call_update_outputs()
4506 snd_hda_gen_update_outputs(codec); in call_update_outputs()
4509 if (spec->auto_mute_via_amp && !codec->bus->shutdown) in call_update_outputs()
4515 * @codec: the HDA codec
4518 void snd_hda_gen_hp_automute(struct hda_codec *codec, in snd_hda_gen_hp_automute() argument
4521 struct hda_gen_spec *spec = codec->spec; in snd_hda_gen_hp_automute()
4531 spec->hp_jack_present = detect_jacks(codec, num_pins, pins); in snd_hda_gen_hp_automute()
4534 call_update_outputs(codec); in snd_hda_gen_hp_automute()
4540 * @codec: the HDA codec
4543 void snd_hda_gen_line_automute(struct hda_codec *codec, in snd_hda_gen_line_automute() argument
4546 struct hda_gen_spec *spec = codec->spec; in snd_hda_gen_line_automute()
4555 detect_jacks(codec, ARRAY_SIZE(spec->autocfg.line_out_pins), in snd_hda_gen_line_automute()
4559 call_update_outputs(codec); in snd_hda_gen_line_automute()
4565 * @codec: the HDA codec
4568 void snd_hda_gen_mic_autoswitch(struct hda_codec *codec, in snd_hda_gen_mic_autoswitch() argument
4571 struct hda_gen_spec *spec = codec->spec; in snd_hda_gen_mic_autoswitch()
4580 if (snd_hda_codec_get_pin_target(codec, pin) & AC_PINCTL_OUT_EN) in snd_hda_gen_mic_autoswitch()
4582 if (snd_hda_jack_detect_state(codec, pin) == HDA_JACK_PRESENT) { in snd_hda_gen_mic_autoswitch()
4583 mux_select(codec, 0, spec->am_entry[i].idx); in snd_hda_gen_mic_autoswitch()
4587 mux_select(codec, 0, spec->am_entry[0].idx); in snd_hda_gen_mic_autoswitch()
4592 static void call_hp_automute(struct hda_codec *codec, in call_hp_automute() argument
4595 struct hda_gen_spec *spec = codec->spec; in call_hp_automute()
4597 spec->hp_automute_hook(codec, jack); in call_hp_automute()
4599 snd_hda_gen_hp_automute(codec, jack); in call_hp_automute()
4602 static void call_line_automute(struct hda_codec *codec, in call_line_automute() argument
4605 struct hda_gen_spec *spec = codec->spec; in call_line_automute()
4607 spec->line_automute_hook(codec, jack); in call_line_automute()
4609 snd_hda_gen_line_automute(codec, jack); in call_line_automute()
4612 static void call_mic_autoswitch(struct hda_codec *codec, in call_mic_autoswitch() argument
4615 struct hda_gen_spec *spec = codec->spec; in call_mic_autoswitch()
4617 spec->mic_autoswitch_hook(codec, jack); in call_mic_autoswitch()
4619 snd_hda_gen_mic_autoswitch(codec, jack); in call_mic_autoswitch()
4623 static void update_automute_all(struct hda_codec *codec) in update_automute_all() argument
4625 call_hp_automute(codec, NULL); in update_automute_all()
4626 call_line_automute(codec, NULL); in update_automute_all()
4627 call_mic_autoswitch(codec, NULL); in update_automute_all()
4636 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in automute_mode_info() local
4637 struct hda_gen_spec *spec = codec->spec; in automute_mode_info()
4650 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in automute_mode_get() local
4651 struct hda_gen_spec *spec = codec->spec; in automute_mode_get()
4665 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in automute_mode_put() local
4666 struct hda_gen_spec *spec = codec->spec; in automute_mode_put()
4699 call_update_outputs(codec); in automute_mode_put()
4711 static int add_automute_mode_enum(struct hda_codec *codec) in add_automute_mode_enum() argument
4713 struct hda_gen_spec *spec = codec->spec; in add_automute_mode_enum()
4724 static int check_auto_mute_availability(struct hda_codec *codec) in check_auto_mute_availability() argument
4726 struct hda_gen_spec *spec = codec->spec; in check_auto_mute_availability()
4759 if (!is_jack_detectable(codec, nid)) in check_auto_mute_availability()
4761 codec_dbg(codec, "Enable HP auto-muting on NID 0x%x\n", nid); in check_auto_mute_availability()
4762 snd_hda_jack_detect_enable_callback(codec, nid, in check_auto_mute_availability()
4771 if (!is_jack_detectable(codec, nid)) in check_auto_mute_availability()
4773 codec_dbg(codec, "Enable Line-Out auto-muting on NID 0x%x\n", nid); in check_auto_mute_availability()
4774 snd_hda_jack_detect_enable_callback(codec, nid, in check_auto_mute_availability()
4789 err = add_automute_mode_enum(codec); in check_auto_mute_availability()
4797 static bool auto_mic_check_imux(struct hda_codec *codec) in auto_mic_check_imux() argument
4799 struct hda_gen_spec *spec = codec->spec; in auto_mic_check_imux()
4814 snd_hda_jack_detect_enable_callback(codec, in auto_mic_check_imux()
4831 static int check_auto_mic_availability(struct hda_codec *codec) in check_auto_mic_availability() argument
4833 struct hda_gen_spec *spec = codec->spec; in check_auto_mic_availability()
4846 attr = snd_hda_codec_get_pincfg(codec, nid); in check_auto_mic_availability()
4863 if (!is_jack_detectable(codec, nid)) in check_auto_mic_availability()
4885 if (!auto_mic_check_imux(codec)) in check_auto_mic_availability()
4891 codec_dbg(codec, "Enable auto-mic switch on NID 0x%x/0x%x/0x%x\n", in check_auto_mic_availability()
4902 * @codec: the HDA codec
4906 unsigned int snd_hda_gen_path_power_filter(struct hda_codec *codec, in snd_hda_gen_path_power_filter() argument
4910 struct hda_gen_spec *spec = codec->spec; in snd_hda_gen_path_power_filter()
4912 if (!spec->power_down_unused && !codec->power_save_node) in snd_hda_gen_path_power_filter()
4914 if (power_state != AC_PWRST_D0 || nid == codec->core.afg) in snd_hda_gen_path_power_filter()
4916 if (get_wcaps_type(get_wcaps(codec, nid)) >= AC_WID_POWER) in snd_hda_gen_path_power_filter()
4918 if (is_active_nid_for_any(codec, nid)) in snd_hda_gen_path_power_filter()
4925 static void mute_all_mixer_nid(struct hda_codec *codec, hda_nid_t mix) in mute_all_mixer_nid() argument
4931 nums = snd_hda_get_conn_list(codec, mix, &conn); in mute_all_mixer_nid()
4932 has_amp = nid_has_mute(codec, mix, HDA_INPUT); in mute_all_mixer_nid()
4935 update_amp(codec, mix, HDA_INPUT, i, in mute_all_mixer_nid()
4937 else if (nid_has_volume(codec, conn[i], HDA_OUTPUT)) in mute_all_mixer_nid()
4938 update_amp(codec, conn[i], HDA_OUTPUT, 0, in mute_all_mixer_nid()
4945 * @codec: the HDA codec
4951 void snd_hda_gen_stream_pm(struct hda_codec *codec, hda_nid_t nid, bool on) in snd_hda_gen_stream_pm() argument
4953 if (codec->power_save_node) in snd_hda_gen_stream_pm()
4954 set_path_power(codec, nid, -1, on); in snd_hda_gen_stream_pm()
4959 static bool force_mute_output_path(struct hda_codec *codec, hda_nid_t nid) in force_mute_output_path() argument
4963 if (!nid_has_mute(codec, nid, HDA_OUTPUT)) in force_mute_output_path()
4965 if (snd_hda_codec_amp_read(codec, nid, 0, HDA_OUTPUT, 0) & in force_mute_output_path()
4966 snd_hda_codec_amp_read(codec, nid, 1, HDA_OUTPUT, 0) & in force_mute_output_path()
4971 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, in force_mute_output_path()
4979 * @codec: the HDA codec
4988 bool snd_hda_gen_shutup_speakers(struct hda_codec *codec) in snd_hda_gen_shutup_speakers() argument
4990 struct hda_gen_spec *spec = codec->spec; in snd_hda_gen_shutup_speakers()
4997 if (!snd_hdac_is_power_on(&codec->core)) in snd_hda_gen_shutup_speakers()
5009 path = snd_hda_get_path_from_idx(codec, paths[i]); in snd_hda_gen_shutup_speakers()
5013 if (force_mute_output_path(codec, path->path[p])) in snd_hda_gen_shutup_speakers()
5024 * @codec: the HDA codec
5030 int snd_hda_gen_parse_auto_config(struct hda_codec *codec, in snd_hda_gen_parse_auto_config() argument
5033 struct hda_gen_spec *spec = codec->spec; in snd_hda_gen_parse_auto_config()
5036 parse_user_hints(codec); in snd_hda_gen_parse_auto_config()
5054 fill_all_dac_nids(codec); in snd_hda_gen_parse_auto_config()
5080 err = parse_output_paths(codec); in snd_hda_gen_parse_auto_config()
5083 err = create_multi_channel_mode(codec); in snd_hda_gen_parse_auto_config()
5086 err = create_multi_out_ctls(codec, cfg); in snd_hda_gen_parse_auto_config()
5089 err = create_hp_out_ctls(codec); in snd_hda_gen_parse_auto_config()
5092 err = create_speaker_out_ctls(codec); in snd_hda_gen_parse_auto_config()
5095 err = create_indep_hp_ctls(codec); in snd_hda_gen_parse_auto_config()
5098 err = create_loopback_mixing_ctl(codec); in snd_hda_gen_parse_auto_config()
5101 err = create_hp_mic(codec); in snd_hda_gen_parse_auto_config()
5104 err = create_input_ctls(codec); in snd_hda_gen_parse_auto_config()
5109 add_all_pin_power_ctls(codec, false); in snd_hda_gen_parse_auto_config()
5122 err = check_auto_mute_availability(codec); in snd_hda_gen_parse_auto_config()
5126 err = check_dyn_adc_switch(codec); in snd_hda_gen_parse_auto_config()
5130 err = check_auto_mic_availability(codec); in snd_hda_gen_parse_auto_config()
5138 err = parse_capture_source(codec, spec->mixer_nid, in snd_hda_gen_parse_auto_config()
5146 err = create_capture_mixers(codec); in snd_hda_gen_parse_auto_config()
5150 err = parse_mic_boost(codec); in snd_hda_gen_parse_auto_config()
5160 err = create_hp_mic_jack_mode(codec, spec->hp_mic_pin); in snd_hda_gen_parse_auto_config()
5167 err = create_out_jack_modes(codec, cfg->line_outs, in snd_hda_gen_parse_auto_config()
5173 err = create_out_jack_modes(codec, cfg->hp_outs, in snd_hda_gen_parse_auto_config()
5181 add_all_pin_power_ctls(codec, true); in snd_hda_gen_parse_auto_config()
5185 mute_all_mixer_nid(codec, spec->mixer_nid); in snd_hda_gen_parse_auto_config()
5188 parse_digital(codec); in snd_hda_gen_parse_auto_config()
5190 if (spec->power_down_unused || codec->power_save_node) { in snd_hda_gen_parse_auto_config()
5191 if (!codec->power_filter) in snd_hda_gen_parse_auto_config()
5192 codec->power_filter = snd_hda_gen_path_power_filter; in snd_hda_gen_parse_auto_config()
5193 if (!codec->patch_ops.stream_pm) in snd_hda_gen_parse_auto_config()
5194 codec->patch_ops.stream_pm = snd_hda_gen_stream_pm; in snd_hda_gen_parse_auto_config()
5198 err = snd_hda_attach_beep_device(codec, spec->beep_nid); in snd_hda_gen_parse_auto_config()
5201 if (codec->beep && codec->power_save_node) { in snd_hda_gen_parse_auto_config()
5202 err = add_fake_beep_paths(codec); in snd_hda_gen_parse_auto_config()
5205 codec->beep->power_hook = beep_power_hook; in snd_hda_gen_parse_auto_config()
5231 * @codec: the HDA codec
5235 int snd_hda_gen_build_controls(struct hda_codec *codec) in snd_hda_gen_build_controls() argument
5237 struct hda_gen_spec *spec = codec->spec; in snd_hda_gen_build_controls()
5241 err = snd_hda_add_new_ctls(codec, spec->kctls.list); in snd_hda_gen_build_controls()
5247 err = snd_hda_create_dig_out_ctls(codec, in snd_hda_gen_build_controls()
5254 err = snd_hda_create_spdif_share_sw(codec, in snd_hda_gen_build_controls()
5262 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); in snd_hda_gen_build_controls()
5269 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { in snd_hda_gen_build_controls()
5270 err = snd_hda_add_vmaster(codec, "Master Playback Volume", in snd_hda_gen_build_controls()
5277 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { in snd_hda_gen_build_controls()
5278 err = __snd_hda_add_vmaster(codec, "Master Playback Switch", in snd_hda_gen_build_controls()
5287 snd_hda_add_vmaster_hook(codec, &spec->vmaster_mute); in snd_hda_gen_build_controls()
5294 err = snd_hda_jack_add_kctls(codec, &spec->autocfg); in snd_hda_gen_build_controls()
5308 struct hda_codec *codec, in call_pcm_playback_hook() argument
5312 struct hda_gen_spec *spec = codec->spec; in call_pcm_playback_hook()
5314 spec->pcm_playback_hook(hinfo, codec, substream, action); in call_pcm_playback_hook()
5318 struct hda_codec *codec, in call_pcm_capture_hook() argument
5322 struct hda_gen_spec *spec = codec->spec; in call_pcm_capture_hook()
5324 spec->pcm_capture_hook(hinfo, codec, substream, action); in call_pcm_capture_hook()
5331 struct hda_codec *codec, in playback_pcm_open() argument
5334 struct hda_gen_spec *spec = codec->spec; in playback_pcm_open()
5338 err = snd_hda_multi_out_analog_open(codec, in playback_pcm_open()
5343 call_pcm_playback_hook(hinfo, codec, substream, in playback_pcm_open()
5351 struct hda_codec *codec, in playback_pcm_prepare() argument
5356 struct hda_gen_spec *spec = codec->spec; in playback_pcm_prepare()
5359 err = snd_hda_multi_out_analog_prepare(codec, &spec->multiout, in playback_pcm_prepare()
5362 call_pcm_playback_hook(hinfo, codec, substream, in playback_pcm_prepare()
5368 struct hda_codec *codec, in playback_pcm_cleanup() argument
5371 struct hda_gen_spec *spec = codec->spec; in playback_pcm_cleanup()
5374 err = snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); in playback_pcm_cleanup()
5376 call_pcm_playback_hook(hinfo, codec, substream, in playback_pcm_cleanup()
5382 struct hda_codec *codec, in playback_pcm_close() argument
5385 struct hda_gen_spec *spec = codec->spec; in playback_pcm_close()
5388 call_pcm_playback_hook(hinfo, codec, substream, in playback_pcm_close()
5395 struct hda_codec *codec, in capture_pcm_open() argument
5398 call_pcm_capture_hook(hinfo, codec, substream, HDA_GEN_PCM_ACT_OPEN); in capture_pcm_open()
5403 struct hda_codec *codec, in capture_pcm_prepare() argument
5408 snd_hda_codec_setup_stream(codec, hinfo->nid, stream_tag, 0, format); in capture_pcm_prepare()
5409 call_pcm_capture_hook(hinfo, codec, substream, in capture_pcm_prepare()
5415 struct hda_codec *codec, in capture_pcm_cleanup() argument
5418 snd_hda_codec_cleanup_stream(codec, hinfo->nid); in capture_pcm_cleanup()
5419 call_pcm_capture_hook(hinfo, codec, substream, in capture_pcm_cleanup()
5425 struct hda_codec *codec, in capture_pcm_close() argument
5428 call_pcm_capture_hook(hinfo, codec, substream, HDA_GEN_PCM_ACT_CLOSE); in capture_pcm_close()
5433 struct hda_codec *codec, in alt_playback_pcm_open() argument
5436 struct hda_gen_spec *spec = codec->spec; in alt_playback_pcm_open()
5444 call_pcm_playback_hook(hinfo, codec, substream, in alt_playback_pcm_open()
5451 struct hda_codec *codec, in alt_playback_pcm_close() argument
5454 struct hda_gen_spec *spec = codec->spec; in alt_playback_pcm_close()
5457 call_pcm_playback_hook(hinfo, codec, substream, in alt_playback_pcm_close()
5464 struct hda_codec *codec, in alt_playback_pcm_prepare() argument
5469 snd_hda_codec_setup_stream(codec, hinfo->nid, stream_tag, 0, format); in alt_playback_pcm_prepare()
5470 call_pcm_playback_hook(hinfo, codec, substream, in alt_playback_pcm_prepare()
5476 struct hda_codec *codec, in alt_playback_pcm_cleanup() argument
5479 snd_hda_codec_cleanup_stream(codec, hinfo->nid); in alt_playback_pcm_cleanup()
5480 call_pcm_playback_hook(hinfo, codec, substream, in alt_playback_pcm_cleanup()
5489 struct hda_codec *codec, in dig_playback_pcm_open() argument
5492 struct hda_gen_spec *spec = codec->spec; in dig_playback_pcm_open()
5493 return snd_hda_multi_out_dig_open(codec, &spec->multiout); in dig_playback_pcm_open()
5497 struct hda_codec *codec, in dig_playback_pcm_prepare() argument
5502 struct hda_gen_spec *spec = codec->spec; in dig_playback_pcm_prepare()
5503 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, in dig_playback_pcm_prepare()
5508 struct hda_codec *codec, in dig_playback_pcm_cleanup() argument
5511 struct hda_gen_spec *spec = codec->spec; in dig_playback_pcm_cleanup()
5512 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); in dig_playback_pcm_cleanup()
5516 struct hda_codec *codec, in dig_playback_pcm_close() argument
5519 struct hda_gen_spec *spec = codec->spec; in dig_playback_pcm_close()
5520 return snd_hda_multi_out_dig_close(codec, &spec->multiout); in dig_playback_pcm_close()
5530 struct hda_codec *codec, in alt_capture_pcm_prepare() argument
5535 struct hda_gen_spec *spec = codec->spec; in alt_capture_pcm_prepare()
5537 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], in alt_capture_pcm_prepare()
5539 call_pcm_capture_hook(hinfo, codec, substream, in alt_capture_pcm_prepare()
5545 struct hda_codec *codec, in alt_capture_pcm_cleanup() argument
5548 struct hda_gen_spec *spec = codec->spec; in alt_capture_pcm_cleanup()
5550 snd_hda_codec_cleanup_stream(codec, in alt_capture_pcm_cleanup()
5552 call_pcm_capture_hook(hinfo, codec, substream, in alt_capture_pcm_cleanup()
5641 static bool dyn_adc_pcm_resetup(struct hda_codec *codec, int cur) in dyn_adc_pcm_resetup() argument
5643 struct hda_gen_spec *spec = codec->spec; in dyn_adc_pcm_resetup()
5648 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1); in dyn_adc_pcm_resetup()
5650 snd_hda_codec_setup_stream(codec, new_adc, in dyn_adc_pcm_resetup()
5660 struct hda_codec *codec, in dyn_adc_capture_pcm_prepare() argument
5665 struct hda_gen_spec *spec = codec->spec; in dyn_adc_capture_pcm_prepare()
5669 snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format); in dyn_adc_capture_pcm_prepare()
5670 call_pcm_capture_hook(hinfo, codec, substream, HDA_GEN_PCM_ACT_PREPARE); in dyn_adc_capture_pcm_prepare()
5675 struct hda_codec *codec, in dyn_adc_capture_pcm_cleanup() argument
5678 struct hda_gen_spec *spec = codec->spec; in dyn_adc_capture_pcm_cleanup()
5679 snd_hda_codec_cleanup_stream(codec, spec->cur_adc); in dyn_adc_capture_pcm_cleanup()
5681 call_pcm_capture_hook(hinfo, codec, substream, HDA_GEN_PCM_ACT_CLEANUP); in dyn_adc_capture_pcm_cleanup()
5744 * @codec: the HDA codec
5748 int snd_hda_gen_build_pcms(struct hda_codec *codec) in snd_hda_gen_build_pcms() argument
5750 struct hda_gen_spec *spec = codec->spec; in snd_hda_gen_build_pcms()
5759 " Analog", codec->core.chip_name); in snd_hda_gen_build_pcms()
5760 info = snd_hda_codec_pcm_new(codec, "%s", spec->stream_name_analog); in snd_hda_gen_build_pcms()
5790 " Digital", codec->core.chip_name); in snd_hda_gen_build_pcms()
5791 info = snd_hda_codec_pcm_new(codec, "%s", in snd_hda_gen_build_pcms()
5795 codec->follower_dig_outs = spec->multiout.follower_dig_outs; in snd_hda_gen_build_pcms()
5825 " Alt Analog", codec->core.chip_name); in snd_hda_gen_build_pcms()
5826 info = snd_hda_codec_pcm_new(codec, "%s", in snd_hda_gen_build_pcms()
5862 static void set_output_and_unmute(struct hda_codec *codec, int path_idx) in set_output_and_unmute() argument
5867 path = snd_hda_get_path_from_idx(codec, path_idx); in set_output_and_unmute()
5871 restore_pin_ctl(codec, pin); in set_output_and_unmute()
5872 snd_hda_activate_path(codec, path, path->active, in set_output_and_unmute()
5873 aamix_default(codec->spec)); in set_output_and_unmute()
5874 set_pin_eapd(codec, pin, path->active); in set_output_and_unmute()
5878 static void init_multi_out(struct hda_codec *codec) in init_multi_out() argument
5880 struct hda_gen_spec *spec = codec->spec; in init_multi_out()
5884 set_output_and_unmute(codec, spec->out_paths[i]); in init_multi_out()
5888 static void __init_extra_out(struct hda_codec *codec, int num_outs, int *paths) in __init_extra_out() argument
5893 set_output_and_unmute(codec, paths[i]); in __init_extra_out()
5897 static void init_extra_out(struct hda_codec *codec) in init_extra_out() argument
5899 struct hda_gen_spec *spec = codec->spec; in init_extra_out()
5902 __init_extra_out(codec, spec->autocfg.hp_outs, spec->hp_paths); in init_extra_out()
5904 __init_extra_out(codec, spec->autocfg.speaker_outs, in init_extra_out()
5909 static void init_multi_io(struct hda_codec *codec) in init_multi_io() argument
5911 struct hda_gen_spec *spec = codec->spec; in init_multi_io()
5917 path = get_multiio_path(codec, i); in init_multi_io()
5922 snd_hda_codec_get_pin_target(codec, pin); in init_multi_io()
5923 snd_hda_activate_path(codec, path, path->active, in init_multi_io()
5928 static void init_aamix_paths(struct hda_codec *codec) in init_aamix_paths() argument
5930 struct hda_gen_spec *spec = codec->spec; in init_aamix_paths()
5936 update_aamix_paths(codec, spec->aamix_mode, spec->out_paths[0], in init_aamix_paths()
5939 update_aamix_paths(codec, spec->aamix_mode, spec->hp_paths[0], in init_aamix_paths()
5942 update_aamix_paths(codec, spec->aamix_mode, spec->speaker_paths[0], in init_aamix_paths()
5948 static void init_analog_input(struct hda_codec *codec) in init_analog_input() argument
5950 struct hda_gen_spec *spec = codec->spec; in init_analog_input()
5956 if (is_input_pin(codec, nid)) in init_analog_input()
5957 restore_pin_ctl(codec, nid); in init_analog_input()
5961 resume_path_from_idx(codec, spec->loopback_paths[i]); in init_analog_input()
5962 resume_path_from_idx(codec, spec->loopback_merge_path); in init_analog_input()
5968 static void init_input_src(struct hda_codec *codec) in init_input_src() argument
5970 struct hda_gen_spec *spec = codec->spec; in init_input_src()
5982 path = get_input_path(codec, c, i); in init_input_src()
5987 snd_hda_activate_path(codec, path, active, false); in init_input_src()
5991 update_hp_mic(codec, c, true); in init_input_src()
5995 spec->cap_sync_hook(codec, NULL, NULL); in init_input_src()
5999 static void init_digital(struct hda_codec *codec) in init_digital() argument
6001 struct hda_gen_spec *spec = codec->spec; in init_digital()
6006 set_output_and_unmute(codec, spec->digout_paths[i]); in init_digital()
6009 restore_pin_ctl(codec, pin); in init_digital()
6010 resume_path_from_idx(codec, spec->digin_path); in init_digital()
6017 static void clear_unsol_on_unused_pins(struct hda_codec *codec) in clear_unsol_on_unused_pins() argument
6022 snd_array_for_each(&codec->init_pins, i, pin) { in clear_unsol_on_unused_pins()
6024 if (is_jack_detectable(codec, nid) && in clear_unsol_on_unused_pins()
6025 !snd_hda_jack_tbl_get(codec, nid)) in clear_unsol_on_unused_pins()
6026 snd_hda_codec_write_cache(codec, nid, 0, in clear_unsol_on_unused_pins()
6033 * @codec: the HDA codec
6037 int snd_hda_gen_init(struct hda_codec *codec) in snd_hda_gen_init() argument
6039 struct hda_gen_spec *spec = codec->spec; in snd_hda_gen_init()
6042 spec->init_hook(codec); in snd_hda_gen_init()
6045 snd_hda_apply_verbs(codec); in snd_hda_gen_init()
6047 init_multi_out(codec); in snd_hda_gen_init()
6048 init_extra_out(codec); in snd_hda_gen_init()
6049 init_multi_io(codec); in snd_hda_gen_init()
6050 init_aamix_paths(codec); in snd_hda_gen_init()
6051 init_analog_input(codec); in snd_hda_gen_init()
6052 init_input_src(codec); in snd_hda_gen_init()
6053 init_digital(codec); in snd_hda_gen_init()
6055 clear_unsol_on_unused_pins(codec); in snd_hda_gen_init()
6057 sync_all_pin_power_ctls(codec); in snd_hda_gen_init()
6060 update_automute_all(codec); in snd_hda_gen_init()
6062 snd_hda_regmap_sync(codec); in snd_hda_gen_init()
6067 hda_call_check_power_status(codec, 0x01); in snd_hda_gen_init()
6074 * @codec: the HDA codec
6078 void snd_hda_gen_free(struct hda_codec *codec) in snd_hda_gen_free() argument
6080 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_FREE); in snd_hda_gen_free()
6081 snd_hda_gen_spec_free(codec->spec); in snd_hda_gen_free()
6082 kfree(codec->spec); in snd_hda_gen_free()
6083 codec->spec = NULL; in snd_hda_gen_free()
6089 * @codec: the HDA codec
6094 int snd_hda_gen_check_power_status(struct hda_codec *codec, hda_nid_t nid) in snd_hda_gen_check_power_status() argument
6096 struct hda_gen_spec *spec = codec->spec; in snd_hda_gen_check_power_status()
6097 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); in snd_hda_gen_check_power_status()
6103 * the generic codec support
6116 * snd_hda_parse_generic_codec - Generic codec parser
6117 * @codec: the HDA codec
6119 static int snd_hda_parse_generic_codec(struct hda_codec *codec) in snd_hda_parse_generic_codec() argument
6128 codec->spec = spec; in snd_hda_parse_generic_codec()
6130 err = snd_hda_parse_pin_defcfg(codec, &spec->autocfg, NULL, 0); in snd_hda_parse_generic_codec()
6134 err = snd_hda_gen_parse_auto_config(codec, &spec->autocfg); in snd_hda_parse_generic_codec()
6138 codec->patch_ops = generic_patch_ops; in snd_hda_parse_generic_codec()
6142 snd_hda_gen_free(codec); in snd_hda_parse_generic_codec()
6159 MODULE_DESCRIPTION("Generic HD-audio codec parser");