sound/soc/intel/avs/utils.h
Source file repositories/reference/linux-study-clean/sound/soc/intel/avs/utils.h
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/intel/avs/utils.h- Extension
.h- Size
- 1832 bytes
- Lines
- 78
- Domain
- Driver Families
- Bucket
- sound/soc
- 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
sound/soc-acpi.h
Detected Declarations
struct avs_mach_pdatafunction avs_mach_singular_sspfunction avs_mach_ssp_portfunction avs_mach_singular_tdmfunction avs_mach_ssp_tdmfunction avs_mach_get_ssp_tdm
Annotated Snippet
struct avs_mach_pdata {
struct hda_codec *codec;
unsigned long *tdms;
char *codec_name; /* DMIC only */
bool obsolete_card_names;
};
static inline bool avs_mach_singular_ssp(struct snd_soc_acpi_mach *mach)
{
return hweight_long(mach->mach_params.i2s_link_mask) == 1;
}
static inline u32 avs_mach_ssp_port(struct snd_soc_acpi_mach *mach)
{
return __ffs(mach->mach_params.i2s_link_mask);
}
static inline bool avs_mach_singular_tdm(struct snd_soc_acpi_mach *mach, u32 port)
{
struct avs_mach_pdata *pdata = mach->pdata;
unsigned long *tdms = pdata->tdms;
return !tdms || (hweight_long(tdms[port]) == 1);
}
static inline u32 avs_mach_ssp_tdm(struct snd_soc_acpi_mach *mach, u32 port)
{
struct avs_mach_pdata *pdata = mach->pdata;
unsigned long *tdms = pdata->tdms;
return tdms ? __ffs(tdms[port]) : 0;
}
static inline int avs_mach_get_ssp_tdm(struct device *dev, struct snd_soc_acpi_mach *mach,
int *ssp_port, int *tdm_slot)
{
int port;
if (!avs_mach_singular_ssp(mach)) {
dev_err(dev, "Invalid SSP configuration\n");
return -EINVAL;
}
port = avs_mach_ssp_port(mach);
if (!avs_mach_singular_tdm(mach, port)) {
dev_err(dev, "Invalid TDM configuration\n");
return -EINVAL;
}
*ssp_port = port;
*tdm_slot = avs_mach_ssp_tdm(mach, *ssp_port);
return 0;
}
/*
* Macro to easily generate format strings
*/
#define AVS_STRING_FMT(prefix, suffix, ssp, tdm) \
(tdm) ? prefix "%d:%d" suffix : prefix "%d" suffix, (ssp), (tdm)
#endif
Annotation
- Immediate include surface: `sound/soc-acpi.h`.
- Detected declarations: `struct avs_mach_pdata`, `function avs_mach_singular_ssp`, `function avs_mach_ssp_port`, `function avs_mach_singular_tdm`, `function avs_mach_ssp_tdm`, `function avs_mach_get_ssp_tdm`.
- Atlas domain: Driver Families / sound/soc.
- 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.