Re: [PATCH v2 4/4] media: platform: mediatek: isp_30: add mediatek ISP3.0 camsv

From: Chun-Kuang Hu
Date: Sun Jul 02 2023 - 05:51:10 EST


Hi, Julien:

Julien Stephan <jstephan@xxxxxxxxxxxx> 於 2023年6月30日 週五 下午6:06寫道:
>
> From: Phi-bang Nguyen <pnguyen@xxxxxxxxxxxx>
>
> This driver provides a path to bypass the SoC ISP so that image data
> coming from the SENINF can go directly into memory without any image
> processing. This allows the use of an external ISP.
>
> Signed-off-by: Phi-bang Nguyen <pnguyen@xxxxxxxxxxxx>
> Signed-off-by: Florian Sylvestre <fsylvestre@xxxxxxxxxxxx>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
> Signed-off-by: Julien Stephan <jstephan@xxxxxxxxxxxx>
> ---

[snip]

> +
> +static irqreturn_t isp_irq_camsv30(int irq, void *data)
> +{
> + struct mtk_cam_dev *cam_dev = (struct mtk_cam_dev *)data;
> + struct mtk_cam_dev_buffer *buf;
> + unsigned long flags = 0;
> + unsigned int irq_status;
> +
> + spin_lock_irqsave(&cam_dev->irqlock, flags);
> +
> + irq_status = mtk_camsv30_read(cam_dev, CAMSV_INT_STATUS);
> +
> + if (irq_status & INT_ST_MASK_CAMSV_ERR) {
> + dev_err(cam_dev->dev, "irq error 0x%x\n",
> + (unsigned int)(irq_status & INT_ST_MASK_CAMSV_ERR));
> + }
> +
> + /* De-queue frame */
> + if (irq_status & CAMSV_IRQ_PASS1_DON) {
> + cam_dev->sequence++;
> +
> + if (!cam_dev->is_dummy_used) {
> + buf = list_first_entry_or_null(&cam_dev->buf_list,
> + struct mtk_cam_dev_buffer,
> + list);
> + if (buf) {
> + buf->v4l2_buf.sequence = cam_dev->sequence;
> + buf->v4l2_buf.vb2_buf.timestamp = ktime_get_ns();
> + vb2_buffer_done(&buf->v4l2_buf.vb2_buf,
> + VB2_BUF_STATE_DONE);
> + list_del(&buf->list);
> + }
> + }
> +
> + if (list_empty(&cam_dev->buf_list)) {
> + (*cam_dev->hw_functions->mtk_cam_update_buffers_add)
> + (cam_dev, &cam_dev->dummy);

It's not necessary to use function pointer. Call
mtk_camsv30_update_buffers_add() directly.

Regards,
Chun-Kuang.

> + cam_dev->is_dummy_used = true;
> + } else {
> + buf = list_first_entry_or_null(&cam_dev->buf_list,
> + struct mtk_cam_dev_buffer,
> + list);
> + (*cam_dev->hw_functions->mtk_cam_update_buffers_add)
> + (cam_dev, buf);
> + cam_dev->is_dummy_used = false;
> + }
> + }
> +
> + spin_unlock_irqrestore(&cam_dev->irqlock, flags);
> +
> + return IRQ_HANDLED;
> +}
> +