diff --git a/drivers/media/platform/rockchip/isp/capture_v32.c b/drivers/media/platform/rockchip/isp/capture_v32.c index 52a78de9eb94..9d76ff076a14 100644 --- a/drivers/media/platform/rockchip/isp/capture_v32.c +++ b/drivers/media/platform/rockchip/isp/capture_v32.c @@ -1081,20 +1081,20 @@ static void update_mi(struct rkisp_stream *stream) if (!ISP3X_ISP_OUT_LINE(rkisp_read(dev, ISP3X_ISP_DEBUG2, true))) { stream->ops->enable_mi(stream); stream_self_update(stream); - if (!stream->curr_buf) { - stream->curr_buf = stream->next_buf; - stream->next_buf = NULL; - } /* maybe no next buf to preclose mi */ stream->ops->disable_mi(stream); - } else if (stream->is_pause) { + } else { /* isp working and mi closed * config buf and enable mi, capture at next frame */ stream->ops->enable_mi(stream); stream->is_pause = false; } - } else if (stream->is_pause) { + if (!stream->curr_buf) { + stream->curr_buf = stream->next_buf; + stream->next_buf = NULL; + } + } else { /* isp working and mi no to close * config buf will auto update at frame end */ @@ -1143,11 +1143,12 @@ static void update_mi(struct rkisp_stream *stream) } v4l2_dbg(2, rkisp_debug, &dev->v4l2_dev, - "%s stream:%d Y:0x%x CB:0x%x | Y_SHD:0x%x\n", - __func__, stream->id, + "%s stream:%d cur:%p next:%p Y:0x%x CB:0x%x | Y_SHD:0x%x pause:%d stop:%d\n", + __func__, stream->id, stream->curr_buf, stream->next_buf, rkisp_read(dev, stream->config->mi.y_base_ad_init, false), rkisp_read(dev, stream->config->mi.cb_base_ad_init, false), - rkisp_read(dev, stream->config->mi.y_base_ad_shd, true)); + rkisp_read(dev, stream->config->mi.y_base_ad_shd, true), + stream->is_pause, stream->ops->is_stream_stopped(stream)); } static int set_mirror_flip(struct rkisp_stream *stream) @@ -1376,17 +1377,16 @@ static int mi_frame_start(struct rkisp_stream *stream, u32 mis) rkisp_stream_config_rsz(stream, false); stream->is_crop_upd = false; } - /* update buf for multi sensor at readback */ - if (!mis && !stream->ispdev->hw_dev->is_single && - !stream->curr_buf && - !list_empty(&stream->buf_queue)) { + if (!list_empty(&stream->buf_queue) && + ((dev->hw_dev->is_single && !stream->next_buf) || + (!dev->hw_dev->is_single && !stream->curr_buf))) { stream->next_buf = list_first_entry(&stream->buf_queue, struct rkisp_buffer, queue); list_del(&stream->next_buf->queue); stream->ops->update_mi(stream); } /* check frame loss */ - if (mis && stream->ops->is_stream_stopped(stream)) + if (stream->ops->is_stream_stopped(stream)) stream->dbg.frameloss++; } spin_unlock_irqrestore(&stream->vbq_lock, lock_flags); @@ -1678,16 +1678,7 @@ static void rkisp_buf_queue(struct vb2_buffer *vb) stream->id, ispbuf->buff_addr[0]); spin_lock_irqsave(&stream->vbq_lock, lock_flags); - /* single sensor with pingpong buf, update next if need */ - if (dev->hw_dev->is_single && - stream->id != RKISP_STREAM_VIR && - stream->id != RKISP_STREAM_LUMA && - stream->streaming && !stream->next_buf) { - stream->next_buf = ispbuf; - stream->ops->update_mi(stream); - } else { - list_add_tail(&ispbuf->queue, &stream->buf_queue); - } + list_add_tail(&ispbuf->queue, &stream->buf_queue); spin_unlock_irqrestore(&stream->vbq_lock, lock_flags); } diff --git a/drivers/media/platform/rockchip/isp/dev.c b/drivers/media/platform/rockchip/isp/dev.c index ebf4a8c02a76..a913914439f7 100644 --- a/drivers/media/platform/rockchip/isp/dev.c +++ b/drivers/media/platform/rockchip/isp/dev.c @@ -1167,7 +1167,7 @@ static void rkisp_pm_complete(struct device *dev) } for (i = 0; i < RKISP_MAX_STREAM; i++) { stream = &isp_dev->cap_dev.stream[i]; - if (i == RKISP_STREAM_VIR || !stream->streaming || !stream->curr_buf) + if (i == RKISP_STREAM_VIR || !stream->streaming) continue; /* skip first frame due to hw no reference frame information */ if (isp_dev->is_first_double) diff --git a/drivers/media/platform/rockchip/isp/isp_rockit.c b/drivers/media/platform/rockchip/isp/isp_rockit.c index 8fb41ec43afe..9c155d0973ef 100644 --- a/drivers/media/platform/rockchip/isp/isp_rockit.c +++ b/drivers/media/platform/rockchip/isp/isp_rockit.c @@ -202,16 +202,7 @@ int rkisp_rockit_buf_queue(struct rockit_cfg *input_rockit_cfg) stream->id, isprk_buf, isprk_buf->isp_buf.buff_addr[0], isprk_buf->isp_buf.buff_addr[1]); - /* single sensor with pingpong buf, update next if need */ - if (ispdev->hw_dev->is_single && !ispdev->is_suspend && - stream->id != RKISP_STREAM_VIR && - stream->id != RKISP_STREAM_LUMA && - stream->streaming && !stream->next_buf) { - stream->next_buf = &isprk_buf->isp_buf; - stream->ops->update_mi(stream); - } else { - list_add_tail(&isprk_buf->isp_buf.queue, &stream->buf_queue); - } + list_add_tail(&isprk_buf->isp_buf.queue, &stream->buf_queue); spin_unlock_irqrestore(&stream->vbq_lock, lock_flags); return 0; diff --git a/drivers/media/platform/rockchip/isp/rkisp.c b/drivers/media/platform/rockchip/isp/rkisp.c index c3eda3fa3fec..98792343a656 100644 --- a/drivers/media/platform/rockchip/isp/rkisp.c +++ b/drivers/media/platform/rockchip/isp/rkisp.c @@ -1075,6 +1075,9 @@ void rkisp_check_idle(struct rkisp_device *dev, u32 irq) unsigned long lock_flags = 0; u32 val = 0; + if (!IS_HDR_RDBK(dev->rd_mode)) + return; + spin_lock_irqsave(&dev->hw_dev->rdbk_lock, lock_flags); dev->irq_ends |= (irq & dev->irq_ends_mask); v4l2_dbg(3, rkisp_debug, &dev->v4l2_dev, @@ -1086,8 +1089,7 @@ void rkisp_check_idle(struct rkisp_device *dev, u32 irq) if (!completion_done(&dev->hw_dev->monitor.cmpl)) complete(&dev->hw_dev->monitor.cmpl); } - if ((dev->irq_ends & dev->irq_ends_mask) != dev->irq_ends_mask || - !IS_HDR_RDBK(dev->rd_mode)) { + if ((dev->irq_ends & dev->irq_ends_mask) != dev->irq_ends_mask) { spin_unlock_irqrestore(&dev->hw_dev->rdbk_lock, lock_flags); return; }