Lines Matching refs:pkt
127 struct cmdq_pkt *pkt; in cmdq_pkt_create() local
131 pkt = kzalloc(sizeof(*pkt), GFP_KERNEL); in cmdq_pkt_create()
132 if (!pkt) in cmdq_pkt_create()
134 pkt->va_base = kzalloc(size, GFP_KERNEL); in cmdq_pkt_create()
135 if (!pkt->va_base) { in cmdq_pkt_create()
136 kfree(pkt); in cmdq_pkt_create()
139 pkt->buf_size = size; in cmdq_pkt_create()
140 pkt->cl = (void *)client; in cmdq_pkt_create()
143 dma_addr = dma_map_single(dev, pkt->va_base, pkt->buf_size, in cmdq_pkt_create()
147 kfree(pkt->va_base); in cmdq_pkt_create()
148 kfree(pkt); in cmdq_pkt_create()
152 pkt->pa_base = dma_addr; in cmdq_pkt_create()
154 return pkt; in cmdq_pkt_create()
158 void cmdq_pkt_destroy(struct cmdq_pkt *pkt) in cmdq_pkt_destroy() argument
160 struct cmdq_client *client = (struct cmdq_client *)pkt->cl; in cmdq_pkt_destroy()
162 dma_unmap_single(client->chan->mbox->dev, pkt->pa_base, pkt->buf_size, in cmdq_pkt_destroy()
164 kfree(pkt->va_base); in cmdq_pkt_destroy()
165 kfree(pkt); in cmdq_pkt_destroy()
169 static int cmdq_pkt_append_command(struct cmdq_pkt *pkt, in cmdq_pkt_append_command() argument
174 if (unlikely(pkt->cmd_buf_size + CMDQ_INST_SIZE > pkt->buf_size)) { in cmdq_pkt_append_command()
183 pkt->cmd_buf_size += CMDQ_INST_SIZE; in cmdq_pkt_append_command()
185 __func__, (u32)pkt->buf_size); in cmdq_pkt_append_command()
189 cmd_ptr = pkt->va_base + pkt->cmd_buf_size; in cmdq_pkt_append_command()
191 pkt->cmd_buf_size += CMDQ_INST_SIZE; in cmdq_pkt_append_command()
196 int cmdq_pkt_write(struct cmdq_pkt *pkt, u8 subsys, u16 offset, u32 value) in cmdq_pkt_write() argument
205 return cmdq_pkt_append_command(pkt, inst); in cmdq_pkt_write()
209 int cmdq_pkt_write_mask(struct cmdq_pkt *pkt, u8 subsys, in cmdq_pkt_write_mask() argument
219 err = cmdq_pkt_append_command(pkt, inst); in cmdq_pkt_write_mask()
225 err = cmdq_pkt_write(pkt, subsys, offset_mask, value); in cmdq_pkt_write_mask()
231 int cmdq_pkt_read_s(struct cmdq_pkt *pkt, u16 high_addr_reg_idx, u16 addr_low, in cmdq_pkt_read_s() argument
242 return cmdq_pkt_append_command(pkt, inst); in cmdq_pkt_read_s()
246 int cmdq_pkt_write_s(struct cmdq_pkt *pkt, u16 high_addr_reg_idx, in cmdq_pkt_write_s() argument
257 return cmdq_pkt_append_command(pkt, inst); in cmdq_pkt_write_s()
261 int cmdq_pkt_write_s_mask(struct cmdq_pkt *pkt, u16 high_addr_reg_idx, in cmdq_pkt_write_s_mask() argument
269 err = cmdq_pkt_append_command(pkt, inst); in cmdq_pkt_write_s_mask()
280 return cmdq_pkt_append_command(pkt, inst); in cmdq_pkt_write_s_mask()
284 int cmdq_pkt_write_s_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx, in cmdq_pkt_write_s_value() argument
294 return cmdq_pkt_append_command(pkt, inst); in cmdq_pkt_write_s_value()
298 int cmdq_pkt_write_s_mask_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx, in cmdq_pkt_write_s_mask_value() argument
306 err = cmdq_pkt_append_command(pkt, inst); in cmdq_pkt_write_s_mask_value()
315 return cmdq_pkt_append_command(pkt, inst); in cmdq_pkt_write_s_mask_value()
319 int cmdq_pkt_wfe(struct cmdq_pkt *pkt, u16 event, bool clear) in cmdq_pkt_wfe() argument
331 return cmdq_pkt_append_command(pkt, inst); in cmdq_pkt_wfe()
335 int cmdq_pkt_clear_event(struct cmdq_pkt *pkt, u16 event) in cmdq_pkt_clear_event() argument
346 return cmdq_pkt_append_command(pkt, inst); in cmdq_pkt_clear_event()
350 int cmdq_pkt_set_event(struct cmdq_pkt *pkt, u16 event) in cmdq_pkt_set_event() argument
361 return cmdq_pkt_append_command(pkt, inst); in cmdq_pkt_set_event()
365 int cmdq_pkt_poll(struct cmdq_pkt *pkt, u8 subsys, in cmdq_pkt_poll() argument
375 err = cmdq_pkt_append_command(pkt, inst); in cmdq_pkt_poll()
381 int cmdq_pkt_poll_mask(struct cmdq_pkt *pkt, u8 subsys, in cmdq_pkt_poll_mask() argument
389 err = cmdq_pkt_append_command(pkt, inst); in cmdq_pkt_poll_mask()
394 err = cmdq_pkt_poll(pkt, subsys, offset, value); in cmdq_pkt_poll_mask()
400 int cmdq_pkt_assign(struct cmdq_pkt *pkt, u16 reg_idx, u32 value) in cmdq_pkt_assign() argument
408 return cmdq_pkt_append_command(pkt, inst); in cmdq_pkt_assign()
412 int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr) in cmdq_pkt_jump() argument
419 cmdq_get_shift_pa(((struct cmdq_client *)pkt->cl)->chan); in cmdq_pkt_jump()
420 return cmdq_pkt_append_command(pkt, inst); in cmdq_pkt_jump()
424 int cmdq_pkt_finalize(struct cmdq_pkt *pkt) in cmdq_pkt_finalize() argument
432 err = cmdq_pkt_append_command(pkt, inst); in cmdq_pkt_finalize()
439 cmdq_get_shift_pa(((struct cmdq_client *)pkt->cl)->chan); in cmdq_pkt_finalize()
440 err = cmdq_pkt_append_command(pkt, inst); in cmdq_pkt_finalize()
448 struct cmdq_pkt *pkt = (struct cmdq_pkt *)data.data; in cmdq_pkt_flush_async_cb() local
449 struct cmdq_task_cb *cb = &pkt->cb; in cmdq_pkt_flush_async_cb()
450 struct cmdq_client *client = (struct cmdq_client *)pkt->cl; in cmdq_pkt_flush_async_cb()
464 dma_sync_single_for_cpu(client->chan->mbox->dev, pkt->pa_base, in cmdq_pkt_flush_async_cb()
465 pkt->cmd_buf_size, DMA_TO_DEVICE); in cmdq_pkt_flush_async_cb()
472 int cmdq_pkt_flush_async(struct cmdq_pkt *pkt, cmdq_async_flush_cb cb, in cmdq_pkt_flush_async() argument
477 struct cmdq_client *client = (struct cmdq_client *)pkt->cl; in cmdq_pkt_flush_async()
479 pkt->cb.cb = cb; in cmdq_pkt_flush_async()
480 pkt->cb.data = data; in cmdq_pkt_flush_async()
481 pkt->async_cb.cb = cmdq_pkt_flush_async_cb; in cmdq_pkt_flush_async()
482 pkt->async_cb.data = pkt; in cmdq_pkt_flush_async()
484 dma_sync_single_for_device(client->chan->mbox->dev, pkt->pa_base, in cmdq_pkt_flush_async()
485 pkt->cmd_buf_size, DMA_TO_DEVICE); in cmdq_pkt_flush_async()
495 err = mbox_send_message(client->chan, pkt); in cmdq_pkt_flush_async()
522 int cmdq_pkt_flush(struct cmdq_pkt *pkt) in cmdq_pkt_flush() argument
528 err = cmdq_pkt_flush_async(pkt, cmdq_pkt_flush_cb, &cmplt); in cmdq_pkt_flush()