sound/soc/codecs/wm8400.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/wm8400.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/wm8400.c- Extension
.c- Size
- 41902 bytes
- Lines
- 1349
- 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/module.hlinux/moduleparam.hlinux/kernel.hlinux/slab.hlinux/init.hlinux/delay.hlinux/pm.hlinux/platform_device.hlinux/regulator/consumer.hlinux/mfd/wm8400-audio.hlinux/mfd/wm8400-private.hlinux/mfd/core.hsound/core.hsound/pcm.hsound/pcm_params.hsound/soc.hsound/initval.hsound/tlv.hwm8400.h
Detected Declarations
struct wm8400_privstruct fll_factorsfunction wm8400_component_resetfunction wm8400_outpga_put_volsw_vufunction outmixer_eventfunction wm8400_set_dai_sysclkfunction fll_factorsfunction wm8400_set_dai_pllfunction wm8400_set_dai_fmtfunction wm8400_set_dai_clkdivfunction wm8400_hw_paramsfunction wm8400_mutefunction wm8400_set_bias_levelfunction wm8400_component_probefunction wm8400_component_removefunction wm8400_probe
Annotated Snippet
struct wm8400_priv {
struct wm8400 *wm8400;
u16 fake_register;
unsigned int sysclk;
unsigned int pcmclk;
int fll_in, fll_out;
};
static void wm8400_component_reset(struct snd_soc_component *component)
{
struct wm8400_priv *wm8400 = snd_soc_component_get_drvdata(component);
wm8400_reset_codec_reg_cache(wm8400->wm8400);
}
static const DECLARE_TLV_DB_SCALE(in_pga_tlv, -1650, 3000, 0);
static const DECLARE_TLV_DB_SCALE(out_mix_tlv, -2100, 0, 0);
static const DECLARE_TLV_DB_SCALE(out_pga_tlv, -7300, 600, 0);
static const DECLARE_TLV_DB_SCALE(out_dac_tlv, -7163, 0, 0);
static const DECLARE_TLV_DB_SCALE(in_adc_tlv, -7163, 1763, 0);
static const DECLARE_TLV_DB_SCALE(out_sidetone_tlv, -3600, 0, 0);
static int wm8400_outpga_put_volsw_vu(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
struct soc_mixer_control *mc =
(struct soc_mixer_control *)kcontrol->private_value;
int reg = mc->reg;
int ret;
u16 val;
ret = snd_soc_put_volsw(kcontrol, ucontrol);
if (ret < 0)
return ret;
/* now hit the volume update bits (always bit 8) */
val = snd_soc_component_read(component, reg);
return snd_soc_component_write(component, reg, val | 0x0100);
}
#define WM8400_OUTPGA_SINGLE_R_TLV(xname, reg, shift, max, invert, tlv_array) \
SOC_SINGLE_EXT_TLV(xname, reg, shift, max, invert, \
snd_soc_get_volsw, wm8400_outpga_put_volsw_vu, tlv_array)
static const char *wm8400_digital_sidetone[] =
{"None", "Left ADC", "Right ADC", "Reserved"};
static SOC_ENUM_SINGLE_DECL(wm8400_left_digital_sidetone_enum,
WM8400_DIGITAL_SIDE_TONE,
WM8400_ADC_TO_DACL_SHIFT,
wm8400_digital_sidetone);
static SOC_ENUM_SINGLE_DECL(wm8400_right_digital_sidetone_enum,
WM8400_DIGITAL_SIDE_TONE,
WM8400_ADC_TO_DACR_SHIFT,
wm8400_digital_sidetone);
static const char *wm8400_adcmode[] =
{"Hi-fi mode", "Voice mode 1", "Voice mode 2", "Voice mode 3"};
static SOC_ENUM_SINGLE_DECL(wm8400_right_adcmode_enum,
WM8400_ADC_CTRL,
WM8400_ADC_HPF_CUT_SHIFT,
wm8400_adcmode);
static const struct snd_kcontrol_new wm8400_snd_controls[] = {
/* INMIXL */
SOC_SINGLE("LIN12 PGA Boost", WM8400_INPUT_MIXER3, WM8400_L12MNBST_SHIFT,
1, 0),
SOC_SINGLE("LIN34 PGA Boost", WM8400_INPUT_MIXER3, WM8400_L34MNBST_SHIFT,
1, 0),
/* INMIXR */
SOC_SINGLE("RIN12 PGA Boost", WM8400_INPUT_MIXER3, WM8400_R12MNBST_SHIFT,
1, 0),
SOC_SINGLE("RIN34 PGA Boost", WM8400_INPUT_MIXER3, WM8400_R34MNBST_SHIFT,
1, 0),
/* LOMIX */
SOC_SINGLE_TLV("LOMIX LIN3 Bypass Volume", WM8400_OUTPUT_MIXER3,
WM8400_LLI3LOVOL_SHIFT, 7, 0, out_mix_tlv),
SOC_SINGLE_TLV("LOMIX RIN12 PGA Bypass Volume", WM8400_OUTPUT_MIXER3,
WM8400_LR12LOVOL_SHIFT, 7, 0, out_mix_tlv),
SOC_SINGLE_TLV("LOMIX LIN12 PGA Bypass Volume", WM8400_OUTPUT_MIXER3,
Annotation
- Immediate include surface: `linux/module.h`, `linux/moduleparam.h`, `linux/kernel.h`, `linux/slab.h`, `linux/init.h`, `linux/delay.h`, `linux/pm.h`, `linux/platform_device.h`.
- Detected declarations: `struct wm8400_priv`, `struct fll_factors`, `function wm8400_component_reset`, `function wm8400_outpga_put_volsw_vu`, `function outmixer_event`, `function wm8400_set_dai_sysclk`, `function fll_factors`, `function wm8400_set_dai_pll`, `function wm8400_set_dai_fmt`, `function wm8400_set_dai_clkdiv`.
- 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.