include/linux/soc/mediatek/mtk-cmdq.h
Source file repositories/reference/linux-study-clean/include/linux/soc/mediatek/mtk-cmdq.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/soc/mediatek/mtk-cmdq.h- Extension
.h- Size
- 19995 bytes
- Lines
- 634
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/mailbox_client.hlinux/mailbox/mtk-cmdq-mailbox.hlinux/timer.h
Detected Declarations
struct cmdq_pktstruct cmdq_operandstruct cmdq_client_regstruct cmdq_clientenum cmdq_logic_opfunction cmdq_pkt_jumpfunction cmdq_pkt_jump_rel_tempfunction cmdq_dev_get_client_regfunction cmdq_mbox_destroyfunction cmdq_pkt_destroyfunction cmdq_pkt_write_pafunction cmdq_pkt_write_subsysfunction cmdq_pkt_write_maskfunction cmdq_pkt_write_mask_pafunction cmdq_pkt_write_mask_subsysfunction cmdq_pkt_read_sfunction cmdq_pkt_write_sfunction cmdq_pkt_write_s_maskfunction cmdq_pkt_write_s_valuefunction cmdq_pkt_write_s_mask_valuefunction cmdq_pkt_wfefunction cmdq_pkt_clear_eventfunction cmdq_pkt_set_eventfunction cmdq_pkt_pollfunction cmdq_pkt_poll_maskfunction cmdq_pkt_assignfunction cmdq_pkt_poll_addrfunction cmdq_pkt_jump_absfunction cmdq_pkt_jumpfunction cmdq_pkt_jump_relfunction cmdq_pkt_jump_rel_tempfunction cmdq_pkt_eoc
Annotated Snippet
struct cmdq_operand {
/* register type */
bool reg;
union {
/* index */
u16 idx;
/* value */
u16 value;
};
};
struct cmdq_client_reg {
u8 subsys;
phys_addr_t pa_base;
u16 offset;
u16 size;
/*
* Client only uses these functions for MMIO access,
* so doesn't need to handle the mminfra_offset.
* The mminfra_offset is used for DRAM access and
* is handled internally by CMDQ APIs.
*/
int (*pkt_write)(struct cmdq_pkt *pkt, u8 subsys, u32 pa_base,
u16 offset, u32 value);
int (*pkt_write_mask)(struct cmdq_pkt *pkt, u8 subsys, u32 pa_base,
u16 offset, u32 value, u32 mask);
};
struct cmdq_client {
struct mbox_client client;
struct mbox_chan *chan;
};
#if IS_ENABLED(CONFIG_MTK_CMDQ)
/**
* cmdq_dev_get_client_reg() - parse cmdq client reg from the device
* node of CMDQ client
* @dev: device of CMDQ mailbox client
* @client_reg: CMDQ client reg pointer
* @idx: the index of desired reg
*
* Return: 0 for success; else the error code is returned
*
* Help CMDQ client parsing the cmdq client reg
* from the device node of CMDQ client.
*/
int cmdq_dev_get_client_reg(struct device *dev,
struct cmdq_client_reg *client_reg, int idx);
/**
* cmdq_mbox_create() - create CMDQ mailbox client and channel
* @dev: device of CMDQ mailbox client
* @index: index of CMDQ mailbox channel
*
* Return: CMDQ mailbox client pointer
*/
struct cmdq_client *cmdq_mbox_create(struct device *dev, int index);
/**
* cmdq_mbox_destroy() - destroy CMDQ mailbox client and channel
* @client: the CMDQ mailbox client
*/
void cmdq_mbox_destroy(struct cmdq_client *client);
/**
* cmdq_pkt_create() - create a CMDQ packet
* @client: the CMDQ mailbox client
* @pkt: the CMDQ packet
* @size: required CMDQ buffer size
*
* Return: 0 for success; else the error code is returned
*/
int cmdq_pkt_create(struct cmdq_client *client, struct cmdq_pkt *pkt, size_t size);
/**
* cmdq_pkt_destroy() - destroy the CMDQ packet
* @client: the CMDQ mailbox client
* @pkt: the CMDQ packet
*/
void cmdq_pkt_destroy(struct cmdq_client *client, struct cmdq_pkt *pkt);
/**
* cmdq_pkt_write() - append write command to the CMDQ packet
* @pkt: the CMDQ packet
* @subsys: the CMDQ sub system code
* @offset: register offset from CMDQ sub system
* @value: the specified target register value
*
Annotation
- Immediate include surface: `linux/mailbox_client.h`, `linux/mailbox/mtk-cmdq-mailbox.h`, `linux/timer.h`.
- Detected declarations: `struct cmdq_pkt`, `struct cmdq_operand`, `struct cmdq_client_reg`, `struct cmdq_client`, `enum cmdq_logic_op`, `function cmdq_pkt_jump`, `function cmdq_pkt_jump_rel_temp`, `function cmdq_dev_get_client_reg`, `function cmdq_mbox_destroy`, `function cmdq_pkt_destroy`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source 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.