Lines Matching refs:pkt

109 	struct cmdq_pkt *pkt;  in cmdq_pkt_create()  local
113 pkt = kzalloc(sizeof(*pkt), GFP_KERNEL); in cmdq_pkt_create()
114 if (!pkt) in cmdq_pkt_create()
116 pkt->va_base = kzalloc(size, GFP_KERNEL); in cmdq_pkt_create()
117 if (!pkt->va_base) { in cmdq_pkt_create()
118 kfree(pkt); in cmdq_pkt_create()
121 pkt->buf_size = size; in cmdq_pkt_create()
122 pkt->cl = (void *)client; in cmdq_pkt_create()
125 dma_addr = dma_map_single(dev, pkt->va_base, pkt->buf_size, in cmdq_pkt_create()
129 kfree(pkt->va_base); in cmdq_pkt_create()
130 kfree(pkt); in cmdq_pkt_create()
134 pkt->pa_base = dma_addr; in cmdq_pkt_create()
136 return pkt; in cmdq_pkt_create()
140 void cmdq_pkt_destroy(struct cmdq_pkt *pkt) in cmdq_pkt_destroy() argument
142 struct cmdq_client *client = (struct cmdq_client *)pkt->cl; in cmdq_pkt_destroy()
144 dma_unmap_single(client->chan->mbox->dev, pkt->pa_base, pkt->buf_size, in cmdq_pkt_destroy()
146 kfree(pkt->va_base); in cmdq_pkt_destroy()
147 kfree(pkt); in cmdq_pkt_destroy()
151 static int cmdq_pkt_append_command(struct cmdq_pkt *pkt, in cmdq_pkt_append_command() argument
156 if (unlikely(pkt->cmd_buf_size + CMDQ_INST_SIZE > pkt->buf_size)) { in cmdq_pkt_append_command()
165 pkt->cmd_buf_size += CMDQ_INST_SIZE; in cmdq_pkt_append_command()
167 __func__, (u32)pkt->buf_size); in cmdq_pkt_append_command()
171 cmd_ptr = pkt->va_base + pkt->cmd_buf_size; in cmdq_pkt_append_command()
173 pkt->cmd_buf_size += CMDQ_INST_SIZE; in cmdq_pkt_append_command()
178 int cmdq_pkt_write(struct cmdq_pkt *pkt, u8 subsys, u16 offset, u32 value) in cmdq_pkt_write() argument
187 return cmdq_pkt_append_command(pkt, inst); in cmdq_pkt_write()
191 int cmdq_pkt_write_mask(struct cmdq_pkt *pkt, u8 subsys, in cmdq_pkt_write_mask() argument
201 err = cmdq_pkt_append_command(pkt, inst); in cmdq_pkt_write_mask()
207 err = cmdq_pkt_write(pkt, subsys, offset_mask, value); in cmdq_pkt_write_mask()
213 int cmdq_pkt_read_s(struct cmdq_pkt *pkt, u16 high_addr_reg_idx, u16 addr_low, in cmdq_pkt_read_s() argument
224 return cmdq_pkt_append_command(pkt, inst); in cmdq_pkt_read_s()
228 int cmdq_pkt_write_s(struct cmdq_pkt *pkt, u16 high_addr_reg_idx, in cmdq_pkt_write_s() argument
239 return cmdq_pkt_append_command(pkt, inst); in cmdq_pkt_write_s()
243 int cmdq_pkt_write_s_mask(struct cmdq_pkt *pkt, u16 high_addr_reg_idx, in cmdq_pkt_write_s_mask() argument
251 err = cmdq_pkt_append_command(pkt, inst); in cmdq_pkt_write_s_mask()
262 return cmdq_pkt_append_command(pkt, inst); in cmdq_pkt_write_s_mask()
266 int cmdq_pkt_write_s_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx, in cmdq_pkt_write_s_value() argument
276 return cmdq_pkt_append_command(pkt, inst); in cmdq_pkt_write_s_value()
280 int cmdq_pkt_write_s_mask_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx, in cmdq_pkt_write_s_mask_value() argument
288 err = cmdq_pkt_append_command(pkt, inst); in cmdq_pkt_write_s_mask_value()
297 return cmdq_pkt_append_command(pkt, inst); in cmdq_pkt_write_s_mask_value()
301 int cmdq_pkt_wfe(struct cmdq_pkt *pkt, u16 event, bool clear) in cmdq_pkt_wfe() argument
313 return cmdq_pkt_append_command(pkt, inst); in cmdq_pkt_wfe()
317 int cmdq_pkt_clear_event(struct cmdq_pkt *pkt, u16 event) in cmdq_pkt_clear_event() argument
328 return cmdq_pkt_append_command(pkt, inst); in cmdq_pkt_clear_event()
332 int cmdq_pkt_set_event(struct cmdq_pkt *pkt, u16 event) in cmdq_pkt_set_event() argument
343 return cmdq_pkt_append_command(pkt, inst); in cmdq_pkt_set_event()
347 int cmdq_pkt_poll(struct cmdq_pkt *pkt, u8 subsys, in cmdq_pkt_poll() argument
357 err = cmdq_pkt_append_command(pkt, inst); in cmdq_pkt_poll()
363 int cmdq_pkt_poll_mask(struct cmdq_pkt *pkt, u8 subsys, in cmdq_pkt_poll_mask() argument
371 err = cmdq_pkt_append_command(pkt, inst); in cmdq_pkt_poll_mask()
376 err = cmdq_pkt_poll(pkt, subsys, offset, value); in cmdq_pkt_poll_mask()
382 int cmdq_pkt_assign(struct cmdq_pkt *pkt, u16 reg_idx, u32 value) in cmdq_pkt_assign() argument
390 return cmdq_pkt_append_command(pkt, inst); in cmdq_pkt_assign()
394 int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr) in cmdq_pkt_jump() argument
401 cmdq_get_shift_pa(((struct cmdq_client *)pkt->cl)->chan); in cmdq_pkt_jump()
402 return cmdq_pkt_append_command(pkt, inst); in cmdq_pkt_jump()
406 int cmdq_pkt_finalize(struct cmdq_pkt *pkt) in cmdq_pkt_finalize() argument
414 err = cmdq_pkt_append_command(pkt, inst); in cmdq_pkt_finalize()
421 cmdq_get_shift_pa(((struct cmdq_client *)pkt->cl)->chan); in cmdq_pkt_finalize()
422 err = cmdq_pkt_append_command(pkt, inst); in cmdq_pkt_finalize()
430 struct cmdq_pkt *pkt = (struct cmdq_pkt *)data.data; in cmdq_pkt_flush_async_cb() local
431 struct cmdq_task_cb *cb = &pkt->cb; in cmdq_pkt_flush_async_cb()
432 struct cmdq_client *client = (struct cmdq_client *)pkt->cl; in cmdq_pkt_flush_async_cb()
434 dma_sync_single_for_cpu(client->chan->mbox->dev, pkt->pa_base, in cmdq_pkt_flush_async_cb()
435 pkt->cmd_buf_size, DMA_TO_DEVICE); in cmdq_pkt_flush_async_cb()
442 int cmdq_pkt_flush_async(struct cmdq_pkt *pkt, cmdq_async_flush_cb cb, in cmdq_pkt_flush_async() argument
446 struct cmdq_client *client = (struct cmdq_client *)pkt->cl; in cmdq_pkt_flush_async()
448 pkt->cb.cb = cb; in cmdq_pkt_flush_async()
449 pkt->cb.data = data; in cmdq_pkt_flush_async()
450 pkt->async_cb.cb = cmdq_pkt_flush_async_cb; in cmdq_pkt_flush_async()
451 pkt->async_cb.data = pkt; in cmdq_pkt_flush_async()
453 dma_sync_single_for_device(client->chan->mbox->dev, pkt->pa_base, in cmdq_pkt_flush_async()
454 pkt->cmd_buf_size, DMA_TO_DEVICE); in cmdq_pkt_flush_async()
456 err = mbox_send_message(client->chan, pkt); in cmdq_pkt_flush_async()