sound/hda/common/bind.c
Source file repositories/reference/linux-study-clean/sound/hda/common/bind.c
File Facts
- System
- Linux kernel
- Corpus path
sound/hda/common/bind.c- Extension
.c- Size
- 8503 bytes
- Lines
- 346
- Domain
- Driver Families
- Bucket
- sound/hda
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/init.hlinux/slab.hlinux/mutex.hlinux/module.hlinux/export.hlinux/pm.hsound/core.hsound/hda_codec.hhda_local.hhda_jack.h
Detected Declarations
function Copyrightfunction hda_codec_unsol_eventfunction snd_hda_codec_set_namefunction hda_codec_driver_probefunction hda_codec_driver_removefunction hda_codec_driver_shutdownfunction __hda_codec_driver_registerfunction hda_codec_driver_unregisterfunction codec_probedfunction request_codec_modulefunction codec_bind_modulefunction is_likely_hdmi_codecfunction for_each_hda_codec_nodefunction codec_bind_genericfunction andexport snd_hda_codec_set_nameexport __hda_codec_driver_registerexport hda_codec_driver_unregisterexport snd_hda_codec_configure
Annotated Snippet
switch (get_wcaps_type(wcaps)) {
case AC_WID_AUD_IN:
return false; /* HDMI parser supports only HDMI out */
case AC_WID_AUD_OUT:
if (!(wcaps & AC_WCAP_DIGITAL))
return false;
break;
}
}
return true;
}
#else
/* no HDMI codec parser support */
#define is_likely_hdmi_codec(codec) false
#endif /* CONFIG_SND_HDA_CODEC_HDMI */
static int codec_bind_generic(struct hda_codec *codec)
{
if (codec->probe_id)
return -ENODEV;
if (is_likely_hdmi_codec(codec)) {
codec->probe_id = HDA_CODEC_ID_GENERIC_HDMI;
request_codec_module(codec);
if (codec_probed(codec))
return 0;
}
codec->probe_id = HDA_CODEC_ID_GENERIC;
request_codec_module(codec);
if (codec_probed(codec))
return 0;
return -ENODEV;
}
#if IS_ENABLED(CONFIG_SND_HDA_GENERIC)
#define is_generic_config(codec) \
(codec->modelname && !strcmp(codec->modelname, "generic"))
#else
#define is_generic_config(codec) 0
#endif
/**
* snd_hda_codec_configure - (Re-)configure the HD-audio codec
* @codec: the HDA codec
*
* Start parsing of the given codec tree and (re-)initialize the whole
* codec driver binding.
*
* Returns 0 if successful or a negative error code.
*/
int snd_hda_codec_configure(struct hda_codec *codec)
{
int err;
if (codec->configured)
return 0;
if (is_generic_config(codec))
codec->probe_id = HDA_CODEC_ID_GENERIC;
else
codec->probe_id = 0;
if (!device_is_registered(&codec->core.dev)) {
err = snd_hdac_device_register(&codec->core);
if (err < 0)
return err;
}
if (!codec->preset)
codec_bind_module(codec);
if (!codec->preset) {
err = codec_bind_generic(codec);
if (err < 0) {
codec_dbg(codec, "Unable to bind the codec\n");
return err;
}
}
codec->configured = 1;
return 0;
}
EXPORT_SYMBOL_GPL(snd_hda_codec_configure);
Annotation
- Immediate include surface: `linux/init.h`, `linux/slab.h`, `linux/mutex.h`, `linux/module.h`, `linux/export.h`, `linux/pm.h`, `sound/core.h`, `sound/hda_codec.h`.
- Detected declarations: `function Copyright`, `function hda_codec_unsol_event`, `function snd_hda_codec_set_name`, `function hda_codec_driver_probe`, `function hda_codec_driver_remove`, `function hda_codec_driver_shutdown`, `function __hda_codec_driver_register`, `function hda_codec_driver_unregister`, `function codec_probed`, `function request_codec_module`.
- Atlas domain: Driver Families / sound/hda.
- Implementation status: integration implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.