From 1543e317f1da31b75942316931e8f491a8920811 Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Thu, 04 Jan 2024 10:08:02 +0000
Subject: [PATCH] disable FB

---
 kernel/drivers/media/platform/rockchip/isp1/capture.c |   62 +++++++++++++++---------------
 1 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/kernel/drivers/media/platform/rockchip/isp1/capture.c b/kernel/drivers/media/platform/rockchip/isp1/capture.c
index eb8d827..9171a48 100644
--- a/kernel/drivers/media/platform/rockchip/isp1/capture.c
+++ b/kernel/drivers/media/platform/rockchip/isp1/capture.c
@@ -920,7 +920,7 @@
 
 	if (!dev->active_sensor ||
 	    (dev->active_sensor &&
-	     dev->active_sensor->mbus.type != V4L2_MBUS_CSI2)) {
+	     dev->active_sensor->mbus.type != V4L2_MBUS_CSI2_DPHY)) {
 		if (stream->id == RKISP1_STREAM_RAW)
 			v4l2_err(&dev->v4l2_dev,
 				 "only mipi sensor support raw path\n");
@@ -1381,7 +1381,7 @@
 		stream->out_fmt.plane_fmt[1].sizeimage,
 		stream->out_fmt.plane_fmt[2].sizeimage);
 	if (dev->active_sensor &&
-	    dev->active_sensor->mbus.type == V4L2_MBUS_CSI2 &&
+	    dev->active_sensor->mbus.type == V4L2_MBUS_CSI2_DPHY &&
 	    (dev->isp_ver == ISP_V12 ||
 	     dev->isp_ver == ISP_V13)) {
 		u32 in_size;
@@ -1412,12 +1412,25 @@
 			  dummy_buf->vaddr, dummy_buf->dma_addr);
 }
 
-static void destroy_buf_queue(struct rkisp1_stream *stream,
-			      enum vb2_buffer_state state)
+static void rkisp1_stop_streaming(struct vb2_queue *queue)
 {
+	struct rkisp1_stream *stream = queue->drv_priv;
+	struct rkisp1_vdev_node *node = &stream->vnode;
+	struct rkisp1_device *dev = stream->ispdev;
+	struct v4l2_device *v4l2_dev = &dev->v4l2_dev;
 	struct rkisp1_buffer *buf;
 	unsigned long lock_flags = 0;
+	int ret;
 
+	rkisp1_stream_stop(stream);
+	/* call to the other devices */
+	media_pipeline_stop(&node->vdev.entity);
+	ret = dev->pipe.set_stream(&dev->pipe, false);
+	if (ret < 0)
+		v4l2_err(v4l2_dev, "pipeline stream-off failed error:%d\n",
+			 ret);
+
+	/* release buffers */
 	spin_lock_irqsave(&stream->vbq_lock, lock_flags);
 	if (stream->curr_buf) {
 		list_add_tail(&stream->curr_buf->queue, &stream->buf_queue);
@@ -1433,29 +1446,9 @@
 		buf = list_first_entry(&stream->buf_queue,
 				       struct rkisp1_buffer, queue);
 		list_del(&buf->queue);
-		vb2_buffer_done(&buf->vb.vb2_buf, state);
+		vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
 	}
 	spin_unlock_irqrestore(&stream->vbq_lock, lock_flags);
-}
-
-static void rkisp1_stop_streaming(struct vb2_queue *queue)
-{
-	struct rkisp1_stream *stream = queue->drv_priv;
-	struct rkisp1_vdev_node *node = &stream->vnode;
-	struct rkisp1_device *dev = stream->ispdev;
-	struct v4l2_device *v4l2_dev = &dev->v4l2_dev;
-	int ret;
-
-	rkisp1_stream_stop(stream);
-	/* call to the other devices */
-	media_pipeline_stop(&node->vdev.entity);
-	ret = dev->pipe.set_stream(&dev->pipe, false);
-	if (ret < 0)
-		v4l2_err(v4l2_dev, "pipeline stream-off failed error:%d\n",
-			 ret);
-
-	/* release buffers */
-	destroy_buf_queue(stream, VB2_BUF_STATE_ERROR);
 
 	ret = dev->pipe.close(&dev->pipe);
 	if (ret < 0)
@@ -1506,6 +1499,7 @@
 	struct rkisp1_device *dev = stream->ispdev;
 	struct v4l2_device *v4l2_dev = &dev->v4l2_dev;
 	int ret;
+	unsigned int i;
 
 	if (WARN_ON(stream->streaming))
 		return -EBUSY;
@@ -1575,8 +1569,14 @@
 destroy_dummy_buf:
 	rkisp1_destroy_dummy_buf(stream);
 buffer_done:
-	destroy_buf_queue(stream, VB2_BUF_STATE_QUEUED);
-	stream->streaming = false;
+	for (i = 0; i < queue->num_buffers; ++i) {
+		struct vb2_buffer *vb;
+
+		vb = queue->bufs[i];
+		if (vb->state == VB2_BUF_STATE_ACTIVE)
+			vb2_buffer_done(vb, VB2_BUF_STATE_QUEUED);
+	}
+
 	return ret;
 }
 
@@ -1739,7 +1739,7 @@
 	ret = v4l2_fh_open(filp);
 	if (!ret) {
 		atomic_inc(&dev->open_cnt);
-		ret = v4l2_pipeline_pm_use(&stream->vnode.vdev.entity, 1);
+		ret = v4l2_pipeline_pm_get(&stream->vnode.vdev.entity);
 		if (ret < 0)
 			vb2_fop_release(filp);
 	}
@@ -1755,7 +1755,7 @@
 
 	ret = vb2_fop_release(file);
 	if (!ret) {
-		ret = v4l2_pipeline_pm_use(&stream->vnode.vdev.entity, 0);
+		ret = v4l2_pipeline_pm_get(&stream->vnode.vdev.entity);
 		if (ret < 0)
 			v4l2_err(&dev->v4l2_dev,
 				"set pipeline power failed %d\n", ret);
@@ -2075,7 +2075,7 @@
 	.vidioc_streamoff = vb2_ioctl_streamoff,
 	.vidioc_enum_input = rkisp1_enum_input,
 	.vidioc_try_fmt_vid_cap_mplane = rkisp1_try_fmt_vid_cap_mplane,
-	.vidioc_enum_fmt_vid_cap_mplane = rkisp1_enum_fmt_vid_cap_mplane,
+	.vidioc_enum_fmt_vid_cap = rkisp1_enum_fmt_vid_cap_mplane,
 	.vidioc_s_fmt_vid_cap_mplane = rkisp1_s_fmt_vid_cap_mplane,
 	.vidioc_g_fmt_vid_cap_mplane = rkisp1_g_fmt_vid_cap_mplane,
 	.vidioc_s_selection = rkisp1_s_selection,
@@ -2162,7 +2162,7 @@
 			     V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
 	vdev->queue = &node->buf_queue;
 
-	ret = video_register_device(vdev, VFL_TYPE_GRABBER, -1);
+	ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1);
 	if (ret < 0) {
 		v4l2_err(v4l2_dev,
 			 "video_register_device failed with error %d\n", ret);

--
Gitblit v1.6.2