sound/soc/sof/intel/hda-mlink.c
Source file repositories/reference/linux-study-clean/sound/soc/sof/intel/hda-mlink.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/sof/intel/hda-mlink.c- Extension
.c- Size
- 28530 bytes
- Lines
- 1103
- Domain
- Driver Families
- Bucket
- sound/soc
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
sound/hdaudio_ext.hsound/hda_register.hsound/hda-mlink.hlinux/bitfield.hlinux/module.hlinux/string_choices.h
Detected Declarations
struct hdac_ext2_linkfunction hdaml_lnk_enumfunction check_sublink_powerfunction hdaml_link_initfunction hdaml_link_shutdownfunction hdaml_link_enable_interruptfunction hdaml_link_check_interruptfunction hdaml_wait_bitfunction hdaml_link_set_syncprdfunction hdaml_link_wait_syncpufunction hdaml_link_sync_armfunction hdaml_link_sync_gofunction hdaml_link_check_cmdsyncfunction hdaml_link_get_lsdiidfunction hdaml_link_set_lsdiidfunction hdaml_shim_map_stream_chfunction hdaml_lctl_offload_enablefunction hda_ml_alloc_h2linkfunction hda_bus_ml_initfunction hda_bus_ml_freefunction list_for_each_entry_safefunction find_ext2_linkfunction list_for_each_entryfunction hdac_bus_eml_get_countfunction hdac_bus_eml_enable_interrupt_unlockedfunction hdac_bus_eml_enable_interruptfunction hdac_bus_eml_check_interruptfunction hdac_bus_eml_set_syncprd_unlockedfunction hdac_bus_eml_sdw_set_syncprd_unlockedfunction hdac_bus_eml_wait_syncpu_unlockedfunction hdac_bus_eml_sdw_wait_syncpu_unlockedfunction hdac_bus_eml_sync_arm_unlockedfunction hdac_bus_eml_sdw_sync_arm_unlockedfunction hdac_bus_eml_sync_go_unlockedfunction hdac_bus_eml_sdw_sync_go_unlockedfunction hdac_bus_eml_check_cmdsync_unlockedfunction hdac_bus_eml_sdw_check_cmdsync_unlockedfunction hdac_bus_eml_power_up_basefunction hdac_bus_eml_power_upfunction hdac_bus_eml_power_up_unlockedfunction hdac_bus_eml_power_down_basefunction hdac_bus_eml_power_downfunction hdac_bus_eml_power_down_unlockedfunction hdac_bus_eml_sdw_power_up_unlockedfunction hdac_bus_eml_sdw_power_down_unlockedfunction hdac_bus_eml_sdw_get_lsdiid_unlockedfunction hdac_bus_eml_sdw_set_lsdiidfunction hdac_bus_eml_sdw_map_stream_ch
Annotated Snippet
struct hdac_ext2_link {
struct hdac_ext_link hext_link;
/* read directly from LCAP register */
bool alt;
bool intc;
bool ofls;
bool lss;
int slcount;
int elid;
int elver;
u32 leptr;
struct mutex eml_lock; /* prevent concurrent access to e.g. CPA/SPA */
int sublink_ref_count[HDAML_MAX_SUBLINKS];
/* internal values computed from LCAP contents */
void __iomem *base_ptr;
u32 instance_offset;
u32 shim_offset;
u32 ip_offset;
u32 shim_vs_offset;
unsigned long mic_privacy_mask;
};
#define hdac_ext_link_to_ext2(h) container_of(h, struct hdac_ext2_link, hext_link)
#define AZX_REG_SDW_INSTANCE_OFFSET 0x8000
#define AZX_REG_SDW_SHIM_OFFSET 0x0
#define AZX_REG_SDW_IP_OFFSET 0x100
#define AZX_REG_SDW_VS_SHIM_OFFSET 0x6000
#define AZX_REG_SDW_SHIM_PCMSyCM(y) (0x16 + 0x4 * (y))
/* only one instance supported */
#define AZX_REG_INTEL_DMIC_SHIM_OFFSET 0x0
#define AZX_REG_INTEL_DMIC_IP_OFFSET 0x100
#define AZX_REG_INTEL_DMIC_VS_SHIM_OFFSET 0x6000
#define AZX_REG_INTEL_SSP_INSTANCE_OFFSET 0x1000
#define AZX_REG_INTEL_SSP_SHIM_OFFSET 0x0
#define AZX_REG_INTEL_SSP_IP_OFFSET 0x100
#define AZX_REG_INTEL_SSP_VS_SHIM_OFFSET 0xC00
/* only one instance supported */
#define AZX_REG_INTEL_UAOL_SHIM_OFFSET 0x0
#define AZX_REG_INTEL_UAOL_IP_OFFSET 0x100
#define AZX_REG_INTEL_UAOL_VS_SHIM_OFFSET 0xC00
/* Microphone privacy */
#define AZX_REG_INTEL_VS_SHIM_PVCCS 0x10
#define AZX_REG_INTEL_VS_SHIM_PVCCS_MDSTSCHGIE BIT(0)
#define AZX_REG_INTEL_VS_SHIM_PVCCS_MDSTSCHG BIT(8)
#define AZX_REG_INTEL_VS_SHIM_PVCCS_MDSTS BIT(9)
#define AZX_REG_INTEL_VS_SHIM_PVCCS_FMDIS BIT(10)
/* HDAML section - this part follows sequences in the hardware specification,
* including naming conventions and the use of the hdaml_ prefix.
* The code is intentionally minimal with limited dependencies on frameworks or
* helpers. Locking and scanning lists is handled at a higher level
*/
static int hdaml_lnk_enum(struct device *dev, struct hdac_ext2_link *h2link,
void __iomem *remap_addr, void __iomem *ml_addr, int link_idx)
{
struct hdac_ext_link *hlink = &h2link->hext_link;
u32 base_offset;
hlink->lcaps = readl(ml_addr + AZX_REG_ML_LCAP);
h2link->alt = FIELD_GET(AZX_ML_HDA_LCAP_ALT, hlink->lcaps);
/* handle alternate extensions */
if (!h2link->alt) {
h2link->slcount = 1;
/*
* LSDIID is initialized by hardware for HDaudio link,
* it needs to be setup by software for alternate links
*/
hlink->lsdiid = readw(ml_addr + AZX_REG_ML_LSDIID);
dev_dbg(dev, "Link %d: HDAudio - lsdiid=%d\n",
link_idx, hlink->lsdiid);
return 0;
}
h2link->intc = FIELD_GET(AZX_ML_HDA_LCAP_INTC, hlink->lcaps);
h2link->ofls = FIELD_GET(AZX_ML_HDA_LCAP_OFLS, hlink->lcaps);
Annotation
- Immediate include surface: `sound/hdaudio_ext.h`, `sound/hda_register.h`, `sound/hda-mlink.h`, `linux/bitfield.h`, `linux/module.h`, `linux/string_choices.h`.
- Detected declarations: `struct hdac_ext2_link`, `function hdaml_lnk_enum`, `function check_sublink_power`, `function hdaml_link_init`, `function hdaml_link_shutdown`, `function hdaml_link_enable_interrupt`, `function hdaml_link_check_interrupt`, `function hdaml_wait_bit`, `function hdaml_link_set_syncprd`, `function hdaml_link_wait_syncpu`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.