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()
32 if (preset->afg && preset->afg != codec->core.afg) in hda_codec_match()
34 if (preset->mfg && preset->mfg != codec->core.mfg) in hda_codec_match()
39 (!preset->rev || preset->rev == codec->core.revision_id)) { in hda_codec_match()
40 codec->preset = preset; in hda_codec_match()
50 struct hda_codec *codec = container_of(dev, struct hda_codec, core); in hda_codec_unsol_event() local
52 if (codec->patch_ops.unsol_event) in hda_codec_unsol_event()
53 codec->patch_ops.unsol_event(codec, ev); in hda_codec_unsol_event()
57 static int codec_refresh_name(struct hda_codec *codec, const char *name) in codec_refresh_name() argument
60 kfree(codec->core.chip_name); in codec_refresh_name()
61 codec->core.chip_name = kstrdup(name, GFP_KERNEL); in codec_refresh_name()
63 return codec->core.chip_name ? 0 : -ENOMEM; in codec_refresh_name()
68 struct hda_codec *codec = dev_to_hda_codec(dev); in hda_codec_driver_probe() local
72 if (WARN_ON(!codec->preset)) in hda_codec_driver_probe()
75 err = codec_refresh_name(codec, codec->preset->name); in hda_codec_driver_probe()
78 err = snd_hdac_regmap_init(&codec->core); in hda_codec_driver_probe()
87 err = codec->preset->patch(codec); in hda_codec_driver_probe()
91 err = snd_hda_codec_build_pcms(codec); in hda_codec_driver_probe()
94 err = snd_hda_codec_build_controls(codec); in hda_codec_driver_probe()
97 if (codec->card->registered) { in hda_codec_driver_probe()
98 err = snd_card_register(codec->card); in hda_codec_driver_probe()
101 snd_hda_codec_register(codec); in hda_codec_driver_probe()
104 codec->core.lazy_cache = true; in hda_codec_driver_probe()
111 snd_hda_codec_cleanup_for_unbind(codec); in hda_codec_driver_probe()
117 struct hda_codec *codec = dev_to_hda_codec(dev); in hda_codec_driver_remove() local
119 if (codec->patch_ops.free) in hda_codec_driver_remove()
120 codec->patch_ops.free(codec); in hda_codec_driver_remove()
121 snd_hda_codec_cleanup_for_unbind(codec); in hda_codec_driver_remove()
128 struct hda_codec *codec = dev_to_hda_codec(dev); in hda_codec_driver_shutdown() local
130 if (!pm_runtime_suspended(dev) && codec->patch_ops.reboot_notify) in hda_codec_driver_shutdown()
131 codec->patch_ops.reboot_notify(codec); in hda_codec_driver_shutdown()
157 static inline bool codec_probed(struct hda_codec *codec) in codec_probed() argument
159 return device_attach(hda_codec_dev(codec)) > 0 && codec->preset; in codec_probed()
163 static void codec_bind_module(struct hda_codec *codec) in codec_bind_module() argument
166 request_module("snd-hda-codec-id:%08x", codec->core.vendor_id); in codec_bind_module()
167 if (codec_probed(codec)) in codec_bind_module()
170 (codec->core.vendor_id >> 16) & 0xffff); in codec_bind_module()
171 if (codec_probed(codec)) in codec_bind_module()
178 static bool is_likely_hdmi_codec(struct hda_codec *codec) in is_likely_hdmi_codec() argument
182 for_each_hda_codec_node(nid, codec) { in is_likely_hdmi_codec()
183 unsigned int wcaps = get_wcaps(codec, nid); in is_likely_hdmi_codec()
197 #define is_likely_hdmi_codec(codec) false argument
200 static int codec_bind_generic(struct hda_codec *codec) in codec_bind_generic() argument
202 if (codec->probe_id) in codec_bind_generic()
205 if (is_likely_hdmi_codec(codec)) { in codec_bind_generic()
206 codec->probe_id = HDA_CODEC_ID_GENERIC_HDMI; in codec_bind_generic()
210 if (codec_probed(codec)) in codec_bind_generic()
214 codec->probe_id = HDA_CODEC_ID_GENERIC; in codec_bind_generic()
218 if (codec_probed(codec)) in codec_bind_generic()
224 #define is_generic_config(codec) \ argument
225 (codec->modelname && !strcmp(codec->modelname, "generic"))
227 #define is_generic_config(codec) 0 argument
239 int snd_hda_codec_configure(struct hda_codec *codec) in snd_hda_codec_configure() argument
243 if (is_generic_config(codec)) in snd_hda_codec_configure()
244 codec->probe_id = HDA_CODEC_ID_GENERIC; in snd_hda_codec_configure()
246 codec->probe_id = 0; in snd_hda_codec_configure()
248 err = snd_hdac_device_register(&codec->core); in snd_hda_codec_configure()
252 if (!codec->preset) in snd_hda_codec_configure()
253 codec_bind_module(codec); in snd_hda_codec_configure()
254 if (!codec->preset) { in snd_hda_codec_configure()
255 err = codec_bind_generic(codec); in snd_hda_codec_configure()
257 codec_err(codec, "Unable to bind the codec\n"); in snd_hda_codec_configure()
263 if (codec->core.afg || !*codec->card->mixername) in snd_hda_codec_configure()
264 snprintf(codec->card->mixername, in snd_hda_codec_configure()
265 sizeof(codec->card->mixername), "%s %s", in snd_hda_codec_configure()
266 codec->core.vendor_name, codec->core.chip_name); in snd_hda_codec_configure()
270 snd_hdac_device_unregister(&codec->core); in snd_hda_codec_configure()