Lines Matching refs:codec

22 	struct hda_codec *codec = container_of(dev, struct hda_codec, core);  in hda_codec_match()  local
27 u32 id = codec->probe_id ? codec->probe_id : codec->core.vendor_id; in hda_codec_match()
28 u32 rev_id = codec->core.revision_id; in hda_codec_match()
33 codec->preset = list; in hda_codec_match()
43 struct hda_codec *codec = container_of(dev, struct hda_codec, core); in hda_codec_unsol_event() local
45 if (codec->patch_ops.unsol_event) in hda_codec_unsol_event()
46 codec->patch_ops.unsol_event(codec, ev); in hda_codec_unsol_event()
54 int snd_hda_codec_set_name(struct hda_codec *codec, const char *name) in snd_hda_codec_set_name() argument
60 err = snd_hdac_device_set_chip_name(&codec->core, name); in snd_hda_codec_set_name()
65 if (!*codec->card->mixername || in snd_hda_codec_set_name()
66 codec->bus->mixer_assigned >= codec->core.addr) { in snd_hda_codec_set_name()
67 snprintf(codec->card->mixername, in snd_hda_codec_set_name()
68 sizeof(codec->card->mixername), "%s %s", in snd_hda_codec_set_name()
69 codec->core.vendor_name, codec->core.chip_name); in snd_hda_codec_set_name()
70 codec->bus->mixer_assigned = codec->core.addr; in snd_hda_codec_set_name()
79 struct hda_codec *codec = dev_to_hda_codec(dev); in hda_codec_driver_probe() local
84 if (WARN_ON(!codec->preset)) in hda_codec_driver_probe()
87 err = snd_hda_codec_set_name(codec, codec->preset->name); in hda_codec_driver_probe()
90 err = snd_hdac_regmap_init(&codec->core); in hda_codec_driver_probe()
99 patch = (hda_codec_patch_t)codec->preset->driver_data; in hda_codec_driver_probe()
101 err = patch(codec); in hda_codec_driver_probe()
106 err = snd_hda_codec_build_pcms(codec); in hda_codec_driver_probe()
109 err = snd_hda_codec_build_controls(codec); in hda_codec_driver_probe()
112 if (codec->card->registered) { in hda_codec_driver_probe()
113 err = snd_card_register(codec->card); in hda_codec_driver_probe()
116 snd_hda_codec_register(codec); in hda_codec_driver_probe()
119 codec->core.lazy_cache = true; in hda_codec_driver_probe()
126 snd_hda_codec_cleanup_for_unbind(codec); in hda_codec_driver_probe()
132 struct hda_codec *codec = dev_to_hda_codec(dev); in hda_codec_driver_remove() local
134 if (codec->patch_ops.free) in hda_codec_driver_remove()
135 codec->patch_ops.free(codec); in hda_codec_driver_remove()
136 snd_hda_codec_cleanup_for_unbind(codec); in hda_codec_driver_remove()
143 struct hda_codec *codec = dev_to_hda_codec(dev); in hda_codec_driver_shutdown() local
145 if (!pm_runtime_suspended(dev) && codec->patch_ops.reboot_notify) in hda_codec_driver_shutdown()
146 codec->patch_ops.reboot_notify(codec); in hda_codec_driver_shutdown()
172 static inline bool codec_probed(struct hda_codec *codec) in codec_probed() argument
174 return device_attach(hda_codec_dev(codec)) > 0 && codec->preset; in codec_probed()
178 static void request_codec_module(struct hda_codec *codec) in request_codec_module() argument
184 switch (codec->probe_id) { in request_codec_module()
196 snd_hdac_codec_modalias(&codec->core, modalias, sizeof(modalias)); in request_codec_module()
207 static void codec_bind_module(struct hda_codec *codec) in codec_bind_module() argument
210 request_codec_module(codec); in codec_bind_module()
211 if (codec_probed(codec)) in codec_bind_module()
218 static bool is_likely_hdmi_codec(struct hda_codec *codec) in is_likely_hdmi_codec() argument
222 for_each_hda_codec_node(nid, codec) { in is_likely_hdmi_codec()
223 unsigned int wcaps = get_wcaps(codec, nid); in is_likely_hdmi_codec()
237 #define is_likely_hdmi_codec(codec) false argument
240 static int codec_bind_generic(struct hda_codec *codec) in codec_bind_generic() argument
242 if (codec->probe_id) in codec_bind_generic()
245 if (is_likely_hdmi_codec(codec)) { in codec_bind_generic()
246 codec->probe_id = HDA_CODEC_ID_GENERIC_HDMI; in codec_bind_generic()
247 request_codec_module(codec); in codec_bind_generic()
248 if (codec_probed(codec)) in codec_bind_generic()
252 codec->probe_id = HDA_CODEC_ID_GENERIC; in codec_bind_generic()
253 request_codec_module(codec); in codec_bind_generic()
254 if (codec_probed(codec)) in codec_bind_generic()
260 #define is_generic_config(codec) \ argument
261 (codec->modelname && !strcmp(codec->modelname, "generic"))
263 #define is_generic_config(codec) 0 argument
275 int snd_hda_codec_configure(struct hda_codec *codec) in snd_hda_codec_configure() argument
279 if (is_generic_config(codec)) in snd_hda_codec_configure()
280 codec->probe_id = HDA_CODEC_ID_GENERIC; in snd_hda_codec_configure()
282 codec->probe_id = 0; in snd_hda_codec_configure()
284 err = snd_hdac_device_register(&codec->core); in snd_hda_codec_configure()
288 if (!codec->preset) in snd_hda_codec_configure()
289 codec_bind_module(codec); in snd_hda_codec_configure()
290 if (!codec->preset) { in snd_hda_codec_configure()
291 err = codec_bind_generic(codec); in snd_hda_codec_configure()
293 codec_err(codec, "Unable to bind the codec\n"); in snd_hda_codec_configure()
301 snd_hdac_device_unregister(&codec->core); in snd_hda_codec_configure()