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_stats_v2x.c | 447 ++++++++++++++++++++++++-------------------------------
1 files changed, 195 insertions(+), 252 deletions(-)
diff --git a/kernel/drivers/media/platform/rockchip/isp/isp_stats_v2x.c b/kernel/drivers/media/platform/rockchip/isp/isp_stats_v2x.c
index 06ae885..b69b48f 100644
--- a/kernel/drivers/media/platform/rockchip/isp/isp_stats_v2x.c
+++ b/kernel/drivers/media/platform/rockchip/isp/isp_stats_v2x.c
@@ -55,17 +55,13 @@
ISP2X_SIAWB_GET_MEAN_Y_G(reg_val);
}
-static int
+static void
rkisp_stats_get_rawawb_meas_reg(struct rkisp_isp_stats_vdev *stats_vdev,
struct rkisp_isp2x_stat_buffer *pbuf)
{
u64 msb, lsb;
- u32 ctrl;
+ u32 value;
int i;
-
- ctrl = rkisp_read(stats_vdev->dev, ISP_RAWAWB_CTRL, true);
- if (!(ctrl & ISP2X_3A_MEAS_DONE))
- return -ENODATA;
if (!pbuf)
goto out;
@@ -159,8 +155,9 @@
}
out:
- rkisp_write(stats_vdev->dev, ISP_RAWAWB_CTRL, ctrl, true);
- return 0;
+ value = rkisp_read(stats_vdev->dev, ISP_RAWAWB_CTRL, true);
+ value |= ISP2X_3A_MEAS_DONE;
+ rkisp_write(stats_vdev->dev, ISP_RAWAWB_CTRL, value, true);
}
static void
@@ -183,18 +180,14 @@
af->win[2].lum = rkisp_read(stats_vdev->dev, ISP_AFM_LUM_C, true);
}
-static int
+static void
rkisp_stats_get_rawaf_meas_reg(struct rkisp_isp_stats_vdev *stats_vdev,
struct rkisp_isp2x_stat_buffer *pbuf)
{
struct isp2x_rawaf_stat *af;
- u32 value, read_line, ctrl;
+ u32 value, read_line;
u32 line_num[ISP2X_RAWAF_LINE_NUM + 1];
int i;
-
- ctrl = rkisp_read(stats_vdev->dev, ISP_RAWAF_CTRL, true);
- if (!(ctrl & ISP2X_3A_MEAS_DONE))
- return -ENODATA;
if (!pbuf)
goto out;
@@ -231,21 +224,18 @@
af->ramdata[i] = rkisp_read(stats_vdev->dev, ISP_RAWAF_RAM_DATA, true);
out:
- rkisp_write(stats_vdev->dev, ISP_RAWAF_CTRL, ctrl, true);
+ value = rkisp_read(stats_vdev->dev, ISP_RAWAF_CTRL, true);
+ value |= ISP2X_3A_MEAS_DONE;
+ rkisp_write(stats_vdev->dev, ISP_RAWAF_CTRL, value, true);
rkisp_write(stats_vdev->dev, ISP_RAWAF_INT_STATE, 0, true);
- return 0;
}
-static int
+static void
rkisp_stats_get_yuvae_meas_reg(struct rkisp_isp_stats_vdev *stats_vdev,
struct rkisp_isp2x_stat_buffer *pbuf)
{
- u32 value, ctrl;
+ u32 value;
int i;
-
- ctrl = rkisp_read(stats_vdev->dev, ISP_YUVAE_CTRL, true);
- if (!(ctrl & ISP2X_3A_MEAS_DONE))
- return -ENODATA;
if (!pbuf)
goto out;
@@ -266,8 +256,9 @@
rkisp_read(stats_vdev->dev, ISP_YUVAE_WND1_SUMY + 4 * i, true);
out:
- rkisp_write(stats_vdev->dev, ISP_YUVAE_CTRL, ctrl, true);
- return 0;
+ value = rkisp_read(stats_vdev->dev, ISP_YUVAE_CTRL, true);
+ value |= ISP2X_3A_MEAS_DONE;
+ rkisp_write(stats_vdev->dev, ISP_YUVAE_CTRL, value, true);
}
static void
@@ -293,11 +284,11 @@
}
}
-static int
+static void
rkisp_stats_get_rawaebig_meas_reg(struct rkisp_isp_stats_vdev *stats_vdev,
struct isp2x_rawaebig_stat *ae, u32 blk_no)
{
- u32 addr, value, ctrl;
+ u32 addr, value;
int i;
switch (blk_no) {
@@ -314,10 +305,6 @@
addr = RAWAE_BIG1_BASE;
break;
}
-
- ctrl = rkisp_read(stats_vdev->dev, addr + RAWAE_BIG_CTRL, true);
- if (!(ctrl & ISP2X_3A_MEAS_DONE))
- return -ENODATA;
if (!ae)
goto out;
@@ -339,15 +326,16 @@
}
out:
- rkisp_write(stats_vdev->dev, addr + RAWAE_BIG_CTRL, ctrl, true);
- return 0;
+ value = rkisp_read(stats_vdev->dev, addr + RAWAE_BIG_CTRL, true);
+ value |= ISP2X_3A_MEAS_DONE;
+ rkisp_write(stats_vdev->dev, addr + RAWAE_BIG_CTRL, value, true);
}
-static int
+static void
rkisp_stats_get_rawhstbig_meas_reg(struct rkisp_isp_stats_vdev *stats_vdev,
struct isp2x_rawhistbig_stat *hst, u32 blk_no)
{
- u32 addr, ctrl;
+ u32 addr, value;
int i;
switch (blk_no) {
@@ -365,10 +353,6 @@
break;
}
- ctrl = rkisp_read(stats_vdev->dev, addr + ISP_RAWHIST_BIG_CTRL, true);
- if (!(ctrl & ISP2X_3A_MEAS_DONE))
- return -ENODATA;
-
if (!hst)
goto out;
@@ -377,129 +361,87 @@
addr + ISP_RAWHIST_BIG_RO_BASE_BIN, true);
out:
- rkisp_write(stats_vdev->dev, addr + ISP_RAWHIST_BIG_CTRL, ctrl, true);
- return 0;
+ value = rkisp_read(stats_vdev->dev, addr + ISP_RAWHIST_BIG_CTRL, true);
+ value |= ISP2X_3A_MEAS_DONE;
+ rkisp_write(stats_vdev->dev, addr + ISP_RAWHIST_BIG_CTRL, value, true);
}
-static int
+static void
rkisp_stats_get_rawae1_meas_reg(struct rkisp_isp_stats_vdev *stats_vdev,
struct rkisp_isp2x_stat_buffer *pbuf)
{
- int ret = 0;
-
- if (!pbuf) {
+ if (!pbuf)
rkisp_stats_get_rawaebig_meas_reg(stats_vdev, NULL, 1);
- } else {
- ret = rkisp_stats_get_rawaebig_meas_reg(stats_vdev, &pbuf->params.rawae1, 1);
- if (!ret)
- pbuf->meas_type |= ISP2X_STAT_RAWAE1;
- }
-
- return ret;
+ else
+ rkisp_stats_get_rawaebig_meas_reg(stats_vdev, &pbuf->params.rawae1, 1);
}
-static int
+static void
rkisp_stats_get_rawhst1_meas_reg(struct rkisp_isp_stats_vdev *stats_vdev,
struct rkisp_isp2x_stat_buffer *pbuf)
{
- int ret = 0;
-
- if (!pbuf) {
+ if (!pbuf)
rkisp_stats_get_rawhstbig_meas_reg(stats_vdev, NULL, 1);
- } else {
- ret = rkisp_stats_get_rawhstbig_meas_reg(stats_vdev, &pbuf->params.rawhist1, 1);
- if (!ret)
- pbuf->meas_type |= ISP2X_STAT_RAWHST1;
- }
-
- return ret;
+ else
+ rkisp_stats_get_rawhstbig_meas_reg(stats_vdev, &pbuf->params.rawhist1, 1);
}
-static int
+static void
rkisp_stats_get_rawae2_meas_reg(struct rkisp_isp_stats_vdev *stats_vdev,
struct rkisp_isp2x_stat_buffer *pbuf)
{
- int ret = 0;
-
- if (!pbuf) {
+ if (!pbuf)
rkisp_stats_get_rawaebig_meas_reg(stats_vdev, NULL, 2);
- } else {
+ else
rkisp_stats_get_rawaebig_meas_reg(stats_vdev, &pbuf->params.rawae2, 2);
- if (!ret)
- pbuf->meas_type |= ISP2X_STAT_RAWAE2;
- }
-
- return ret;
}
-static int
+static void
rkisp_stats_get_rawhst2_meas_reg(struct rkisp_isp_stats_vdev *stats_vdev,
struct rkisp_isp2x_stat_buffer *pbuf)
{
- int ret = 0;
-
- if (!pbuf) {
+ if (!pbuf)
rkisp_stats_get_rawhstbig_meas_reg(stats_vdev, NULL, 2);
- } else {
- ret = rkisp_stats_get_rawhstbig_meas_reg(stats_vdev, &pbuf->params.rawhist2, 2);
- if (!ret)
- pbuf->meas_type |= ISP2X_STAT_RAWHST2;
- }
-
- return ret;
+ else
+ rkisp_stats_get_rawhstbig_meas_reg(stats_vdev, &pbuf->params.rawhist2, 2);
}
-static int
+static void
rkisp_stats_get_rawae3_meas_reg(struct rkisp_isp_stats_vdev *stats_vdev,
struct rkisp_isp2x_stat_buffer *pbuf)
{
- int ret = 0;
-
- if (!pbuf) {
+ if (!pbuf)
rkisp_stats_get_rawaebig_meas_reg(stats_vdev, NULL, 0);
- } else {
- ret = rkisp_stats_get_rawaebig_meas_reg(stats_vdev, &pbuf->params.rawae3, 0);
- if (!ret)
- pbuf->meas_type |= ISP2X_STAT_RAWAE3;
- }
-
- return ret;
+ else
+ rkisp_stats_get_rawaebig_meas_reg(stats_vdev, &pbuf->params.rawae3, 0);
}
-static int
+static void
rkisp_stats_get_rawhst3_meas_reg(struct rkisp_isp_stats_vdev *stats_vdev,
struct rkisp_isp2x_stat_buffer *pbuf)
{
- int ret = 0;
-
- if (!pbuf) {
+ if (!pbuf)
rkisp_stats_get_rawhstbig_meas_reg(stats_vdev, NULL, 0);
- } else {
- ret = rkisp_stats_get_rawhstbig_meas_reg(stats_vdev, &pbuf->params.rawhist3, 0);
- if (!ret)
- pbuf->meas_type |= ISP2X_STAT_RAWHST3;
- }
-
- return ret;
+ else
+ rkisp_stats_get_rawhstbig_meas_reg(stats_vdev, &pbuf->params.rawhist3, 0);
}
-static int
+static void
rkisp_stats_get_rawaelite_meas_reg(struct rkisp_isp_stats_vdev *stats_vdev,
struct rkisp_isp2x_stat_buffer *pbuf)
{
struct isp2x_rawaelite_stat *ae;
- u32 value, ctrl;
+ u32 value;
int i;
-
- ctrl = rkisp_read(stats_vdev->dev, ISP_RAWAE_LITE_CTRL, true);
- if (!(ctrl & ISP2X_3A_MEAS_DONE))
- return -ENODATA;
if (!pbuf)
goto out;
- pbuf->meas_type |= ISP2X_STAT_RAWAE0;
ae = &pbuf->params.rawae0;
+ value = rkisp_read(stats_vdev->dev, ISP_RAWAE_LITE_CTRL, true);
+
+ if ((value & ISP2X_3A_MEAS_DONE) == 0)
+ return;
for (i = 0; i < ISP2X_RAWAELITE_MEAN_NUM; i++) {
value = rkisp_read(stats_vdev->dev, ISP_RAWAE_LITE_RO_MEAN + 4 * i, true);
@@ -509,33 +451,30 @@
}
out:
- rkisp_write(stats_vdev->dev, ISP_RAWAE_LITE_CTRL, ctrl, true);
- return 0;
+ value = rkisp_read(stats_vdev->dev, ISP_RAWAE_LITE_CTRL, true);
+ value |= ISP2X_3A_MEAS_DONE;
+ rkisp_write(stats_vdev->dev, ISP_RAWAE_LITE_CTRL, value, true);
}
-static int
+static void
rkisp_stats_get_rawhstlite_meas_reg(struct rkisp_isp_stats_vdev *stats_vdev,
struct rkisp_isp2x_stat_buffer *pbuf)
{
struct isp2x_rawhistlite_stat *hst;
- u32 ctrl;
+ u32 value;
int i;
-
- ctrl = rkisp_read(stats_vdev->dev, ISP_RAWHIST_LITE_CTRL, true);
- if (!(ctrl & ISP2X_3A_MEAS_DONE))
- return -ENODATA;
if (!pbuf)
goto out;
- pbuf->meas_type |= ISP2X_STAT_RAWHST0;
hst = &pbuf->params.rawhist0;
for (i = 0; i < ISP2X_HIST_BIN_N_MAX; i++)
hst->hist_bin[i] = rkisp_read(stats_vdev->dev, ISP_RAWHIST_LITE_RO_BASE_BIN, true);
out:
- rkisp_write(stats_vdev->dev, ISP_RAWHIST_LITE_CTRL, ctrl, true);
- return 0;
+ value = rkisp_read(stats_vdev->dev, ISP_RAWHIST_LITE_CTRL, true);
+ value |= ISP2X_3A_MEAS_DONE;
+ rkisp_write(stats_vdev->dev, ISP_RAWHIST_LITE_CTRL, value, true);
}
static void
@@ -723,7 +662,7 @@
ISP2X_SIAWB_GET_MEAN_Y_G(reg_val);
}
-static int
+static void
rkisp_stats_get_rawawb_meas_ddr(struct rkisp_isp_stats_vdev *stats_vdev,
struct rkisp_isp2x_stat_buffer *pbuf)
{
@@ -733,7 +672,7 @@
u32 i;
if (!pbuf)
- goto out;
+ goto OUT;
pbuf->meas_type |= ISP2X_STAT_RAWAWB;
@@ -830,11 +769,10 @@
pbuf->params.rawawb.ramdata[2 * i].r = (msb & 0x3FFFF0) >> 4;
pbuf->params.rawawb.ramdata[2 * i].wp = (msb & 0x01C00000) >> 22;
-out:
+OUT:
value = rkisp_read(stats_vdev->dev, ISP_RAWAWB_CTRL, true);
value |= ISP2X_3A_MEAS_DONE;
rkisp_write(stats_vdev->dev, ISP_RAWAWB_CTRL, value, true);
- return 0;
}
static void
@@ -861,7 +799,7 @@
af->win[2].lum = ddr_addr[6];
}
-static int
+static void
rkisp_stats_get_rawaf_meas_ddr(struct rkisp_isp_stats_vdev *stats_vdev,
struct rkisp_isp2x_stat_buffer *pbuf)
{
@@ -871,7 +809,7 @@
int i;
if (!pbuf)
- goto out;
+ goto OUT;
af = &pbuf->params.rawaf;
pbuf->meas_type |= ISP2X_STAT_RAWAF;
@@ -888,15 +826,14 @@
for (i = 0; i < ISP2X_RAWAF_SUMDATA_ROW * ISP2X_RAWAF_SUMDATA_COLUMN; i++)
af->ramdata[i] = ddr_addr[i];
-out:
+OUT:
value = rkisp_read(stats_vdev->dev, ISP_RAWAF_CTRL, true);
value |= ISP2X_3A_MEAS_DONE;
rkisp_write(stats_vdev->dev, ISP_RAWAF_CTRL, value, true);
rkisp_write(stats_vdev->dev, ISP_RAWAF_INT_STATE, 0, true);
- return 0;
}
-static int
+static void
rkisp_stats_get_yuvae_meas_ddr(struct rkisp_isp_stats_vdev *stats_vdev,
struct rkisp_isp2x_stat_buffer *pbuf)
{
@@ -905,7 +842,7 @@
int i;
if (!pbuf)
- goto out;
+ goto OUT;
pbuf->meas_type |= ISP2X_STAT_YUVAE;
@@ -925,11 +862,10 @@
pbuf->params.yuvae.ro_yuvae_sumy[i] =
rkisp_read(stats_vdev->dev, ISP_YUVAE_WND1_SUMY + 4 * i, true);
-out:
+OUT:
value = rkisp_read(stats_vdev->dev, ISP_YUVAE_CTRL, true);
value |= ISP2X_3A_MEAS_DONE;
rkisp_write(stats_vdev->dev, ISP_YUVAE_CTRL, value, true);
- return 0;
}
static void
@@ -960,7 +896,7 @@
}
}
-static int
+static void
rkisp_stats_get_rawaebig_meas_ddr(struct rkisp_isp_stats_vdev *stats_vdev,
struct isp2x_rawaebig_stat *ae, u32 blk_no)
{
@@ -987,7 +923,7 @@
}
if (!ae)
- goto out;
+ goto OUT;
for (i = 0; i < ISP2X_RAWAEBIG_SUBWIN_NUM; i++)
ae->sumr[i] = rkisp_read(stats_vdev->dev, addr + RAWAE_BIG_WND1_SUMR + i * 4, true);
@@ -1005,14 +941,13 @@
ae->data[i].channelr_xy = ISP2X_RAWAEBIG_GET_MEAN_R(value);
}
-out:
+OUT:
value = rkisp_read(stats_vdev->dev, addr + RAWAE_BIG_CTRL, true);
value |= ISP2X_3A_MEAS_DONE;
rkisp_write(stats_vdev->dev, addr + RAWAE_BIG_CTRL, value, true);
- return 0;
}
-static int
+static void
rkisp_stats_get_rawhstbig_meas_ddr(struct rkisp_isp_stats_vdev *stats_vdev,
struct isp2x_rawhistbig_stat *hst, u32 blk_no)
{
@@ -1039,121 +974,78 @@
}
if (!hst)
- goto out;
+ goto OUT;
for (i = 0; i < ISP2X_HIST_BIN_N_MAX; i++)
hst->hist_bin[i] = ddr_addr[i];
-out:
+OUT:
value = rkisp_read(stats_vdev->dev, addr + ISP_RAWHIST_BIG_CTRL, true);
value |= ISP2X_3A_MEAS_DONE;
rkisp_write(stats_vdev->dev, addr + ISP_RAWHIST_BIG_CTRL, value, true);
- return 0;
}
-static int
+static void
rkisp_stats_get_rawae1_meas_ddr(struct rkisp_isp_stats_vdev *stats_vdev,
struct rkisp_isp2x_stat_buffer *pbuf)
{
- int ret = 0;
-
- if (!pbuf) {
+ if (!pbuf)
rkisp_stats_get_rawaebig_meas_ddr(stats_vdev, NULL, 1);
- } else {
- ret = rkisp_stats_get_rawaebig_meas_ddr(stats_vdev, &pbuf->params.rawae1, 1);
- if (!ret)
- pbuf->meas_type |= ISP2X_STAT_RAWAE1;
- }
-
- return ret;
+ else
+ rkisp_stats_get_rawaebig_meas_ddr(stats_vdev, &pbuf->params.rawae1, 1);
}
-static int
+static void
rkisp_stats_get_rawhst1_meas_ddr(struct rkisp_isp_stats_vdev *stats_vdev,
struct rkisp_isp2x_stat_buffer *pbuf)
{
- int ret = 0;
-
- if (!pbuf) {
+ if (!pbuf)
rkisp_stats_get_rawhstbig_meas_ddr(stats_vdev, NULL, 1);
- } else {
- ret = rkisp_stats_get_rawhstbig_meas_ddr(stats_vdev, &pbuf->params.rawhist1, 1);
- if (!ret)
- pbuf->meas_type |= ISP2X_STAT_RAWHST1;
- }
-
- return ret;
+ else
+ rkisp_stats_get_rawhstbig_meas_ddr(stats_vdev, &pbuf->params.rawhist1, 1);
}
-static int
+static void
rkisp_stats_get_rawae2_meas_ddr(struct rkisp_isp_stats_vdev *stats_vdev,
struct rkisp_isp2x_stat_buffer *pbuf)
{
- int ret = 0;
-
- if (!pbuf) {
+ if (!pbuf)
rkisp_stats_get_rawaebig_meas_ddr(stats_vdev, NULL, 2);
- } else {
- ret = rkisp_stats_get_rawaebig_meas_ddr(stats_vdev, &pbuf->params.rawae2, 2);
- if (!ret)
- pbuf->meas_type |= ISP2X_STAT_RAWAE2;
- }
-
- return ret;
+ else
+ rkisp_stats_get_rawaebig_meas_ddr(stats_vdev, &pbuf->params.rawae2, 2);
}
-static int
+static void
rkisp_stats_get_rawhst2_meas_ddr(struct rkisp_isp_stats_vdev *stats_vdev,
struct rkisp_isp2x_stat_buffer *pbuf)
{
- int ret = 0;
-
- if (!pbuf) {
+ if (!pbuf)
rkisp_stats_get_rawhstbig_meas_ddr(stats_vdev, NULL, 2);
- } else {
- ret = rkisp_stats_get_rawhstbig_meas_ddr(stats_vdev, &pbuf->params.rawhist2, 2);
- if (!ret)
- pbuf->meas_type |= ISP2X_STAT_RAWHST2;
- }
-
- return ret;
+ else
+ rkisp_stats_get_rawhstbig_meas_ddr(stats_vdev, &pbuf->params.rawhist2, 2);
}
-static int
+static void
rkisp_stats_get_rawae3_meas_ddr(struct rkisp_isp_stats_vdev *stats_vdev,
struct rkisp_isp2x_stat_buffer *pbuf)
{
- int ret = 0;
-
- if (!pbuf) {
+ if (!pbuf)
rkisp_stats_get_rawaebig_meas_ddr(stats_vdev, NULL, 0);
- } else {
+ else
rkisp_stats_get_rawaebig_meas_ddr(stats_vdev, &pbuf->params.rawae3, 0);
- if (!ret)
- pbuf->meas_type |= ISP2X_STAT_RAWAE3;
- }
-
- return ret;
}
-static int
+static void
rkisp_stats_get_rawhst3_meas_ddr(struct rkisp_isp_stats_vdev *stats_vdev,
struct rkisp_isp2x_stat_buffer *pbuf)
{
- int ret = 0;
-
- if (!pbuf) {
+ if (!pbuf)
rkisp_stats_get_rawhstbig_meas_ddr(stats_vdev, NULL, 0);
- } else {
- ret = rkisp_stats_get_rawhstbig_meas_ddr(stats_vdev, &pbuf->params.rawhist3, 0);
- if (!ret)
- pbuf->meas_type |= ISP2X_STAT_RAWHST3;
- }
-
- return ret;
+ else
+ rkisp_stats_get_rawhstbig_meas_ddr(stats_vdev, &pbuf->params.rawhist3, 0);
}
-static int
+static void
rkisp_stats_get_rawaelite_meas_ddr(struct rkisp_isp_stats_vdev *stats_vdev,
struct rkisp_isp2x_stat_buffer *pbuf)
{
@@ -1163,10 +1055,13 @@
int i;
if (!pbuf)
- goto out;
+ goto OUT;
- pbuf->meas_type |= ISP2X_STAT_RAWAE0;
ae = &pbuf->params.rawae0;
+ value = rkisp_read(stats_vdev->dev, ISP_RAWAE_LITE_CTRL, true);
+ if ((value & ISP2X_3A_MEAS_DONE) == 0)
+ return;
+
rd_buf_idx = stats_vdev->rd_buf_idx;
ddr_addr = stats_vdev->stats_buf[rd_buf_idx].vaddr + 0x0AB0;
for (i = 0; i < ISP2X_RAWAELITE_MEAN_NUM; i++) {
@@ -1176,14 +1071,13 @@
ae->data[i].channelr_xy = ISP2X_RAWAEBIG_GET_MEAN_R(value);
}
-out:
+OUT:
value = rkisp_read(stats_vdev->dev, ISP_RAWAE_LITE_CTRL, true);
value |= ISP2X_3A_MEAS_DONE;
rkisp_write(stats_vdev->dev, ISP_RAWAE_LITE_CTRL, value, true);
- return 0;
}
-static int
+static void
rkisp_stats_get_rawhstlite_meas_ddr(struct rkisp_isp_stats_vdev *stats_vdev,
struct rkisp_isp2x_stat_buffer *pbuf)
{
@@ -1193,9 +1087,8 @@
int i;
if (!pbuf)
- goto out;
+ goto OUT;
- pbuf->meas_type |= ISP2X_STAT_RAWHST0;
hst = &pbuf->params.rawhist0;
rd_buf_idx = stats_vdev->rd_buf_idx;
@@ -1204,11 +1097,10 @@
for (i = 0; i < ISP2X_HIST_BIN_N_MAX; i++)
hst->hist_bin[i] = ddr_addr[i];
-out:
+OUT:
value = rkisp_read(stats_vdev->dev, ISP_RAWHIST_LITE_CTRL, true);
value |= ISP2X_3A_MEAS_DONE;
rkisp_write(stats_vdev->dev, ISP_RAWHIST_LITE_CTRL, value, true);
- return 0;
}
static struct rkisp_stats_v2x_ops __maybe_unused rkisp_stats_ddr_ops_v2x = {
@@ -1237,15 +1129,14 @@
{
unsigned int cur_frame_id = -1;
struct rkisp_isp2x_stat_buffer *cur_stat_buf = NULL;
- struct rkisp_buffer *cur_buf = stats_vdev->cur_buf;
+ struct rkisp_buffer *cur_buf = NULL;
struct rkisp_stats_v2x_ops *ops =
(struct rkisp_stats_v2x_ops *)stats_vdev->priv_ops;
- int ret = 0;
cur_frame_id = meas_work->frame_id;
spin_lock(&stats_vdev->rd_lock);
/* get one empty buffer */
- if (!cur_buf && !list_empty(&stats_vdev->stat)) {
+ if (!list_empty(&stats_vdev->stat)) {
cur_buf = list_first_entry(&stats_vdev->stat,
struct rkisp_buffer, queue);
list_del(&cur_buf->queue);
@@ -1258,11 +1149,18 @@
cur_stat_buf->frame_id = cur_frame_id;
}
- if (meas_work->isp_ris & ISP2X_SIAWB_DONE)
+ if (meas_work->isp_ris & ISP2X_SIAWB_DONE) {
ops->get_siawb_meas(stats_vdev, cur_stat_buf);
- if (meas_work->isp_ris & ISP2X_SIAF_FIN)
+ if (cur_stat_buf)
+ cur_stat_buf->meas_type |= ISP2X_STAT_SIAWB;
+ }
+
+ if (meas_work->isp_ris & ISP2X_SIAF_FIN) {
ops->get_siaf_meas(stats_vdev, cur_stat_buf);
+ if (cur_stat_buf)
+ cur_stat_buf->meas_type |= ISP2X_STAT_SIAF;
+ }
if (meas_work->isp_ris & ISP2X_AFM_SUM_OF)
v4l2_warn(stats_vdev->vnode.vdev.v4l2_dev,
@@ -1272,17 +1170,29 @@
v4l2_warn(stats_vdev->vnode.vdev.v4l2_dev,
"ISP2X_AFM_LUM_OF\n");
- if (meas_work->isp_ris & ISP2X_YUVAE_END)
- ret |= ops->get_yuvae_meas(stats_vdev, cur_stat_buf);
+ if (meas_work->isp_ris & ISP2X_YUVAE_END) {
+ ops->get_yuvae_meas(stats_vdev, cur_stat_buf);
+ if (cur_stat_buf)
+ cur_stat_buf->meas_type |= ISP2X_STAT_YUVAE;
+ }
- if (meas_work->isp_ris & ISP2X_SIHST_RDY)
+ if (meas_work->isp_ris & ISP2X_SIHST_RDY) {
ops->get_sihst_meas(stats_vdev, cur_stat_buf);
+ if (cur_stat_buf)
+ cur_stat_buf->meas_type |= ISP2X_STAT_SIHST;
+ }
- if (meas_work->isp3a_ris & ISP2X_3A_RAWAWB)
- ret |= ops->get_rawawb_meas(stats_vdev, cur_stat_buf);
+ if (meas_work->isp3a_ris & ISP2X_3A_RAWAWB) {
+ ops->get_rawawb_meas(stats_vdev, cur_stat_buf);
+ if (cur_stat_buf)
+ cur_stat_buf->meas_type |= ISP2X_STAT_RAWAWB;
+ }
- if (meas_work->isp3a_ris & ISP2X_3A_RAWAF)
- ret |= ops->get_rawaf_meas(stats_vdev, cur_stat_buf);
+ if (meas_work->isp3a_ris & ISP2X_3A_RAWAF) {
+ ops->get_rawaf_meas(stats_vdev, cur_stat_buf);
+ if (cur_stat_buf)
+ cur_stat_buf->meas_type |= ISP2X_STAT_RAWAF;
+ }
if (meas_work->isp3a_ris & ISP2X_3A_RAWAF_SUM)
v4l2_warn(stats_vdev->vnode.vdev.v4l2_dev,
@@ -1292,29 +1202,53 @@
v4l2_warn(stats_vdev->vnode.vdev.v4l2_dev,
"ISP2X_3A_RAWAF_LUM\n");
- if (meas_work->isp3a_ris & ISP2X_3A_RAWAE_BIG)
- ret |= ops->get_rawae3_meas(stats_vdev, cur_stat_buf);
+ if (meas_work->isp3a_ris & ISP2X_3A_RAWAE_BIG) {
+ ops->get_rawae3_meas(stats_vdev, cur_stat_buf);
+ if (cur_stat_buf)
+ cur_stat_buf->meas_type |= ISP2X_STAT_RAWAE3;
+ }
- if (meas_work->isp3a_ris & ISP2X_3A_RAWHIST_BIG)
- ret |= ops->get_rawhst3_meas(stats_vdev, cur_stat_buf);
+ if (meas_work->isp3a_ris & ISP2X_3A_RAWHIST_BIG) {
+ ops->get_rawhst3_meas(stats_vdev, cur_stat_buf);
+ if (cur_stat_buf)
+ cur_stat_buf->meas_type |= ISP2X_STAT_RAWHST3;
+ }
- if (meas_work->isp3a_ris & ISP2X_3A_RAWAE_CH0)
- ret |= ops->get_rawae0_meas(stats_vdev, cur_stat_buf);
+ if (meas_work->isp3a_ris & ISP2X_3A_RAWAE_CH0) {
+ ops->get_rawae0_meas(stats_vdev, cur_stat_buf);
+ if (cur_stat_buf)
+ cur_stat_buf->meas_type |= ISP2X_STAT_RAWAE0;
+ }
- if (meas_work->isp3a_ris & ISP2X_3A_RAWAE_CH1)
- ret |= ops->get_rawae1_meas(stats_vdev, cur_stat_buf);
+ if (meas_work->isp3a_ris & ISP2X_3A_RAWAE_CH1) {
+ ops->get_rawae1_meas(stats_vdev, cur_stat_buf);
+ if (cur_stat_buf)
+ cur_stat_buf->meas_type |= ISP2X_STAT_RAWAE1;
+ }
- if (meas_work->isp3a_ris & ISP2X_3A_RAWAE_CH2)
- ret |= ops->get_rawae2_meas(stats_vdev, cur_stat_buf);
+ if (meas_work->isp3a_ris & ISP2X_3A_RAWAE_CH2) {
+ ops->get_rawae2_meas(stats_vdev, cur_stat_buf);
+ if (cur_stat_buf)
+ cur_stat_buf->meas_type |= ISP2X_STAT_RAWAE2;
+ }
- if (meas_work->isp3a_ris & ISP2X_3A_RAWHIST_CH0)
- ret |= ops->get_rawhst0_meas(stats_vdev, cur_stat_buf);
+ if (meas_work->isp3a_ris & ISP2X_3A_RAWHIST_CH0) {
+ ops->get_rawhst0_meas(stats_vdev, cur_stat_buf);
+ if (cur_stat_buf)
+ cur_stat_buf->meas_type |= ISP2X_STAT_RAWHST0;
+ }
- if (meas_work->isp3a_ris & ISP2X_3A_RAWHIST_CH1)
- ret |= ops->get_rawhst1_meas(stats_vdev, cur_stat_buf);
+ if (meas_work->isp3a_ris & ISP2X_3A_RAWHIST_CH1) {
+ ops->get_rawhst1_meas(stats_vdev, cur_stat_buf);
+ if (cur_stat_buf)
+ cur_stat_buf->meas_type |= ISP2X_STAT_RAWHST1;
+ }
- if (meas_work->isp3a_ris & ISP2X_3A_RAWHIST_CH2)
- ret |= ops->get_rawhst2_meas(stats_vdev, cur_stat_buf);
+ if (meas_work->isp3a_ris & ISP2X_3A_RAWHIST_CH2) {
+ ops->get_rawhst2_meas(stats_vdev, cur_stat_buf);
+ if (cur_stat_buf)
+ cur_stat_buf->meas_type |= ISP2X_STAT_RAWHST2;
+ }
if (meas_work->isp_ris & ISP2X_FRAME) {
ops->get_bls_stats(stats_vdev, cur_stat_buf);
@@ -1322,7 +1256,7 @@
ops->get_dhaz_stats(stats_vdev, cur_stat_buf);
}
- if (cur_buf && !ret) {
+ if (cur_buf) {
bool reg_withstream = false;
struct v4l2_subdev *sd = v4l2_get_subdev_hostdata(&stats_vdev->dev->br_dev.sd);
@@ -1339,9 +1273,7 @@
memcpy(tmp_statsbuf, cur_stat_buf, sizeof(*cur_stat_buf));
}
vb2_buffer_done(&cur_buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
- cur_buf = NULL;
}
- stats_vdev->cur_buf = cur_buf;
}
static void
@@ -1447,7 +1379,7 @@
if ((isp_ris & ISP2X_FRAME) && stats_vdev->rd_stats_from_ddr) {
wr_buf_idx = stats_vdev->wr_buf_idx;
stats_vdev->rd_buf_idx = wr_buf_idx;
- rkisp_finish_buffer(dev, &stats_vdev->stats_buf[wr_buf_idx]);
+
wr_buf_idx = (wr_buf_idx + 1) % RKISP_STATS_DDR_BUF_NUM;
stats_vdev->wr_buf_idx = wr_buf_idx;
rkisp_write(stats_vdev->dev, MI_DBR_WR_SIZE,
@@ -1474,9 +1406,20 @@
work.frame_id = cur_frame_id;
work.isp_ris = temp_isp_ris | isp_ris;
work.isp3a_ris = temp_isp3a_ris | iq_3a_mask;
- work.timestamp = ktime_get_ns();
+ work.timestamp = rkisp_time_get_ns(dev);
- rkisp_stats_send_meas_v2x(stats_vdev, &work);
+ if (!IS_HDR_RDBK(dev->hdr.op_mode)) {
+ if (!kfifo_is_full(&stats_vdev->rd_kfifo))
+ kfifo_in(&stats_vdev->rd_kfifo,
+ &work, sizeof(work));
+ else
+ v4l2_err(stats_vdev->vnode.vdev.v4l2_dev,
+ "stats kfifo is full\n");
+
+ tasklet_schedule(&stats_vdev->rd_tasklet);
+ } else {
+ rkisp_stats_send_meas_v2x(stats_vdev, &work);
+ }
}
/*
--
Gitblit v1.6.2