sound/soc/intel/catpt/messages.c
Source file repositories/reference/linux-study-clean/sound/soc/intel/catpt/messages.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/intel/catpt/messages.c- Extension
.c- Size
- 6832 bytes
- Lines
- 249
- Domain
- Driver Families
- Bucket
- sound/soc
- 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/slab.hcore.hmessages.hregisters.h
Detected Declarations
struct catpt_alloc_stream_inputstruct catpt_set_volume_inputstruct catpt_set_write_pos_inputfunction catpt_ipc_get_fw_versionfunction catpt_ipc_alloc_streamfunction catpt_ipc_free_streamfunction catpt_ipc_set_device_formatfunction catpt_ipc_enter_dxstatefunction catpt_ipc_get_mixer_stream_infofunction catpt_ipc_reset_streamfunction catpt_ipc_pause_streamfunction catpt_ipc_resume_streamfunction catpt_ipc_set_volumefunction catpt_ipc_set_write_posfunction catpt_ipc_mute_loopback
Annotated Snippet
struct catpt_alloc_stream_input {
enum catpt_path_id path_id:8;
enum catpt_stream_type stream_type:8;
enum catpt_format_id format_id:8;
u8 reserved;
struct catpt_audio_format input_format;
struct catpt_ring_info ring_info;
u8 num_entries;
/* flex array with entries here */
struct catpt_memory_info persistent_mem;
struct catpt_memory_info scratch_mem;
u32 num_notifications; /* obsolete */
} __packed;
int catpt_ipc_alloc_stream(struct catpt_dev *cdev,
enum catpt_path_id path_id,
enum catpt_stream_type type,
struct catpt_audio_format *afmt,
struct catpt_ring_info *rinfo,
u8 num_modules,
struct catpt_module_entry *modules,
struct resource *persistent,
struct resource *scratch,
struct catpt_stream_info *sinfo)
{
union catpt_global_msg msg = CATPT_GLOBAL_MSG(ALLOCATE_STREAM);
struct catpt_alloc_stream_input input;
struct catpt_ipc_msg request, reply;
size_t size, arrsz;
u8 *payload;
off_t off;
int ret;
off = offsetof(struct catpt_alloc_stream_input, persistent_mem);
arrsz = sizeof(*modules) * num_modules;
size = sizeof(input) + arrsz;
payload = kzalloc(size, GFP_KERNEL);
if (!payload)
return -ENOMEM;
memset(&input, 0, sizeof(input));
input.path_id = path_id;
input.stream_type = type;
input.format_id = CATPT_FORMAT_PCM;
input.input_format = *afmt;
input.ring_info = *rinfo;
input.num_entries = num_modules;
input.persistent_mem.offset = catpt_to_dsp_offset(persistent->start);
input.persistent_mem.size = resource_size(persistent);
if (scratch) {
input.scratch_mem.offset = catpt_to_dsp_offset(scratch->start);
input.scratch_mem.size = resource_size(scratch);
}
/* re-arrange the input: account for flex array 'entries' */
memcpy(payload, &input, sizeof(input));
memmove(payload + off + arrsz, payload + off, sizeof(input) - off);
memcpy(payload + off, modules, arrsz);
request.header = msg.val;
request.size = size;
request.data = payload;
reply.size = sizeof(*sinfo);
reply.data = sinfo;
ret = catpt_dsp_send_msg(cdev, request, &reply, "alloc stream");
kfree(payload);
return ret;
}
int catpt_ipc_free_stream(struct catpt_dev *cdev, u8 stream_hw_id)
{
union catpt_global_msg msg = CATPT_GLOBAL_MSG(FREE_STREAM);
struct catpt_ipc_msg request;
request.header = msg.val;
request.size = sizeof(stream_hw_id);
request.data = &stream_hw_id;
return catpt_dsp_send_msg(cdev, request, NULL, "free stream");
}
int catpt_ipc_set_device_format(struct catpt_dev *cdev,
struct catpt_ssp_device_format *devfmt)
{
union catpt_global_msg msg = CATPT_GLOBAL_MSG(SET_DEVICE_FORMATS);
struct catpt_ipc_msg request;
request.header = msg.val;
Annotation
- Immediate include surface: `linux/slab.h`, `core.h`, `messages.h`, `registers.h`.
- Detected declarations: `struct catpt_alloc_stream_input`, `struct catpt_set_volume_input`, `struct catpt_set_write_pos_input`, `function catpt_ipc_get_fw_version`, `function catpt_ipc_alloc_stream`, `function catpt_ipc_free_stream`, `function catpt_ipc_set_device_format`, `function catpt_ipc_enter_dxstate`, `function catpt_ipc_get_mixer_stream_info`, `function catpt_ipc_reset_stream`.
- Atlas domain: Driver Families / sound/soc.
- 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.