sound/soc/codecs/wm8997.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/wm8997.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/wm8997.c- Extension
.c- Size
- 42343 bytes
- Lines
- 1222
- 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/init.hlinux/delay.hlinux/pm.hlinux/pm_runtime.hlinux/regmap.hlinux/slab.hsound/core.hsound/pcm.hsound/pcm_params.hsound/soc.hsound/jack.hsound/initval.hsound/tlv.hlinux/mfd/arizona/core.hlinux/mfd/arizona/registers.harizona.hwm8997.h
Detected Declarations
struct wm8997_privfunction wm8997_sysclk_evfunction wm8997_set_fllfunction wm8997_component_probefunction wm8997_component_removefunction wm8997_probefunction wm8997_remove
Annotated Snippet
struct wm8997_priv {
struct arizona_priv core;
struct arizona_fll fll[2];
};
static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0);
static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);
static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0);
static DECLARE_TLV_DB_SCALE(noise_tlv, -13200, 600, 0);
static DECLARE_TLV_DB_SCALE(ng_tlv, -10200, 600, 0);
static const struct reg_default wm8997_sysclk_reva_patch[] = {
{ 0x301D, 0x7B15 },
{ 0x301B, 0x0050 },
{ 0x305D, 0x7B17 },
{ 0x305B, 0x0050 },
{ 0x3001, 0x08FE },
{ 0x3003, 0x00F4 },
{ 0x3041, 0x08FF },
{ 0x3043, 0x0005 },
{ 0x3020, 0x0225 },
{ 0x3021, 0x0A00 },
{ 0x3022, 0xE24D },
{ 0x3023, 0x0800 },
{ 0x3024, 0xE24D },
{ 0x3025, 0xF000 },
{ 0x3060, 0x0226 },
{ 0x3061, 0x0A00 },
{ 0x3062, 0xE252 },
{ 0x3063, 0x0800 },
{ 0x3064, 0xE252 },
{ 0x3065, 0xF000 },
{ 0x3116, 0x022B },
{ 0x3117, 0xFA00 },
{ 0x3110, 0x246C },
{ 0x3111, 0x0A03 },
{ 0x3112, 0x246E },
{ 0x3113, 0x0A03 },
{ 0x3114, 0x2470 },
{ 0x3115, 0x0A03 },
{ 0x3126, 0x246C },
{ 0x3127, 0x0A02 },
{ 0x3128, 0x246E },
{ 0x3129, 0x0A02 },
{ 0x312A, 0x2470 },
{ 0x312B, 0xFA02 },
{ 0x3125, 0x0800 },
};
static int wm8997_sysclk_ev(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
struct arizona *arizona = dev_get_drvdata(component->dev->parent);
struct regmap *regmap = arizona->regmap;
const struct reg_default *patch = NULL;
int i, patch_size;
switch (arizona->rev) {
case 0:
patch = wm8997_sysclk_reva_patch;
patch_size = ARRAY_SIZE(wm8997_sysclk_reva_patch);
break;
default:
break;
}
switch (event) {
case SND_SOC_DAPM_POST_PMU:
if (patch)
for (i = 0; i < patch_size; i++)
regmap_write_async(regmap, patch[i].reg,
patch[i].def);
break;
case SND_SOC_DAPM_PRE_PMD:
break;
case SND_SOC_DAPM_PRE_PMU:
case SND_SOC_DAPM_POST_PMD:
return arizona_clk_ev(w, kcontrol, event);
default:
return 0;
}
return arizona_dvfs_sysclk_ev(w, kcontrol, event);
}
static const char * const wm8997_osr_text[] = {
"Low power", "Normal", "High performance",
};
Annotation
- Immediate include surface: `linux/module.h`, `linux/moduleparam.h`, `linux/init.h`, `linux/delay.h`, `linux/pm.h`, `linux/pm_runtime.h`, `linux/regmap.h`, `linux/slab.h`.
- Detected declarations: `struct wm8997_priv`, `function wm8997_sysclk_ev`, `function wm8997_set_fll`, `function wm8997_component_probe`, `function wm8997_component_remove`, `function wm8997_probe`, `function wm8997_remove`.
- 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.