diff options
author | Philipp Zabel <p.zabel@pengutronix.de> | 2014-08-06 07:02:23 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-08-21 16:25:26 -0400 |
commit | f23797b636c4d69b29d2739ba5fc0e36b4e47390 (patch) | |
tree | 4233bd29e4cdb61d7ac162603d8f8d68da8f5d73 | |
parent | a188a668dda4ea6b9454066343b78d662946fe07 (diff) |
[media] coda: checkpatch cleanup
This patch breaks most long lines, concatenates broken up text strings,
and adds or removes parentheses where needed to make checkpatch happy.
The long codec list lines and a few 81-wide lines remain.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r-- | drivers/media/platform/coda/coda-bit.c | 143 | ||||
-rw-r--r-- | drivers/media/platform/coda/coda-common.c | 34 |
2 files changed, 113 insertions, 64 deletions
diff --git a/drivers/media/platform/coda/coda-bit.c b/drivers/media/platform/coda/coda-bit.c index 18fa369d204d..07fc91aba1e0 100644 --- a/drivers/media/platform/coda/coda-bit.c +++ b/drivers/media/platform/coda/coda-bit.c | |||
@@ -37,7 +37,7 @@ | |||
37 | 37 | ||
38 | static inline int coda_is_initialized(struct coda_dev *dev) | 38 | static inline int coda_is_initialized(struct coda_dev *dev) |
39 | { | 39 | { |
40 | return (coda_read(dev, CODA_REG_BIT_CUR_PC) != 0); | 40 | return coda_read(dev, CODA_REG_BIT_CUR_PC) != 0; |
41 | } | 41 | } |
42 | 42 | ||
43 | static inline unsigned long coda_isbusy(struct coda_dev *dev) | 43 | static inline unsigned long coda_isbusy(struct coda_dev *dev) |
@@ -165,17 +165,20 @@ static void coda_kfifo_sync_to_device_write(struct coda_ctx *ctx) | |||
165 | coda_write(dev, wr_ptr, CODA_REG_BIT_WR_PTR(ctx->reg_idx)); | 165 | coda_write(dev, wr_ptr, CODA_REG_BIT_WR_PTR(ctx->reg_idx)); |
166 | } | 166 | } |
167 | 167 | ||
168 | static int coda_bitstream_queue(struct coda_ctx *ctx, struct vb2_buffer *src_buf) | 168 | static int coda_bitstream_queue(struct coda_ctx *ctx, |
169 | struct vb2_buffer *src_buf) | ||
169 | { | 170 | { |
170 | u32 src_size = vb2_get_plane_payload(src_buf, 0); | 171 | u32 src_size = vb2_get_plane_payload(src_buf, 0); |
171 | u32 n; | 172 | u32 n; |
172 | 173 | ||
173 | n = kfifo_in(&ctx->bitstream_fifo, vb2_plane_vaddr(src_buf, 0), src_size); | 174 | n = kfifo_in(&ctx->bitstream_fifo, vb2_plane_vaddr(src_buf, 0), |
175 | src_size); | ||
174 | if (n < src_size) | 176 | if (n < src_size) |
175 | return -ENOSPC; | 177 | return -ENOSPC; |
176 | 178 | ||
177 | dma_sync_single_for_device(&ctx->dev->plat_dev->dev, ctx->bitstream.paddr, | 179 | dma_sync_single_for_device(&ctx->dev->plat_dev->dev, |
178 | ctx->bitstream.size, DMA_TO_DEVICE); | 180 | ctx->bitstream.paddr, ctx->bitstream.size, |
181 | DMA_TO_DEVICE); | ||
179 | 182 | ||
180 | src_buf->v4l2_buf.sequence = ctx->qsequence++; | 183 | src_buf->v4l2_buf.sequence = ctx->qsequence++; |
181 | 184 | ||
@@ -246,11 +249,12 @@ void coda_bit_stream_end_flag(struct coda_ctx *ctx) | |||
246 | 249 | ||
247 | ctx->bit_stream_param |= CODA_BIT_STREAM_END_FLAG; | 250 | ctx->bit_stream_param |= CODA_BIT_STREAM_END_FLAG; |
248 | 251 | ||
252 | /* If this context is currently running, update the hardware flag */ | ||
249 | if ((dev->devtype->product == CODA_960) && | 253 | if ((dev->devtype->product == CODA_960) && |
250 | coda_isbusy(dev) && | 254 | coda_isbusy(dev) && |
251 | (ctx->idx == coda_read(dev, CODA_REG_BIT_RUN_INDEX))) { | 255 | (ctx->idx == coda_read(dev, CODA_REG_BIT_RUN_INDEX))) { |
252 | /* If this context is currently running, update the hardware flag */ | 256 | coda_write(dev, ctx->bit_stream_param, |
253 | coda_write(dev, ctx->bit_stream_param, CODA_REG_BIT_BIT_STREAM_PARAM); | 257 | CODA_REG_BIT_BIT_STREAM_PARAM); |
254 | } | 258 | } |
255 | } | 259 | } |
256 | 260 | ||
@@ -315,9 +319,10 @@ static int coda_alloc_framebuffers(struct coda_ctx *ctx, | |||
315 | /* Register frame buffers in the parameter buffer */ | 319 | /* Register frame buffers in the parameter buffer */ |
316 | for (i = 0; i < ctx->num_internal_frames; i++) { | 320 | for (i = 0; i < ctx->num_internal_frames; i++) { |
317 | paddr = ctx->internal_frames[i].paddr; | 321 | paddr = ctx->internal_frames[i].paddr; |
318 | coda_parabuf_write(ctx, i * 3 + 0, paddr); /* Y */ | 322 | /* Start addresses of Y, Cb, Cr planes */ |
319 | coda_parabuf_write(ctx, i * 3 + 1, paddr + ysize); /* Cb */ | 323 | coda_parabuf_write(ctx, i * 3 + 0, paddr); |
320 | coda_parabuf_write(ctx, i * 3 + 2, paddr + ysize + ysize/4); /* Cr */ | 324 | coda_parabuf_write(ctx, i * 3 + 1, paddr + ysize); |
325 | coda_parabuf_write(ctx, i * 3 + 2, paddr + ysize + ysize / 4); | ||
321 | 326 | ||
322 | /* mvcol buffer for h.264 */ | 327 | /* mvcol buffer for h.264 */ |
323 | if (ctx->codec->src_fourcc == V4L2_PIX_FMT_H264 && | 328 | if (ctx->codec->src_fourcc == V4L2_PIX_FMT_H264 && |
@@ -374,18 +379,22 @@ static int coda_alloc_context_buffers(struct coda_ctx *ctx, | |||
374 | /* worst case slice size */ | 379 | /* worst case slice size */ |
375 | size = (DIV_ROUND_UP(q_data->width, 16) * | 380 | size = (DIV_ROUND_UP(q_data->width, 16) * |
376 | DIV_ROUND_UP(q_data->height, 16)) * 3200 / 8 + 512; | 381 | DIV_ROUND_UP(q_data->height, 16)) * 3200 / 8 + 512; |
377 | ret = coda_alloc_context_buf(ctx, &ctx->slicebuf, size, "slicebuf"); | 382 | ret = coda_alloc_context_buf(ctx, &ctx->slicebuf, size, |
383 | "slicebuf"); | ||
378 | if (ret < 0) { | 384 | if (ret < 0) { |
379 | v4l2_err(&dev->v4l2_dev, "failed to allocate %d byte slice buffer", | 385 | v4l2_err(&dev->v4l2_dev, |
386 | "failed to allocate %d byte slice buffer", | ||
380 | ctx->slicebuf.size); | 387 | ctx->slicebuf.size); |
381 | return ret; | 388 | return ret; |
382 | } | 389 | } |
383 | } | 390 | } |
384 | 391 | ||
385 | if (dev->devtype->product == CODA_7541) { | 392 | if (dev->devtype->product == CODA_7541) { |
386 | ret = coda_alloc_context_buf(ctx, &ctx->psbuf, CODA7_PS_BUF_SIZE, "psbuf"); | 393 | ret = coda_alloc_context_buf(ctx, &ctx->psbuf, |
394 | CODA7_PS_BUF_SIZE, "psbuf"); | ||
387 | if (ret < 0) { | 395 | if (ret < 0) { |
388 | v4l2_err(&dev->v4l2_dev, "failed to allocate psmem buffer"); | 396 | v4l2_err(&dev->v4l2_dev, |
397 | "failed to allocate psmem buffer"); | ||
389 | goto err; | 398 | goto err; |
390 | } | 399 | } |
391 | } | 400 | } |
@@ -396,7 +405,8 @@ static int coda_alloc_context_buffers(struct coda_ctx *ctx, | |||
396 | size += CODA9_PS_SAVE_SIZE; | 405 | size += CODA9_PS_SAVE_SIZE; |
397 | ret = coda_alloc_context_buf(ctx, &ctx->workbuf, size, "workbuf"); | 406 | ret = coda_alloc_context_buf(ctx, &ctx->workbuf, size, "workbuf"); |
398 | if (ret < 0) { | 407 | if (ret < 0) { |
399 | v4l2_err(&dev->v4l2_dev, "failed to allocate %d byte context buffer", | 408 | v4l2_err(&dev->v4l2_dev, |
409 | "failed to allocate %d byte context buffer", | ||
400 | ctx->workbuf.size); | 410 | ctx->workbuf.size); |
401 | goto err; | 411 | goto err; |
402 | } | 412 | } |
@@ -465,6 +475,7 @@ static void coda_setup_iram(struct coda_ctx *ctx) | |||
465 | { | 475 | { |
466 | struct coda_iram_info *iram_info = &ctx->iram_info; | 476 | struct coda_iram_info *iram_info = &ctx->iram_info; |
467 | struct coda_dev *dev = ctx->dev; | 477 | struct coda_dev *dev = ctx->dev; |
478 | int w64, w128; | ||
468 | int mb_width; | 479 | int mb_width; |
469 | int dbk_bits; | 480 | int dbk_bits; |
470 | int bit_bits; | 481 | int bit_bits; |
@@ -497,13 +508,15 @@ static void coda_setup_iram(struct coda_ctx *ctx) | |||
497 | 508 | ||
498 | q_data_src = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT); | 509 | q_data_src = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT); |
499 | mb_width = DIV_ROUND_UP(q_data_src->width, 16); | 510 | mb_width = DIV_ROUND_UP(q_data_src->width, 16); |
511 | w128 = mb_width * 128; | ||
512 | w64 = mb_width * 64; | ||
500 | 513 | ||
501 | /* Prioritize in case IRAM is too small for everything */ | 514 | /* Prioritize in case IRAM is too small for everything */ |
502 | if (dev->devtype->product == CODA_7541) { | 515 | if (dev->devtype->product == CODA_7541) { |
503 | iram_info->search_ram_size = round_up(mb_width * 16 * | 516 | iram_info->search_ram_size = round_up(mb_width * 16 * |
504 | 36 + 2048, 1024); | 517 | 36 + 2048, 1024); |
505 | iram_info->search_ram_paddr = coda_iram_alloc(iram_info, | 518 | iram_info->search_ram_paddr = coda_iram_alloc(iram_info, |
506 | iram_info->search_ram_size); | 519 | iram_info->search_ram_size); |
507 | if (!iram_info->search_ram_paddr) { | 520 | if (!iram_info->search_ram_paddr) { |
508 | pr_err("IRAM is smaller than the search ram size\n"); | 521 | pr_err("IRAM is smaller than the search ram size\n"); |
509 | goto out; | 522 | goto out; |
@@ -513,18 +526,18 @@ static void coda_setup_iram(struct coda_ctx *ctx) | |||
513 | } | 526 | } |
514 | 527 | ||
515 | /* Only H.264BP and H.263P3 are considered */ | 528 | /* Only H.264BP and H.263P3 are considered */ |
516 | iram_info->buf_dbk_y_use = coda_iram_alloc(iram_info, 64 * mb_width); | 529 | iram_info->buf_dbk_y_use = coda_iram_alloc(iram_info, w64); |
517 | iram_info->buf_dbk_c_use = coda_iram_alloc(iram_info, 64 * mb_width); | 530 | iram_info->buf_dbk_c_use = coda_iram_alloc(iram_info, w64); |
518 | if (!iram_info->buf_dbk_c_use) | 531 | if (!iram_info->buf_dbk_c_use) |
519 | goto out; | 532 | goto out; |
520 | iram_info->axi_sram_use |= dbk_bits; | 533 | iram_info->axi_sram_use |= dbk_bits; |
521 | 534 | ||
522 | iram_info->buf_bit_use = coda_iram_alloc(iram_info, 128 * mb_width); | 535 | iram_info->buf_bit_use = coda_iram_alloc(iram_info, w128); |
523 | if (!iram_info->buf_bit_use) | 536 | if (!iram_info->buf_bit_use) |
524 | goto out; | 537 | goto out; |
525 | iram_info->axi_sram_use |= bit_bits; | 538 | iram_info->axi_sram_use |= bit_bits; |
526 | 539 | ||
527 | iram_info->buf_ip_ac_dc_use = coda_iram_alloc(iram_info, 128 * mb_width); | 540 | iram_info->buf_ip_ac_dc_use = coda_iram_alloc(iram_info, w128); |
528 | if (!iram_info->buf_ip_ac_dc_use) | 541 | if (!iram_info->buf_ip_ac_dc_use) |
529 | goto out; | 542 | goto out; |
530 | iram_info->axi_sram_use |= ip_bits; | 543 | iram_info->axi_sram_use |= ip_bits; |
@@ -535,19 +548,20 @@ static void coda_setup_iram(struct coda_ctx *ctx) | |||
535 | 548 | ||
536 | q_data_dst = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE); | 549 | q_data_dst = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE); |
537 | mb_width = DIV_ROUND_UP(q_data_dst->width, 16); | 550 | mb_width = DIV_ROUND_UP(q_data_dst->width, 16); |
551 | w128 = mb_width * 128; | ||
538 | 552 | ||
539 | iram_info->buf_dbk_y_use = coda_iram_alloc(iram_info, 128 * mb_width); | 553 | iram_info->buf_dbk_y_use = coda_iram_alloc(iram_info, w128); |
540 | iram_info->buf_dbk_c_use = coda_iram_alloc(iram_info, 128 * mb_width); | 554 | iram_info->buf_dbk_c_use = coda_iram_alloc(iram_info, w128); |
541 | if (!iram_info->buf_dbk_c_use) | 555 | if (!iram_info->buf_dbk_c_use) |
542 | goto out; | 556 | goto out; |
543 | iram_info->axi_sram_use |= dbk_bits; | 557 | iram_info->axi_sram_use |= dbk_bits; |
544 | 558 | ||
545 | iram_info->buf_bit_use = coda_iram_alloc(iram_info, 128 * mb_width); | 559 | iram_info->buf_bit_use = coda_iram_alloc(iram_info, w128); |
546 | if (!iram_info->buf_bit_use) | 560 | if (!iram_info->buf_bit_use) |
547 | goto out; | 561 | goto out; |
548 | iram_info->axi_sram_use |= bit_bits; | 562 | iram_info->axi_sram_use |= bit_bits; |
549 | 563 | ||
550 | iram_info->buf_ip_ac_dc_use = coda_iram_alloc(iram_info, 128 * mb_width); | 564 | iram_info->buf_ip_ac_dc_use = coda_iram_alloc(iram_info, w128); |
551 | if (!iram_info->buf_ip_ac_dc_use) | 565 | if (!iram_info->buf_ip_ac_dc_use) |
552 | goto out; | 566 | goto out; |
553 | iram_info->axi_sram_use |= ip_bits; | 567 | iram_info->axi_sram_use |= ip_bits; |
@@ -634,8 +648,8 @@ int coda_check_firmware(struct coda_dev *dev) | |||
634 | clk_disable_unprepare(dev->clk_ahb); | 648 | clk_disable_unprepare(dev->clk_ahb); |
635 | 649 | ||
636 | if (product != dev->devtype->product) { | 650 | if (product != dev->devtype->product) { |
637 | v4l2_err(&dev->v4l2_dev, "Wrong firmware. Hw: %s, Fw: %s," | 651 | v4l2_err(&dev->v4l2_dev, |
638 | " Version: %u.%u.%u\n", | 652 | "Wrong firmware. Hw: %s, Fw: %s, Version: %u.%u.%u\n", |
639 | coda_product_name(dev->devtype->product), | 653 | coda_product_name(dev->devtype->product), |
640 | coda_product_name(product), major, minor, release); | 654 | coda_product_name(product), major, minor, release); |
641 | return -EINVAL; | 655 | return -EINVAL; |
@@ -648,8 +662,9 @@ int coda_check_firmware(struct coda_dev *dev) | |||
648 | v4l2_info(&dev->v4l2_dev, "Firmware version: %u.%u.%u\n", | 662 | v4l2_info(&dev->v4l2_dev, "Firmware version: %u.%u.%u\n", |
649 | major, minor, release); | 663 | major, minor, release); |
650 | } else { | 664 | } else { |
651 | v4l2_warn(&dev->v4l2_dev, "Unsupported firmware version: " | 665 | v4l2_warn(&dev->v4l2_dev, |
652 | "%u.%u.%u\n", major, minor, release); | 666 | "Unsupported firmware version: %u.%u.%u\n", |
667 | major, minor, release); | ||
653 | } | 668 | } |
654 | 669 | ||
655 | return 0; | 670 | return 0; |
@@ -720,27 +735,32 @@ static int coda_start_encoding(struct coda_ctx *ctx) | |||
720 | 735 | ||
721 | if (dev->devtype->product == CODA_DX6) { | 736 | if (dev->devtype->product == CODA_DX6) { |
722 | /* Configure the coda */ | 737 | /* Configure the coda */ |
723 | coda_write(dev, dev->iram.paddr, CODADX6_REG_BIT_SEARCH_RAM_BASE_ADDR); | 738 | coda_write(dev, dev->iram.paddr, |
739 | CODADX6_REG_BIT_SEARCH_RAM_BASE_ADDR); | ||
724 | } | 740 | } |
725 | 741 | ||
726 | /* Could set rotation here if needed */ | 742 | /* Could set rotation here if needed */ |
727 | switch (dev->devtype->product) { | 743 | switch (dev->devtype->product) { |
728 | case CODA_DX6: | 744 | case CODA_DX6: |
729 | value = (q_data_src->width & CODADX6_PICWIDTH_MASK) << CODADX6_PICWIDTH_OFFSET; | 745 | value = (q_data_src->width & CODADX6_PICWIDTH_MASK) |
730 | value |= (q_data_src->height & CODADX6_PICHEIGHT_MASK) << CODA_PICHEIGHT_OFFSET; | 746 | << CODADX6_PICWIDTH_OFFSET; |
747 | value |= (q_data_src->height & CODADX6_PICHEIGHT_MASK) | ||
748 | << CODA_PICHEIGHT_OFFSET; | ||
731 | break; | 749 | break; |
732 | case CODA_7541: | 750 | case CODA_7541: |
733 | if (dst_fourcc == V4L2_PIX_FMT_H264) { | 751 | if (dst_fourcc == V4L2_PIX_FMT_H264) { |
734 | value = (round_up(q_data_src->width, 16) & | 752 | value = (round_up(q_data_src->width, 16) & |
735 | CODA7_PICWIDTH_MASK) << CODA7_PICWIDTH_OFFSET; | 753 | CODA7_PICWIDTH_MASK) << CODA7_PICWIDTH_OFFSET; |
736 | value |= (round_up(q_data_src->height, 16) & | 754 | value |= (round_up(q_data_src->height, 16) & |
737 | CODA7_PICHEIGHT_MASK) << CODA_PICHEIGHT_OFFSET; | 755 | CODA7_PICHEIGHT_MASK) << CODA_PICHEIGHT_OFFSET; |
738 | break; | 756 | break; |
739 | } | 757 | } |
740 | /* fallthrough */ | 758 | /* fallthrough */ |
741 | case CODA_960: | 759 | case CODA_960: |
742 | value = (q_data_src->width & CODA7_PICWIDTH_MASK) << CODA7_PICWIDTH_OFFSET; | 760 | value = (q_data_src->width & CODA7_PICWIDTH_MASK) |
743 | value |= (q_data_src->height & CODA7_PICHEIGHT_MASK) << CODA_PICHEIGHT_OFFSET; | 761 | << CODA7_PICWIDTH_OFFSET; |
762 | value |= (q_data_src->height & CODA7_PICHEIGHT_MASK) | ||
763 | << CODA_PICHEIGHT_OFFSET; | ||
744 | } | 764 | } |
745 | coda_write(dev, value, CODA_CMD_ENC_SEQ_SRC_SIZE); | 765 | coda_write(dev, value, CODA_CMD_ENC_SEQ_SRC_SIZE); |
746 | coda_write(dev, ctx->params.framerate, | 766 | coda_write(dev, ctx->params.framerate, |
@@ -750,16 +770,20 @@ static int coda_start_encoding(struct coda_ctx *ctx) | |||
750 | switch (dst_fourcc) { | 770 | switch (dst_fourcc) { |
751 | case V4L2_PIX_FMT_MPEG4: | 771 | case V4L2_PIX_FMT_MPEG4: |
752 | if (dev->devtype->product == CODA_960) | 772 | if (dev->devtype->product == CODA_960) |
753 | coda_write(dev, CODA9_STD_MPEG4, CODA_CMD_ENC_SEQ_COD_STD); | 773 | coda_write(dev, CODA9_STD_MPEG4, |
774 | CODA_CMD_ENC_SEQ_COD_STD); | ||
754 | else | 775 | else |
755 | coda_write(dev, CODA_STD_MPEG4, CODA_CMD_ENC_SEQ_COD_STD); | 776 | coda_write(dev, CODA_STD_MPEG4, |
777 | CODA_CMD_ENC_SEQ_COD_STD); | ||
756 | coda_write(dev, 0, CODA_CMD_ENC_SEQ_MP4_PARA); | 778 | coda_write(dev, 0, CODA_CMD_ENC_SEQ_MP4_PARA); |
757 | break; | 779 | break; |
758 | case V4L2_PIX_FMT_H264: | 780 | case V4L2_PIX_FMT_H264: |
759 | if (dev->devtype->product == CODA_960) | 781 | if (dev->devtype->product == CODA_960) |
760 | coda_write(dev, CODA9_STD_H264, CODA_CMD_ENC_SEQ_COD_STD); | 782 | coda_write(dev, CODA9_STD_H264, |
783 | CODA_CMD_ENC_SEQ_COD_STD); | ||
761 | else | 784 | else |
762 | coda_write(dev, CODA_STD_H264, CODA_CMD_ENC_SEQ_COD_STD); | 785 | coda_write(dev, CODA_STD_H264, |
786 | CODA_CMD_ENC_SEQ_COD_STD); | ||
763 | if (ctx->params.h264_deblk_enabled) { | 787 | if (ctx->params.h264_deblk_enabled) { |
764 | value = ((ctx->params.h264_deblk_alpha & | 788 | value = ((ctx->params.h264_deblk_alpha & |
765 | CODA_264PARAM_DEBLKFILTEROFFSETALPHA_MASK) << | 789 | CODA_264PARAM_DEBLKFILTEROFFSETALPHA_MASK) << |
@@ -784,13 +808,17 @@ static int coda_start_encoding(struct coda_ctx *ctx) | |||
784 | value = 0; | 808 | value = 0; |
785 | break; | 809 | break; |
786 | case V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_MB: | 810 | case V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_MB: |
787 | value = (ctx->params.slice_max_mb & CODA_SLICING_SIZE_MASK) << CODA_SLICING_SIZE_OFFSET; | 811 | value = (ctx->params.slice_max_mb & CODA_SLICING_SIZE_MASK) |
788 | value |= (1 & CODA_SLICING_UNIT_MASK) << CODA_SLICING_UNIT_OFFSET; | 812 | << CODA_SLICING_SIZE_OFFSET; |
813 | value |= (1 & CODA_SLICING_UNIT_MASK) | ||
814 | << CODA_SLICING_UNIT_OFFSET; | ||
789 | value |= 1 & CODA_SLICING_MODE_MASK; | 815 | value |= 1 & CODA_SLICING_MODE_MASK; |
790 | break; | 816 | break; |
791 | case V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES: | 817 | case V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES: |
792 | value = (ctx->params.slice_max_bits & CODA_SLICING_SIZE_MASK) << CODA_SLICING_SIZE_OFFSET; | 818 | value = (ctx->params.slice_max_bits & CODA_SLICING_SIZE_MASK) |
793 | value |= (0 & CODA_SLICING_UNIT_MASK) << CODA_SLICING_UNIT_OFFSET; | 819 | << CODA_SLICING_SIZE_OFFSET; |
820 | value |= (0 & CODA_SLICING_UNIT_MASK) | ||
821 | << CODA_SLICING_UNIT_OFFSET; | ||
794 | value |= 1 & CODA_SLICING_MODE_MASK; | 822 | value |= 1 & CODA_SLICING_MODE_MASK; |
795 | break; | 823 | break; |
796 | } | 824 | } |
@@ -800,7 +828,8 @@ static int coda_start_encoding(struct coda_ctx *ctx) | |||
800 | 828 | ||
801 | if (ctx->params.bitrate) { | 829 | if (ctx->params.bitrate) { |
802 | /* Rate control enabled */ | 830 | /* Rate control enabled */ |
803 | value = (ctx->params.bitrate & CODA_RATECONTROL_BITRATE_MASK) << CODA_RATECONTROL_BITRATE_OFFSET; | 831 | value = (ctx->params.bitrate & CODA_RATECONTROL_BITRATE_MASK) |
832 | << CODA_RATECONTROL_BITRATE_OFFSET; | ||
804 | value |= 1 & CODA_RATECONTROL_ENABLE_MASK; | 833 | value |= 1 & CODA_RATECONTROL_ENABLE_MASK; |
805 | if (dev->devtype->product == CODA_960) | 834 | if (dev->devtype->product == CODA_960) |
806 | value |= BIT(31); /* disable autoskip */ | 835 | value |= BIT(31); /* disable autoskip */ |
@@ -919,8 +948,10 @@ static int coda_start_encoding(struct coda_ctx *ctx) | |||
919 | CODA9_CMD_SET_FRAME_AXI_BTP_ADDR); | 948 | CODA9_CMD_SET_FRAME_AXI_BTP_ADDR); |
920 | 949 | ||
921 | /* FIXME */ | 950 | /* FIXME */ |
922 | coda_write(dev, ctx->internal_frames[2].paddr, CODA9_CMD_SET_FRAME_SUBSAMP_A); | 951 | coda_write(dev, ctx->internal_frames[2].paddr, |
923 | coda_write(dev, ctx->internal_frames[3].paddr, CODA9_CMD_SET_FRAME_SUBSAMP_B); | 952 | CODA9_CMD_SET_FRAME_SUBSAMP_A); |
953 | coda_write(dev, ctx->internal_frames[3].paddr, | ||
954 | CODA9_CMD_SET_FRAME_SUBSAMP_B); | ||
924 | } | 955 | } |
925 | } | 956 | } |
926 | 957 | ||
@@ -1092,7 +1123,8 @@ static int coda_prepare_encode(struct coda_ctx *ctx) | |||
1092 | } | 1123 | } |
1093 | 1124 | ||
1094 | /* submit */ | 1125 | /* submit */ |
1095 | coda_write(dev, CODA_ROT_MIR_ENABLE | ctx->params.rot_mode, CODA_CMD_ENC_PIC_ROT_MODE); | 1126 | coda_write(dev, CODA_ROT_MIR_ENABLE | ctx->params.rot_mode, |
1127 | CODA_CMD_ENC_PIC_ROT_MODE); | ||
1096 | coda_write(dev, quant_param, CODA_CMD_ENC_PIC_QS); | 1128 | coda_write(dev, quant_param, CODA_CMD_ENC_PIC_QS); |
1097 | 1129 | ||
1098 | 1130 | ||
@@ -1135,9 +1167,10 @@ static int coda_prepare_encode(struct coda_ctx *ctx) | |||
1135 | CODA_CMD_ENC_PIC_BB_SIZE); | 1167 | CODA_CMD_ENC_PIC_BB_SIZE); |
1136 | 1168 | ||
1137 | if (!ctx->streamon_out) { | 1169 | if (!ctx->streamon_out) { |
1138 | /* After streamoff on the output side, set the stream end flag */ | 1170 | /* After streamoff on the output side, set stream end flag */ |
1139 | ctx->bit_stream_param |= CODA_BIT_STREAM_END_FLAG; | 1171 | ctx->bit_stream_param |= CODA_BIT_STREAM_END_FLAG; |
1140 | coda_write(dev, ctx->bit_stream_param, CODA_REG_BIT_BIT_STREAM_PARAM); | 1172 | coda_write(dev, ctx->bit_stream_param, |
1173 | CODA_REG_BIT_BIT_STREAM_PARAM); | ||
1141 | } | 1174 | } |
1142 | 1175 | ||
1143 | if (dev->devtype->product != CODA_DX6) | 1176 | if (dev->devtype->product != CODA_DX6) |
@@ -1217,7 +1250,8 @@ static void coda_seq_end_work(struct work_struct *work) | |||
1217 | mutex_lock(&dev->coda_mutex); | 1250 | mutex_lock(&dev->coda_mutex); |
1218 | 1251 | ||
1219 | v4l2_dbg(1, coda_debug, &dev->v4l2_dev, | 1252 | v4l2_dbg(1, coda_debug, &dev->v4l2_dev, |
1220 | "%d: %s: sent command 'SEQ_END' to coda\n", ctx->idx, __func__); | 1253 | "%d: %s: sent command 'SEQ_END' to coda\n", ctx->idx, |
1254 | __func__); | ||
1221 | if (coda_command_sync(ctx, CODA_COMMAND_SEQ_END)) { | 1255 | if (coda_command_sync(ctx, CODA_COMMAND_SEQ_END)) { |
1222 | v4l2_err(&dev->v4l2_dev, | 1256 | v4l2_err(&dev->v4l2_dev, |
1223 | "CODA_COMMAND_SEQ_END failed\n"); | 1257 | "CODA_COMMAND_SEQ_END failed\n"); |
@@ -1550,7 +1584,8 @@ static int coda_prepare_decode(struct coda_ctx *ctx) | |||
1550 | coda_write(dev, CODA_PRE_SCAN_EN, CODA_CMD_DEC_PIC_OPTION); | 1584 | coda_write(dev, CODA_PRE_SCAN_EN, CODA_CMD_DEC_PIC_OPTION); |
1551 | break; | 1585 | break; |
1552 | case CODA_960: | 1586 | case CODA_960: |
1553 | coda_write(dev, (1 << 10), CODA_CMD_DEC_PIC_OPTION); /* 'hardcode to use interrupt disable mode'? */ | 1587 | /* 'hardcode to use interrupt disable mode'? */ |
1588 | coda_write(dev, (1 << 10), CODA_CMD_DEC_PIC_OPTION); | ||
1554 | break; | 1589 | break; |
1555 | } | 1590 | } |
1556 | 1591 | ||
@@ -1666,7 +1701,8 @@ static void coda_finish_decode(struct coda_ctx *ctx) | |||
1666 | } | 1701 | } |
1667 | } | 1702 | } |
1668 | 1703 | ||
1669 | ctx->frm_dis_flg = coda_read(dev, CODA_REG_BIT_FRM_DIS_FLG(ctx->reg_idx)); | 1704 | ctx->frm_dis_flg = coda_read(dev, |
1705 | CODA_REG_BIT_FRM_DIS_FLG(ctx->reg_idx)); | ||
1670 | 1706 | ||
1671 | /* | 1707 | /* |
1672 | * The previous display frame was copied out by the rotator, | 1708 | * The previous display frame was copied out by the rotator, |
@@ -1694,7 +1730,7 @@ static void coda_finish_decode(struct coda_ctx *ctx) | |||
1694 | else if (ctx->display_idx < 0) | 1730 | else if (ctx->display_idx < 0) |
1695 | ctx->hold = true; | 1731 | ctx->hold = true; |
1696 | } else if (decoded_idx == -2) { | 1732 | } else if (decoded_idx == -2) { |
1697 | /* no frame was decoded, we still return the remaining buffers */ | 1733 | /* no frame was decoded, we still return remaining buffers */ |
1698 | } else if (decoded_idx < 0 || decoded_idx >= ctx->num_internal_frames) { | 1734 | } else if (decoded_idx < 0 || decoded_idx >= ctx->num_internal_frames) { |
1699 | v4l2_err(&dev->v4l2_dev, | 1735 | v4l2_err(&dev->v4l2_dev, |
1700 | "decoded frame index out of range: %d\n", decoded_idx); | 1736 | "decoded frame index out of range: %d\n", decoded_idx); |
@@ -1801,7 +1837,8 @@ irqreturn_t coda_irq_handler(int irq, void *data) | |||
1801 | 1837 | ||
1802 | ctx = v4l2_m2m_get_curr_priv(dev->m2m_dev); | 1838 | ctx = v4l2_m2m_get_curr_priv(dev->m2m_dev); |
1803 | if (ctx == NULL) { | 1839 | if (ctx == NULL) { |
1804 | v4l2_err(&dev->v4l2_dev, "Instance released before the end of transaction\n"); | 1840 | v4l2_err(&dev->v4l2_dev, |
1841 | "Instance released before the end of transaction\n"); | ||
1805 | mutex_unlock(&dev->coda_mutex); | 1842 | mutex_unlock(&dev->coda_mutex); |
1806 | return IRQ_HANDLED; | 1843 | return IRQ_HANDLED; |
1807 | } | 1844 | } |
diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c index ffb4c76e5755..0997b5c677bd 100644 --- a/drivers/media/platform/coda/coda-common.c +++ b/drivers/media/platform/coda/coda-common.c | |||
@@ -75,6 +75,7 @@ void coda_write(struct coda_dev *dev, u32 data, u32 reg) | |||
75 | unsigned int coda_read(struct coda_dev *dev, u32 reg) | 75 | unsigned int coda_read(struct coda_dev *dev, u32 reg) |
76 | { | 76 | { |
77 | u32 data; | 77 | u32 data; |
78 | |||
78 | data = readl(dev->regs_base + reg); | 79 | data = readl(dev->regs_base + reg); |
79 | v4l2_dbg(2, coda_debug, &dev->v4l2_dev, | 80 | v4l2_dbg(2, coda_debug, &dev->v4l2_dev, |
80 | "%s: data=0x%x, reg=0x%x\n", __func__, data, reg); | 81 | "%s: data=0x%x, reg=0x%x\n", __func__, data, reg); |
@@ -736,7 +737,8 @@ static void coda_pic_run_work(struct work_struct *work) | |||
736 | return; | 737 | return; |
737 | } | 738 | } |
738 | 739 | ||
739 | if (!wait_for_completion_timeout(&ctx->completion, msecs_to_jiffies(1000))) { | 740 | if (!wait_for_completion_timeout(&ctx->completion, |
741 | msecs_to_jiffies(1000))) { | ||
740 | dev_err(&dev->plat_dev->dev, "CODA PIC_RUN timeout\n"); | 742 | dev_err(&dev->plat_dev->dev, "CODA PIC_RUN timeout\n"); |
741 | 743 | ||
742 | ctx->hold = true; | 744 | ctx->hold = true; |
@@ -812,6 +814,7 @@ static void coda_lock(void *m2m_priv) | |||
812 | { | 814 | { |
813 | struct coda_ctx *ctx = m2m_priv; | 815 | struct coda_ctx *ctx = m2m_priv; |
814 | struct coda_dev *pcdev = ctx->dev; | 816 | struct coda_dev *pcdev = ctx->dev; |
817 | |||
815 | mutex_lock(&pcdev->dev_mutex); | 818 | mutex_lock(&pcdev->dev_mutex); |
816 | } | 819 | } |
817 | 820 | ||
@@ -819,6 +822,7 @@ static void coda_unlock(void *m2m_priv) | |||
819 | { | 822 | { |
820 | struct coda_ctx *ctx = m2m_priv; | 823 | struct coda_ctx *ctx = m2m_priv; |
821 | struct coda_dev *pcdev = ctx->dev; | 824 | struct coda_dev *pcdev = ctx->dev; |
825 | |||
822 | mutex_unlock(&pcdev->dev_mutex); | 826 | mutex_unlock(&pcdev->dev_mutex); |
823 | } | 827 | } |
824 | 828 | ||
@@ -995,7 +999,8 @@ int coda_alloc_aux_buf(struct coda_dev *dev, struct coda_aux_buf *buf, | |||
995 | if (name && parent) { | 999 | if (name && parent) { |
996 | buf->blob.data = buf->vaddr; | 1000 | buf->blob.data = buf->vaddr; |
997 | buf->blob.size = size; | 1001 | buf->blob.size = size; |
998 | buf->dentry = debugfs_create_blob(name, 0644, parent, &buf->blob); | 1002 | buf->dentry = debugfs_create_blob(name, 0644, parent, |
1003 | &buf->blob); | ||
999 | if (!buf->dentry) | 1004 | if (!buf->dentry) |
1000 | dev_warn(&dev->plat_dev->dev, | 1005 | dev_warn(&dev->plat_dev->dev, |
1001 | "failed to create debugfs entry %s\n", name); | 1006 | "failed to create debugfs entry %s\n", name); |
@@ -1276,17 +1281,20 @@ static int coda_ctrls_setup(struct coda_ctx *ctx) | |||
1276 | v4l2_ctrl_new_std(&ctx->ctrls, &coda_ctrl_ops, | 1281 | v4l2_ctrl_new_std(&ctx->ctrls, &coda_ctrl_ops, |
1277 | V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_MB, 1, 0x3fffffff, 1, 1); | 1282 | V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_MB, 1, 0x3fffffff, 1, 1); |
1278 | v4l2_ctrl_new_std(&ctx->ctrls, &coda_ctrl_ops, | 1283 | v4l2_ctrl_new_std(&ctx->ctrls, &coda_ctrl_ops, |
1279 | V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_BYTES, 1, 0x3fffffff, 1, 500); | 1284 | V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_BYTES, 1, 0x3fffffff, 1, |
1285 | 500); | ||
1280 | v4l2_ctrl_new_std_menu(&ctx->ctrls, &coda_ctrl_ops, | 1286 | v4l2_ctrl_new_std_menu(&ctx->ctrls, &coda_ctrl_ops, |
1281 | V4L2_CID_MPEG_VIDEO_HEADER_MODE, | 1287 | V4L2_CID_MPEG_VIDEO_HEADER_MODE, |
1282 | V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME, | 1288 | V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME, |
1283 | (1 << V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE), | 1289 | (1 << V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE), |
1284 | V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME); | 1290 | V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME); |
1285 | v4l2_ctrl_new_std(&ctx->ctrls, &coda_ctrl_ops, | 1291 | v4l2_ctrl_new_std(&ctx->ctrls, &coda_ctrl_ops, |
1286 | V4L2_CID_MPEG_VIDEO_CYCLIC_INTRA_REFRESH_MB, 0, 1920 * 1088 / 256, 1, 0); | 1292 | V4L2_CID_MPEG_VIDEO_CYCLIC_INTRA_REFRESH_MB, 0, |
1293 | 1920 * 1088 / 256, 1, 0); | ||
1287 | 1294 | ||
1288 | if (ctx->ctrls.error) { | 1295 | if (ctx->ctrls.error) { |
1289 | v4l2_err(&ctx->dev->v4l2_dev, "control initialization error (%d)", | 1296 | v4l2_err(&ctx->dev->v4l2_dev, |
1297 | "control initialization error (%d)", | ||
1290 | ctx->ctrls.error); | 1298 | ctx->ctrls.error); |
1291 | return -EINVAL; | 1299 | return -EINVAL; |
1292 | } | 1300 | } |
@@ -1365,7 +1373,7 @@ static int coda_open(struct file *file, enum coda_inst_type inst_type, | |||
1365 | int ret; | 1373 | int ret; |
1366 | int idx; | 1374 | int idx; |
1367 | 1375 | ||
1368 | ctx = kzalloc(sizeof *ctx, GFP_KERNEL); | 1376 | ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); |
1369 | if (!ctx) | 1377 | if (!ctx) |
1370 | return -ENOMEM; | 1378 | return -ENOMEM; |
1371 | 1379 | ||
@@ -1444,7 +1452,8 @@ static int coda_open(struct file *file, enum coda_inst_type inst_type, | |||
1444 | ctx->bitstream.vaddr = dma_alloc_writecombine(&dev->plat_dev->dev, | 1452 | ctx->bitstream.vaddr = dma_alloc_writecombine(&dev->plat_dev->dev, |
1445 | ctx->bitstream.size, &ctx->bitstream.paddr, GFP_KERNEL); | 1453 | ctx->bitstream.size, &ctx->bitstream.paddr, GFP_KERNEL); |
1446 | if (!ctx->bitstream.vaddr) { | 1454 | if (!ctx->bitstream.vaddr) { |
1447 | v4l2_err(&dev->v4l2_dev, "failed to allocate bitstream ringbuffer"); | 1455 | v4l2_err(&dev->v4l2_dev, |
1456 | "failed to allocate bitstream ringbuffer"); | ||
1448 | ret = -ENOMEM; | 1457 | ret = -ENOMEM; |
1449 | goto err_dma_writecombine; | 1458 | goto err_dma_writecombine; |
1450 | } | 1459 | } |
@@ -1617,10 +1626,12 @@ static int coda_hw_init(struct coda_dev *dev) | |||
1617 | /* Set default values */ | 1626 | /* Set default values */ |
1618 | switch (dev->devtype->product) { | 1627 | switch (dev->devtype->product) { |
1619 | case CODA_DX6: | 1628 | case CODA_DX6: |
1620 | coda_write(dev, CODADX6_STREAM_BUF_PIC_FLUSH, CODA_REG_BIT_STREAM_CTRL); | 1629 | coda_write(dev, CODADX6_STREAM_BUF_PIC_FLUSH, |
1630 | CODA_REG_BIT_STREAM_CTRL); | ||
1621 | break; | 1631 | break; |
1622 | default: | 1632 | default: |
1623 | coda_write(dev, CODA7_STREAM_BUF_PIC_FLUSH, CODA_REG_BIT_STREAM_CTRL); | 1633 | coda_write(dev, CODA7_STREAM_BUF_PIC_FLUSH, |
1634 | CODA_REG_BIT_STREAM_CTRL); | ||
1624 | } | 1635 | } |
1625 | if (dev->devtype->product == CODA_960) | 1636 | if (dev->devtype->product == CODA_960) |
1626 | coda_write(dev, 1 << 12, CODA_REG_BIT_FRAME_MEM_CTRL); | 1637 | coda_write(dev, 1 << 12, CODA_REG_BIT_FRAME_MEM_CTRL); |
@@ -1854,7 +1865,7 @@ static int coda_probe(struct platform_device *pdev) | |||
1854 | struct resource *res; | 1865 | struct resource *res; |
1855 | int ret, irq; | 1866 | int ret, irq; |
1856 | 1867 | ||
1857 | dev = devm_kzalloc(&pdev->dev, sizeof *dev, GFP_KERNEL); | 1868 | dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); |
1858 | if (!dev) { | 1869 | if (!dev) { |
1859 | dev_err(&pdev->dev, "Not enough memory for %s\n", | 1870 | dev_err(&pdev->dev, "Not enough memory for %s\n", |
1860 | CODA_NAME); | 1871 | CODA_NAME); |
@@ -1905,7 +1916,8 @@ static int coda_probe(struct platform_device *pdev) | |||
1905 | if (ret == -ENOENT || ret == -ENOSYS) { | 1916 | if (ret == -ENOENT || ret == -ENOSYS) { |
1906 | dev->rstc = NULL; | 1917 | dev->rstc = NULL; |
1907 | } else { | 1918 | } else { |
1908 | dev_err(&pdev->dev, "failed get reset control: %d\n", ret); | 1919 | dev_err(&pdev->dev, "failed get reset control: %d\n", |
1920 | ret); | ||
1909 | return ret; | 1921 | return ret; |
1910 | } | 1922 | } |
1911 | } | 1923 | } |