diff for duplicates of <2597148.lBPpEOX3Ao@avalon> diff --git a/a/1.txt b/N1/1.txt index b405e52..1dfe378 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -550,9 +550,11 @@ How about adding a timeout ? > + > +/* > + * -> =====================================> = + * video ioctl operations +> =========================================================================== +> = + * video ioctl operations > + * -> =====================================> = + */ +> =========================================================================== +> = + */ > +static void put_byte(unsigned long *p, u8 v) > +{ > + u8 *addr = (u8 *)*p; @@ -631,7 +633,7 @@ Wouldn't a memcpy be more efficient ? > + put_byte(&p, 0x03); > + put_byte(&p, 0x01); > + -> + if (q->fmt->fourcc = V4L2_PIX_FMT_NV16) +> + if (q->fmt->fourcc == V4L2_PIX_FMT_NV16) > + put_byte(&p, 0x21); > + else > + put_byte(&p, 0x22); @@ -656,7 +658,7 @@ conversions that way. > +{ > + struct jpu_ctx *ctx = fh_to_ctx(priv); > + -> + if (ctx->mode = JPU_ENCODE) { +> + if (ctx->mode == JPU_ENCODE) { > + strlcpy(cap->driver, JPU_M2M_NAME " encoder", > + sizeof(cap->driver)); > + strlcpy(cap->card, JPU_M2M_NAME " encoder", @@ -679,11 +681,11 @@ conversions that way. > +{ > + unsigned int k, fmt_flag; > + -> + if (mode = JPU_ENCODE) -> + fmt_flag = (fmt_type = JPU_FMT_TYPE_OUTPUT) ? JPU_ENC_OUTPUT : +> + if (mode == JPU_ENCODE) +> + fmt_flag = (fmt_type == JPU_FMT_TYPE_OUTPUT) ? JPU_ENC_OUTPUT : > + JPU_ENC_CAPTURE; > + else -> + fmt_flag = (fmt_type = JPU_FMT_TYPE_OUTPUT) ? JPU_DEC_OUTPUT : +> + fmt_flag = (fmt_type == JPU_FMT_TYPE_OUTPUT) ? JPU_DEC_OUTPUT : > + JPU_DEC_CAPTURE; > + > + for (k = 0; k < ARRAY_SIZE(jpu_formats); k++) { @@ -692,7 +694,7 @@ Anything wrong with i as a loop index ? :-) > + struct jpu_fmt *fmt = &jpu_formats[k]; > + -> + if (fmt->fourcc = pixelformat && fmt->types & fmt_flag) +> + if (fmt->fourcc == pixelformat && fmt->types & fmt_flag) > + return fmt; > + } > + @@ -706,7 +708,7 @@ Anything wrong with i as a loop index ? :-) > + for (i = 0; i < ARRAY_SIZE(jpu_formats); ++i) { > + if (jpu_formats[i].types & type) { > + /* index-th format of type type found ? */ -> + if (num = f->index) +> + if (num == f->index) > + break; > + /* > + * Correct type but haven't reached our index yet, @@ -731,7 +733,7 @@ Anything wrong with i as a loop index ? :-) > +{ > + struct jpu_ctx *ctx = fh_to_ctx(priv); > + -> + if (ctx->mode = JPU_ENCODE) +> + if (ctx->mode == JPU_ENCODE) > + return jpu_enum_fmt(f, JPU_ENC_CAPTURE); > + > + return jpu_enum_fmt(f, JPU_DEC_CAPTURE); @@ -742,7 +744,7 @@ Anything wrong with i as a loop index ? :-) > +{ > + struct jpu_ctx *ctx = fh_to_ctx(priv); > + -> + if (ctx->mode = JPU_ENCODE) +> + if (ctx->mode == JPU_ENCODE) > + return jpu_enum_fmt(f, JPU_ENC_OUTPUT); > + > + return jpu_enum_fmt(f, JPU_DEC_OUTPUT); @@ -775,8 +777,8 @@ Can the default case occur ? > + if (!vq) > + return -EINVAL; > + -> + if (f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE && -> + ctx->mode = JPU_DECODE && !ctx->hdr_parsed) +> + if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && +> + ctx->mode == JPU_DECODE && !ctx->hdr_parsed) > + return -EINVAL; I wonder if -EINVAL is the proper error code to be returned here. We want to @@ -849,7 +851,7 @@ These should be unsigned. > + fmt->h_align, &pix->height, JPU_HEIGHT_MIN, > + JPU_HEIGHT_MAX, fmt->v_align); > + -> + if (fmt->fourcc = V4L2_PIX_FMT_JPEG) { +> + if (fmt->fourcc == V4L2_PIX_FMT_JPEG) { > + if (pix->sizeimage <= 0) > + pix->sizeimage = PAGE_SIZE; @@ -960,7 +962,7 @@ A leftover ? > + > + spin_lock_irqsave(&ctx->jpu->slock, flags); > + -> + if (ctrl->id = V4L2_CID_JPEG_COMPRESSION_QUALITY) +> + if (ctrl->id == V4L2_CID_JPEG_COMPRESSION_QUALITY) > + ctx->compr_quality = ctrl->val; > + > + spin_unlock_irqrestore(&ctx->jpu->slock, flags); @@ -1020,7 +1022,7 @@ Can't you just leave the operations unimplemented ? You have a single control, so you could use 1 instead of 3. -> + if (ctx->mode = JPU_ENCODE) { +> + if (ctx->mode == JPU_ENCODE) { > + v4l2_ctrl_new_std(&ctx->ctrl_handler, &jpu_ctrl_ops, > + V4L2_CID_JPEG_COMPRESSION_QUALITY, > + 0, 1, 1, 1); @@ -1029,7 +1031,7 @@ You have a single control, so you could use 1 instead of 3. > + if (ctx->ctrl_handler.error) > + return ctx->ctrl_handler.error; > + -> + if (ctx->mode = JPU_DECODE) +> + if (ctx->mode == JPU_DECODE) > + ctrl->flags |= V4L2_CTRL_FLAG_VOLATILE | > + V4L2_CTRL_FLAG_READ_ONLY; @@ -1040,9 +1042,11 @@ ctrl isn't initialized. > + > +/* > + * -> =====================================> = + * Queue operations +> =========================================================================== +> = + * Queue operations > + * -> =====================================> = + */ +> =========================================================================== +> = + */ > +static int jpu_queue_setup(struct vb2_queue *vq, > + const struct v4l2_format *fmt, > + unsigned int *nbuffers, unsigned int *nplanes, @@ -1053,7 +1057,7 @@ ctrl isn't initialized. > + unsigned int size, count = *nbuffers; > + > + q_data = jpu_get_q_data(ctx, vq->type); -> + if (q_data = NULL) +> + if (q_data == NULL) > + return -EINVAL; > + > + size = q_data->size; @@ -1062,7 +1066,7 @@ ctrl isn't initialized. > + * Header is parsed during decoding and parsed information stored > + * in the context so we do not allow another buffer to overwrite it > + */ -> + if (ctx->mode = JPU_DECODE) +> + if (ctx->mode == JPU_DECODE) > + count = 1; > + > + *nbuffers = count; @@ -1079,7 +1083,7 @@ ctrl isn't initialized. > + struct jpu_q_data *q_data; > + > + q_data = jpu_get_q_data(ctx, vb->vb2_queue->type); -> + if (q_data = NULL) +> + if (q_data == NULL) > + return -EINVAL; > + > + if (vb2_plane_size(vb, 0) < q_data->size) { @@ -1097,8 +1101,8 @@ ctrl isn't initialized. > +{ > + struct jpu_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue); > + -> + if (ctx->mode = JPU_DECODE && -> + vb->vb2_queue->type = V4L2_BUF_TYPE_VIDEO_OUTPUT) { +> + if (ctx->mode == JPU_DECODE && +> + vb->vb2_queue->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) { > + struct jpu_q_data *q_data; > + struct jpu *jpu = ctx->jpu; > + unsigned int subsampling, w_out, h_out, w_cap, h_cap; @@ -1123,7 +1127,7 @@ ctrl isn't initialized. > + if (wait_event_interruptible_timeout(jpu->wq, > + jpu->status != JPU_BUSY, > + msecs_to_jiffies(100)) > 0 -> + && jpu->status = JPU_OK) +> + && jpu->status == JPU_OK) > + ctx->hdr_parsed = true; > + > + w_out = ioread32(jpu->regs + JCHSZU) << 8 | @@ -1165,7 +1169,8 @@ ctrl isn't initialized. > + q_data->fmt = jpu_find_format(JPU_DECODE, subsampling, > + JPU_FMT_TYPE_CAPTURE); > + -> + q_data->size > + (q_data->w * q_data->h * q_data->fmt->depth) >> 3; +> + q_data->size = +> + (q_data->w * q_data->h * q_data->fmt->depth) >> 3; > + } > + > + if (ctx->fh.m2m_ctx) @@ -1228,9 +1233,11 @@ like to encourage userspace to move from USERPTR to DMABUF. > + > +/* > + * -> =====================================> = + * Device file operations +> =========================================================================== +> = + * Device file operations > + * -> =====================================> = + */ +> =========================================================================== +> = + */ > +static int jpu_open(struct file *file) > +{ > + struct jpu *jpu = video_drvdata(file); @@ -1266,7 +1273,7 @@ No need to initialize ret to 0. > + cap_q->h = JPU_DEFAULT_HEIGHT; > + > + ctx->jpu = jpu; -> + if (vfd = jpu->vfd_encoder) { +> + if (vfd == jpu->vfd_encoder) { > + ctx->mode = JPU_ENCODE; > + out_q->fmt = jpu_find_format(ctx->mode, V4L2_PIX_FMT_NV16, > + JPU_FMT_TYPE_OUTPUT); @@ -1297,7 +1304,7 @@ No need to initialize ret to 0. > + if (ret < 0) > + goto error; > + -> + if (jpu->ref_count = 0) { +> + if (jpu->ref_count == 0) { > + ret = clk_prepare_enable(jpu->clk); > + if (ret < 0) > + goto error; @@ -1323,7 +1330,7 @@ No need to initialize ret to 0. > + struct jpu_ctx *ctx = fh_to_ctx(file->private_data); > + > + mutex_lock(&jpu->mutex); -> + if (--jpu->ref_count = 0) +> + if (--jpu->ref_count == 0) > + clk_disable_unprepare(jpu->clk); > + v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); > + v4l2_ctrl_handler_free(&ctx->ctrl_handler); @@ -1346,9 +1353,11 @@ No need to initialize ret to 0. > + > +/* > + * -> =====================================> = + * mem2mem callbacks +> =========================================================================== +> = + * mem2mem callbacks > + * -> =====================================> = + */ +> =========================================================================== +> = + */ > +static void jpu_device_run(void *priv) > +{ > + struct jpu_ctx *ctx = priv; @@ -1372,7 +1381,7 @@ not spin_lock_irq is enough. > + > + jpu_reset(jpu->regs); > + -> + if (ctx->mode = JPU_ENCODE) { +> + if (ctx->mode == JPU_ENCODE) { > + unsigned int redu, inft; > + > + w = ctx->out_q.w; @@ -1380,7 +1389,7 @@ not spin_lock_irq is enough. > + > + jpu_generate_hdr(&ctx->out_q, ctx->compr_quality, dst_vaddr); > + -> + if (ctx->out_q.fmt->fourcc = V4L2_PIX_FMT_NV12) { +> + if (ctx->out_q.fmt->fourcc == V4L2_PIX_FMT_NV12) { > + redu = JCMOD_REDU_420; > + inft = JIFECNT_INFT_420; > + } else { @@ -1447,7 +1456,7 @@ not spin_lock_irq is enough. > +{ > + struct jpu_ctx *ctx = priv; > + -> + if (ctx->mode = JPU_DECODE) +> + if (ctx->mode == JPU_DECODE) > + return ctx->hdr_parsed; > + return 1; > +} @@ -1464,9 +1473,11 @@ not spin_lock_irq is enough. > + > +/* > + * -> =====================================> = + * IRQ handler +> =========================================================================== +> = + * IRQ handler > + * -> =====================================> = + */ +> =========================================================================== +> = + */ > +static irqreturn_t jpu_irq_handler(int irq, void *dev_id) > +{ > + struct jpu *jpu = dev_id; @@ -1495,7 +1506,7 @@ them ? > + return IRQ_NONE; > + } > + -> + if (jpu->status = JPU_BUSY) { +> + if (jpu->status == JPU_BUSY) { > + if (int_status & INT(3)) > + jpu->status = JPU_OK; > + if (int_status & INT(5)) @@ -1513,7 +1524,7 @@ them ? > + dst_buf = v4l2_m2m_dst_buf_remove(curr_ctx->fh.m2m_ctx); > + > + if (int_status & INT(10)) { -> + if (curr_ctx->mode = JPU_ENCODE) { +> + if (curr_ctx->mode == JPU_ENCODE) { > + payload_size = ioread32(jpu->regs + JCDTCU) << 16 | > + ioread32(jpu->regs + JCDTCM) << 8 | > + ioread32(jpu->regs + JCDTCD); @@ -1538,9 +1549,11 @@ them ? > + > +/* > + * -> =====================================> = + * Driver basic infrastructure +> =========================================================================== +> = + * Driver basic infrastructure > + * -> =====================================> = + */ +> =========================================================================== +> = + */ > +static const struct of_device_id jpu_dt_ids[] = { > + { .compatible = "renesas,jpu-r8a7790" }, > + { .compatible = "renesas,jpu-r8a7791" }, @@ -1727,7 +1740,7 @@ Neither is this one. > +{ > + struct jpu *jpu = dev_get_drvdata(dev); > + -> + if (jpu->ref_count = 0) +> + if (jpu->ref_count == 0) > + return 0; > + > + clk_disable_unprepare(jpu->clk); @@ -1741,7 +1754,7 @@ Neither is this one. > + > + if (jpu->ref_count) -Shouldn't this be ref_count = 0 ? +Shouldn't this be ref_count == 0 ? > + return 0; > + diff --git a/a/content_digest b/N1/content_digest index e5bd244..12490cd 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -2,7 +2,7 @@ "ref\01408969787-23132-1-git-send-email-mikhail.ulyanov@cogentembedded.com\0" "From\0Laurent Pinchart <laurent.pinchart@ideasonboard.com>\0" "Subject\0Re: [PATCH v2 1/6] V4L2: Add Renesas R-Car JPEG codec driver.\0" - "Date\0Fri, 26 Sep 2014 14:01:29 +0000\0" + "Date\0Fri, 26 Sep 2014 17:01:29 +0300\0" "To\0Mikhail Ulyanov <mikhail.ulyanov@cogentembedded.com>\0" "Cc\0horms@verge.net.au" magnus.damm@gmail.com @@ -567,9 +567,11 @@ "> +\n" "> +/*\n" "> + *\n" - "> =====================================> = + * video ioctl operations\n" + "> ===========================================================================\n" + "> = + * video ioctl operations\n" "> + *\n" - "> =====================================> = + */\n" + "> ===========================================================================\n" + "> = + */\n" "> +static void put_byte(unsigned long *p, u8 v)\n" "> +{\n" "> +\tu8 *addr = (u8 *)*p;\n" @@ -648,7 +650,7 @@ "> +\tput_byte(&p, 0x03);\n" "> +\tput_byte(&p, 0x01);\n" "> +\n" - "> +\tif (q->fmt->fourcc = V4L2_PIX_FMT_NV16)\n" + "> +\tif (q->fmt->fourcc == V4L2_PIX_FMT_NV16)\n" "> +\t\tput_byte(&p, 0x21);\n" "> +\telse\n" "> +\t\tput_byte(&p, 0x22);\n" @@ -673,7 +675,7 @@ "> +{\n" "> +\tstruct jpu_ctx *ctx = fh_to_ctx(priv);\n" "> +\n" - "> +\tif (ctx->mode = JPU_ENCODE) {\n" + "> +\tif (ctx->mode == JPU_ENCODE) {\n" "> +\t\tstrlcpy(cap->driver, JPU_M2M_NAME \" encoder\",\n" "> +\t\t\tsizeof(cap->driver));\n" "> +\t\tstrlcpy(cap->card, JPU_M2M_NAME \" encoder\",\n" @@ -696,11 +698,11 @@ "> +{\n" "> +\tunsigned int k, fmt_flag;\n" "> +\n" - "> +\tif (mode = JPU_ENCODE)\n" - "> +\t\tfmt_flag = (fmt_type = JPU_FMT_TYPE_OUTPUT) ? JPU_ENC_OUTPUT :\n" + "> +\tif (mode == JPU_ENCODE)\n" + "> +\t\tfmt_flag = (fmt_type == JPU_FMT_TYPE_OUTPUT) ? JPU_ENC_OUTPUT :\n" "> +\t\t\t\t\t\t\t JPU_ENC_CAPTURE;\n" "> +\telse\n" - "> +\t\tfmt_flag = (fmt_type = JPU_FMT_TYPE_OUTPUT) ? JPU_DEC_OUTPUT :\n" + "> +\t\tfmt_flag = (fmt_type == JPU_FMT_TYPE_OUTPUT) ? JPU_DEC_OUTPUT :\n" "> +\t\t\t\t\t\t\t JPU_DEC_CAPTURE;\n" "> +\n" "> +\tfor (k = 0; k < ARRAY_SIZE(jpu_formats); k++) {\n" @@ -709,7 +711,7 @@ "\n" "> +\t\tstruct jpu_fmt *fmt = &jpu_formats[k];\n" "> +\n" - "> +\t\tif (fmt->fourcc = pixelformat && fmt->types & fmt_flag)\n" + "> +\t\tif (fmt->fourcc == pixelformat && fmt->types & fmt_flag)\n" "> +\t\t\treturn fmt;\n" "> +\t}\n" "> +\n" @@ -723,7 +725,7 @@ "> +\tfor (i = 0; i < ARRAY_SIZE(jpu_formats); ++i) {\n" "> +\t\tif (jpu_formats[i].types & type) {\n" "> +\t\t\t/* index-th format of type type found ? */\n" - "> +\t\t\tif (num = f->index)\n" + "> +\t\t\tif (num == f->index)\n" "> +\t\t\t\tbreak;\n" "> +\t\t\t/*\n" "> +\t\t\t * Correct type but haven't reached our index yet,\n" @@ -748,7 +750,7 @@ "> +{\n" "> +\tstruct jpu_ctx *ctx = fh_to_ctx(priv);\n" "> +\n" - "> +\tif (ctx->mode = JPU_ENCODE)\n" + "> +\tif (ctx->mode == JPU_ENCODE)\n" "> +\t\treturn jpu_enum_fmt(f, JPU_ENC_CAPTURE);\n" "> +\n" "> +\treturn jpu_enum_fmt(f, JPU_DEC_CAPTURE);\n" @@ -759,7 +761,7 @@ "> +{\n" "> +\tstruct jpu_ctx *ctx = fh_to_ctx(priv);\n" "> +\n" - "> +\tif (ctx->mode = JPU_ENCODE)\n" + "> +\tif (ctx->mode == JPU_ENCODE)\n" "> +\t\treturn jpu_enum_fmt(f, JPU_ENC_OUTPUT);\n" "> +\n" "> +\treturn jpu_enum_fmt(f, JPU_DEC_OUTPUT);\n" @@ -792,8 +794,8 @@ "> +\tif (!vq)\n" "> +\t\treturn -EINVAL;\n" "> +\n" - "> +\tif (f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE &&\n" - "> +\t ctx->mode = JPU_DECODE && !ctx->hdr_parsed)\n" + "> +\tif (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE &&\n" + "> +\t ctx->mode == JPU_DECODE && !ctx->hdr_parsed)\n" "> +\t\treturn -EINVAL;\n" "\n" "I wonder if -EINVAL is the proper error code to be returned here. We want to \n" @@ -866,7 +868,7 @@ "> +\t\t\t fmt->h_align, &pix->height, JPU_HEIGHT_MIN,\n" "> +\t\t\t JPU_HEIGHT_MAX, fmt->v_align);\n" "> +\n" - "> +\tif (fmt->fourcc = V4L2_PIX_FMT_JPEG) {\n" + "> +\tif (fmt->fourcc == V4L2_PIX_FMT_JPEG) {\n" "> +\t\tif (pix->sizeimage <= 0)\n" "> +\t\t\tpix->sizeimage = PAGE_SIZE;\n" "\n" @@ -977,7 +979,7 @@ "> +\n" "> +\tspin_lock_irqsave(&ctx->jpu->slock, flags);\n" "> +\n" - "> +\tif (ctrl->id = V4L2_CID_JPEG_COMPRESSION_QUALITY)\n" + "> +\tif (ctrl->id == V4L2_CID_JPEG_COMPRESSION_QUALITY)\n" "> +\t\tctx->compr_quality = ctrl->val;\n" "> +\n" "> +\tspin_unlock_irqrestore(&ctx->jpu->slock, flags);\n" @@ -1037,7 +1039,7 @@ "\n" "You have a single control, so you could use 1 instead of 3.\n" "\n" - "> +\tif (ctx->mode = JPU_ENCODE) {\n" + "> +\tif (ctx->mode == JPU_ENCODE) {\n" "> +\t\tv4l2_ctrl_new_std(&ctx->ctrl_handler, &jpu_ctrl_ops,\n" "> +\t\t\t\t V4L2_CID_JPEG_COMPRESSION_QUALITY,\n" "> +\t\t\t\t 0, 1, 1, 1);\n" @@ -1046,7 +1048,7 @@ "> +\tif (ctx->ctrl_handler.error)\n" "> +\t\treturn ctx->ctrl_handler.error;\n" "> +\n" - "> +\tif (ctx->mode = JPU_DECODE)\n" + "> +\tif (ctx->mode == JPU_DECODE)\n" "> +\t\tctrl->flags |= V4L2_CTRL_FLAG_VOLATILE |\n" "> +\t\t\t V4L2_CTRL_FLAG_READ_ONLY;\n" "\n" @@ -1057,9 +1059,11 @@ "> +\n" "> +/*\n" "> + *\n" - "> =====================================> = + * Queue operations\n" + "> ===========================================================================\n" + "> = + * Queue operations\n" "> + *\n" - "> =====================================> = + */\n" + "> ===========================================================================\n" + "> = + */\n" "> +static int jpu_queue_setup(struct vb2_queue *vq,\n" "> +\t\t\t const struct v4l2_format *fmt,\n" "> +\t\t\t unsigned int *nbuffers, unsigned int *nplanes,\n" @@ -1070,7 +1074,7 @@ "> +\tunsigned int size, count = *nbuffers;\n" "> +\n" "> +\tq_data = jpu_get_q_data(ctx, vq->type);\n" - "> +\tif (q_data = NULL)\n" + "> +\tif (q_data == NULL)\n" "> +\t\treturn -EINVAL;\n" "> +\n" "> +\tsize = q_data->size;\n" @@ -1079,7 +1083,7 @@ "> +\t * Header is parsed during decoding and parsed information stored\n" "> +\t * in the context so we do not allow another buffer to overwrite it\n" "> +\t */\n" - "> +\tif (ctx->mode = JPU_DECODE)\n" + "> +\tif (ctx->mode == JPU_DECODE)\n" "> +\t\tcount = 1;\n" "> +\n" "> +\t*nbuffers = count;\n" @@ -1096,7 +1100,7 @@ "> +\tstruct jpu_q_data *q_data;\n" "> +\n" "> +\tq_data = jpu_get_q_data(ctx, vb->vb2_queue->type);\n" - "> +\tif (q_data = NULL)\n" + "> +\tif (q_data == NULL)\n" "> +\t\treturn -EINVAL;\n" "> +\n" "> +\tif (vb2_plane_size(vb, 0) < q_data->size) {\n" @@ -1114,8 +1118,8 @@ "> +{\n" "> +\tstruct jpu_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);\n" "> +\n" - "> +\tif (ctx->mode = JPU_DECODE &&\n" - "> +\t\tvb->vb2_queue->type = V4L2_BUF_TYPE_VIDEO_OUTPUT) {\n" + "> +\tif (ctx->mode == JPU_DECODE &&\n" + "> +\t\tvb->vb2_queue->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) {\n" "> +\t\tstruct jpu_q_data *q_data;\n" "> +\t\tstruct jpu *jpu = ctx->jpu;\n" "> +\t\tunsigned int subsampling, w_out, h_out, w_cap, h_cap;\n" @@ -1140,7 +1144,7 @@ "> +\t\tif (wait_event_interruptible_timeout(jpu->wq,\n" "> +\t\t\t\t\t\t jpu->status != JPU_BUSY,\n" "> +\t\t\t\t\t\t msecs_to_jiffies(100)) > 0\n" - "> +\t\t\t\t\t\t && jpu->status = JPU_OK)\n" + "> +\t\t\t\t\t\t && jpu->status == JPU_OK)\n" "> +\t\t\tctx->hdr_parsed = true;\n" "> +\n" "> +\t\tw_out = ioread32(jpu->regs + JCHSZU) << 8 |\n" @@ -1182,7 +1186,8 @@ "> +\t\tq_data->fmt = jpu_find_format(JPU_DECODE, subsampling,\n" "> +\t\t\t\t\t JPU_FMT_TYPE_CAPTURE);\n" "> +\n" - "> +\t\tq_data->size > +\t\t\t(q_data->w * q_data->h * q_data->fmt->depth) >> 3;\n" + "> +\t\tq_data->size =\n" + "> +\t\t\t(q_data->w * q_data->h * q_data->fmt->depth) >> 3;\n" "> +\t}\n" "> +\n" "> +\tif (ctx->fh.m2m_ctx)\n" @@ -1245,9 +1250,11 @@ "> +\n" "> +/*\n" "> + *\n" - "> =====================================> = + * Device file operations\n" + "> ===========================================================================\n" + "> = + * Device file operations\n" "> + *\n" - "> =====================================> = + */\n" + "> ===========================================================================\n" + "> = + */\n" "> +static int jpu_open(struct file *file)\n" "> +{\n" "> +\tstruct jpu *jpu = video_drvdata(file);\n" @@ -1283,7 +1290,7 @@ "> +\tcap_q->h = JPU_DEFAULT_HEIGHT;\n" "> +\n" "> +\tctx->jpu = jpu;\n" - "> +\tif (vfd = jpu->vfd_encoder) {\n" + "> +\tif (vfd == jpu->vfd_encoder) {\n" "> +\t\tctx->mode = JPU_ENCODE;\n" "> +\t\tout_q->fmt = jpu_find_format(ctx->mode, V4L2_PIX_FMT_NV16,\n" "> +\t\t\t\t\t JPU_FMT_TYPE_OUTPUT);\n" @@ -1314,7 +1321,7 @@ "> +\tif (ret < 0)\n" "> +\t\tgoto error;\n" "> +\n" - "> +\tif (jpu->ref_count = 0) {\n" + "> +\tif (jpu->ref_count == 0) {\n" "> +\t\tret = clk_prepare_enable(jpu->clk);\n" "> +\t\tif (ret < 0)\n" "> +\t\t\tgoto error;\n" @@ -1340,7 +1347,7 @@ "> +\tstruct jpu_ctx *ctx = fh_to_ctx(file->private_data);\n" "> +\n" "> +\tmutex_lock(&jpu->mutex);\n" - "> +\tif (--jpu->ref_count = 0)\n" + "> +\tif (--jpu->ref_count == 0)\n" "> +\t\tclk_disable_unprepare(jpu->clk);\n" "> +\tv4l2_m2m_ctx_release(ctx->fh.m2m_ctx);\n" "> +\tv4l2_ctrl_handler_free(&ctx->ctrl_handler);\n" @@ -1363,9 +1370,11 @@ "> +\n" "> +/*\n" "> + *\n" - "> =====================================> = + * mem2mem callbacks\n" + "> ===========================================================================\n" + "> = + * mem2mem callbacks\n" "> + *\n" - "> =====================================> = + */\n" + "> ===========================================================================\n" + "> = + */\n" "> +static void jpu_device_run(void *priv)\n" "> +{\n" "> +\tstruct jpu_ctx *ctx = priv;\n" @@ -1389,7 +1398,7 @@ "> +\n" "> +\tjpu_reset(jpu->regs);\n" "> +\n" - "> +\tif (ctx->mode = JPU_ENCODE) {\n" + "> +\tif (ctx->mode == JPU_ENCODE) {\n" "> +\t\tunsigned int redu, inft;\n" "> +\n" "> +\t\tw = ctx->out_q.w;\n" @@ -1397,7 +1406,7 @@ "> +\n" "> +\t\tjpu_generate_hdr(&ctx->out_q, ctx->compr_quality, dst_vaddr);\n" "> +\n" - "> +\t\tif (ctx->out_q.fmt->fourcc = V4L2_PIX_FMT_NV12) {\n" + "> +\t\tif (ctx->out_q.fmt->fourcc == V4L2_PIX_FMT_NV12) {\n" "> +\t\t\tredu = JCMOD_REDU_420;\n" "> +\t\t\tinft = JIFECNT_INFT_420;\n" "> +\t\t} else {\n" @@ -1464,7 +1473,7 @@ "> +{\n" "> +\tstruct jpu_ctx *ctx = priv;\n" "> +\n" - "> +\tif (ctx->mode = JPU_DECODE)\n" + "> +\tif (ctx->mode == JPU_DECODE)\n" "> +\t\treturn ctx->hdr_parsed;\n" "> +\treturn 1;\n" "> +}\n" @@ -1481,9 +1490,11 @@ "> +\n" "> +/*\n" "> + *\n" - "> =====================================> = + * IRQ handler\n" + "> ===========================================================================\n" + "> = + * IRQ handler\n" "> + *\n" - "> =====================================> = + */\n" + "> ===========================================================================\n" + "> = + */\n" "> +static irqreturn_t jpu_irq_handler(int irq, void *dev_id)\n" "> +{\n" "> +\tstruct jpu *jpu = dev_id;\n" @@ -1512,7 +1523,7 @@ "> +\t\treturn IRQ_NONE;\n" "> +\t}\n" "> +\n" - "> +\tif (jpu->status = JPU_BUSY) {\n" + "> +\tif (jpu->status == JPU_BUSY) {\n" "> +\t\tif (int_status & INT(3))\n" "> +\t\t\tjpu->status = JPU_OK;\n" "> +\t\tif (int_status & INT(5))\n" @@ -1530,7 +1541,7 @@ "> +\tdst_buf = v4l2_m2m_dst_buf_remove(curr_ctx->fh.m2m_ctx);\n" "> +\n" "> +\tif (int_status & INT(10)) {\n" - "> +\t\tif (curr_ctx->mode = JPU_ENCODE) {\n" + "> +\t\tif (curr_ctx->mode == JPU_ENCODE) {\n" "> +\t\t\tpayload_size = ioread32(jpu->regs + JCDTCU) << 16 |\n" "> +\t\t\t\t ioread32(jpu->regs + JCDTCM) << 8 |\n" "> +\t\t\t\t ioread32(jpu->regs + JCDTCD);\n" @@ -1555,9 +1566,11 @@ "> +\n" "> +/*\n" "> + *\n" - "> =====================================> = + * Driver basic infrastructure\n" + "> ===========================================================================\n" + "> = + * Driver basic infrastructure\n" "> + *\n" - "> =====================================> = + */\n" + "> ===========================================================================\n" + "> = + */\n" "> +static const struct of_device_id jpu_dt_ids[] = {\n" "> +\t{ .compatible = \"renesas,jpu-r8a7790\" },\n" "> +\t{ .compatible = \"renesas,jpu-r8a7791\" },\n" @@ -1744,7 +1757,7 @@ "> +{\n" "> +\tstruct jpu *jpu = dev_get_drvdata(dev);\n" "> +\n" - "> +\tif (jpu->ref_count = 0)\n" + "> +\tif (jpu->ref_count == 0)\n" "> +\t\treturn 0;\n" "> +\n" "> +\tclk_disable_unprepare(jpu->clk);\n" @@ -1758,7 +1771,7 @@ "> +\n" "> +\tif (jpu->ref_count)\n" "\n" - "Shouldn't this be ref_count = 0 ?\n" + "Shouldn't this be ref_count == 0 ?\n" "\n" "> +\t\treturn 0;\n" "> +\n" @@ -1795,4 +1808,4 @@ "\n" Laurent Pinchart -9024ccc8f61de8b1224e5ea7c95e0daf17acf7a8aa265fe0f79ffd5929d8c9ba +887fbcfc014d34208e82df997a578c0e879711c7d93ca9fb1af2a22118f47eb3
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.