forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/media/platform/rockchip/isp1/capture.c
....@@ -920,7 +920,7 @@
920920
921921 if (!dev->active_sensor ||
922922 (dev->active_sensor &&
923
- dev->active_sensor->mbus.type != V4L2_MBUS_CSI2)) {
923
+ dev->active_sensor->mbus.type != V4L2_MBUS_CSI2_DPHY)) {
924924 if (stream->id == RKISP1_STREAM_RAW)
925925 v4l2_err(&dev->v4l2_dev,
926926 "only mipi sensor support raw path\n");
....@@ -1381,7 +1381,7 @@
13811381 stream->out_fmt.plane_fmt[1].sizeimage,
13821382 stream->out_fmt.plane_fmt[2].sizeimage);
13831383 if (dev->active_sensor &&
1384
- dev->active_sensor->mbus.type == V4L2_MBUS_CSI2 &&
1384
+ dev->active_sensor->mbus.type == V4L2_MBUS_CSI2_DPHY &&
13851385 (dev->isp_ver == ISP_V12 ||
13861386 dev->isp_ver == ISP_V13)) {
13871387 u32 in_size;
....@@ -1412,12 +1412,25 @@
14121412 dummy_buf->vaddr, dummy_buf->dma_addr);
14131413 }
14141414
1415
-static void destroy_buf_queue(struct rkisp1_stream *stream,
1416
- enum vb2_buffer_state state)
1415
+static void rkisp1_stop_streaming(struct vb2_queue *queue)
14171416 {
1417
+ struct rkisp1_stream *stream = queue->drv_priv;
1418
+ struct rkisp1_vdev_node *node = &stream->vnode;
1419
+ struct rkisp1_device *dev = stream->ispdev;
1420
+ struct v4l2_device *v4l2_dev = &dev->v4l2_dev;
14181421 struct rkisp1_buffer *buf;
14191422 unsigned long lock_flags = 0;
1423
+ int ret;
14201424
1425
+ rkisp1_stream_stop(stream);
1426
+ /* call to the other devices */
1427
+ media_pipeline_stop(&node->vdev.entity);
1428
+ ret = dev->pipe.set_stream(&dev->pipe, false);
1429
+ if (ret < 0)
1430
+ v4l2_err(v4l2_dev, "pipeline stream-off failed error:%d\n",
1431
+ ret);
1432
+
1433
+ /* release buffers */
14211434 spin_lock_irqsave(&stream->vbq_lock, lock_flags);
14221435 if (stream->curr_buf) {
14231436 list_add_tail(&stream->curr_buf->queue, &stream->buf_queue);
....@@ -1433,29 +1446,9 @@
14331446 buf = list_first_entry(&stream->buf_queue,
14341447 struct rkisp1_buffer, queue);
14351448 list_del(&buf->queue);
1436
- vb2_buffer_done(&buf->vb.vb2_buf, state);
1449
+ vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
14371450 }
14381451 spin_unlock_irqrestore(&stream->vbq_lock, lock_flags);
1439
-}
1440
-
1441
-static void rkisp1_stop_streaming(struct vb2_queue *queue)
1442
-{
1443
- struct rkisp1_stream *stream = queue->drv_priv;
1444
- struct rkisp1_vdev_node *node = &stream->vnode;
1445
- struct rkisp1_device *dev = stream->ispdev;
1446
- struct v4l2_device *v4l2_dev = &dev->v4l2_dev;
1447
- int ret;
1448
-
1449
- rkisp1_stream_stop(stream);
1450
- /* call to the other devices */
1451
- media_pipeline_stop(&node->vdev.entity);
1452
- ret = dev->pipe.set_stream(&dev->pipe, false);
1453
- if (ret < 0)
1454
- v4l2_err(v4l2_dev, "pipeline stream-off failed error:%d\n",
1455
- ret);
1456
-
1457
- /* release buffers */
1458
- destroy_buf_queue(stream, VB2_BUF_STATE_ERROR);
14591452
14601453 ret = dev->pipe.close(&dev->pipe);
14611454 if (ret < 0)
....@@ -1506,6 +1499,7 @@
15061499 struct rkisp1_device *dev = stream->ispdev;
15071500 struct v4l2_device *v4l2_dev = &dev->v4l2_dev;
15081501 int ret;
1502
+ unsigned int i;
15091503
15101504 if (WARN_ON(stream->streaming))
15111505 return -EBUSY;
....@@ -1575,8 +1569,14 @@
15751569 destroy_dummy_buf:
15761570 rkisp1_destroy_dummy_buf(stream);
15771571 buffer_done:
1578
- destroy_buf_queue(stream, VB2_BUF_STATE_QUEUED);
1579
- stream->streaming = false;
1572
+ for (i = 0; i < queue->num_buffers; ++i) {
1573
+ struct vb2_buffer *vb;
1574
+
1575
+ vb = queue->bufs[i];
1576
+ if (vb->state == VB2_BUF_STATE_ACTIVE)
1577
+ vb2_buffer_done(vb, VB2_BUF_STATE_QUEUED);
1578
+ }
1579
+
15801580 return ret;
15811581 }
15821582
....@@ -1739,7 +1739,7 @@
17391739 ret = v4l2_fh_open(filp);
17401740 if (!ret) {
17411741 atomic_inc(&dev->open_cnt);
1742
- ret = v4l2_pipeline_pm_use(&stream->vnode.vdev.entity, 1);
1742
+ ret = v4l2_pipeline_pm_get(&stream->vnode.vdev.entity);
17431743 if (ret < 0)
17441744 vb2_fop_release(filp);
17451745 }
....@@ -1755,7 +1755,7 @@
17551755
17561756 ret = vb2_fop_release(file);
17571757 if (!ret) {
1758
- ret = v4l2_pipeline_pm_use(&stream->vnode.vdev.entity, 0);
1758
+ ret = v4l2_pipeline_pm_get(&stream->vnode.vdev.entity);
17591759 if (ret < 0)
17601760 v4l2_err(&dev->v4l2_dev,
17611761 "set pipeline power failed %d\n", ret);
....@@ -2075,7 +2075,7 @@
20752075 .vidioc_streamoff = vb2_ioctl_streamoff,
20762076 .vidioc_enum_input = rkisp1_enum_input,
20772077 .vidioc_try_fmt_vid_cap_mplane = rkisp1_try_fmt_vid_cap_mplane,
2078
- .vidioc_enum_fmt_vid_cap_mplane = rkisp1_enum_fmt_vid_cap_mplane,
2078
+ .vidioc_enum_fmt_vid_cap = rkisp1_enum_fmt_vid_cap_mplane,
20792079 .vidioc_s_fmt_vid_cap_mplane = rkisp1_s_fmt_vid_cap_mplane,
20802080 .vidioc_g_fmt_vid_cap_mplane = rkisp1_g_fmt_vid_cap_mplane,
20812081 .vidioc_s_selection = rkisp1_s_selection,
....@@ -2162,7 +2162,7 @@
21622162 V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
21632163 vdev->queue = &node->buf_queue;
21642164
2165
- ret = video_register_device(vdev, VFL_TYPE_GRABBER, -1);
2165
+ ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1);
21662166 if (ret < 0) {
21672167 v4l2_err(v4l2_dev,
21682168 "video_register_device failed with error %d\n", ret);