sound/hda/core/component.c
Source file repositories/reference/linux-study-clean/sound/hda/core/component.c
File Facts
- System
- Linux kernel
- Corpus path
sound/hda/core/component.c- Extension
.c- Size
- 9956 bytes
- Lines
- 352
- 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/module.hlinux/pci.hlinux/component.hlinux/string_choices.hsound/core.hsound/hdaudio.hsound/hda_component.hsound/hda_register.h
Detected Declarations
function hdac_acomp_releasefunction snd_hdac_set_codec_wakeupfunction put_powerfunction snd_hdac_sync_audio_ratefunction snd_hdac_acomp_get_eldfunction hdac_component_master_bindfunction hdac_component_master_unbindfunction snd_hdac_acomp_register_notifierfunction snd_hdac_i915_initfunction snd_hdac_acomp_exitexport snd_hdac_set_codec_wakeupexport snd_hdac_display_powerexport snd_hdac_sync_audio_rateexport snd_hdac_acomp_get_eldexport snd_hdac_acomp_register_notifierexport snd_hdac_acomp_initexport snd_hdac_acomp_exit
Annotated Snippet
if (!bus->display_power_active) {
unsigned long cookie = -1;
if (acomp->ops->get_power)
cookie = acomp->ops->get_power(acomp->dev);
snd_hdac_set_codec_wakeup(bus, true);
snd_hdac_set_codec_wakeup(bus, false);
bus->display_power_active = cookie;
}
} else {
if (bus->display_power_active) {
unsigned long cookie = bus->display_power_active;
if (acomp->ops->put_power)
acomp->ops->put_power(acomp->dev, cookie);
bus->display_power_active = 0;
}
}
}
EXPORT_SYMBOL_GPL(snd_hdac_display_power);
/**
* snd_hdac_sync_audio_rate - Set N/CTS based on the sample rate
* @codec: HDA codec
* @nid: the pin widget NID
* @dev_id: device identifier
* @rate: the sample rate to set
*
* This function is supposed to be used only by a HD-audio controller
* driver that needs the interaction with graphics driver.
*
* This function sets N/CTS value based on the given sample rate.
* Returns zero for success, or a negative error code.
*/
int snd_hdac_sync_audio_rate(struct hdac_device *codec, hda_nid_t nid,
int dev_id, int rate)
{
struct hdac_bus *bus = codec->bus;
struct drm_audio_component *acomp = bus->audio_component;
int port, pipe;
if (!acomp || !acomp->ops || !acomp->ops->sync_audio_rate)
return -ENODEV;
port = nid;
if (acomp->audio_ops && acomp->audio_ops->pin2port) {
port = acomp->audio_ops->pin2port(codec, nid);
if (port < 0)
return -EINVAL;
}
pipe = dev_id;
return acomp->ops->sync_audio_rate(acomp->dev, port, pipe, rate);
}
EXPORT_SYMBOL_GPL(snd_hdac_sync_audio_rate);
/**
* snd_hdac_acomp_get_eld - Get the audio state and ELD via component
* @codec: HDA codec
* @nid: the pin widget NID
* @dev_id: device identifier
* @audio_enabled: the pointer to store the current audio state
* @buffer: the buffer pointer to store ELD bytes
* @max_bytes: the max bytes to be stored on @buffer
*
* This function is supposed to be used only by a HD-audio controller
* driver that needs the interaction with graphics driver.
*
* This function queries the current state of the audio on the given
* digital port and fetches the ELD bytes onto the given buffer.
* It returns the number of bytes for the total ELD data, zero for
* invalid ELD, or a negative error code.
*
* The return size is the total bytes required for the whole ELD bytes,
* thus it may be over @max_bytes. If it's over @max_bytes, it implies
* that only a part of ELD bytes have been fetched.
*/
int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, int dev_id,
bool *audio_enabled, char *buffer, int max_bytes)
{
struct hdac_bus *bus = codec->bus;
struct drm_audio_component *acomp = bus->audio_component;
int port, pipe;
if (!acomp || !acomp->ops || !acomp->ops->get_eld)
return -ENODEV;
port = nid;
if (acomp->audio_ops && acomp->audio_ops->pin2port) {
port = acomp->audio_ops->pin2port(codec, nid);
Annotation
- Immediate include surface: `linux/init.h`, `linux/module.h`, `linux/pci.h`, `linux/component.h`, `linux/string_choices.h`, `sound/core.h`, `sound/hdaudio.h`, `sound/hda_component.h`.
- Detected declarations: `function hdac_acomp_release`, `function snd_hdac_set_codec_wakeup`, `function put_power`, `function snd_hdac_sync_audio_rate`, `function snd_hdac_acomp_get_eld`, `function hdac_component_master_bind`, `function hdac_component_master_unbind`, `function snd_hdac_acomp_register_notifier`, `function snd_hdac_i915_init`, `function snd_hdac_acomp_exit`.
- 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.