sound/soc/codecs/tscs454.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/tscs454.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/tscs454.c- Extension
.c- Size
- 109660 bytes
- Lines
- 3482
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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
linux/kernel.hlinux/clk.hlinux/device.hlinux/regmap.hlinux/i2c.hlinux/err.hlinux/string.hlinux/string_choices.hlinux/module.hlinux/delay.hlinux/mutex.hsound/tlv.hsound/pcm_params.hsound/pcm.hsound/soc.hsound/soc-dapm.htscs454.h
Detected Declarations
struct pllstruct internal_ratestruct aifstruct coeff_ramstruct aifs_statusstruct tscs454struct coeff_ram_ctlstruct reg_settingstruct pll_ctlfunction pll_initfunction aif_initfunction init_coeff_ram_cachefunction coeff_ram_initfunction set_aif_status_activefunction set_aif_status_inactivefunction aifs_activefunction aif_activefunction tscs454_volatilefunction tscs454_writablefunction tscs454_readablefunction tscs454_preciousfunction tscs454_data_initfunction coeff_ram_getfunction write_coeff_ramfunction coeff_ram_putfunction coeff_ram_syncfunction set_sysclkfunction reserve_pllfunction free_pllfunction pll_connectedfunction pll_power_eventfunction aif_set_providerfunction aif_preparefunction aif_freefunction bytes_info_extfunction tscs454_set_sysclkfunction tscs454_set_bclk_ratiofunction set_aif_provider_from_fmtfunction set_aif_tdm_delayfunction set_aif_format_from_fmtfunction set_aif_clock_format_from_fmtfunction tscs454_set_dai_fmtfunction tscs454_dai1_set_tdm_slotfunction tscs454_dai23_set_tdm_slotfunction set_aif_fsfunction set_aif_sample_formatfunction tscs454_hw_paramsfunction tscs454_hw_free
Annotated Snippet
struct pll {
int id;
unsigned int users;
struct mutex lock;
};
static inline void pll_init(struct pll *pll, int id)
{
pll->id = id;
mutex_init(&pll->lock);
}
struct internal_rate {
struct pll *pll;
};
struct aif {
unsigned int id;
bool provider;
struct pll *pll;
};
static inline void aif_init(struct aif *aif, unsigned int id)
{
aif->id = id;
}
struct coeff_ram {
u8 cache[COEFF_RAM_SIZE];
bool synced;
struct mutex lock;
};
static inline void init_coeff_ram_cache(u8 *cache)
{
static const u8 norm_addrs[] = { 0x00, 0x05, 0x0a, 0x0f, 0x14, 0x19,
0x1f, 0x20, 0x25, 0x2a, 0x2f, 0x34, 0x39, 0x3f, 0x40, 0x45,
0x4a, 0x4f, 0x54, 0x59, 0x5f, 0x60, 0x65, 0x6a, 0x6f, 0x74,
0x79, 0x7f, 0x80, 0x85, 0x8c, 0x91, 0x96, 0x97, 0x9c, 0xa3,
0xa8, 0xad, 0xaf, 0xb0, 0xb5, 0xba, 0xbf, 0xc4, 0xc9};
int i;
for (i = 0; i < ARRAY_SIZE(norm_addrs); i++)
cache[((norm_addrs[i] + 1) * COEFF_SIZE) - 1] = 0x40;
}
static inline void coeff_ram_init(struct coeff_ram *ram)
{
init_coeff_ram_cache(ram->cache);
mutex_init(&ram->lock);
}
struct aifs_status {
u8 streams;
};
static inline void set_aif_status_active(struct aifs_status *status,
int aif_id, bool playback)
{
u8 mask = 0x01 << (aif_id * 2 + !playback);
status->streams |= mask;
}
static inline void set_aif_status_inactive(struct aifs_status *status,
int aif_id, bool playback)
{
u8 mask = ~(0x01 << (aif_id * 2 + !playback));
status->streams &= mask;
}
static bool aifs_active(struct aifs_status *status)
{
return status->streams;
}
static bool aif_active(struct aifs_status *status, int aif_id)
{
return (0x03 << aif_id * 2) & status->streams;
}
struct tscs454 {
struct regmap *regmap;
struct aif aifs[TSCS454_DAI_COUNT];
struct aifs_status aifs_status;
struct mutex aifs_status_lock;
struct pll pll1;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/clk.h`, `linux/device.h`, `linux/regmap.h`, `linux/i2c.h`, `linux/err.h`, `linux/string.h`, `linux/string_choices.h`.
- Detected declarations: `struct pll`, `struct internal_rate`, `struct aif`, `struct coeff_ram`, `struct aifs_status`, `struct tscs454`, `struct coeff_ram_ctl`, `struct reg_setting`, `struct pll_ctl`, `function pll_init`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.