Lines Matching refs:vpdma
280 static u32 read_reg(struct vpdma_data *vpdma, int offset) in read_reg() argument
282 return ioread32(vpdma->base + offset); in read_reg()
285 static void write_reg(struct vpdma_data *vpdma, int offset, u32 value) in write_reg() argument
287 iowrite32(value, vpdma->base + offset); in write_reg()
290 static int read_field_reg(struct vpdma_data *vpdma, int offset, in read_field_reg() argument
293 return (read_reg(vpdma, offset) & (mask << shift)) >> shift; in read_field_reg()
296 static void write_field_reg(struct vpdma_data *vpdma, int offset, u32 field, in write_field_reg() argument
299 u32 val = read_reg(vpdma, offset); in write_field_reg()
304 write_reg(vpdma, offset, val); in write_field_reg()
307 void vpdma_dump_regs(struct vpdma_data *vpdma) in vpdma_dump_regs() argument
309 struct device *dev = &vpdma->pdev->dev; in vpdma_dump_regs()
311 #define DUMPREG(r) dev_dbg(dev, "%-35s %08x\n", #r, read_reg(vpdma, VPDMA_##r)) in vpdma_dump_regs()
389 int vpdma_map_desc_buf(struct vpdma_data *vpdma, struct vpdma_buf *buf) in vpdma_map_desc_buf() argument
391 struct device *dev = &vpdma->pdev->dev; in vpdma_map_desc_buf()
411 void vpdma_unmap_desc_buf(struct vpdma_data *vpdma, struct vpdma_buf *buf) in vpdma_unmap_desc_buf() argument
413 struct device *dev = &vpdma->pdev->dev; in vpdma_unmap_desc_buf()
430 int vpdma_list_cleanup(struct vpdma_data *vpdma, int list_num, in vpdma_list_cleanup() argument
436 write_reg(vpdma, VPDMA_LIST_ATTR, in vpdma_list_cleanup()
451 ret = vpdma_map_desc_buf(vpdma, &abort_list.buf); in vpdma_list_cleanup()
454 ret = vpdma_submit_descs(vpdma, &abort_list, list_num); in vpdma_list_cleanup()
458 while (vpdma_list_busy(vpdma, list_num) && --timeout) in vpdma_list_cleanup()
462 dev_err(&vpdma->pdev->dev, "Timed out cleaning up VPDMA list\n"); in vpdma_list_cleanup()
467 vpdma_unmap_desc_buf(vpdma, &abort_list.buf); in vpdma_list_cleanup()
519 bool vpdma_list_busy(struct vpdma_data *vpdma, int list_num) in vpdma_list_busy() argument
521 return read_reg(vpdma, VPDMA_LIST_STAT_SYNC) & BIT(list_num + 16); in vpdma_list_busy()
528 int vpdma_submit_descs(struct vpdma_data *vpdma, in vpdma_submit_descs() argument
534 if (vpdma_list_busy(vpdma, list_num)) in vpdma_submit_descs()
540 spin_lock_irqsave(&vpdma->lock, flags); in vpdma_submit_descs()
541 write_reg(vpdma, VPDMA_LIST_ADDR, (u32) list->buf.dma_addr); in vpdma_submit_descs()
543 write_reg(vpdma, VPDMA_LIST_ATTR, in vpdma_submit_descs()
547 spin_unlock_irqrestore(&vpdma->lock, flags); in vpdma_submit_descs()
555 void vpdma_update_dma_addr(struct vpdma_data *vpdma, in vpdma_update_dma_addr() argument
564 vpdma_unmap_desc_buf(vpdma, &list->buf); in vpdma_update_dma_addr()
581 vpdma_map_desc_buf(vpdma, &list->buf); in vpdma_update_dma_addr()
587 void vpdma_set_max_size(struct vpdma_data *vpdma, int reg_addr, in vpdma_set_max_size() argument
594 write_field_reg(vpdma, reg_addr, width - 1, in vpdma_set_max_size()
597 write_field_reg(vpdma, reg_addr, height - 1, in vpdma_set_max_size()
939 int vpdma_hwlist_alloc(struct vpdma_data *vpdma, void *priv) in vpdma_hwlist_alloc() argument
944 spin_lock_irqsave(&vpdma->lock, flags); in vpdma_hwlist_alloc()
945 for (i = 0; i < VPDMA_MAX_NUM_LIST && vpdma->hwlist_used[i]; i++) in vpdma_hwlist_alloc()
950 vpdma->hwlist_used[i] = true; in vpdma_hwlist_alloc()
951 vpdma->hwlist_priv[i] = priv; in vpdma_hwlist_alloc()
953 spin_unlock_irqrestore(&vpdma->lock, flags); in vpdma_hwlist_alloc()
959 void *vpdma_hwlist_get_priv(struct vpdma_data *vpdma, int list_num) in vpdma_hwlist_get_priv() argument
961 if (!vpdma || list_num >= VPDMA_MAX_NUM_LIST) in vpdma_hwlist_get_priv()
964 return vpdma->hwlist_priv[list_num]; in vpdma_hwlist_get_priv()
968 void *vpdma_hwlist_release(struct vpdma_data *vpdma, int list_num) in vpdma_hwlist_release() argument
973 spin_lock_irqsave(&vpdma->lock, flags); in vpdma_hwlist_release()
974 vpdma->hwlist_used[list_num] = false; in vpdma_hwlist_release()
975 priv = vpdma->hwlist_priv; in vpdma_hwlist_release()
976 spin_unlock_irqrestore(&vpdma->lock, flags); in vpdma_hwlist_release()
983 void vpdma_enable_list_complete_irq(struct vpdma_data *vpdma, int irq_num, in vpdma_enable_list_complete_irq() argument
989 val = read_reg(vpdma, reg_addr); in vpdma_enable_list_complete_irq()
994 write_reg(vpdma, reg_addr, val); in vpdma_enable_list_complete_irq()
999 unsigned int vpdma_get_list_stat(struct vpdma_data *vpdma, int irq_num) in vpdma_get_list_stat() argument
1003 return read_reg(vpdma, reg_addr); in vpdma_get_list_stat()
1008 unsigned int vpdma_get_list_mask(struct vpdma_data *vpdma, int irq_num) in vpdma_get_list_mask() argument
1012 return read_reg(vpdma, reg_addr); in vpdma_get_list_mask()
1017 void vpdma_clear_list_stat(struct vpdma_data *vpdma, int irq_num, in vpdma_clear_list_stat() argument
1022 write_reg(vpdma, reg_addr, 3 << (list_num * 2)); in vpdma_clear_list_stat()
1026 void vpdma_set_bg_color(struct vpdma_data *vpdma, in vpdma_set_bg_color() argument
1030 write_reg(vpdma, VPDMA_BG_RGB, color); in vpdma_set_bg_color()
1032 write_reg(vpdma, VPDMA_BG_YUV, color); in vpdma_set_bg_color()
1041 void vpdma_set_line_mode(struct vpdma_data *vpdma, int line_mode, in vpdma_set_line_mode() argument
1046 write_field_reg(vpdma, client_cstat, line_mode, in vpdma_set_line_mode()
1055 void vpdma_set_frame_start_event(struct vpdma_data *vpdma, in vpdma_set_frame_start_event() argument
1061 write_field_reg(vpdma, client_cstat, fs_event, in vpdma_set_frame_start_event()
1068 struct vpdma_data *vpdma = context; in vpdma_firmware_cb() local
1072 dev_dbg(&vpdma->pdev->dev, "firmware callback\n"); in vpdma_firmware_cb()
1075 dev_err(&vpdma->pdev->dev, "couldn't get firmware\n"); in vpdma_firmware_cb()
1080 if (read_field_reg(vpdma, VPDMA_LIST_ATTR, VPDMA_LIST_RDY_MASK, in vpdma_firmware_cb()
1082 vpdma->cb(vpdma->pdev); in vpdma_firmware_cb()
1088 dev_err(&vpdma->pdev->dev, in vpdma_firmware_cb()
1095 vpdma_map_desc_buf(vpdma, &fw_dma_buf); in vpdma_firmware_cb()
1097 write_reg(vpdma, VPDMA_LIST_ADDR, (u32) fw_dma_buf.dma_addr); in vpdma_firmware_cb()
1102 if (read_field_reg(vpdma, VPDMA_LIST_ATTR, VPDMA_LIST_RDY_MASK, in vpdma_firmware_cb()
1108 dev_err(&vpdma->pdev->dev, "firmware upload failed\n"); in vpdma_firmware_cb()
1112 vpdma->cb(vpdma->pdev); in vpdma_firmware_cb()
1115 vpdma_unmap_desc_buf(vpdma, &fw_dma_buf); in vpdma_firmware_cb()
1122 static int vpdma_load_firmware(struct vpdma_data *vpdma) in vpdma_load_firmware() argument
1125 struct device *dev = &vpdma->pdev->dev; in vpdma_load_firmware()
1128 (const char *) VPDMA_FIRMWARE, dev, GFP_KERNEL, vpdma, in vpdma_load_firmware()
1140 int vpdma_create(struct platform_device *pdev, struct vpdma_data *vpdma, in vpdma_create() argument
1148 vpdma->pdev = pdev; in vpdma_create()
1149 vpdma->cb = cb; in vpdma_create()
1150 spin_lock_init(&vpdma->lock); in vpdma_create()
1158 vpdma->base = devm_ioremap(&pdev->dev, res->start, resource_size(res)); in vpdma_create()
1159 if (!vpdma->base) { in vpdma_create()
1164 r = vpdma_load_firmware(vpdma); in vpdma_create()