Lines Matching refs:pkt

110 	struct cmdq_pkt *pkt;
114 pkt = kzalloc(sizeof(*pkt), GFP_KERNEL);
115 if (!pkt)
117 pkt->va_base = kzalloc(size, GFP_KERNEL);
118 if (!pkt->va_base) {
119 kfree(pkt);
122 pkt->buf_size = size;
123 pkt->cl = (void *)client;
126 dma_addr = dma_map_single(dev, pkt->va_base, pkt->buf_size,
130 kfree(pkt->va_base);
131 kfree(pkt);
135 pkt->pa_base = dma_addr;
137 return pkt;
141 void cmdq_pkt_destroy(struct cmdq_pkt *pkt)
143 struct cmdq_client *client = (struct cmdq_client *)pkt->cl;
145 dma_unmap_single(client->chan->mbox->dev, pkt->pa_base, pkt->buf_size,
147 kfree(pkt->va_base);
148 kfree(pkt);
152 static int cmdq_pkt_append_command(struct cmdq_pkt *pkt,
157 if (unlikely(pkt->cmd_buf_size + CMDQ_INST_SIZE > pkt->buf_size)) {
159 * In the case of allocated buffer size (pkt->buf_size) is used
160 * up, the real required size (pkt->cmdq_buf_size) is still
166 pkt->cmd_buf_size += CMDQ_INST_SIZE;
168 __func__, (u32)pkt->buf_size);
172 cmd_ptr = pkt->va_base + pkt->cmd_buf_size;
174 pkt->cmd_buf_size += CMDQ_INST_SIZE;
179 int cmdq_pkt_write(struct cmdq_pkt *pkt, u8 subsys, u16 offset, u32 value)
188 return cmdq_pkt_append_command(pkt, inst);
192 int cmdq_pkt_write_mask(struct cmdq_pkt *pkt, u8 subsys,
202 err = cmdq_pkt_append_command(pkt, inst);
208 err = cmdq_pkt_write(pkt, subsys, offset_mask, value);
214 int cmdq_pkt_read_s(struct cmdq_pkt *pkt, u16 high_addr_reg_idx, u16 addr_low,
225 return cmdq_pkt_append_command(pkt, inst);
229 int cmdq_pkt_write_s(struct cmdq_pkt *pkt, u16 high_addr_reg_idx,
240 return cmdq_pkt_append_command(pkt, inst);
244 int cmdq_pkt_write_s_mask(struct cmdq_pkt *pkt, u16 high_addr_reg_idx,
252 err = cmdq_pkt_append_command(pkt, inst);
263 return cmdq_pkt_append_command(pkt, inst);
267 int cmdq_pkt_write_s_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx,
277 return cmdq_pkt_append_command(pkt, inst);
281 int cmdq_pkt_write_s_mask_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx,
289 err = cmdq_pkt_append_command(pkt, inst);
298 return cmdq_pkt_append_command(pkt, inst);
302 int cmdq_pkt_wfe(struct cmdq_pkt *pkt, u16 event, bool clear)
314 return cmdq_pkt_append_command(pkt, inst);
318 int cmdq_pkt_clear_event(struct cmdq_pkt *pkt, u16 event)
329 return cmdq_pkt_append_command(pkt, inst);
333 int cmdq_pkt_set_event(struct cmdq_pkt *pkt, u16 event)
344 return cmdq_pkt_append_command(pkt, inst);
348 int cmdq_pkt_poll(struct cmdq_pkt *pkt, u8 subsys,
358 err = cmdq_pkt_append_command(pkt, inst);
364 int cmdq_pkt_poll_mask(struct cmdq_pkt *pkt, u8 subsys,
372 err = cmdq_pkt_append_command(pkt, inst);
377 err = cmdq_pkt_poll(pkt, subsys, offset, value);
383 int cmdq_pkt_assign(struct cmdq_pkt *pkt, u16 reg_idx, u32 value)
391 return cmdq_pkt_append_command(pkt, inst);
395 int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr)
402 cmdq_get_shift_pa(((struct cmdq_client *)pkt->cl)->chan);
403 return cmdq_pkt_append_command(pkt, inst);
407 int cmdq_pkt_finalize(struct cmdq_pkt *pkt)
415 err = cmdq_pkt_append_command(pkt, inst);
422 cmdq_get_shift_pa(((struct cmdq_client *)pkt->cl)->chan);
423 err = cmdq_pkt_append_command(pkt, inst);
429 int cmdq_pkt_flush_async(struct cmdq_pkt *pkt)
432 struct cmdq_client *client = (struct cmdq_client *)pkt->cl;
434 err = mbox_send_message(client->chan, pkt);