Lines Matching full:codec

3  * HD-audio codec driver binding
19 * find a matching codec id
23 struct hda_codec *codec = container_of(dev, struct hda_codec, core); in hda_codec_match() local
28 u32 id = codec->probe_id ? codec->probe_id : codec->core.vendor_id; in hda_codec_match()
29 u32 rev_id = codec->core.revision_id; in hda_codec_match()
34 codec->preset = list; in hda_codec_match()
44 struct hda_codec *codec = container_of(dev, struct hda_codec, core); in hda_codec_unsol_event() local
46 if (codec->patch_ops.unsol_event) in hda_codec_unsol_event()
47 codec->patch_ops.unsol_event(codec, ev); in hda_codec_unsol_event()
51 * snd_hda_codec_set_name - set the codec name
52 * @codec: the HDA codec
55 int snd_hda_codec_set_name(struct hda_codec *codec, const char *name) in snd_hda_codec_set_name() argument
61 err = snd_hdac_device_set_chip_name(&codec->core, name); in snd_hda_codec_set_name()
66 if (!*codec->card->mixername || in snd_hda_codec_set_name()
67 codec->bus->mixer_assigned >= codec->core.addr) { in snd_hda_codec_set_name()
68 snprintf(codec->card->mixername, in snd_hda_codec_set_name()
69 sizeof(codec->card->mixername), "%s %s", in snd_hda_codec_set_name()
70 codec->core.vendor_name, codec->core.chip_name); in snd_hda_codec_set_name()
71 codec->bus->mixer_assigned = codec->core.addr; in snd_hda_codec_set_name()
80 struct hda_codec *codec = dev_to_hda_codec(dev); in hda_codec_driver_probe() local
85 if (codec->bus->core.ext_ops) { in hda_codec_driver_probe()
86 if (WARN_ON(!codec->bus->core.ext_ops->hdev_attach)) in hda_codec_driver_probe()
88 return codec->bus->core.ext_ops->hdev_attach(&codec->core); in hda_codec_driver_probe()
91 if (WARN_ON(!codec->preset)) in hda_codec_driver_probe()
94 err = snd_hda_codec_set_name(codec, codec->preset->name); in hda_codec_driver_probe()
97 err = snd_hdac_regmap_init(&codec->core); in hda_codec_driver_probe()
106 patch = (hda_codec_patch_t)codec->preset->driver_data; in hda_codec_driver_probe()
108 err = patch(codec); in hda_codec_driver_probe()
113 err = snd_hda_codec_build_pcms(codec); in hda_codec_driver_probe()
116 err = snd_hda_codec_build_controls(codec); in hda_codec_driver_probe()
120 if (!codec->bus->bus_probing && codec->card->registered) { in hda_codec_driver_probe()
121 err = snd_card_register(codec->card); in hda_codec_driver_probe()
124 snd_hda_codec_register(codec); in hda_codec_driver_probe()
127 codec->core.lazy_cache = true; in hda_codec_driver_probe()
131 if (codec->patch_ops.free) in hda_codec_driver_probe()
132 codec->patch_ops.free(codec); in hda_codec_driver_probe()
137 snd_hda_codec_cleanup_for_unbind(codec); in hda_codec_driver_probe()
143 struct hda_codec *codec = dev_to_hda_codec(dev); in hda_codec_driver_remove() local
145 if (codec->bus->core.ext_ops) { in hda_codec_driver_remove()
146 if (WARN_ON(!codec->bus->core.ext_ops->hdev_detach)) in hda_codec_driver_remove()
148 return codec->bus->core.ext_ops->hdev_detach(&codec->core); in hda_codec_driver_remove()
151 if (codec->patch_ops.free) in hda_codec_driver_remove()
152 codec->patch_ops.free(codec); in hda_codec_driver_remove()
153 snd_hda_codec_cleanup_for_unbind(codec); in hda_codec_driver_remove()
160 struct hda_codec *codec = dev_to_hda_codec(dev); in hda_codec_driver_shutdown() local
162 if (!pm_runtime_suspended(dev) && codec->patch_ops.reboot_notify) in hda_codec_driver_shutdown()
163 codec->patch_ops.reboot_notify(codec); in hda_codec_driver_shutdown()
189 static inline bool codec_probed(struct hda_codec *codec) in codec_probed() argument
191 return device_attach(hda_codec_dev(codec)) > 0 && codec->preset; in codec_probed()
194 /* try to auto-load codec module */
195 static void request_codec_module(struct hda_codec *codec) in request_codec_module() argument
201 switch (codec->probe_id) { in request_codec_module()
204 mod = "snd-hda-codec-hdmi"; in request_codec_module()
209 mod = "snd-hda-codec-generic"; in request_codec_module()
213 snd_hdac_codec_modalias(&codec->core, modalias, sizeof(modalias)); in request_codec_module()
223 /* try to auto-load and bind the codec module */
224 static void codec_bind_module(struct hda_codec *codec) in codec_bind_module() argument
227 request_codec_module(codec); in codec_bind_module()
228 if (codec_probed(codec)) in codec_bind_module()
234 /* if all audio out widgets are digital, let's assume the codec as a HDMI/DP */
235 static bool is_likely_hdmi_codec(struct hda_codec *codec) in is_likely_hdmi_codec() argument
239 for_each_hda_codec_node(nid, codec) { in is_likely_hdmi_codec()
240 unsigned int wcaps = get_wcaps(codec, nid); in is_likely_hdmi_codec()
253 /* no HDMI codec parser support */
254 #define is_likely_hdmi_codec(codec) false argument
257 static int codec_bind_generic(struct hda_codec *codec) in codec_bind_generic() argument
259 if (codec->probe_id) in codec_bind_generic()
262 if (is_likely_hdmi_codec(codec)) { in codec_bind_generic()
263 codec->probe_id = HDA_CODEC_ID_GENERIC_HDMI; in codec_bind_generic()
264 request_codec_module(codec); in codec_bind_generic()
265 if (codec_probed(codec)) in codec_bind_generic()
269 codec->probe_id = HDA_CODEC_ID_GENERIC; in codec_bind_generic()
270 request_codec_module(codec); in codec_bind_generic()
271 if (codec_probed(codec)) in codec_bind_generic()
277 #define is_generic_config(codec) \ argument
278 (codec->modelname && !strcmp(codec->modelname, "generic"))
280 #define is_generic_config(codec) 0 argument
284 * snd_hda_codec_configure - (Re-)configure the HD-audio codec
285 * @codec: the HDA codec
287 * Start parsing of the given codec tree and (re-)initialize the whole
292 int snd_hda_codec_configure(struct hda_codec *codec) in snd_hda_codec_configure() argument
296 if (is_generic_config(codec)) in snd_hda_codec_configure()
297 codec->probe_id = HDA_CODEC_ID_GENERIC; in snd_hda_codec_configure()
299 codec->probe_id = 0; in snd_hda_codec_configure()
301 err = snd_hdac_device_register(&codec->core); in snd_hda_codec_configure()
305 if (!codec->preset) in snd_hda_codec_configure()
306 codec_bind_module(codec); in snd_hda_codec_configure()
307 if (!codec->preset) { in snd_hda_codec_configure()
308 err = codec_bind_generic(codec); in snd_hda_codec_configure()
310 codec_err(codec, "Unable to bind the codec\n"); in snd_hda_codec_configure()
318 snd_hdac_device_unregister(&codec->core); in snd_hda_codec_configure()