sound/pci/pcxhr/pcxhr_hwdep.c
Source file repositories/reference/linux-study-clean/sound/pci/pcxhr/pcxhr_hwdep.c
File Facts
- System
- Linux kernel
- Corpus path
sound/pci/pcxhr/pcxhr_hwdep.c- Extension
.c- Size
- 10806 bytes
- Lines
- 413
- Domain
- Driver Families
- Bucket
- sound/pci
- 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.
- 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/interrupt.hlinux/vmalloc.hlinux/firmware.hlinux/pci.hlinux/module.hlinux/io.hsound/core.hsound/hwdep.hpcxhr.hpcxhr_mixer.hpcxhr_hwdep.hpcxhr_core.hpcxhr_mix22.h
Detected Declarations
function pcxhr_init_boardfunction pcxhr_sub_initfunction pcxhr_reset_boardfunction pcxhr_dsp_allocate_pipefunction pcxhr_dsp_free_pipefunction pcxhr_config_pipesfunction pcxhr_start_pipesfunction pcxhr_dsp_loadfunction pcxhr_setup_firmware
Annotated Snippet
if (!mgr->is_hr_stereo) {
/* a read to IO_NUM_REG_MUTE_OUT register unmutes! */
pcxhr_init_rmh(&rmh, CMD_ACCESS_IO_WRITE);
rmh.cmd[0] |= IO_NUM_REG_MUTE_OUT;
pcxhr_send_msg(mgr, &rmh);
/* mute inputs */
pcxhr_write_io_num_reg_cont(mgr, REG_CONT_UNMUTE_INPUTS,
0, NULL);
}
/* stereo cards mute with reset of dsp */
}
/* reset pcxhr dsp */
if (mgr->dsp_loaded & (1 << PCXHR_FIRMWARE_DSP_EPRM_INDEX))
pcxhr_reset_dsp(mgr);
/* reset second xilinx */
if (mgr->dsp_loaded & (1 << PCXHR_FIRMWARE_XLX_COM_INDEX)) {
pcxhr_reset_xilinx_com(mgr);
mgr->dsp_loaded = 1;
}
return;
}
/*
* allocate a playback/capture pipe (pcmp0/pcmc0)
*/
static int pcxhr_dsp_allocate_pipe(struct pcxhr_mgr *mgr,
struct pcxhr_pipe *pipe,
int is_capture, int pin)
{
int stream_count, audio_count;
int err;
struct pcxhr_rmh rmh;
if (is_capture) {
stream_count = 1;
if (mgr->mono_capture)
audio_count = 1;
else
audio_count = 2;
} else {
stream_count = PCXHR_PLAYBACK_STREAMS;
audio_count = 2; /* always stereo */
}
dev_dbg(&mgr->pci->dev, "snd_add_ref_pipe pin(%d) pcm%c0\n",
pin, is_capture ? 'c' : 'p');
pipe->is_capture = is_capture;
pipe->first_audio = pin;
/* define pipe (P_PCM_ONLY_MASK (0x020000) is not necessary) */
pcxhr_init_rmh(&rmh, CMD_RES_PIPE);
pcxhr_set_pipe_cmd_params(&rmh, is_capture, pin,
audio_count, stream_count);
rmh.cmd[1] |= 0x020000; /* add P_PCM_ONLY_MASK */
if (DSP_EXT_CMD_SET(mgr)) {
/* add channel mask to command */
rmh.cmd[rmh.cmd_len++] = (audio_count == 1) ? 0x01 : 0x03;
}
err = pcxhr_send_msg(mgr, &rmh);
if (err < 0) {
dev_err(&mgr->pci->dev, "error pipe allocation "
"(CMD_RES_PIPE) err=%x!\n", err);
return err;
}
pipe->status = PCXHR_PIPE_DEFINED;
return 0;
}
/*
* free playback/capture pipe (pcmp0/pcmc0)
*/
#if 0
static int pcxhr_dsp_free_pipe( struct pcxhr_mgr *mgr, struct pcxhr_pipe *pipe)
{
struct pcxhr_rmh rmh;
int capture_mask = 0;
int playback_mask = 0;
int err = 0;
if (pipe->is_capture)
capture_mask = (1 << pipe->first_audio);
else
playback_mask = (1 << pipe->first_audio);
/* stop one pipe */
err = pcxhr_set_pipe_state(mgr, playback_mask, capture_mask, 0);
if (err < 0)
dev_err(&mgr->pci->dev, "error stopping pipe!\n");
/* release the pipe */
pcxhr_init_rmh(&rmh, CMD_FREE_PIPE);
Annotation
- Immediate include surface: `linux/interrupt.h`, `linux/vmalloc.h`, `linux/firmware.h`, `linux/pci.h`, `linux/module.h`, `linux/io.h`, `sound/core.h`, `sound/hwdep.h`.
- Detected declarations: `function pcxhr_init_board`, `function pcxhr_sub_init`, `function pcxhr_reset_board`, `function pcxhr_dsp_allocate_pipe`, `function pcxhr_dsp_free_pipe`, `function pcxhr_config_pipes`, `function pcxhr_start_pipes`, `function pcxhr_dsp_load`, `function pcxhr_setup_firmware`.
- Atlas domain: Driver Families / sound/pci.
- Implementation status: source implementation candidate.
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.