sound/soc/codecs/wm8962.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/wm8962.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/wm8962.c- Extension
.c- Size
- 127960 bytes
- Lines
- 4021
- 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.
- 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/module.hlinux/moduleparam.hlinux/init.hlinux/clk.hlinux/delay.hlinux/pm.hlinux/gcd.hlinux/gpio/driver.hlinux/i2c.hlinux/input.hlinux/pm_runtime.hlinux/regmap.hlinux/regulator/consumer.hlinux/slab.hlinux/workqueue.hlinux/mutex.hsound/core.hsound/jack.hsound/pcm.hsound/pcm_params.hsound/soc.hsound/initval.hsound/tlv.hsound/wm8962.htrace/events/asoc.hwm8962.h
Detected Declarations
struct wm8962_privstruct _fll_divfunction wm8962_volatile_registerfunction wm8962_readable_registerfunction wm8962_resetfunction wm8962_dsp2_write_configfunction wm8962_dsp2_set_enablefunction wm8962_dsp2_startfunction wm8962_dsp2_stopfunction wm8962_dsp2_ena_infofunction wm8962_dsp2_ena_getfunction wm8962_dsp2_ena_putfunction wm8962_put_hp_swfunction wm8962_put_spk_swfunction tp_eventfunction cp_eventfunction hp_eventfunction out_pga_eventfunction dsp2_eventfunction wm8962_add_widgetsfunction wm8962_configure_bclkfunction wm8962_set_bias_levelfunction wm8962_set_tdm_slotfunction wm8962_hw_paramsfunction wm8962_set_dai_sysclkfunction wm8962_set_dai_fmtfunction fll_factorsfunction wm8962_set_fllfunction wm8962_mutefunction wm8962_mic_workfunction wm8962_irqfunction snd_soc_jack_add_gpiosfunction wm8962_beep_workfunction wm8962_beep_eventfunction beep_storefunction wm8962_init_beepfunction wm8962_free_beepfunction wm8962_set_gpio_modefunction wm8962_gpio_requestfunction wm8962_gpio_setfunction wm8962_gpio_direction_outfunction wm8962_init_gpiofunction wm8962_free_gpiofunction wm8962_init_gpiofunction wm8962_removefunction wm8962_set_pdata_from_offunction wm8962_i2c_probefunction wm8962_i2c_remove
Annotated Snippet
struct wm8962_priv {
struct wm8962_pdata pdata;
struct regmap *regmap;
struct snd_soc_component *component;
int sysclk;
int sysclk_rate;
int bclk; /* Desired BCLK */
int lrclk;
struct completion fll_lock;
int fll_src;
int fll_fref;
int fll_fout;
struct mutex dsp2_ena_lock;
u16 dsp2_ena;
int mic_status;
struct delayed_work mic_work;
struct snd_soc_jack *jack;
struct regulator_bulk_data supplies[WM8962_NUM_SUPPLIES];
struct notifier_block disable_nb[WM8962_NUM_SUPPLIES];
struct input_dev *beep;
struct work_struct beep_work;
int beep_rate;
#ifdef CONFIG_GPIOLIB
struct gpio_chip gpio_chip;
#endif
int irq;
bool master_flag;
int tdm_width;
int tdm_slots;
};
/* 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 WM8962_REGULATOR_EVENT(n) \
static int wm8962_regulator_event_##n(struct notifier_block *nb, \
unsigned long event, void *data) \
{ \
struct wm8962_priv *wm8962 = container_of(nb, struct wm8962_priv, \
disable_nb[n]); \
if (event & REGULATOR_EVENT_DISABLE) { \
regcache_mark_dirty(wm8962->regmap); \
} \
return 0; \
}
WM8962_REGULATOR_EVENT(0)
WM8962_REGULATOR_EVENT(1)
WM8962_REGULATOR_EVENT(2)
WM8962_REGULATOR_EVENT(3)
WM8962_REGULATOR_EVENT(4)
WM8962_REGULATOR_EVENT(5)
WM8962_REGULATOR_EVENT(6)
WM8962_REGULATOR_EVENT(7)
static const struct reg_default wm8962_reg[] = {
{ 0, 0x009F }, /* R0 - Left Input volume */
{ 1, 0x049F }, /* R1 - Right Input volume */
{ 2, 0x0000 }, /* R2 - HPOUTL volume */
{ 3, 0x0000 }, /* R3 - HPOUTR volume */
{ 5, 0x0018 }, /* R5 - ADC & DAC Control 1 */
{ 6, 0x2008 }, /* R6 - ADC & DAC Control 2 */
{ 7, 0x000A }, /* R7 - Audio Interface 0 */
{ 8, 0x01E4 }, /* R8 - Clocking2 */
{ 9, 0x0300 }, /* R9 - Audio Interface 1 */
{ 10, 0x00C0 }, /* R10 - Left DAC volume */
{ 11, 0x00C0 }, /* R11 - Right DAC volume */
{ 14, 0x0040 }, /* R14 - Audio Interface 2 */
{ 15, 0x6243 }, /* R15 - Software Reset */
{ 17, 0x007B }, /* R17 - ALC1 */
{ 18, 0x0000 }, /* R18 - ALC2 */
{ 19, 0x1C32 }, /* R19 - ALC3 */
{ 20, 0x3200 }, /* R20 - Noise Gate */
{ 21, 0x00C0 }, /* R21 - Left ADC volume */
{ 22, 0x00C0 }, /* R22 - Right ADC volume */
{ 23, 0x0160 }, /* R23 - Additional control(1) */
Annotation
- Immediate include surface: `linux/module.h`, `linux/moduleparam.h`, `linux/init.h`, `linux/clk.h`, `linux/delay.h`, `linux/pm.h`, `linux/gcd.h`, `linux/gpio/driver.h`.
- Detected declarations: `struct wm8962_priv`, `struct _fll_div`, `function wm8962_volatile_register`, `function wm8962_readable_register`, `function wm8962_reset`, `function wm8962_dsp2_write_config`, `function wm8962_dsp2_set_enable`, `function wm8962_dsp2_start`, `function wm8962_dsp2_stop`, `function wm8962_dsp2_ena_info`.
- 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.
- 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.