sound/soc/codecs/wm8904.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/wm8904.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/wm8904.c- Extension
.c- Size
- 75846 bytes
- Lines
- 2645
- 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.
- 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/clk.hlinux/module.hlinux/init.hlinux/delay.hlinux/pm.hlinux/i2c.hlinux/regmap.hlinux/regulator/consumer.hlinux/slab.hsound/core.hsound/pcm.hsound/pcm_params.hsound/soc.hsound/initval.hsound/tlv.hsound/wm8904.hwm8904.h
Detected Declarations
struct wm8904_privstruct _fll_divenum wm8904_typefunction wm8904_volatile_registerfunction wm8904_readable_registerfunction wm8904_configure_clockingfunction wm8904_set_drcfunction wm8904_put_drc_enumfunction wm8904_get_drc_enumfunction wm8904_set_retune_mobilefunction wm8904_put_retune_mobile_enumfunction wm8904_get_retune_mobile_enumfunction wm8904_set_deemphfunction wm8904_get_deemphfunction wm8904_put_deemphfunction wm8904_adc_osr_putfunction cp_eventfunction sysclk_eventfunction out_pga_eventfunction wm8904_add_widgetsfunction wm8904_hw_paramsfunction wm8904_set_fmtfunction wm8904_set_tdm_slotfunction fll_factorsfunction wm8904_set_fllfunction wm8904_set_sysclkfunction wm8904_mutefunction wm8904_set_bias_levelfunction wm8904_handle_retune_mobile_pdatafunction wm8904_handle_dmic_pdatafunction wm8904_handle_pdatafunction wm8904_probefunction wm8904_removefunction wm8904_read_cfg_reg_arrfunction wm8904_parse_retune_cfg_regsfunction wm8904_parse_drc_cfg_regsfunction wm8904_parse_drc_cfg_from_offunction wm8904_parse_retune_cfg_from_offunction wm8904_set_pdata_from_offunction wm8904_i2c_probe
Annotated Snippet
struct wm8904_priv {
struct regmap *regmap;
struct clk *mclk;
enum wm8904_type devtype;
struct regulator_bulk_data supplies[WM8904_NUM_SUPPLIES];
struct wm8904_pdata *pdata;
int deemph;
/* Platform provided DRC configuration */
const char **drc_texts;
int drc_cfg;
struct soc_enum drc_enum;
/* Platform provided ReTune mobile configuration */
int num_retune_mobile_texts;
const char **retune_mobile_texts;
int retune_mobile_cfg;
struct soc_enum retune_mobile_enum;
/* FLL setup */
int fll_src;
int fll_fref;
int fll_fout;
/* Clocking configuration */
unsigned int mclk_rate;
int sysclk_src;
unsigned int sysclk_rate;
int tdm_width;
int tdm_slots;
int bclk;
int fs;
/* DC servo configuration - cached offset values */
int dcs_state[WM8904_NUM_DCS_CHANNELS];
};
static const struct reg_default wm8904_reg_defaults[] = {
{ 4, 0x0018 }, /* R4 - Bias Control 0 */
{ 5, 0x0000 }, /* R5 - VMID Control 0 */
{ 6, 0x0000 }, /* R6 - Mic Bias Control 0 */
{ 7, 0x0000 }, /* R7 - Mic Bias Control 1 */
{ 8, 0x0001 }, /* R8 - Analogue DAC 0 */
{ 9, 0x9696 }, /* R9 - mic Filter Control */
{ 10, 0x0001 }, /* R10 - Analogue ADC 0 */
{ 12, 0x0000 }, /* R12 - Power Management 0 */
{ 14, 0x0000 }, /* R14 - Power Management 2 */
{ 15, 0x0000 }, /* R15 - Power Management 3 */
{ 18, 0x0000 }, /* R18 - Power Management 6 */
{ 20, 0x945E }, /* R20 - Clock Rates 0 */
{ 21, 0x0C05 }, /* R21 - Clock Rates 1 */
{ 22, 0x0006 }, /* R22 - Clock Rates 2 */
{ 24, 0x0050 }, /* R24 - Audio Interface 0 */
{ 25, 0x000A }, /* R25 - Audio Interface 1 */
{ 26, 0x00E4 }, /* R26 - Audio Interface 2 */
{ 27, 0x0040 }, /* R27 - Audio Interface 3 */
{ 30, 0x00C0 }, /* R30 - DAC Digital Volume Left */
{ 31, 0x00C0 }, /* R31 - DAC Digital Volume Right */
{ 32, 0x0000 }, /* R32 - DAC Digital 0 */
{ 33, 0x0008 }, /* R33 - DAC Digital 1 */
{ 36, 0x00C0 }, /* R36 - ADC Digital Volume Left */
{ 37, 0x00C0 }, /* R37 - ADC Digital Volume Right */
{ 38, 0x0010 }, /* R38 - ADC Digital 0 */
{ 39, 0x0000 }, /* R39 - Digital Microphone 0 */
{ 40, 0x01AF }, /* R40 - DRC 0 */
{ 41, 0x3248 }, /* R41 - DRC 1 */
{ 42, 0x0000 }, /* R42 - DRC 2 */
{ 43, 0x0000 }, /* R43 - DRC 3 */
{ 44, 0x0085 }, /* R44 - Analogue Left Input 0 */
{ 45, 0x0085 }, /* R45 - Analogue Right Input 0 */
{ 46, 0x0044 }, /* R46 - Analogue Left Input 1 */
{ 47, 0x0044 }, /* R47 - Analogue Right Input 1 */
{ 57, 0x002D }, /* R57 - Analogue OUT1 Left */
{ 58, 0x002D }, /* R58 - Analogue OUT1 Right */
{ 59, 0x0039 }, /* R59 - Analogue OUT2 Left */
{ 60, 0x0039 }, /* R60 - Analogue OUT2 Right */
{ 61, 0x0000 }, /* R61 - Analogue OUT12 ZC */
{ 67, 0x0000 }, /* R67 - DC Servo 0 */
{ 69, 0xAAAA }, /* R69 - DC Servo 2 */
{ 71, 0xAAAA }, /* R71 - DC Servo 4 */
{ 72, 0xAAAA }, /* R72 - DC Servo 5 */
{ 90, 0x0000 }, /* R90 - Analogue HP 0 */
{ 94, 0x0000 }, /* R94 - Analogue Lineout 0 */
{ 98, 0x0000 }, /* R98 - Charge Pump 0 */
{ 104, 0x0004 }, /* R104 - Class W 0 */
Annotation
- Immediate include surface: `linux/clk.h`, `linux/module.h`, `linux/init.h`, `linux/delay.h`, `linux/pm.h`, `linux/i2c.h`, `linux/regmap.h`, `linux/regulator/consumer.h`.
- Detected declarations: `struct wm8904_priv`, `struct _fll_div`, `enum wm8904_type`, `function wm8904_volatile_register`, `function wm8904_readable_register`, `function wm8904_configure_clocking`, `function wm8904_set_drc`, `function wm8904_put_drc_enum`, `function wm8904_get_drc_enum`, `function wm8904_set_retune_mobile`.
- 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.