sound/soc/codecs/pcm512x.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/pcm512x.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/pcm512x.c- Extension
.c- Size
- 48070 bytes
- Lines
- 1800
- 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
linux/init.hlinux/module.hlinux/clk.hlinux/kernel.hlinux/pm_runtime.hlinux/regmap.hlinux/regulator/consumer.hlinux/gcd.hsound/soc.hsound/soc-dapm.hsound/pcm_params.hsound/tlv.hpcm512x.h
Detected Declarations
struct pcm512x_privfunction pcm512x_readablefunction pcm512x_volatilefunction pcm512x_overclock_pll_getfunction pcm512x_overclock_pll_putfunction pcm512x_overclock_dsp_getfunction pcm512x_overclock_dsp_putfunction pcm512x_overclock_dac_getfunction pcm512x_overclock_dac_putfunction pcm512x_update_mutefunction pcm512x_digital_playback_switch_getfunction pcm512x_digital_playback_switch_putfunction pcm512x_pll_maxfunction pcm512x_dsp_maxfunction pcm512x_dac_maxfunction pcm512x_sck_maxfunction pcm512x_ncp_targetfunction pcm512x_hw_rule_ratefunction pcm512x_dai_startup_masterfunction pcm512x_dai_startup_slavefunction pcm512x_dai_startupfunction pcm512x_set_bias_levelfunction pcm512x_find_sckfunction pcm512x_find_pll_coefffunction pcm512x_pllin_dac_ratefunction pcm512x_set_dividersfunction pcm512x_hw_paramsfunction pcm512x_set_fmtfunction pcm512x_set_bclk_ratiofunction pcm512x_mutefunction pcm512x_probefunction pcm512x_removefunction pcm512x_suspendfunction pcm512x_resumeexport pcm512x_regmapexport pcm512x_probeexport pcm512x_remove
Annotated Snippet
struct pcm512x_priv {
struct regmap *regmap;
struct clk *sclk;
struct regulator_bulk_data supplies[PCM512x_NUM_SUPPLIES];
struct notifier_block supply_nb[PCM512x_NUM_SUPPLIES];
int fmt;
int pll_in;
int pll_out;
int pll_r;
int pll_j;
int pll_d;
int pll_p;
unsigned long real_pll;
unsigned long overclock_pll;
unsigned long overclock_dac;
unsigned long overclock_dsp;
int mute;
struct mutex mutex;
unsigned int bclk_ratio;
int force_pll_on;
};
/*
* We can't use the same notifier block for more than one supply and
* there's no way I can see to get from a callback to the caller
* except container_of().
*/
#define PCM512x_REGULATOR_EVENT(n) \
static int pcm512x_regulator_event_##n(struct notifier_block *nb, \
unsigned long event, void *data) \
{ \
struct pcm512x_priv *pcm512x = container_of(nb, struct pcm512x_priv, \
supply_nb[n]); \
if (event & REGULATOR_EVENT_DISABLE) { \
regcache_mark_dirty(pcm512x->regmap); \
regcache_cache_only(pcm512x->regmap, true); \
} \
return 0; \
}
PCM512x_REGULATOR_EVENT(0)
PCM512x_REGULATOR_EVENT(1)
PCM512x_REGULATOR_EVENT(2)
static const struct reg_default pcm512x_reg_defaults[] = {
{ PCM512x_RESET, 0x00 },
{ PCM512x_POWER, 0x00 },
{ PCM512x_MUTE, 0x00 },
{ PCM512x_DSP, 0x00 },
{ PCM512x_PLL_REF, 0x00 },
{ PCM512x_DAC_REF, 0x00 },
{ PCM512x_DAC_ROUTING, 0x11 },
{ PCM512x_DSP_PROGRAM, 0x01 },
{ PCM512x_CLKDET, 0x00 },
{ PCM512x_AUTO_MUTE, 0x00 },
{ PCM512x_ERROR_DETECT, 0x00 },
{ PCM512x_DIGITAL_VOLUME_1, 0x00 },
{ PCM512x_DIGITAL_VOLUME_2, 0x30 },
{ PCM512x_DIGITAL_VOLUME_3, 0x30 },
{ PCM512x_DIGITAL_MUTE_1, 0x22 },
{ PCM512x_DIGITAL_MUTE_2, 0x00 },
{ PCM512x_DIGITAL_MUTE_3, 0x07 },
{ PCM512x_OUTPUT_AMPLITUDE, 0x00 },
{ PCM512x_ANALOG_GAIN_CTRL, 0x00 },
{ PCM512x_UNDERVOLTAGE_PROT, 0x00 },
{ PCM512x_ANALOG_MUTE_CTRL, 0x00 },
{ PCM512x_ANALOG_GAIN_BOOST, 0x00 },
{ PCM512x_VCOM_CTRL_1, 0x00 },
{ PCM512x_VCOM_CTRL_2, 0x01 },
{ PCM512x_BCLK_LRCLK_CFG, 0x00 },
{ PCM512x_MASTER_MODE, 0x7c },
{ PCM512x_GPIO_DACIN, 0x00 },
{ PCM512x_GPIO_PLLIN, 0x00 },
{ PCM512x_SYNCHRONIZE, 0x10 },
{ PCM512x_PLL_COEFF_0, 0x00 },
{ PCM512x_PLL_COEFF_1, 0x00 },
{ PCM512x_PLL_COEFF_2, 0x00 },
{ PCM512x_PLL_COEFF_3, 0x00 },
{ PCM512x_PLL_COEFF_4, 0x00 },
{ PCM512x_DSP_CLKDIV, 0x00 },
{ PCM512x_DAC_CLKDIV, 0x00 },
{ PCM512x_NCP_CLKDIV, 0x00 },
{ PCM512x_OSR_CLKDIV, 0x00 },
{ PCM512x_MASTER_CLKDIV_1, 0x00 },
{ PCM512x_MASTER_CLKDIV_2, 0x00 },
{ PCM512x_FS_SPEED_MODE, 0x00 },
{ PCM512x_IDAC_1, 0x01 },
{ PCM512x_IDAC_2, 0x00 },
{ PCM512x_I2S_1, 0x02 },
{ PCM512x_I2S_2, 0x00 },
Annotation
- Immediate include surface: `linux/init.h`, `linux/module.h`, `linux/clk.h`, `linux/kernel.h`, `linux/pm_runtime.h`, `linux/regmap.h`, `linux/regulator/consumer.h`, `linux/gcd.h`.
- Detected declarations: `struct pcm512x_priv`, `function pcm512x_readable`, `function pcm512x_volatile`, `function pcm512x_overclock_pll_get`, `function pcm512x_overclock_pll_put`, `function pcm512x_overclock_dsp_get`, `function pcm512x_overclock_dsp_put`, `function pcm512x_overclock_dac_get`, `function pcm512x_overclock_dac_put`, `function pcm512x_update_mute`.
- 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.