sound/soc/codecs/tscs42xx.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/tscs42xx.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/tscs42xx.c- Extension
.c- Size
- 40619 bytes
- Lines
- 1513
- 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.
- 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/device.hlinux/regmap.hlinux/i2c.hlinux/err.hlinux/string.hlinux/module.hlinux/delay.hlinux/mutex.hlinux/clk.hsound/tlv.hsound/pcm_params.hsound/soc.hsound/soc-dapm.htscs42xx.h
Detected Declarations
struct tscs42xxstruct coeff_ram_ctlstruct reg_settingstruct pll_ctlfunction tscs42xx_volatilefunction tscs42xx_preciousfunction plls_lockedfunction sample_rate_to_pll_freq_outfunction write_coeff_ramfunction power_up_audio_pllsfunction power_down_audio_pllsfunction coeff_ram_getfunction coeff_ram_putfunction dapm_vref_eventfunction dapm_micb_eventfunction pll_eventfunction dac_eventfunction bytes_info_extfunction setup_sample_formatfunction setup_sample_ratefunction set_pll_ctl_from_input_freqfunction tscs42xx_hw_paramsfunction dac_mutefunction dac_unmutefunction adc_mutefunction adc_unmutefunction tscs42xx_mute_streamfunction tscs42xx_set_dai_fmtfunction tscs42xx_set_dai_bclk_ratiofunction part_is_validfunction set_sysclkfunction tscs42xx_probefunction init_coeff_ram_cachefunction tscs42xx_i2c_probe
Annotated Snippet
struct tscs42xx {
int bclk_ratio;
int samplerate;
struct mutex audio_params_lock;
u8 coeff_ram[COEFF_RAM_SIZE];
bool coeff_ram_synced;
struct mutex coeff_ram_lock;
struct mutex pll_lock;
struct regmap *regmap;
struct clk *sysclk;
int sysclk_src_id;
};
struct coeff_ram_ctl {
unsigned int addr;
struct soc_bytes_ext bytes_ext;
};
static bool tscs42xx_volatile(struct device *dev, unsigned int reg)
{
switch (reg) {
case R_DACCRWRL:
case R_DACCRWRM:
case R_DACCRWRH:
case R_DACCRRDL:
case R_DACCRRDM:
case R_DACCRRDH:
case R_DACCRSTAT:
case R_DACCRADDR:
case R_PLLCTL0:
return true;
default:
return false;
}
}
static bool tscs42xx_precious(struct device *dev, unsigned int reg)
{
switch (reg) {
case R_DACCRWRL:
case R_DACCRWRM:
case R_DACCRWRH:
case R_DACCRRDL:
case R_DACCRRDM:
case R_DACCRRDH:
return true;
default:
return false;
}
}
static const struct regmap_config tscs42xx_regmap = {
.reg_bits = 8,
.val_bits = 8,
.volatile_reg = tscs42xx_volatile,
.precious_reg = tscs42xx_precious,
.max_register = R_DACMBCREL3H,
.cache_type = REGCACHE_RBTREE,
.can_multi_write = true,
};
#define MAX_PLL_LOCK_20MS_WAITS 1
static bool plls_locked(struct snd_soc_component *component)
{
int ret;
int count = MAX_PLL_LOCK_20MS_WAITS;
do {
ret = snd_soc_component_read(component, R_PLLCTL0);
if (ret < 0) {
dev_err(component->dev,
"Failed to read PLL lock status (%d)\n", ret);
return false;
} else if (ret > 0) {
return true;
}
msleep(20);
} while (count--);
return false;
}
static int sample_rate_to_pll_freq_out(int sample_rate)
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/device.h`, `linux/regmap.h`, `linux/i2c.h`, `linux/err.h`, `linux/string.h`, `linux/module.h`, `linux/delay.h`.
- Detected declarations: `struct tscs42xx`, `struct coeff_ram_ctl`, `struct reg_setting`, `struct pll_ctl`, `function tscs42xx_volatile`, `function tscs42xx_precious`, `function plls_locked`, `function sample_rate_to_pll_freq_out`, `function write_coeff_ram`, `function power_up_audio_plls`.
- 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.
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.