sound/soc/codecs/wm8996.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/wm8996.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/wm8996.c- Extension
.c- Size
- 94925 bytes
- Lines
- 3094
- 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/completion.hlinux/delay.hlinux/pm.hlinux/gcd.hlinux/gpio/driver.hlinux/gpio/consumer.hlinux/i2c.hlinux/regmap.hlinux/regulator/consumer.hlinux/slab.hlinux/workqueue.hsound/core.hsound/jack.hsound/pcm.hsound/pcm_params.hsound/soc.hsound/initval.hsound/tlv.htrace/events/asoc.hsound/wm8996.hwm8996.h
Detected Declarations
struct wm8996_privstruct _fll_divfunction wm8996_set_retune_mobilefunction wm8996_get_retune_mobile_blockfunction wm8996_put_retune_mobile_enumfunction wm8996_get_retune_mobile_enumfunction wm8996_bg_enablefunction wm8996_bg_disablefunction bg_eventfunction cp_eventfunction rmv_short_eventfunction wait_for_dc_servofunction wm8996_seq_notifierfunction dcs_startfunction wm8996_readable_registerfunction wm8996_volatile_registerfunction wm8996_update_bclkfunction wm8996_set_bias_levelfunction wm8996_set_fmtfunction wm8996_hw_paramsfunction wm8996_set_sysclkfunction fll_factorsfunction wm8996_set_fllfunction wm8996_gpio_setfunction wm8996_gpio_direction_outfunction wm8996_gpio_getfunction wm8996_gpio_direction_infunction wm8996_init_gpiofunction wm8996_free_gpiofunction wm8996_init_gpiofunction wm8996_hpdet_irqfunction wm8996_hpdet_startfunction wm8996_report_headphonefunction wm8996_micdfunction wm8996_irqfunction wm8996_edge_irqfunction wm8996_retune_mobile_pdatafunction wm8996_probefunction wm8996_removefunction wm8996_i2c_probefunction wm8996_i2c_removeexport wm8996_detect
Annotated Snippet
struct wm8996_priv {
struct device *dev;
struct regmap *regmap;
struct snd_soc_component *component;
struct gpio_desc *ldo_ena;
int sysclk;
int sysclk_src;
int fll_src;
int fll_fref;
int fll_fout;
struct completion fll_lock;
u16 dcs_pending;
struct completion dcs_done;
u16 hpout_ena;
u16 hpout_pending;
struct regulator_bulk_data supplies[WM8996_NUM_SUPPLIES];
struct notifier_block disable_nb[WM8996_NUM_SUPPLIES];
int bg_ena;
struct wm8996_pdata pdata;
int rx_rate[WM8996_AIFS];
int bclk_rate[WM8996_AIFS];
/* Platform dependent ReTune mobile configuration */
int num_retune_mobile_texts;
const char **retune_mobile_texts;
int retune_mobile_cfg[2];
struct soc_enum retune_mobile_enum;
struct snd_soc_jack *jack;
bool detecting;
bool jack_mic;
int jack_flips;
wm8996_polarity_fn polarity_cb;
#ifdef CONFIG_GPIOLIB
struct gpio_chip gpio_chip;
#endif
};
/* 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 WM8996_REGULATOR_EVENT(n) \
static int wm8996_regulator_event_##n(struct notifier_block *nb, \
unsigned long event, void *data) \
{ \
struct wm8996_priv *wm8996 = container_of(nb, struct wm8996_priv, \
disable_nb[n]); \
if (event & REGULATOR_EVENT_DISABLE) { \
regcache_mark_dirty(wm8996->regmap); \
} \
return 0; \
}
WM8996_REGULATOR_EVENT(0)
WM8996_REGULATOR_EVENT(1)
WM8996_REGULATOR_EVENT(2)
static const struct reg_default wm8996_reg[] = {
{ WM8996_POWER_MANAGEMENT_1, 0x0 },
{ WM8996_POWER_MANAGEMENT_2, 0x0 },
{ WM8996_POWER_MANAGEMENT_3, 0x0 },
{ WM8996_POWER_MANAGEMENT_4, 0x0 },
{ WM8996_POWER_MANAGEMENT_5, 0x0 },
{ WM8996_POWER_MANAGEMENT_6, 0x0 },
{ WM8996_POWER_MANAGEMENT_7, 0x10 },
{ WM8996_POWER_MANAGEMENT_8, 0x0 },
{ WM8996_LEFT_LINE_INPUT_VOLUME, 0x0 },
{ WM8996_RIGHT_LINE_INPUT_VOLUME, 0x0 },
{ WM8996_LINE_INPUT_CONTROL, 0x0 },
{ WM8996_DAC1_HPOUT1_VOLUME, 0x88 },
{ WM8996_DAC2_HPOUT2_VOLUME, 0x88 },
{ WM8996_DAC1_LEFT_VOLUME, 0x2c0 },
{ WM8996_DAC1_RIGHT_VOLUME, 0x2c0 },
{ WM8996_DAC2_LEFT_VOLUME, 0x2c0 },
{ WM8996_DAC2_RIGHT_VOLUME, 0x2c0 },
{ WM8996_OUTPUT1_LEFT_VOLUME, 0x80 },
{ WM8996_OUTPUT1_RIGHT_VOLUME, 0x80 },
{ WM8996_OUTPUT2_LEFT_VOLUME, 0x80 },
{ WM8996_OUTPUT2_RIGHT_VOLUME, 0x80 },
Annotation
- Immediate include surface: `linux/module.h`, `linux/moduleparam.h`, `linux/init.h`, `linux/completion.h`, `linux/delay.h`, `linux/pm.h`, `linux/gcd.h`, `linux/gpio/driver.h`.
- Detected declarations: `struct wm8996_priv`, `struct _fll_div`, `function wm8996_set_retune_mobile`, `function wm8996_get_retune_mobile_block`, `function wm8996_put_retune_mobile_enum`, `function wm8996_get_retune_mobile_enum`, `function wm8996_bg_enable`, `function wm8996_bg_disable`, `function bg_event`, `function cp_event`.
- 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.