drivers/hid/intel-ish-hid/ishtp/client.h

Source file repositories/reference/linux-study-clean/drivers/hid/intel-ish-hid/ishtp/client.h

File Facts

System
Linux kernel
Corpus path
drivers/hid/intel-ish-hid/ishtp/client.h
Extension
.h
Size
4302 bytes
Lines
153
Domain
Driver Families
Bucket
drivers/hid
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct ishtp_cl_tx_ring {
	struct list_head	list;
	struct ishtp_msg_data	send_buf;
};

/* ISHTP client instance */
struct ishtp_cl {
	struct list_head	link;
	struct ishtp_device	*dev;
	enum cl_state		state;
	int			status;

	/* Link to ISHTP bus device */
	struct ishtp_cl_device	*device;

	/* ID of client connected */
	uint8_t	host_client_id;
	uint8_t	fw_client_id;
	uint8_t	ishtp_flow_ctrl_creds;
	uint8_t	out_flow_ctrl_creds;

	/* dma */
	int	last_tx_path;
	/* 0: ack wasn't received,1:ack was received */
	int	last_dma_acked;
	unsigned char	*last_dma_addr;
	/* 0: ack wasn't received,1:ack was received */
	int	last_ipc_acked;

	/* Rx ring buffer pool */
	unsigned int	rx_ring_size;
	struct ishtp_cl_rb	free_rb_list;
	spinlock_t	free_list_spinlock;
	/* Rx in-process list */
	struct ishtp_cl_rb	in_process_list;
	spinlock_t	in_process_spinlock;

	/* Client Tx buffers list */
	unsigned int	tx_ring_size;
	struct ishtp_cl_tx_ring	tx_list, tx_free_list;
	int		tx_ring_free_size;
	spinlock_t	tx_list_spinlock;
	spinlock_t	tx_free_list_spinlock;
	size_t	tx_offs;	/* Offset in buffer at head of 'tx_list' */

	/**
	 * if we get a FC, and the list is not empty, we must know whether we
	 * are at the middle of sending.
	 * if so -need to increase FC counter, otherwise, need to start sending
	 * the first msg in list
	 * (!)This is for counting-FC implementation only. Within single-FC the
	 * other party may NOT send FC until it receives complete message
	 */
	int	sending;

	/* Send FC spinlock */
	spinlock_t	fc_spinlock;

	/* wait queue for connect and disconnect response from FW */
	wait_queue_head_t	wait_ctrl_res;

	/* Error stats */
	unsigned int	err_send_msg;
	unsigned int	err_send_fc;

	/* Send/recv stats */
	unsigned int	send_msg_cnt_ipc;
	unsigned int	send_msg_cnt_dma;
	unsigned int	recv_msg_cnt_ipc;
	unsigned int	recv_msg_cnt_dma;
	unsigned int	recv_msg_num_frags;
	unsigned int	ishtp_flow_ctrl_cnt;
	unsigned int	out_flow_ctrl_cnt;

	/* Rx msg ... out FC timing */
	ktime_t ts_rx;
	ktime_t ts_out_fc;
	ktime_t ts_max_fc_delay;
	void *client_data;
};

/* Client connection managenment internal functions */
int ishtp_fw_cl_by_id(struct ishtp_device *dev, uint8_t client_id);
void ishtp_cl_send_msg(struct ishtp_device *dev, struct ishtp_cl *cl);
void recv_ishtp_cl_msg(struct ishtp_device *dev,
		       struct ishtp_msg_hdr *ishtp_hdr);
int ishtp_cl_read_start(struct ishtp_cl *cl);

/* Ring Buffer I/F */
int ishtp_cl_alloc_rx_ring(struct ishtp_cl *cl);

Annotation

Implementation Notes