sound/soc/codecs/wm8958-dsp2.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/wm8958-dsp2.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/wm8958-dsp2.c- Extension
.c- Size
- 28801 bytes
- Lines
- 1033
- 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.
- 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/i2c.hlinux/platform_device.hlinux/slab.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.hlinux/unaligned.hwm8994.h
Detected Declarations
function wm8958_dsp2_fwfunction wm8958_dsp_start_mbcfunction wm8958_dsp_start_vssfunction wm8958_dsp_start_enh_eqfunction wm8958_dsp_applyfunction wm8958_aif_evfunction wm8958_dsp2_busyfunction wm8958_put_mbc_enumfunction wm8958_get_mbc_enumfunction wm8958_mbc_infofunction wm8958_mbc_getfunction wm8958_mbc_putfunction wm8958_put_vss_enumfunction wm8958_get_vss_enumfunction wm8958_put_vss_hpf_enumfunction wm8958_get_vss_hpf_enumfunction wm8958_vss_infofunction wm8958_vss_getfunction wm8958_vss_putfunction wm8958_hpf_infofunction wm8958_hpf_getfunction wm8958_hpf_putfunction wm8958_put_enh_eq_enumfunction wm8958_get_enh_eq_enumfunction wm8958_enh_eq_infofunction wm8958_enh_eq_getfunction wm8958_enh_eq_putfunction wm8958_enh_eq_loadedfunction wm8958_mbc_vss_loadedfunction wm8958_mbc_loadedfunction wm8958_dsp2_init
Annotated Snippet
if (len < 12) {
dev_err(component->dev, "%s short data block of %zd\n",
name, len);
goto err;
}
block_len = get_unaligned_be32(data + 4);
if (block_len + 8 > len) {
dev_err(component->dev, "%zd byte block longer than file\n",
block_len);
goto err;
}
if (block_len == 0) {
dev_err(component->dev, "Zero length block\n");
goto err;
}
data32 = get_unaligned_be32(data);
switch ((data32 >> 24) & 0xff) {
case WM_FW_BLOCK_INFO:
/* Informational text */
if (!check)
break;
str = kzalloc(block_len + 1, GFP_KERNEL);
if (str) {
memcpy(str, data + 8, block_len);
dev_info(component->dev, "%s: %s\n", name, str);
kfree(str);
} else {
dev_err(component->dev, "Out of memory\n");
}
break;
case WM_FW_BLOCK_PM:
case WM_FW_BLOCK_X:
case WM_FW_BLOCK_Y:
case WM_FW_BLOCK_Z:
case WM_FW_BLOCK_I:
case WM_FW_BLOCK_A:
case WM_FW_BLOCK_C:
dev_dbg(component->dev, "%s: %zd bytes of %x@%x\n", name,
block_len, (data32 >> 24) & 0xff,
data32 & 0xffffff);
if (check)
break;
data32 &= 0xffffff;
wm8994_bulk_write(wm8994->wm8994,
data32 & 0xffffff,
block_len / 2,
(void *)(data + 8));
break;
default:
dev_warn(component->dev, "%s: unknown block type %d\n",
name, (data32 >> 24) & 0xff);
break;
}
/* Round up to the next 32 bit word */
block_len += block_len % 4;
data += block_len + 8;
len -= block_len + 8;
}
if (!check) {
dev_dbg(component->dev, "%s: download done\n", name);
wm8994->cur_fw = fw;
} else {
dev_info(component->dev, "%s: got firmware\n", name);
}
goto ok;
err:
ret = -EINVAL;
ok:
if (!check) {
snd_soc_component_write(component, 0x900, 0x0);
snd_soc_component_write(component, 0x102, 0x0);
}
return ret;
}
static void wm8958_dsp_start_mbc(struct snd_soc_component *component, int path)
Annotation
- Immediate include surface: `linux/module.h`, `linux/moduleparam.h`, `linux/init.h`, `linux/delay.h`, `linux/pm.h`, `linux/i2c.h`, `linux/platform_device.h`, `linux/slab.h`.
- Detected declarations: `function wm8958_dsp2_fw`, `function wm8958_dsp_start_mbc`, `function wm8958_dsp_start_vss`, `function wm8958_dsp_start_enh_eq`, `function wm8958_dsp_apply`, `function wm8958_aif_ev`, `function wm8958_dsp2_busy`, `function wm8958_put_mbc_enum`, `function wm8958_get_mbc_enum`, `function wm8958_mbc_info`.
- 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.
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.