Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] media: vb2: dma contig allocator: use dma_addr instread of paddr

Use the correct 'dma_addr' name for the buffer address. 'paddr' suggested
that this is the physical address in system memory. For most ARM platforms
these two are the same, but this is not a generic rule. 'dma_addr' will
also point better to dma-mapping api.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Pawel Osciak <pawel@osciak.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

authored by

Marek Szyprowski and committed by
Mauro Carvalho Chehab
ba7fcb0c 035aa147

+51 -51
+1 -1
drivers/media/video/atmel-isi.c
··· 341 341 342 342 /* Initialize the dma descriptor */ 343 343 desc->p_fbd->fb_address = 344 - vb2_dma_contig_plane_paddr(vb, 0); 344 + vb2_dma_contig_plane_dma_addr(vb, 0); 345 345 desc->p_fbd->next_fbd_address = 0; 346 346 set_dma_ctrl(desc->p_fbd, ISI_DMA_CTRL_WB); 347 347
+2 -2
drivers/media/video/marvell-ccic/mcam-core.c
··· 450 450 buf = cam->vb_bufs[frame ^ 0x1]; 451 451 cam->vb_bufs[frame] = buf; 452 452 mcam_reg_write(cam, frame == 0 ? REG_Y0BAR : REG_Y1BAR, 453 - vb2_dma_contig_plane_paddr(&buf->vb_buf, 0)); 453 + vb2_dma_contig_plane_dma_addr(&buf->vb_buf, 0)); 454 454 set_bit(CF_SINGLE_BUFFER, &cam->flags); 455 455 singles++; 456 456 return; ··· 461 461 buf = list_first_entry(&cam->buffers, struct mcam_vb_buffer, queue); 462 462 list_del_init(&buf->queue); 463 463 mcam_reg_write(cam, frame == 0 ? REG_Y0BAR : REG_Y1BAR, 464 - vb2_dma_contig_plane_paddr(&buf->vb_buf, 0)); 464 + vb2_dma_contig_plane_dma_addr(&buf->vb_buf, 0)); 465 465 cam->vb_bufs[frame] = buf; 466 466 clear_bit(CF_SINGLE_BUFFER, &cam->flags); 467 467 }
+1 -1
drivers/media/video/mx3_camera.c
··· 247 247 } 248 248 249 249 if (buf->state == CSI_BUF_NEEDS_INIT) { 250 - sg_dma_address(sg) = vb2_dma_contig_plane_paddr(vb, 0); 250 + sg_dma_address(sg) = vb2_dma_contig_plane_dma_addr(vb, 0); 251 251 sg_dma_len(sg) = new_size; 252 252 253 253 buf->txd = ichan->dma_chan.device->device_prep_slave_sg(
+3 -3
drivers/media/video/s5p-fimc/fimc-core.c
··· 457 457 dbg("memplanes= %d, colplanes= %d, pix_size= %d", 458 458 frame->fmt->memplanes, frame->fmt->colplanes, pix_size); 459 459 460 - paddr->y = vb2_dma_contig_plane_paddr(vb, 0); 460 + paddr->y = vb2_dma_contig_plane_dma_addr(vb, 0); 461 461 462 462 if (frame->fmt->memplanes == 1) { 463 463 switch (frame->fmt->colplanes) { ··· 485 485 } 486 486 } else { 487 487 if (frame->fmt->memplanes >= 2) 488 - paddr->cb = vb2_dma_contig_plane_paddr(vb, 1); 488 + paddr->cb = vb2_dma_contig_plane_dma_addr(vb, 1); 489 489 490 490 if (frame->fmt->memplanes == 3) 491 - paddr->cr = vb2_dma_contig_plane_paddr(vb, 2); 491 + paddr->cr = vb2_dma_contig_plane_dma_addr(vb, 2); 492 492 } 493 493 494 494 dbg("PHYS_ADDR: y= 0x%X cb= 0x%X cr= 0x%X ret= %d",
+2 -2
drivers/media/video/s5p-mfc/s5p_mfc.c
··· 202 202 appropraite flags */ 203 203 src_buf = list_entry(ctx->src_queue.next, struct s5p_mfc_buf, list); 204 204 list_for_each_entry(dst_buf, &ctx->dst_queue, list) { 205 - if (vb2_dma_contig_plane_paddr(dst_buf->b, 0) == dec_y_addr) { 205 + if (vb2_dma_contig_plane_dma_addr(dst_buf->b, 0) == dec_y_addr) { 206 206 memcpy(&dst_buf->b->v4l2_buf.timecode, 207 207 &src_buf->b->v4l2_buf.timecode, 208 208 sizeof(struct v4l2_timecode)); ··· 248 248 * check which videobuf does it correspond to */ 249 249 list_for_each_entry(dst_buf, &ctx->dst_queue, list) { 250 250 /* Check if this is the buffer we're looking for */ 251 - if (vb2_dma_contig_plane_paddr(dst_buf->b, 0) == dspl_y_addr) { 251 + if (vb2_dma_contig_plane_dma_addr(dst_buf->b, 0) == dspl_y_addr) { 252 252 list_del(&dst_buf->list); 253 253 ctx->dst_queue_cnt--; 254 254 dst_buf->b->v4l2_buf.sequence = ctx->sequence;
+5 -5
drivers/media/video/s5p-mfc/s5p_mfc_dec.c
··· 824 824 return 0; 825 825 for (i = 0; i <= ctx->src_fmt->num_planes ; i++) { 826 826 if (IS_ERR_OR_NULL(ERR_PTR( 827 - vb2_dma_contig_plane_paddr(vb, i)))) { 827 + vb2_dma_contig_plane_dma_addr(vb, i)))) { 828 828 mfc_err("Plane mem not allocated\n"); 829 829 return -EINVAL; 830 830 } ··· 837 837 i = vb->v4l2_buf.index; 838 838 ctx->dst_bufs[i].b = vb; 839 839 ctx->dst_bufs[i].cookie.raw.luma = 840 - vb2_dma_contig_plane_paddr(vb, 0); 840 + vb2_dma_contig_plane_dma_addr(vb, 0); 841 841 ctx->dst_bufs[i].cookie.raw.chroma = 842 - vb2_dma_contig_plane_paddr(vb, 1); 842 + vb2_dma_contig_plane_dma_addr(vb, 1); 843 843 ctx->dst_bufs_cnt++; 844 844 } else if (vq->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { 845 845 if (IS_ERR_OR_NULL(ERR_PTR( 846 - vb2_dma_contig_plane_paddr(vb, 0)))) { 846 + vb2_dma_contig_plane_dma_addr(vb, 0)))) { 847 847 mfc_err("Plane memory not allocated\n"); 848 848 return -EINVAL; 849 849 } ··· 855 855 i = vb->v4l2_buf.index; 856 856 ctx->src_bufs[i].b = vb; 857 857 ctx->src_bufs[i].cookie.stream = 858 - vb2_dma_contig_plane_paddr(vb, 0); 858 + vb2_dma_contig_plane_dma_addr(vb, 0); 859 859 ctx->src_bufs_cnt++; 860 860 } else { 861 861 mfc_err("s5p_mfc_buf_init: unknown queue type\n");
+15 -15
drivers/media/video/s5p-mfc/s5p_mfc_enc.c
··· 599 599 while (!list_empty(&ctx->ref_queue)) { 600 600 mb_entry = list_entry((&ctx->ref_queue)->next, 601 601 struct s5p_mfc_buf, list); 602 - mb_y_addr = vb2_dma_contig_plane_paddr(mb_entry->b, 0); 603 - mb_c_addr = vb2_dma_contig_plane_paddr(mb_entry->b, 1); 602 + mb_y_addr = vb2_dma_contig_plane_dma_addr(mb_entry->b, 0); 603 + mb_c_addr = vb2_dma_contig_plane_dma_addr(mb_entry->b, 1); 604 604 list_del(&mb_entry->list); 605 605 ctx->ref_queue_cnt--; 606 606 list_add_tail(&mb_entry->list, &ctx->src_queue); ··· 622 622 623 623 spin_lock_irqsave(&dev->irqlock, flags); 624 624 dst_mb = list_entry(ctx->dst_queue.next, struct s5p_mfc_buf, list); 625 - dst_addr = vb2_dma_contig_plane_paddr(dst_mb->b, 0); 625 + dst_addr = vb2_dma_contig_plane_dma_addr(dst_mb->b, 0); 626 626 dst_size = vb2_plane_size(dst_mb->b, 0); 627 627 s5p_mfc_set_enc_stream_buffer(ctx, dst_addr, dst_size); 628 628 spin_unlock_irqrestore(&dev->irqlock, flags); ··· 668 668 669 669 spin_lock_irqsave(&dev->irqlock, flags); 670 670 src_mb = list_entry(ctx->src_queue.next, struct s5p_mfc_buf, list); 671 - src_y_addr = vb2_dma_contig_plane_paddr(src_mb->b, 0); 672 - src_c_addr = vb2_dma_contig_plane_paddr(src_mb->b, 1); 671 + src_y_addr = vb2_dma_contig_plane_dma_addr(src_mb->b, 0); 672 + src_c_addr = vb2_dma_contig_plane_dma_addr(src_mb->b, 1); 673 673 s5p_mfc_set_enc_frame_buffer(ctx, src_y_addr, src_c_addr); 674 674 spin_unlock_irqrestore(&dev->irqlock, flags); 675 675 676 676 spin_lock_irqsave(&dev->irqlock, flags); 677 677 dst_mb = list_entry(ctx->dst_queue.next, struct s5p_mfc_buf, list); 678 - dst_addr = vb2_dma_contig_plane_paddr(dst_mb->b, 0); 678 + dst_addr = vb2_dma_contig_plane_dma_addr(dst_mb->b, 0); 679 679 dst_size = vb2_plane_size(dst_mb->b, 0); 680 680 s5p_mfc_set_enc_stream_buffer(ctx, dst_addr, dst_size); 681 681 spin_unlock_irqrestore(&dev->irqlock, flags); ··· 703 703 if (slice_type >= 0) { 704 704 s5p_mfc_get_enc_frame_buffer(ctx, &enc_y_addr, &enc_c_addr); 705 705 list_for_each_entry(mb_entry, &ctx->src_queue, list) { 706 - mb_y_addr = vb2_dma_contig_plane_paddr(mb_entry->b, 0); 707 - mb_c_addr = vb2_dma_contig_plane_paddr(mb_entry->b, 1); 706 + mb_y_addr = vb2_dma_contig_plane_dma_addr(mb_entry->b, 0); 707 + mb_c_addr = vb2_dma_contig_plane_dma_addr(mb_entry->b, 1); 708 708 if ((enc_y_addr == mb_y_addr) && 709 709 (enc_c_addr == mb_c_addr)) { 710 710 list_del(&mb_entry->list); ··· 715 715 } 716 716 } 717 717 list_for_each_entry(mb_entry, &ctx->ref_queue, list) { 718 - mb_y_addr = vb2_dma_contig_plane_paddr(mb_entry->b, 0); 719 - mb_c_addr = vb2_dma_contig_plane_paddr(mb_entry->b, 1); 718 + mb_y_addr = vb2_dma_contig_plane_dma_addr(mb_entry->b, 0); 719 + mb_c_addr = vb2_dma_contig_plane_dma_addr(mb_entry->b, 1); 720 720 if ((enc_y_addr == mb_y_addr) && 721 721 (enc_c_addr == mb_c_addr)) { 722 722 list_del(&mb_entry->list); ··· 1501 1501 return -EINVAL; 1502 1502 } 1503 1503 for (i = 0; i < fmt->num_planes; i++) { 1504 - if (!vb2_dma_contig_plane_paddr(vb, i)) { 1504 + if (!vb2_dma_contig_plane_dma_addr(vb, i)) { 1505 1505 mfc_err("failed to get plane cookie\n"); 1506 1506 return -EINVAL; 1507 1507 } 1508 1508 mfc_debug(2, "index: %d, plane[%d] cookie: 0x%08zx", 1509 1509 vb->v4l2_buf.index, i, 1510 - vb2_dma_contig_plane_paddr(vb, i)); 1510 + vb2_dma_contig_plane_dma_addr(vb, i)); 1511 1511 } 1512 1512 return 0; 1513 1513 } ··· 1584 1584 i = vb->v4l2_buf.index; 1585 1585 ctx->dst_bufs[i].b = vb; 1586 1586 ctx->dst_bufs[i].cookie.stream = 1587 - vb2_dma_contig_plane_paddr(vb, 0); 1587 + vb2_dma_contig_plane_dma_addr(vb, 0); 1588 1588 ctx->dst_bufs_cnt++; 1589 1589 } else if (vq->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { 1590 1590 ret = check_vb_with_fmt(ctx->src_fmt, vb); ··· 1593 1593 i = vb->v4l2_buf.index; 1594 1594 ctx->src_bufs[i].b = vb; 1595 1595 ctx->src_bufs[i].cookie.raw.luma = 1596 - vb2_dma_contig_plane_paddr(vb, 0); 1596 + vb2_dma_contig_plane_dma_addr(vb, 0); 1597 1597 ctx->src_bufs[i].cookie.raw.chroma = 1598 - vb2_dma_contig_plane_paddr(vb, 1); 1598 + vb2_dma_contig_plane_dma_addr(vb, 1); 1599 1599 ctx->src_bufs_cnt++; 1600 1600 } else { 1601 1601 mfc_err("inavlid queue type: %d\n", vq->type);
+7 -7
drivers/media/video/s5p-mfc/s5p_mfc_opr.c
··· 1135 1135 temp_vb = list_entry(ctx->src_queue.next, struct s5p_mfc_buf, list); 1136 1136 temp_vb->used = 1; 1137 1137 s5p_mfc_set_dec_stream_buffer(ctx, 1138 - vb2_dma_contig_plane_paddr(temp_vb->b, 0), ctx->consumed_stream, 1138 + vb2_dma_contig_plane_dma_addr(temp_vb->b, 0), ctx->consumed_stream, 1139 1139 temp_vb->b->v4l2_planes[0].bytesused); 1140 1140 spin_unlock_irqrestore(&dev->irqlock, flags); 1141 1141 index = temp_vb->b->v4l2_buf.index; ··· 1172 1172 } 1173 1173 src_mb = list_entry(ctx->src_queue.next, struct s5p_mfc_buf, list); 1174 1174 src_mb->used = 1; 1175 - src_y_addr = vb2_dma_contig_plane_paddr(src_mb->b, 0); 1176 - src_c_addr = vb2_dma_contig_plane_paddr(src_mb->b, 1); 1175 + src_y_addr = vb2_dma_contig_plane_dma_addr(src_mb->b, 0); 1176 + src_c_addr = vb2_dma_contig_plane_dma_addr(src_mb->b, 1); 1177 1177 s5p_mfc_set_enc_frame_buffer(ctx, src_y_addr, src_c_addr); 1178 1178 dst_mb = list_entry(ctx->dst_queue.next, struct s5p_mfc_buf, list); 1179 1179 dst_mb->used = 1; 1180 - dst_addr = vb2_dma_contig_plane_paddr(dst_mb->b, 0); 1180 + dst_addr = vb2_dma_contig_plane_dma_addr(dst_mb->b, 0); 1181 1181 dst_size = vb2_plane_size(dst_mb->b, 0); 1182 1182 s5p_mfc_set_enc_stream_buffer(ctx, dst_addr, dst_size); 1183 1183 spin_unlock_irqrestore(&dev->irqlock, flags); ··· 1200 1200 s5p_mfc_set_dec_desc_buffer(ctx); 1201 1201 mfc_debug(2, "Header size: %d\n", temp_vb->b->v4l2_planes[0].bytesused); 1202 1202 s5p_mfc_set_dec_stream_buffer(ctx, 1203 - vb2_dma_contig_plane_paddr(temp_vb->b, 0), 1203 + vb2_dma_contig_plane_dma_addr(temp_vb->b, 0), 1204 1204 0, temp_vb->b->v4l2_planes[0].bytesused); 1205 1205 spin_unlock_irqrestore(&dev->irqlock, flags); 1206 1206 dev->curr_ctx = ctx->num; ··· 1219 1219 s5p_mfc_set_enc_ref_buffer(ctx); 1220 1220 spin_lock_irqsave(&dev->irqlock, flags); 1221 1221 dst_mb = list_entry(ctx->dst_queue.next, struct s5p_mfc_buf, list); 1222 - dst_addr = vb2_dma_contig_plane_paddr(dst_mb->b, 0); 1222 + dst_addr = vb2_dma_contig_plane_dma_addr(dst_mb->b, 0); 1223 1223 dst_size = vb2_plane_size(dst_mb->b, 0); 1224 1224 s5p_mfc_set_enc_stream_buffer(ctx, dst_addr, dst_size); 1225 1225 spin_unlock_irqrestore(&dev->irqlock, flags); ··· 1255 1255 temp_vb = list_entry(ctx->src_queue.next, struct s5p_mfc_buf, list); 1256 1256 mfc_debug(2, "Header size: %d\n", temp_vb->b->v4l2_planes[0].bytesused); 1257 1257 s5p_mfc_set_dec_stream_buffer(ctx, 1258 - vb2_dma_contig_plane_paddr(temp_vb->b, 0), 1258 + vb2_dma_contig_plane_dma_addr(temp_vb->b, 0), 1259 1259 0, temp_vb->b->v4l2_planes[0].bytesused); 1260 1260 spin_unlock_irqrestore(&dev->irqlock, flags); 1261 1261 dev->curr_ctx = ctx->num;
+1 -1
drivers/media/video/s5p-tv/mixer_grp_layer.c
··· 86 86 dma_addr_t addr = 0; 87 87 88 88 if (buf) 89 - addr = vb2_dma_contig_plane_paddr(&buf->vb, 0); 89 + addr = vb2_dma_contig_plane_dma_addr(&buf->vb, 0); 90 90 mxr_reg_graph_buffer(layer->mdev, layer->idx, addr); 91 91 } 92 92
+2 -2
drivers/media/video/s5p-tv/mixer_vp_layer.c
··· 97 97 mxr_reg_vp_buffer(layer->mdev, luma_addr, chroma_addr); 98 98 return; 99 99 } 100 - luma_addr[0] = vb2_dma_contig_plane_paddr(&buf->vb, 0); 100 + luma_addr[0] = vb2_dma_contig_plane_dma_addr(&buf->vb, 0); 101 101 if (layer->fmt->num_subframes == 2) { 102 - chroma_addr[0] = vb2_dma_contig_plane_paddr(&buf->vb, 1); 102 + chroma_addr[0] = vb2_dma_contig_plane_dma_addr(&buf->vb, 1); 103 103 } else { 104 104 /* FIXME: mxr_get_plane_size compute integer division, 105 105 * which is slow and should not be performed in interrupt */
+1 -1
drivers/media/video/sh_mobile_ceu_camera.c
··· 312 312 bottom2 = CDBCR; 313 313 } 314 314 315 - phys_addr_top = vb2_dma_contig_plane_paddr(pcdev->active, 0); 315 + phys_addr_top = vb2_dma_contig_plane_dma_addr(pcdev->active, 0); 316 316 317 317 ceu_write(pcdev, top1, phys_addr_top); 318 318 if (V4L2_FIELD_NONE != pcdev->field) {
+8 -8
drivers/media/video/videobuf2-dma-contig.c
··· 24 24 struct vb2_dc_buf { 25 25 struct vb2_dc_conf *conf; 26 26 void *vaddr; 27 - dma_addr_t paddr; 27 + dma_addr_t dma_addr; 28 28 unsigned long size; 29 29 struct vm_area_struct *vma; 30 30 atomic_t refcount; ··· 42 42 if (!buf) 43 43 return ERR_PTR(-ENOMEM); 44 44 45 - buf->vaddr = dma_alloc_coherent(conf->dev, size, &buf->paddr, 45 + buf->vaddr = dma_alloc_coherent(conf->dev, size, &buf->dma_addr, 46 46 GFP_KERNEL); 47 47 if (!buf->vaddr) { 48 48 dev_err(conf->dev, "dma_alloc_coherent of size %ld failed\n", ··· 69 69 70 70 if (atomic_dec_and_test(&buf->refcount)) { 71 71 dma_free_coherent(buf->conf->dev, buf->size, buf->vaddr, 72 - buf->paddr); 72 + buf->dma_addr); 73 73 kfree(buf); 74 74 } 75 75 } ··· 78 78 { 79 79 struct vb2_dc_buf *buf = buf_priv; 80 80 81 - return &buf->paddr; 81 + return &buf->dma_addr; 82 82 } 83 83 84 84 static void *vb2_dma_contig_vaddr(void *buf_priv) ··· 106 106 return -EINVAL; 107 107 } 108 108 109 - return vb2_mmap_pfn_range(vma, buf->paddr, buf->size, 109 + return vb2_mmap_pfn_range(vma, buf->dma_addr, buf->size, 110 110 &vb2_common_vm_ops, &buf->handler); 111 111 } 112 112 ··· 115 115 { 116 116 struct vb2_dc_buf *buf; 117 117 struct vm_area_struct *vma; 118 - dma_addr_t paddr = 0; 118 + dma_addr_t dma_addr = 0; 119 119 int ret; 120 120 121 121 buf = kzalloc(sizeof *buf, GFP_KERNEL); 122 122 if (!buf) 123 123 return ERR_PTR(-ENOMEM); 124 124 125 - ret = vb2_get_contig_userptr(vaddr, size, &vma, &paddr); 125 + ret = vb2_get_contig_userptr(vaddr, size, &vma, &dma_addr); 126 126 if (ret) { 127 127 printk(KERN_ERR "Failed acquiring VMA for vaddr 0x%08lx\n", 128 128 vaddr); ··· 131 131 } 132 132 133 133 buf->size = size; 134 - buf->paddr = paddr; 134 + buf->dma_addr = dma_addr; 135 135 buf->vma = vma; 136 136 137 137 return buf;
+3 -3
include/media/videobuf2-dma-contig.h
··· 17 17 #include <linux/dma-mapping.h> 18 18 19 19 static inline dma_addr_t 20 - vb2_dma_contig_plane_paddr(struct vb2_buffer *vb, unsigned int plane_no) 20 + vb2_dma_contig_plane_dma_addr(struct vb2_buffer *vb, unsigned int plane_no) 21 21 { 22 - dma_addr_t *paddr = vb2_plane_cookie(vb, plane_no); 22 + dma_addr_t *addr = vb2_plane_cookie(vb, plane_no); 23 23 24 - return *paddr; 24 + return *addr; 25 25 } 26 26 27 27 void *vb2_dma_contig_init_ctx(struct device *dev);