include/sound/hda_codec.h
Source file repositories/reference/linux-study-clean/include/sound/hda_codec.h
File Facts
- System
- Linux kernel
- Corpus path
include/sound/hda_codec.h- Extension
.h- Size
- 19616 bytes
- Lines
- 584
- Domain
- Driver Families
- Bucket
- include/sound
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/refcount.hlinux/mod_devicetable.hsound/info.hsound/control.hsound/pcm.hsound/hwdep.hsound/hdaudio.hsound/hda_verbs.hsound/hda_regmap.h
Detected Declarations
struct hda_busstruct hda_beepstruct hda_codecstruct hda_pcmstruct hda_pcm_streamstruct hda_codec_opsstruct hda_busstruct hda_codec_driverstruct hda_codec_opsstruct hda_pcm_opsstruct hda_pcm_streamstruct hda_pcmstruct hda_codecstruct hda_verbstruct hda_pincfgstruct hda_spdif_outstruct __hda_power_objfunction snd_hda_codec_readfunction snd_hda_codec_writefunction snd_hda_codec_write_syncfunction snd_hda_get_num_connsfunction snd_hda_codec_write_cachefunction snd_hda_codec_pcm_getfunction snd_hda_codec_pcm_putfunction hda_call_check_power_statusfunction hda_codec_need_resumefunction __snd_hda_power_upfunction __snd_hda_power_up_pmfunction snd_hda_codec_load_dsp_preparefunction snd_hda_codec_load_dsp_trigger
Annotated Snippet
struct hda_bus {
struct hdac_bus core;
struct snd_card *card;
struct pci_dev *pci;
const char *modelname;
struct mutex prepare_mutex;
/* assigned PCMs */
DECLARE_BITMAP(pcm_dev_bits, SNDRV_PCM_DEVICES);
/* misc op flags */
unsigned int allow_bus_reset:1; /* allow bus reset at fatal error */
/* status for codec/controller */
unsigned int shutdown :1; /* being unloaded */
unsigned int response_reset:1; /* controller was reset */
unsigned int in_reset:1; /* during reset operation */
unsigned int no_response_fallback:1; /* don't fallback at RIRB error */
unsigned int bus_probing :1; /* during probing process */
unsigned int keep_power:1; /* keep power up for notification */
unsigned int jackpoll_in_suspend:1; /* keep jack polling during
* runtime suspend
*/
int primary_dig_out_type; /* primary digital out PCM type */
unsigned int mixer_assigned; /* codec addr for mixer name */
};
/* from hdac_bus to hda_bus */
#define to_hda_bus(bus) container_of(bus, struct hda_bus, core)
/*
* codec preset
*/
#define HDA_CODEC_ID_SKIP_PROBE 0x00000001
#define HDA_CODEC_ID_GENERIC_HDMI 0x00000101
#define HDA_CODEC_ID_GENERIC 0x00000201
#define HDA_CODEC_ID_REV_MODEL(_vid, _rev, _name, _model) \
{ .vendor_id = (_vid), .rev_id = (_rev), .name = (_name), \
.api_version = HDA_DEV_LEGACY, .driver_data = (_model) }
#define HDA_CODEC_ID_MODEL(_vid, _name, _model) \
HDA_CODEC_ID_REV_MODEL(_vid, 0, _name, _model)
#define HDA_CODEC_ID_REV(_vid, _rev, _name) \
HDA_CODEC_ID_REV_MODEL(_vid, _rev, _name, 0)
#define HDA_CODEC_ID(_vid, _name) \
HDA_CODEC_ID_REV(_vid, 0, _name)
struct hda_codec_driver {
struct hdac_driver core;
const struct hda_device_id *id;
const struct hda_codec_ops *ops;
};
#define hda_codec_to_driver(codec) \
container_of((codec)->core.dev.driver, struct hda_codec_driver, core.driver)
int __hda_codec_driver_register(struct hda_codec_driver *drv, const char *name,
struct module *owner);
#define hda_codec_driver_register(drv) \
__hda_codec_driver_register(drv, KBUILD_MODNAME, THIS_MODULE)
void hda_codec_driver_unregister(struct hda_codec_driver *drv);
#define module_hda_codec_driver(drv) \
module_driver(drv, hda_codec_driver_register, \
hda_codec_driver_unregister)
/* ops for hda codec driver */
struct hda_codec_ops {
int (*probe)(struct hda_codec *codec, const struct hda_device_id *id);
void (*remove)(struct hda_codec *codec);
int (*build_controls)(struct hda_codec *codec);
int (*build_pcms)(struct hda_codec *codec);
int (*init)(struct hda_codec *codec);
void (*unsol_event)(struct hda_codec *codec, unsigned int res);
void (*set_power_state)(struct hda_codec *codec, hda_nid_t fg,
unsigned int power_state);
int (*suspend)(struct hda_codec *codec);
int (*resume)(struct hda_codec *codec);
int (*check_power_status)(struct hda_codec *codec, hda_nid_t nid);
void (*stream_pm)(struct hda_codec *codec, hda_nid_t nid, bool on);
};
/* PCM callbacks */
struct hda_pcm_ops {
int (*open)(struct hda_pcm_stream *info, struct hda_codec *codec,
struct snd_pcm_substream *substream);
int (*close)(struct hda_pcm_stream *info, struct hda_codec *codec,
Annotation
- Immediate include surface: `linux/refcount.h`, `linux/mod_devicetable.h`, `sound/info.h`, `sound/control.h`, `sound/pcm.h`, `sound/hwdep.h`, `sound/hdaudio.h`, `sound/hda_verbs.h`.
- Detected declarations: `struct hda_bus`, `struct hda_beep`, `struct hda_codec`, `struct hda_pcm`, `struct hda_pcm_stream`, `struct hda_codec_ops`, `struct hda_bus`, `struct hda_codec_driver`, `struct hda_codec_ops`, `struct hda_pcm_ops`.
- Atlas domain: Driver Families / include/sound.
- Implementation status: source 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.