• Home
  • Raw
  • Download

Lines Matching full:codec

2  * HD-audio codec driver binding
18 * find a matching codec id
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
46 if (codec->bus->shutdown) in hda_codec_unsol_event()
49 if (codec->patch_ops.unsol_event) in hda_codec_unsol_event()
50 codec->patch_ops.unsol_event(codec, ev); in hda_codec_unsol_event()
54 * snd_hda_codec_set_name - set the codec name
55 * @codec: the HDA codec
58 int snd_hda_codec_set_name(struct hda_codec *codec, const char *name) in snd_hda_codec_set_name() argument
64 err = snd_hdac_device_set_chip_name(&codec->core, name); in snd_hda_codec_set_name()
69 if (!*codec->card->mixername || in snd_hda_codec_set_name()
70 codec->bus->mixer_assigned >= codec->core.addr) { in snd_hda_codec_set_name()
71 snprintf(codec->card->mixername, in snd_hda_codec_set_name()
72 sizeof(codec->card->mixername), "%s %s", in snd_hda_codec_set_name()
73 codec->core.vendor_name, codec->core.chip_name); in snd_hda_codec_set_name()
74 codec->bus->mixer_assigned = codec->core.addr; in snd_hda_codec_set_name()
83 struct hda_codec *codec = dev_to_hda_codec(dev); in hda_codec_driver_probe() local
88 if (WARN_ON(!codec->preset)) in hda_codec_driver_probe()
91 err = snd_hda_codec_set_name(codec, codec->preset->name); in hda_codec_driver_probe()
94 err = snd_hdac_regmap_init(&codec->core); in hda_codec_driver_probe()
103 patch = (hda_codec_patch_t)codec->preset->driver_data; in hda_codec_driver_probe()
105 err = patch(codec); in hda_codec_driver_probe()
110 err = snd_hda_codec_build_pcms(codec); in hda_codec_driver_probe()
113 err = snd_hda_codec_build_controls(codec); in hda_codec_driver_probe()
117 if (!codec->bus->bus_probing && codec->card->registered) { in hda_codec_driver_probe()
118 err = snd_card_register(codec->card); in hda_codec_driver_probe()
121 snd_hda_codec_register(codec); in hda_codec_driver_probe()
124 codec->core.lazy_cache = true; in hda_codec_driver_probe()
128 if (codec->patch_ops.free) in hda_codec_driver_probe()
129 codec->patch_ops.free(codec); in hda_codec_driver_probe()
134 snd_hda_codec_cleanup_for_unbind(codec); in hda_codec_driver_probe()
140 struct hda_codec *codec = dev_to_hda_codec(dev); in hda_codec_driver_remove() local
142 if (codec->patch_ops.free) in hda_codec_driver_remove()
143 codec->patch_ops.free(codec); in hda_codec_driver_remove()
144 snd_hda_codec_cleanup_for_unbind(codec); in hda_codec_driver_remove()
151 struct hda_codec *codec = dev_to_hda_codec(dev); in hda_codec_driver_shutdown() local
153 if (!pm_runtime_suspended(dev) && codec->patch_ops.reboot_notify) in hda_codec_driver_shutdown()
154 codec->patch_ops.reboot_notify(codec); in hda_codec_driver_shutdown()
180 static inline bool codec_probed(struct hda_codec *codec) in codec_probed() argument
182 return device_attach(hda_codec_dev(codec)) > 0 && codec->preset; in codec_probed()
185 /* try to auto-load codec module */
186 static void request_codec_module(struct hda_codec *codec) in request_codec_module() argument
192 switch (codec->probe_id) { in request_codec_module()
195 mod = "snd-hda-codec-hdmi"; in request_codec_module()
200 mod = "snd-hda-codec-generic"; in request_codec_module()
204 snd_hdac_codec_modalias(&codec->core, modalias, sizeof(modalias)); in request_codec_module()
214 /* try to auto-load and bind the codec module */
215 static void codec_bind_module(struct hda_codec *codec) in codec_bind_module() argument
218 request_codec_module(codec); in codec_bind_module()
219 if (codec_probed(codec)) in codec_bind_module()
225 /* if all audio out widgets are digital, let's assume the codec as a HDMI/DP */
226 static bool is_likely_hdmi_codec(struct hda_codec *codec) in is_likely_hdmi_codec() argument
230 for_each_hda_codec_node(nid, codec) { in is_likely_hdmi_codec()
231 unsigned int wcaps = get_wcaps(codec, nid); in is_likely_hdmi_codec()
244 /* no HDMI codec parser support */
245 #define is_likely_hdmi_codec(codec) false argument
248 static int codec_bind_generic(struct hda_codec *codec) in codec_bind_generic() argument
250 if (codec->probe_id) in codec_bind_generic()
253 if (is_likely_hdmi_codec(codec)) { in codec_bind_generic()
254 codec->probe_id = HDA_CODEC_ID_GENERIC_HDMI; in codec_bind_generic()
255 request_codec_module(codec); in codec_bind_generic()
256 if (codec_probed(codec)) in codec_bind_generic()
260 codec->probe_id = HDA_CODEC_ID_GENERIC; in codec_bind_generic()
261 request_codec_module(codec); in codec_bind_generic()
262 if (codec_probed(codec)) in codec_bind_generic()
268 #define is_generic_config(codec) \ argument
269 (codec->modelname && !strcmp(codec->modelname, "generic"))
271 #define is_generic_config(codec) 0 argument
275 * snd_hda_codec_configure - (Re-)configure the HD-audio codec
276 * @codec: the HDA codec
278 * Start parsing of the given codec tree and (re-)initialize the whole
283 int snd_hda_codec_configure(struct hda_codec *codec) in snd_hda_codec_configure() argument
287 if (is_generic_config(codec)) in snd_hda_codec_configure()
288 codec->probe_id = HDA_CODEC_ID_GENERIC; in snd_hda_codec_configure()
290 codec->probe_id = 0; in snd_hda_codec_configure()
292 err = snd_hdac_device_register(&codec->core); in snd_hda_codec_configure()
296 if (!codec->preset) in snd_hda_codec_configure()
297 codec_bind_module(codec); in snd_hda_codec_configure()
298 if (!codec->preset) { in snd_hda_codec_configure()
299 err = codec_bind_generic(codec); in snd_hda_codec_configure()
301 codec_err(codec, "Unable to bind the codec\n"); in snd_hda_codec_configure()
309 snd_hdac_device_unregister(&codec->core); in snd_hda_codec_configure()