sound/soc/codecs/wm0010.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/wm0010.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/wm0010.c- Extension
.c- Size
- 22996 bytes
- Lines
- 978
- 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.
- 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/interrupt.hlinux/irqreturn.hlinux/init.hlinux/spi/spi.hlinux/firmware.hlinux/delay.hlinux/fs.hlinux/gpio/consumer.hlinux/regulator/consumer.hlinux/mutex.hlinux/workqueue.hsound/soc.hsound/wm0010.h
Detected Declarations
struct dfw_binrecstruct dfw_inforecstruct dfw_pllrecstruct wm0010_privstruct wm0010_boot_xferenum dfw_cmdenum wm0010_statefunction wm0010_haltfunction wm0010_mark_boot_failurefunction wm0010_boot_xfer_completefunction byte_swap_64function wm0010_firmware_loadfunction wm0010_stage2_loadfunction wm0010_bootfunction wm0010_set_bias_levelfunction wm0010_set_sysclkfunction wm0010_irqfunction wm0010_probefunction wm0010_spi_probefunction wm0010_spi_remove
Annotated Snippet
struct dfw_binrec {
u8 command;
u32 length:24;
u32 address;
uint8_t data[];
} __packed;
struct dfw_inforec {
u8 info_version;
u8 tool_major_version;
u8 tool_minor_version;
u8 dsp_target;
};
struct dfw_pllrec {
u8 command;
u32 length:24;
u32 address;
u32 clkctrl1;
u32 clkctrl2;
u32 clkctrl3;
u32 ldetctrl;
u32 uart_div;
u32 spi_div;
} __packed;
static struct pll_clock_map {
int max_sysclk;
int max_pll_spi_speed;
u32 pll_clkctrl1;
} pll_clock_map[] = { /* Dividers */
{ 22000000, 26000000, 0x00201f11 }, /* 2,32,2 */
{ 18000000, 26000000, 0x00203f21 }, /* 2,64,4 */
{ 14000000, 26000000, 0x00202620 }, /* 1,39,4 */
{ 10000000, 22000000, 0x00203120 }, /* 1,50,4 */
{ 6500000, 22000000, 0x00204520 }, /* 1,70,4 */
{ 5500000, 22000000, 0x00103f10 }, /* 1,64,2 */
};
enum wm0010_state {
WM0010_POWER_OFF,
WM0010_OUT_OF_RESET,
WM0010_BOOTROM,
WM0010_STAGE2,
WM0010_FIRMWARE,
};
struct wm0010_priv {
struct snd_soc_component *component;
struct mutex lock;
struct device *dev;
struct wm0010_pdata pdata;
struct gpio_desc *reset;
struct regulator_bulk_data core_supplies[2];
struct regulator *dbvdd;
int sysclk;
enum wm0010_state state;
bool boot_failed;
bool ready;
bool pll_running;
int max_spi_freq;
int board_max_spi_speed;
u32 pll_clkctrl1;
spinlock_t irq_lock;
int irq;
struct completion boot_completion;
};
static const struct snd_soc_dapm_widget wm0010_dapm_widgets[] = {
SND_SOC_DAPM_SUPPLY("CLKIN", SND_SOC_NOPM, 0, 0, NULL, 0),
};
static const struct snd_soc_dapm_route wm0010_dapm_routes[] = {
{ "SDI2 Capture", NULL, "SDI1 Playback" },
{ "SDI1 Capture", NULL, "SDI2 Playback" },
{ "SDI1 Capture", NULL, "CLKIN" },
{ "SDI2 Capture", NULL, "CLKIN" },
{ "SDI1 Playback", NULL, "CLKIN" },
{ "SDI2 Playback", NULL, "CLKIN" },
};
Annotation
- Immediate include surface: `linux/module.h`, `linux/moduleparam.h`, `linux/interrupt.h`, `linux/irqreturn.h`, `linux/init.h`, `linux/spi/spi.h`, `linux/firmware.h`, `linux/delay.h`.
- Detected declarations: `struct dfw_binrec`, `struct dfw_inforec`, `struct dfw_pllrec`, `struct wm0010_priv`, `struct wm0010_boot_xfer`, `enum dfw_cmd`, `enum wm0010_state`, `function wm0010_halt`, `function wm0010_mark_boot_failure`, `function wm0010_boot_xfer_complete`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: source 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.