sound/soc/qcom/qdsp6/q6adm.c
Source file repositories/reference/linux-study-clean/sound/soc/qcom/qdsp6/q6adm.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/qcom/qdsp6/q6adm.c- Extension
.c- Size
- 15163 bytes
- Lines
- 610
- Domain
- Driver Families
- Bucket
- sound/soc
- 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.
- 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/device.hlinux/jiffies.hlinux/kernel.hlinux/kref.hlinux/module.hlinux/of.hlinux/of_platform.hlinux/platform_device.hlinux/sched.hlinux/slab.hlinux/soc/qcom/apr.hlinux/wait.hsound/asound.hq6adm.hq6afe.hq6core.hq6dsp-common.hq6dsp-errno.h
Detected Declarations
struct q6coppstruct q6admstruct q6adm_cmd_device_open_v5struct q6adm_cmd_matrix_map_routings_v5struct q6adm_session_map_node_v5struct adm_cmd_rsp_device_open_v5function q6adm_apr_send_copp_pktfunction q6adm_device_closefunction q6adm_free_coppfunction q6adm_callbackfunction list_for_each_entryfunction q6adm_device_openfunction q6adm_openfunction q6adm_get_copp_idfunction q6adm_matrix_mapfunction q6adm_closefunction q6adm_probeexport q6adm_openexport q6adm_get_copp_idexport q6adm_matrix_mapexport q6adm_close
Annotated Snippet
struct q6copp {
int afe_port;
int copp_idx;
int id;
int topology;
int mode;
int rate;
int bit_width;
int channels;
int app_type;
int acdb_id;
struct aprv2_ibasic_rsp_result_t result;
struct kref refcount;
wait_queue_head_t wait;
struct list_head node;
struct q6adm *adm;
};
struct q6adm {
struct apr_device *apr;
struct device *dev;
struct q6core_svc_api_info ainfo;
unsigned long copp_bitmap[AFE_MAX_PORTS];
struct list_head copps_list;
spinlock_t copps_list_lock;
struct aprv2_ibasic_rsp_result_t result;
struct mutex lock;
wait_queue_head_t matrix_map_wait;
};
struct q6adm_cmd_device_open_v5 {
u16 flags;
u16 mode_of_operation;
u16 endpoint_id_1;
u16 endpoint_id_2;
u32 topology_id;
u16 dev_num_channel;
u16 bit_width;
u32 sample_rate;
u8 dev_channel_mapping[8];
} __packed;
struct q6adm_cmd_matrix_map_routings_v5 {
u32 matrix_id;
u32 num_sessions;
} __packed;
struct q6adm_session_map_node_v5 {
u16 session_id;
u16 num_copps;
} __packed;
static struct q6copp *q6adm_find_copp(struct q6adm *adm, int port_idx,
int copp_idx)
{
struct q6copp *c;
struct q6copp *ret = NULL;
unsigned long flags;
spin_lock_irqsave(&adm->copps_list_lock, flags);
list_for_each_entry(c, &adm->copps_list, node) {
if ((port_idx == c->afe_port) && (copp_idx == c->copp_idx)) {
ret = c;
kref_get(&c->refcount);
break;
}
}
spin_unlock_irqrestore(&adm->copps_list_lock, flags);
return ret;
}
static int q6adm_apr_send_copp_pkt(struct q6adm *adm, struct q6copp *copp,
struct apr_pkt *pkt, uint32_t rsp_opcode)
{
struct device *dev = adm->dev;
uint32_t opcode = pkt->hdr.opcode;
int ret;
mutex_lock(&adm->lock);
copp->result.opcode = 0;
copp->result.status = 0;
ret = apr_send_pkt(adm->apr, pkt);
if (ret < 0) {
dev_err(dev, "Failed to send APR packet\n");
ret = -EINVAL;
goto err;
Annotation
- Immediate include surface: `linux/device.h`, `linux/jiffies.h`, `linux/kernel.h`, `linux/kref.h`, `linux/module.h`, `linux/of.h`, `linux/of_platform.h`, `linux/platform_device.h`.
- Detected declarations: `struct q6copp`, `struct q6adm`, `struct q6adm_cmd_device_open_v5`, `struct q6adm_cmd_matrix_map_routings_v5`, `struct q6adm_session_map_node_v5`, `struct adm_cmd_rsp_device_open_v5`, `function q6adm_apr_send_copp_pkt`, `function q6adm_device_close`, `function q6adm_free_copp`, `function q6adm_callback`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: integration 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.