sound/isa/wavefront/wavefront_fx.c
Source file repositories/reference/linux-study-clean/sound/isa/wavefront/wavefront_fx.c
File Facts
- System
- Linux kernel
- Corpus path
sound/isa/wavefront/wavefront_fx.c- Extension
.c- Size
- 5716 bytes
- Lines
- 273
- Domain
- Driver Families
- Bucket
- sound/isa
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/io.hlinux/init.hlinux/time.hlinux/wait.hlinux/slab.hlinux/module.hlinux/firmware.hsound/core.hsound/snd_wavefront.hsound/initval.h
Detected Declarations
function Copyrightfunction wavefront_fx_mutefunction wavefront_fx_memsetfunction snd_wavefront_fx_detectfunction snd_wavefront_fx_openfunction snd_wavefront_fx_releasefunction snd_wavefront_fx_ioctlfunction snd_wavefront_fx_start
Annotated Snippet
if ((x & 0x80) == 0) {
break;
}
}
if (x & 0x80) {
dev_err(dev->card->dev, "FX device never idle.\n");
return 0;
}
return (1);
}
static void
wavefront_fx_mute (snd_wavefront_t *dev, int onoff)
{
if (!wavefront_fx_idle(dev)) {
return;
}
outb (onoff ? 0x02 : 0x00, dev->fx_op);
}
static int
wavefront_fx_memset (snd_wavefront_t *dev,
int page,
int addr,
int cnt,
unsigned short *data)
{
if (page < 0 || page > 7) {
dev_err(dev->card->dev,
"FX memset: page must be >= 0 and <= 7\n");
return -EINVAL;
}
if (addr < 0 || addr > 0x7f) {
dev_err(dev->card->dev,
"FX memset: addr must be >= 0 and <= 7f\n");
return -EINVAL;
}
if (cnt == 1) {
outb (FX_LSB_TRANSFER, dev->fx_lcr);
outb (page, dev->fx_dsp_page);
outb (addr, dev->fx_dsp_addr);
outb ((data[0] >> 8), dev->fx_dsp_msb);
outb ((data[0] & 0xff), dev->fx_dsp_lsb);
dev_err(dev->card->dev, "FX: addr %d:%x set to 0x%x\n",
page, addr, data[0]);
} else {
int i;
outb (FX_AUTO_INCR|FX_LSB_TRANSFER, dev->fx_lcr);
outb (page, dev->fx_dsp_page);
outb (addr, dev->fx_dsp_addr);
for (i = 0; i < cnt; i++) {
outb ((data[i] >> 8), dev->fx_dsp_msb);
outb ((data[i] & 0xff), dev->fx_dsp_lsb);
if (!wavefront_fx_idle (dev)) {
break;
}
}
if (i != cnt) {
dev_err(dev->card->dev,
"FX memset (0x%x, 0x%x, 0x%lx, %d) incomplete\n",
page, addr, (unsigned long) data, cnt);
return -EIO;
}
}
return 0;
}
int
snd_wavefront_fx_detect (snd_wavefront_t *dev)
{
/* This is a crude check, but its the best one I have for now.
Certainly on the Maui and the Tropez, wavefront_fx_idle() will
report "never idle", which suggests that this test should
work OK.
*/
Annotation
- Immediate include surface: `linux/io.h`, `linux/init.h`, `linux/time.h`, `linux/wait.h`, `linux/slab.h`, `linux/module.h`, `linux/firmware.h`, `sound/core.h`.
- Detected declarations: `function Copyright`, `function wavefront_fx_mute`, `function wavefront_fx_memset`, `function snd_wavefront_fx_detect`, `function snd_wavefront_fx_open`, `function snd_wavefront_fx_release`, `function snd_wavefront_fx_ioctl`, `function snd_wavefront_fx_start`.
- Atlas domain: Driver Families / sound/isa.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
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.