sound/drivers/vx/vx_core.c
Source file repositories/reference/linux-study-clean/sound/drivers/vx/vx_core.c
File Facts
- System
- Linux kernel
- Corpus path
sound/drivers/vx/vx_core.c- Extension
.c- Size
- 19550 bytes
- Lines
- 809
- Domain
- Driver Families
- Bucket
- sound/drivers
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hlinux/slab.hlinux/interrupt.hlinux/init.hlinux/device.hlinux/firmware.hlinux/module.hlinux/io.hsound/core.hsound/pcm.hsound/asoundef.hsound/info.hsound/vx_core.hvx_cmd.h
Detected Declarations
function snd_vx_check_reg_bitfunction vx_send_irq_dspfunction vx_reset_chkfunction vx_transfer_endfunction vx_read_statusfunction vx_send_msg_nolockfunction vx_send_msg_nolockfunction vx_send_rih_nolockfunction vx_send_rih_nolockfunction snd_vx_load_boot_imagefunction vx_test_irq_srcfunction snd_vx_threaded_irq_handlerfunction snd_vx_irq_handlerfunction vx_reset_boardfunction vx_proc_readfunction vx_proc_initfunction snd_vx_dsp_bootfunction snd_vx_dsp_loadfunction snd_vx_suspendfunction snd_vx_resumefunction snd_vx_releaseexport snd_vx_check_reg_bitexport snd_vx_load_boot_imageexport snd_vx_threaded_irq_handlerexport snd_vx_irq_handlerexport snd_vx_dsp_bootexport snd_vx_dsp_loadexport snd_vx_suspendexport snd_vx_resumeexport snd_vx_create
Annotated Snippet
if (err < 0) {
dev_dbg(chip->card->dev,
"transfer_end: error in rx_full\n");
return err;
}
err = vx_inb(chip, RXH) << 16;
err |= vx_inb(chip, RXM) << 8;
err |= vx_inb(chip, RXL);
dev_dbg(chip->card->dev, "transfer_end: error = 0x%x\n", err);
return -(VX_ERR_MASK | err);
}
return 0;
}
/*
* vx_read_status - return the status rmh
* @rmh: rmh record to store the status
*
* returns 0 if successful, or a negative error code.
* the error code can be VX-specific, retrieved via vx_get_error().
* NB: call with mutex held!
*/
static int vx_read_status(struct vx_core *chip, struct vx_rmh *rmh)
{
int i, err, val, size;
/* no read necessary? */
if (rmh->DspStat == RMH_SSIZE_FIXED && rmh->LgStat == 0)
return 0;
/* Wait for RX full (with timeout protection)
* The first word of status is in RX
*/
err = vx_wait_for_rx_full(chip);
if (err < 0)
return err;
/* Read RX */
val = vx_inb(chip, RXH) << 16;
val |= vx_inb(chip, RXM) << 8;
val |= vx_inb(chip, RXL);
/* If status given by DSP, let's decode its size */
switch (rmh->DspStat) {
case RMH_SSIZE_ARG:
size = val & 0xff;
rmh->Stat[0] = val & 0xffff00;
rmh->LgStat = size + 1;
break;
case RMH_SSIZE_MASK:
/* Let's count the arg numbers from a mask */
rmh->Stat[0] = val;
size = 0;
while (val) {
if (val & 0x01)
size++;
val >>= 1;
}
rmh->LgStat = size + 1;
break;
default:
/* else retrieve the status length given by the driver */
size = rmh->LgStat;
rmh->Stat[0] = val; /* Val is the status 1st word */
size--; /* hence adjust remaining length */
break;
}
if (size < 1)
return 0;
if (snd_BUG_ON(size >= SIZE_MAX_STATUS))
return -EINVAL;
for (i = 1; i <= size; i++) {
/* trigger an irq MESS_WRITE_NEXT */
err = vx_send_irq_dsp(chip, IRQ_MESS_WRITE_NEXT);
if (err < 0)
return err;
/* Wait for RX full (with timeout protection) */
err = vx_wait_for_rx_full(chip);
if (err < 0)
return err;
rmh->Stat[i] = vx_inb(chip, RXH) << 16;
rmh->Stat[i] |= vx_inb(chip, RXM) << 8;
rmh->Stat[i] |= vx_inb(chip, RXL);
}
return vx_transfer_end(chip, IRQ_MESS_WRITE_END);
}
Annotation
- Immediate include surface: `linux/delay.h`, `linux/slab.h`, `linux/interrupt.h`, `linux/init.h`, `linux/device.h`, `linux/firmware.h`, `linux/module.h`, `linux/io.h`.
- Detected declarations: `function snd_vx_check_reg_bit`, `function vx_send_irq_dsp`, `function vx_reset_chk`, `function vx_transfer_end`, `function vx_read_status`, `function vx_send_msg_nolock`, `function vx_send_msg_nolock`, `function vx_send_rih_nolock`, `function vx_send_rih_nolock`, `function snd_vx_load_boot_image`.
- Atlas domain: Driver Families / sound/drivers.
- Implementation status: integration implementation candidate.
- 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.