diff options
author | Ricardo Ribalda <ricardo.ribalda@gmail.com> | 2013-08-02 09:20:00 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2013-09-26 06:33:59 -0400 |
commit | 223012475968fb8dac866bff5b278e9311a36894 (patch) | |
tree | ed1ea775ccb2353502dd78f76190160c07b8e9d5 /drivers/staging | |
parent | df23728118cd0f53070769e2ac26a255f66daa57 (diff) |
[media] videobuf2-dma-sg: Replace vb2_dma_sg_desc with sg_table
Replace the private struct vb2_dma_sg_desc with the struct sg_table so
we can benefit from all the helping functions in lib/scatterlist.c for
things like allocating the sg or compacting the descriptor.
marvel-ccic and solo6x10 drivers, that use this API have been updated.
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Andre Heider <a.heider@gmail.com>
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
[s.nawrocki@samsung.com: minor corrections of the changelog]
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c b/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c index a4c589604b02..9a6d5c0b1339 100644 --- a/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c +++ b/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c | |||
@@ -346,7 +346,7 @@ static int enc_get_mpeg_dma(struct solo_dev *solo_dev, dma_addr_t dma, | |||
346 | /* Build a descriptor queue out of an SG list and send it to the P2M for | 346 | /* Build a descriptor queue out of an SG list and send it to the P2M for |
347 | * processing. */ | 347 | * processing. */ |
348 | static int solo_send_desc(struct solo_enc_dev *solo_enc, int skip, | 348 | static int solo_send_desc(struct solo_enc_dev *solo_enc, int skip, |
349 | struct vb2_dma_sg_desc *vbuf, int off, int size, | 349 | struct sg_table *vbuf, int off, int size, |
350 | unsigned int base, unsigned int base_size) | 350 | unsigned int base, unsigned int base_size) |
351 | { | 351 | { |
352 | struct solo_dev *solo_dev = solo_enc->solo_dev; | 352 | struct solo_dev *solo_dev = solo_enc->solo_dev; |
@@ -359,7 +359,7 @@ static int solo_send_desc(struct solo_enc_dev *solo_enc, int skip, | |||
359 | 359 | ||
360 | solo_enc->desc_count = 1; | 360 | solo_enc->desc_count = 1; |
361 | 361 | ||
362 | for_each_sg(vbuf->sglist, sg, vbuf->num_pages, i) { | 362 | for_each_sg(vbuf->sgl, sg, vbuf->nents, i) { |
363 | struct solo_p2m_desc *desc; | 363 | struct solo_p2m_desc *desc; |
364 | dma_addr_t dma; | 364 | dma_addr_t dma; |
365 | int len; | 365 | int len; |
@@ -434,7 +434,7 @@ static int solo_fill_jpeg(struct solo_enc_dev *solo_enc, | |||
434 | struct vb2_buffer *vb, struct vop_header *vh) | 434 | struct vb2_buffer *vb, struct vop_header *vh) |
435 | { | 435 | { |
436 | struct solo_dev *solo_dev = solo_enc->solo_dev; | 436 | struct solo_dev *solo_dev = solo_enc->solo_dev; |
437 | struct vb2_dma_sg_desc *vbuf = vb2_dma_sg_plane_desc(vb, 0); | 437 | struct sg_table *vbuf = vb2_dma_sg_plane_desc(vb, 0); |
438 | int frame_size; | 438 | int frame_size; |
439 | int ret; | 439 | int ret; |
440 | 440 | ||
@@ -443,7 +443,7 @@ static int solo_fill_jpeg(struct solo_enc_dev *solo_enc, | |||
443 | if (vb2_plane_size(vb, 0) < vh->jpeg_size + solo_enc->jpeg_len) | 443 | if (vb2_plane_size(vb, 0) < vh->jpeg_size + solo_enc->jpeg_len) |
444 | return -EIO; | 444 | return -EIO; |
445 | 445 | ||
446 | sg_copy_from_buffer(vbuf->sglist, vbuf->num_pages, | 446 | sg_copy_from_buffer(vbuf->sgl, vbuf->nents, |
447 | solo_enc->jpeg_header, | 447 | solo_enc->jpeg_header, |
448 | solo_enc->jpeg_len); | 448 | solo_enc->jpeg_len); |
449 | 449 | ||
@@ -451,12 +451,12 @@ static int solo_fill_jpeg(struct solo_enc_dev *solo_enc, | |||
451 | & ~(DMA_ALIGN - 1); | 451 | & ~(DMA_ALIGN - 1); |
452 | vb2_set_plane_payload(vb, 0, vh->jpeg_size + solo_enc->jpeg_len); | 452 | vb2_set_plane_payload(vb, 0, vh->jpeg_size + solo_enc->jpeg_len); |
453 | 453 | ||
454 | dma_map_sg(&solo_dev->pdev->dev, vbuf->sglist, vbuf->num_pages, | 454 | dma_map_sg(&solo_dev->pdev->dev, vbuf->sgl, vbuf->nents, |
455 | DMA_FROM_DEVICE); | 455 | DMA_FROM_DEVICE); |
456 | ret = solo_send_desc(solo_enc, solo_enc->jpeg_len, vbuf, vh->jpeg_off, | 456 | ret = solo_send_desc(solo_enc, solo_enc->jpeg_len, vbuf, vh->jpeg_off, |
457 | frame_size, SOLO_JPEG_EXT_ADDR(solo_dev), | 457 | frame_size, SOLO_JPEG_EXT_ADDR(solo_dev), |
458 | SOLO_JPEG_EXT_SIZE(solo_dev)); | 458 | SOLO_JPEG_EXT_SIZE(solo_dev)); |
459 | dma_unmap_sg(&solo_dev->pdev->dev, vbuf->sglist, vbuf->num_pages, | 459 | dma_unmap_sg(&solo_dev->pdev->dev, vbuf->sgl, vbuf->nents, |
460 | DMA_FROM_DEVICE); | 460 | DMA_FROM_DEVICE); |
461 | return ret; | 461 | return ret; |
462 | } | 462 | } |
@@ -465,7 +465,7 @@ static int solo_fill_mpeg(struct solo_enc_dev *solo_enc, | |||
465 | struct vb2_buffer *vb, struct vop_header *vh) | 465 | struct vb2_buffer *vb, struct vop_header *vh) |
466 | { | 466 | { |
467 | struct solo_dev *solo_dev = solo_enc->solo_dev; | 467 | struct solo_dev *solo_dev = solo_enc->solo_dev; |
468 | struct vb2_dma_sg_desc *vbuf = vb2_dma_sg_plane_desc(vb, 0); | 468 | struct sg_table *vbuf = vb2_dma_sg_plane_desc(vb, 0); |
469 | int frame_off, frame_size; | 469 | int frame_off, frame_size; |
470 | int skip = 0; | 470 | int skip = 0; |
471 | int ret; | 471 | int ret; |
@@ -475,7 +475,7 @@ static int solo_fill_mpeg(struct solo_enc_dev *solo_enc, | |||
475 | 475 | ||
476 | /* If this is a key frame, add extra header */ | 476 | /* If this is a key frame, add extra header */ |
477 | if (!vh->vop_type) { | 477 | if (!vh->vop_type) { |
478 | sg_copy_from_buffer(vbuf->sglist, vbuf->num_pages, | 478 | sg_copy_from_buffer(vbuf->sgl, vbuf->nents, |
479 | solo_enc->vop, | 479 | solo_enc->vop, |
480 | solo_enc->vop_len); | 480 | solo_enc->vop_len); |
481 | 481 | ||
@@ -494,12 +494,12 @@ static int solo_fill_mpeg(struct solo_enc_dev *solo_enc, | |||
494 | frame_size = (vh->mpeg_size + skip + (DMA_ALIGN - 1)) | 494 | frame_size = (vh->mpeg_size + skip + (DMA_ALIGN - 1)) |
495 | & ~(DMA_ALIGN - 1); | 495 | & ~(DMA_ALIGN - 1); |
496 | 496 | ||
497 | dma_map_sg(&solo_dev->pdev->dev, vbuf->sglist, vbuf->num_pages, | 497 | dma_map_sg(&solo_dev->pdev->dev, vbuf->sgl, vbuf->nents, |
498 | DMA_FROM_DEVICE); | 498 | DMA_FROM_DEVICE); |
499 | ret = solo_send_desc(solo_enc, skip, vbuf, frame_off, frame_size, | 499 | ret = solo_send_desc(solo_enc, skip, vbuf, frame_off, frame_size, |
500 | SOLO_MP4E_EXT_ADDR(solo_dev), | 500 | SOLO_MP4E_EXT_ADDR(solo_dev), |
501 | SOLO_MP4E_EXT_SIZE(solo_dev)); | 501 | SOLO_MP4E_EXT_SIZE(solo_dev)); |
502 | dma_unmap_sg(&solo_dev->pdev->dev, vbuf->sglist, vbuf->num_pages, | 502 | dma_unmap_sg(&solo_dev->pdev->dev, vbuf->sgl, vbuf->nents, |
503 | DMA_FROM_DEVICE); | 503 | DMA_FROM_DEVICE); |
504 | return ret; | 504 | return ret; |
505 | } | 505 | } |