sound/soc/codecs/wm5100.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/wm5100.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/wm5100.c- Extension
.c- Size
- 78170 bytes
- Lines
- 2692
- 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/export.hlinux/pm.hlinux/gcd.hlinux/gpio/driver.hlinux/gpio/consumer.hlinux/i2c.hlinux/pm_runtime.hlinux/regulator/consumer.hlinux/regulator/fixed.hlinux/slab.hsound/core.hsound/pcm.hsound/pcm_params.hsound/soc.hsound/jack.hsound/initval.hsound/tlv.hsound/wm5100.hwm5100.h
Detected Declarations
struct wm5100_fllstruct wm5100_privstruct _fll_divfunction wm5100_alloc_srfunction wm5100_free_srfunction wm5100_resetfunction wm5100_seq_notifierfunction wm5100_out_evfunction wm5100_log_status3function wm5100_log_status4function wm5100_post_evfunction wm5100_set_fmtfunction wm5100_hw_paramsfunction wm5100_set_sysclkfunction fll_factorsfunction wm5100_set_fllfunction wm5100_set_detect_modefunction wm5100_report_headphonefunction wm5100_micd_irqfunction wm5100_detectfunction wm5100_irqfunction wm5100_edge_irqfunction wm5100_gpio_setfunction wm5100_gpio_direction_outfunction wm5100_gpio_getfunction wm5100_gpio_direction_infunction wm5100_init_gpiofunction wm5100_free_gpiofunction wm5100_init_gpiofunction wm5100_i2c_probefunction wm5100_i2c_removefunction wm5100_runtime_suspendfunction wm5100_runtime_resumeexport wm5100_detect
Annotated Snippet
struct wm5100_fll {
int fref;
int fout;
int src;
struct completion lock;
};
/* codec private data */
struct wm5100_priv {
struct device *dev;
struct regmap *regmap;
struct snd_soc_component *component;
struct regulator_bulk_data core_supplies[WM5100_NUM_CORE_SUPPLIES];
struct gpio_desc *reset;
struct gpio_desc *ldo_ena;
struct gpio_desc *hp_pol;
int rev;
int sysclk;
int asyncclk;
bool aif_async[WM5100_AIFS];
bool aif_symmetric[WM5100_AIFS];
int sr_ref[WM5100_SYNC_SRS];
bool out_ena[2];
struct snd_soc_jack *jack;
bool jack_detecting;
bool jack_mic;
int jack_mode;
int jack_flips;
struct wm5100_fll fll[2];
struct wm5100_pdata pdata;
#ifdef CONFIG_GPIOLIB
struct gpio_chip gpio_chip;
#endif
};
static int wm5100_sr_code[] = {
0,
12000,
24000,
48000,
96000,
192000,
384000,
768000,
0,
11025,
22050,
44100,
88200,
176400,
352800,
705600,
4000,
8000,
16000,
32000,
64000,
128000,
256000,
512000,
};
static int wm5100_sr_regs[WM5100_SYNC_SRS] = {
WM5100_CLOCKING_4,
WM5100_CLOCKING_5,
WM5100_CLOCKING_6,
};
static int wm5100_alloc_sr(struct snd_soc_component *component, int rate)
{
struct wm5100_priv *wm5100 = snd_soc_component_get_drvdata(component);
int sr_code, sr_free, i;
for (i = 0; i < ARRAY_SIZE(wm5100_sr_code); i++)
if (wm5100_sr_code[i] == rate)
break;
if (i == ARRAY_SIZE(wm5100_sr_code)) {
dev_err(component->dev, "Unsupported sample rate: %dHz\n", rate);
return -EINVAL;
}
sr_code = i;
Annotation
- Immediate include surface: `linux/module.h`, `linux/moduleparam.h`, `linux/init.h`, `linux/delay.h`, `linux/export.h`, `linux/pm.h`, `linux/gcd.h`, `linux/gpio/driver.h`.
- Detected declarations: `struct wm5100_fll`, `struct wm5100_priv`, `struct _fll_div`, `function wm5100_alloc_sr`, `function wm5100_free_sr`, `function wm5100_reset`, `function wm5100_seq_notifier`, `function wm5100_out_ev`, `function wm5100_log_status3`, `function wm5100_log_status4`.
- 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.