sound/soc/codecs/wm8994.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/wm8994.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/wm8994.c- Extension
.c- Size
- 136207 bytes
- Lines
- 4711
- 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/delay.hlinux/pm.hlinux/gcd.hlinux/i2c.hlinux/platform_device.hlinux/pm_runtime.hlinux/regulator/consumer.hlinux/slab.hsound/core.hsound/jack.hsound/pcm.hsound/pcm_params.hsound/soc.hsound/initval.hsound/tlv.htrace/events/asoc.hlinux/mfd/wm8994/core.hlinux/mfd/wm8994/registers.hlinux/mfd/wm8994/pdata.hlinux/mfd/wm8994/gpio.hwm8994.hwm_hubs.h
Detected Declarations
struct wm8994_reg_maskstruct fll_divfunction wm8958_micd_set_ratefunction configure_aif_clockfunction configure_clockfunction check_clk_sysfunction wm8994_put_drc_swfunction wm8994_set_drcfunction wm8994_get_drcfunction wm8994_put_drc_enumfunction wm8994_get_drc_enumfunction wm8994_set_retune_mobilefunction wm8994_get_retune_mobile_blockfunction wm8994_put_retune_mobile_enumfunction wm8994_get_retune_mobile_enumfunction wm1811_jackdet_set_modefunction active_referencefunction active_dereferencefunction clk_sys_eventfunction vmid_referencefunction vmid_dereferencefunction vmid_eventfunction wm8994_check_class_w_digitalfunction wm8994_update_vu_bitsfunction aif_mclk_setfunction aif1clk_evfunction aif2clk_evfunction aif1clk_late_evfunction aif2clk_late_evfunction late_enable_evfunction late_disable_evfunction adc_mux_evfunction micbias_evfunction dac_evfunction post_evfunction wm8994_put_class_wfunction wm8994_get_fll_configfunction _wm8994_set_fllfunction wm8994_fll_locked_irqfunction wm8994_set_fllfunction wm8994_set_mclk_ratefunction wm8994_set_dai_sysclkfunction wm8994_set_bias_levelfunction wm8994_vmid_modefunction wm8994_set_dai_fmtfunction wm8994_hw_paramsfunction wm8994_aif3_hw_paramsfunction wm8994_aif_mute
Annotated Snippet
struct wm8994_reg_mask {
unsigned int reg;
unsigned int mask;
};
static struct wm8994_reg_mask wm8994_vu_bits[] = {
{ WM8994_LEFT_LINE_INPUT_1_2_VOLUME, WM8994_IN1_VU },
{ WM8994_RIGHT_LINE_INPUT_1_2_VOLUME, WM8994_IN1_VU },
{ WM8994_LEFT_LINE_INPUT_3_4_VOLUME, WM8994_IN2_VU },
{ WM8994_RIGHT_LINE_INPUT_3_4_VOLUME, WM8994_IN2_VU },
{ WM8994_SPEAKER_VOLUME_LEFT, WM8994_SPKOUT_VU },
{ WM8994_SPEAKER_VOLUME_RIGHT, WM8994_SPKOUT_VU },
{ WM8994_LEFT_OUTPUT_VOLUME, WM8994_HPOUT1_VU },
{ WM8994_RIGHT_OUTPUT_VOLUME, WM8994_HPOUT1_VU },
{ WM8994_LEFT_OPGA_VOLUME, WM8994_MIXOUT_VU },
{ WM8994_RIGHT_OPGA_VOLUME, WM8994_MIXOUT_VU },
{ WM8994_AIF1_DAC1_LEFT_VOLUME, WM8994_AIF1DAC1_VU },
{ WM8994_AIF1_DAC1_RIGHT_VOLUME, WM8994_AIF1DAC1_VU },
{ WM8994_AIF2_DAC_LEFT_VOLUME, WM8994_AIF2DAC_VU },
{ WM8994_AIF2_DAC_RIGHT_VOLUME, WM8994_AIF2DAC_VU },
{ WM8994_AIF1_ADC1_LEFT_VOLUME, WM8994_AIF1ADC1_VU },
{ WM8994_AIF1_ADC1_RIGHT_VOLUME, WM8994_AIF1ADC1_VU },
{ WM8994_AIF2_ADC_LEFT_VOLUME, WM8994_AIF2ADC_VU },
{ WM8994_AIF2_ADC_RIGHT_VOLUME, WM8994_AIF1ADC2_VU },
{ WM8994_DAC1_LEFT_VOLUME, WM8994_DAC1_VU },
{ WM8994_DAC1_RIGHT_VOLUME, WM8994_DAC1_VU },
{ WM8994_DAC2_LEFT_VOLUME, WM8994_DAC2_VU },
{ WM8994_DAC2_RIGHT_VOLUME, WM8994_DAC2_VU },
};
/* VU bitfields for ADC2, DAC2 not available on WM1811 */
static struct wm8994_reg_mask wm8994_adc2_dac2_vu_bits[] = {
{ WM8994_AIF1_DAC2_LEFT_VOLUME, WM8994_AIF1DAC2_VU },
{ WM8994_AIF1_DAC2_RIGHT_VOLUME, WM8994_AIF1DAC2_VU },
{ WM8994_AIF1_ADC2_LEFT_VOLUME, WM8994_AIF1ADC2_VU },
{ WM8994_AIF1_ADC2_RIGHT_VOLUME, WM8994_AIF1ADC2_VU },
};
static int wm8994_drc_base[] = {
WM8994_AIF1_DRC1_1,
WM8994_AIF1_DRC2_1,
WM8994_AIF2_DRC_1,
};
static int wm8994_retune_mobile_base[] = {
WM8994_AIF1_DAC1_EQ_GAINS_1,
WM8994_AIF1_DAC2_EQ_GAINS_1,
WM8994_AIF2_EQ_GAINS_1,
};
static const struct wm8958_micd_rate micdet_rates[] = {
{ 32768, true, 1, 4 },
{ 32768, false, 1, 1 },
{ 44100 * 256, true, 7, 10 },
{ 44100 * 256, false, 7, 10 },
};
static const struct wm8958_micd_rate jackdet_rates[] = {
{ 32768, true, 0, 1 },
{ 32768, false, 0, 1 },
{ 44100 * 256, true, 10, 10 },
{ 44100 * 256, false, 7, 8 },
};
static void wm8958_micd_set_rate(struct snd_soc_component *component)
{
struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component);
struct wm8994 *control = wm8994->wm8994;
int best, i, sysclk, val;
bool idle;
const struct wm8958_micd_rate *rates;
int num_rates;
idle = !wm8994->jack_mic;
sysclk = snd_soc_component_read(component, WM8994_CLOCKING_1);
if (sysclk & WM8994_SYSCLK_SRC)
sysclk = wm8994->aifclk[1];
else
sysclk = wm8994->aifclk[0];
if (control->pdata.micd_rates) {
rates = control->pdata.micd_rates;
num_rates = control->pdata.num_micd_rates;
} else if (wm8994->jackdet) {
rates = jackdet_rates;
num_rates = ARRAY_SIZE(jackdet_rates);
} else {
rates = micdet_rates;
Annotation
- Immediate include surface: `linux/module.h`, `linux/moduleparam.h`, `linux/init.h`, `linux/delay.h`, `linux/pm.h`, `linux/gcd.h`, `linux/i2c.h`, `linux/platform_device.h`.
- Detected declarations: `struct wm8994_reg_mask`, `struct fll_div`, `function wm8958_micd_set_rate`, `function configure_aif_clock`, `function configure_clock`, `function check_clk_sys`, `function wm8994_put_drc_sw`, `function wm8994_set_drc`, `function wm8994_get_drc`, `function wm8994_put_drc_enum`.
- 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.