sound/pci/mixart/mixart_core.c
Source file repositories/reference/linux-study-clean/sound/pci/mixart/mixart_core.c
File Facts
- System
- Linux kernel
- Corpus path
sound/pci/mixart/mixart_core.c- Extension
.c- Size
- 17513 bytes
- Lines
- 585
- 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.
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/interrupt.hlinux/mutex.hlinux/pci.hlinux/io.hsound/core.hmixart.hmixart_hwdep.hmixart_core.h
Detected Declarations
function Copyrightfunction get_msgfunction send_msgfunction snd_mixart_send_msgfunction scoped_guardfunction scoped_guardfunction snd_mixart_send_msg_wait_notiffunction scoped_guardfunction snd_mixart_send_msg_nonblockfunction snd_mixart_process_msgfunction snd_mixart_interruptfunction snd_mixart_threaded_irqfunction scoped_guardfunction snd_mixart_init_mailboxfunction snd_mixart_exit_mailboxfunction snd_mixart_reset_board
Annotated Snippet
if( *msg_event ) {
/* the pending event is the notification we wait for ! */
mgr->pending_event = *msg_event;
}
else {
/* the pending event is the answer we wait for (same address than the request)! */
mgr->pending_event = msg_frame_address;
/* copy address back to caller */
*msg_event = msg_frame_address;
}
}
/* mark the frame as a request (will have an answer) */
msg_frame_address |= MSG_TYPE_REQUEST;
/* post the frame */
headptr = readl_be(MIXART_MEM(mgr, MSG_INBOUND_POST_HEAD));
if( (headptr < MSG_INBOUND_POST_STACK) || (headptr >= (MSG_INBOUND_POST_STACK+MSG_BOUND_STACK_SIZE))) {
return -EINVAL;
}
writel_be(msg_frame_address, MIXART_MEM(mgr, headptr));
/* increment the inbound post head */
headptr += 4;
if( headptr >= (MSG_INBOUND_POST_STACK+MSG_BOUND_STACK_SIZE) )
headptr = MSG_INBOUND_POST_STACK;
writel_be(headptr, MIXART_MEM(mgr, MSG_INBOUND_POST_HEAD));
return 0;
}
int snd_mixart_send_msg(struct mixart_mgr *mgr, struct mixart_msg *request, int max_resp_size, void *resp_data)
{
struct mixart_msg resp;
u32 msg_frame = 0; /* set to 0, so it's no notification to wait for, but the answer */
int err;
wait_queue_entry_t wait;
long timeout;
init_waitqueue_entry(&wait, current);
scoped_guard(mutex, &mgr->msg_lock) {
/* send the message */
err = send_msg(mgr, request, max_resp_size, 1, &msg_frame); /* send and mark the answer pending */
if (err)
return err;
set_current_state(TASK_UNINTERRUPTIBLE);
add_wait_queue(&mgr->msg_sleep, &wait);
}
timeout = schedule_timeout(MSG_TIMEOUT_JIFFIES);
remove_wait_queue(&mgr->msg_sleep, &wait);
if (! timeout) {
/* error - no ack */
dev_err(&mgr->pci->dev,
"error: no response on msg %x\n", msg_frame);
return -EIO;
}
/* retrieve the answer into the same struct mixart_msg */
resp.message_id = 0;
resp.uid = (struct mixart_uid){0,0};
resp.data = resp_data;
resp.size = max_resp_size;
scoped_guard(mutex, &mgr->msg_lock) {
err = get_msg(mgr, &resp, msg_frame);
}
if( request->message_id != resp.message_id )
dev_err(&mgr->pci->dev, "RESPONSE ERROR!\n");
return err;
}
int snd_mixart_send_msg_wait_notif(struct mixart_mgr *mgr,
struct mixart_msg *request, u32 notif_event)
{
int err;
wait_queue_entry_t wait;
long timeout;
Annotation
- Immediate include surface: `linux/interrupt.h`, `linux/mutex.h`, `linux/pci.h`, `linux/io.h`, `sound/core.h`, `mixart.h`, `mixart_hwdep.h`, `mixart_core.h`.
- Detected declarations: `function Copyright`, `function get_msg`, `function send_msg`, `function snd_mixart_send_msg`, `function scoped_guard`, `function scoped_guard`, `function snd_mixart_send_msg_wait_notif`, `function scoped_guard`, `function snd_mixart_send_msg_nonblock`, `function snd_mixart_process_msg`.
- Atlas domain: Driver Families / sound/pci.
- 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.