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.

Dependency Surface

Detected Declarations

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

Implementation Notes