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/isp/isp_params.c | 102 ++++++++++++++++++++++++++++++++-------------------
1 files changed, 64 insertions(+), 38 deletions(-)
diff --git a/kernel/drivers/media/platform/rockchip/isp/isp_params.c b/kernel/drivers/media/platform/rockchip/isp/isp_params.c
index 020ff5a..03fd7fc 100644
--- a/kernel/drivers/media/platform/rockchip/isp/isp_params.c
+++ b/kernel/drivers/media/platform/rockchip/isp/isp_params.c
@@ -146,11 +146,12 @@
struct rkisp_buffer *params_buf = to_rkisp_buffer(vbuf);
struct vb2_queue *vq = vb->vb2_queue;
struct rkisp_isp_params_vdev *params_vdev = vq->drv_priv;
+ struct rkisp_device *dev = params_vdev->dev;
void *first_param;
unsigned long flags;
unsigned int cur_frame_id = -1;
- cur_frame_id = atomic_read(¶ms_vdev->dev->isp_sdev.frm_sync_seq) - 1;
+ cur_frame_id = atomic_read(&dev->isp_sdev.frm_sync_seq) - 1;
if (params_vdev->first_params) {
first_param = vb2_plane_vaddr(vb, 0);
params_vdev->ops->save_first_param(params_vdev, first_param);
@@ -159,16 +160,22 @@
vb2_buffer_done(¶ms_buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
params_vdev->first_params = false;
wake_up(¶ms_vdev->dev->sync_onoff);
- if (params_vdev->dev->is_first_double) {
- dev_info(params_vdev->dev->dev, "first params for fast\n");
- params_vdev->dev->is_first_double = false;
- rkisp_trigger_read_back(params_vdev->dev, false, false, false);
+ if (dev->is_first_double) {
+ dev_info(dev->dev, "first params for fast\n");
+ dev->is_first_double = false;
+ dev->sw_rd_cnt = 0;
+ if (dev->hw_dev->unite == ISP_UNITE_ONE) {
+ dev->unite_index = ISP_UNITE_LEFT;
+ dev->sw_rd_cnt += dev->hw_dev->is_multi_overflow ? 3 : 1;
+ }
+ params_vdev->rdbk_times = dev->sw_rd_cnt + 1;
+ rkisp_trigger_read_back(dev, false, false, false);
}
- dev_info(params_vdev->dev->dev, "first params buf queue\n");
+ dev_info(dev->dev, "first params buf queue\n");
return;
}
- if (params_vdev->dev->procfs.mode &
+ if (dev->procfs.mode &
(RKISP_PROCFS_FIL_AIQ | RKISP_PROCFS_FIL_SW)) {
vb2_buffer_done(¶ms_buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
return;
@@ -178,6 +185,28 @@
spin_lock_irqsave(¶ms_vdev->config_lock, flags);
list_add_tail(¶ms_buf->queue, ¶ms_vdev->params);
spin_unlock_irqrestore(¶ms_vdev->config_lock, flags);
+
+ if (params_vdev->dev->is_first_double) {
+ struct isp32_isp_params_cfg *params = params_buf->vaddr[0];
+ struct rkisp_buffer *buf;
+
+ if (!(params->module_cfg_update & ISP32_MODULE_RTT_FST))
+ return;
+ spin_lock_irqsave(¶ms_vdev->config_lock, flags);
+ while (!list_empty(¶ms_vdev->params)) {
+ buf = list_first_entry(¶ms_vdev->params,
+ struct rkisp_buffer, queue);
+ if (buf == params_buf)
+ break;
+ list_del(&buf->queue);
+ vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
+ }
+ spin_unlock_irqrestore(¶ms_vdev->config_lock, flags);
+ dev_info(params_vdev->dev->dev,
+ "first params:%d for rtt resume\n", params->frame_id);
+ params_vdev->dev->is_first_double = false;
+ rkisp_trigger_read_back(params_vdev->dev, false, false, false);
+ }
}
static void rkisp_params_vb2_stop_streaming(struct vb2_queue *vq)
@@ -186,38 +215,23 @@
struct rkisp_device *dev = params_vdev->dev;
struct rkisp_buffer *buf;
unsigned long flags;
- int i;
/* stop params input firstly */
spin_lock_irqsave(¶ms_vdev->config_lock, flags);
params_vdev->streamon = false;
wake_up(&dev->sync_onoff);
- spin_unlock_irqrestore(¶ms_vdev->config_lock, flags);
-
- for (i = 0; i < RKISP_ISP_PARAMS_REQ_BUFS_MAX; i++) {
- spin_lock_irqsave(¶ms_vdev->config_lock, flags);
- if (!list_empty(¶ms_vdev->params)) {
- buf = list_first_entry(¶ms_vdev->params,
- struct rkisp_buffer, queue);
- list_del(&buf->queue);
- spin_unlock_irqrestore(¶ms_vdev->config_lock,
- flags);
- } else {
- spin_unlock_irqrestore(¶ms_vdev->config_lock,
- flags);
- break;
- }
-
- if (buf)
- vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
- buf = NULL;
+ while (!list_empty(¶ms_vdev->params)) {
+ buf = list_first_entry(¶ms_vdev->params,
+ struct rkisp_buffer, queue);
+ list_del(&buf->queue);
+ vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
}
-
if (params_vdev->cur_buf) {
buf = params_vdev->cur_buf;
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
params_vdev->cur_buf = NULL;
}
+ spin_unlock_irqrestore(¶ms_vdev->config_lock, flags);
if (dev->is_pre_on) {
params_vdev->first_cfg_params = true;
@@ -284,10 +298,21 @@
return ret;
}
+static __poll_t rkisp_params_fop_poll(struct file *file, poll_table *wait)
+{
+ struct video_device *vdev = video_devdata(file);
+
+ /* buf done or subscribe event */
+ if (vdev->queue->owner == file->private_data)
+ return vb2_fop_poll(file, wait);
+ else
+ return v4l2_ctrl_poll(file, wait);
+}
+
struct v4l2_file_operations rkisp_params_fops = {
.mmap = vb2_fop_mmap,
.unlocked_ioctl = video_ioctl2,
- .poll = vb2_fop_poll,
+ .poll = rkisp_params_fop_poll,
.open = rkisp_params_fh_open,
.release = rkisp_params_fop_release
};
@@ -352,15 +377,16 @@
params_vdev->ops->param_cfg(params_vdev, frame_id, RKISP_PARAMS_IMD);
}
-void rkisp_params_cfgsram(struct rkisp_isp_params_vdev *params_vdev)
+void rkisp_params_cfgsram(struct rkisp_isp_params_vdev *params_vdev, bool is_check)
{
- if (params_vdev->dev->procfs.mode & RKISP_PROCFS_FIL_SW)
- return;
+ if (is_check) {
+ if (params_vdev->dev->procfs.mode & RKISP_PROCFS_FIL_SW)
+ return;
- /* multi device to switch sram config */
- if (params_vdev->dev->hw_dev->is_single)
- return;
-
+ /* multi device to switch sram config */
+ if (params_vdev->dev->hw_dev->is_single)
+ return;
+ }
if (params_vdev->ops->param_cfgsram)
params_vdev->ops->param_cfgsram(params_vdev);
}
@@ -395,8 +421,7 @@
stream->out_isp_fmt.fmt_type == FMT_RGB)
rkisp_unite_set_bits(dev, ISP3X_MI_WR_CTRL, mask,
quantization == V4L2_QUANTIZATION_FULL_RANGE ?
- mask : 0,
- false, dev->hw_dev->is_unite);
+ mask : 0, false);
dev->isp_sdev.quantization = quantization;
}
}
@@ -440,6 +465,7 @@
params_vdev->ops->stream_stop(params_vdev);
if (params_vdev->ops->fop_release)
params_vdev->ops->fop_release(params_vdev);
+ params_vdev->first_cfg_params = false;
}
bool rkisp_params_check_bigmode(struct rkisp_isp_params_vdev *params_vdev)
--
Gitblit v1.6.2