sound/soc/intel/avs/debugfs.c
Source file repositories/reference/linux-study-clean/sound/soc/intel/avs/debugfs.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/intel/avs/debugfs.c- Extension
.c- Size
- 10522 bytes
- Lines
- 439
- Domain
- Driver Families
- Bucket
- sound/soc
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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/debugfs.hlinux/kfifo.hlinux/wait.hlinux/sched/signal.hlinux/string_helpers.hsound/soc.havs.hdebug.hmessages.h
Detected Declarations
function __kfifo_fromiofunction avs_logging_fwfunction avs_dump_fw_logfunction avs_dump_fw_log_wakeupfunction fw_regs_readfunction debug_window_readfunction probe_points_readfunction probe_points_writefunction probe_points_disconnect_writefunction strace_readfunction strace_openfunction strace_releasefunction enable_logsfunction disable_logsfunction trace_control_readfunction trace_control_writefunction avs_debugfs_initfunction avs_debugfs_exit
Annotated Snippet
static const struct file_operations fw_regs_fops = {
.open = simple_open,
.read = fw_regs_read,
};
static ssize_t debug_window_read(struct file *file, char __user *to, size_t count, loff_t *ppos)
{
struct avs_dev *adev = file->private_data;
size_t size;
char *buf;
int ret;
size = adev->hw_cfg.dsp_cores * AVS_WINDOW_CHUNK_SIZE;
buf = kzalloc(size, GFP_KERNEL);
if (!buf)
return -ENOMEM;
memcpy_fromio(buf, avs_sram_addr(adev, AVS_DEBUG_WINDOW), size);
ret = simple_read_from_buffer(to, count, ppos, buf, size);
kfree(buf);
return ret;
}
static const struct file_operations debug_window_fops = {
.open = simple_open,
.read = debug_window_read,
};
static ssize_t probe_points_read(struct file *file, char __user *to, size_t count, loff_t *ppos)
{
struct avs_dev *adev = file->private_data;
struct avs_probe_point_desc *desc;
size_t num_desc, len = 0;
char *buf;
int i, ret;
/* Prevent chaining, send and dump IPC value just once. */
if (*ppos)
return 0;
buf = kzalloc(PAGE_SIZE, GFP_KERNEL);
if (!buf)
return -ENOMEM;
ret = avs_ipc_probe_get_points(adev, &desc, &num_desc);
if (ret) {
ret = AVS_IPC_RET(ret);
goto exit;
}
for (i = 0; i < num_desc; i++) {
ret = scnprintf(buf + len, PAGE_SIZE - len,
"Id: %#010x Purpose: %d Node id: %#x\n",
desc[i].id.value, desc[i].purpose, desc[i].node_id.val);
len += ret;
}
ret = simple_read_from_buffer(to, count, ppos, buf, len);
kfree(desc);
exit:
kfree(buf);
return ret;
}
static ssize_t probe_points_write(struct file *file, const char __user *from, size_t count,
loff_t *ppos)
{
struct avs_dev *adev = file->private_data;
struct avs_probe_point_desc *desc;
u32 *array, num_elems;
size_t bytes;
int ret;
ret = parse_int_array_user(from, count, (int **)&array);
if (ret)
return ret;
num_elems = *array;
bytes = sizeof(*array) * num_elems;
if (bytes % sizeof(*desc)) {
ret = -EINVAL;
goto exit;
}
desc = (struct avs_probe_point_desc *)&array[1];
ret = avs_ipc_probe_connect_points(adev, desc, bytes / sizeof(*desc));
if (ret)
ret = AVS_IPC_RET(ret);
else
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/kfifo.h`, `linux/wait.h`, `linux/sched/signal.h`, `linux/string_helpers.h`, `sound/soc.h`, `avs.h`, `debug.h`.
- Detected declarations: `function __kfifo_fromio`, `function avs_logging_fw`, `function avs_dump_fw_log`, `function avs_dump_fw_log_wakeup`, `function fw_regs_read`, `function debug_window_read`, `function probe_points_read`, `function probe_points_write`, `function probe_points_disconnect_write`, `function strace_read`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: pattern 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.