media: rockchip: vicap creates dummy buffer with the max sensor resolution

fixeds:
rkcif-mipi-lvds2: not active buffer, use dummy buffer, mipi/lvds stream[0]
rk_iommu fdce0800.iommu: Page fault at 0x00000000fc538000 of type write
rk_iommu fdce0800.iommu: iova = 0x00000000fc538000: dte_index: 0x3f1 pte_index: 0x138 page_offset: 0x0
rk_iommu fdce0800.iommu: mmu_dte_addr: 0x0000000000354000 dte@0x0000000000354fc4: 0x318d001 valid: 1 pte@0x000000000318d4e0: 0x000000 valid: 0 page@0x0000000000000000 flags: 0x0
rkcif-mipi-lvds2: ERROR: csi fifo overflow, intstat:0x10000, lastline:4785733!!

Signed-off-by: Zefa Chen <zefa.chen@rock-chips.com>
Change-Id: Ie66d805d91367eb9ac695788511c6c6cb648d799
This commit is contained in:
Zefa Chen
2022-11-29 11:27:10 +08:00
parent d3f424655c
commit c69ef7e2ae

View File

@@ -3878,10 +3878,7 @@ static int rkcif_create_dummy_buf(struct rkcif_stream *stream)
struct rkcif_hw *hw = dev->hw_dev;
struct rkcif_dummy_buffer *dummy_buf = &hw->dummy_buf;
struct rkcif_device *tmp_dev = NULL;
struct rkcif_stream *tmp_stream = NULL;
struct v4l2_rect rect;
struct csi_channel_info csi_info;
const struct cif_input_fmt *input_fmt;
struct v4l2_subdev_frame_interval_enum fie;
u32 max_size = 0;
u32 size = 0;
int ret = 0;
@@ -3889,25 +3886,31 @@ static int rkcif_create_dummy_buf(struct rkcif_stream *stream)
for (i = 0; i < hw->dev_num; i++) {
tmp_dev = hw->cif_dev[i];
for (j = 0; j < tmp_dev->num_channels; j++) {
tmp_stream = &tmp_dev->stream[j];
if (tmp_stream) {
if (!tmp_dev->terminal_sensor.sd)
rkcif_update_sensor_info(tmp_stream);
if (tmp_dev->terminal_sensor.sd) {
input_fmt = get_input_fmt(tmp_dev->terminal_sensor.sd,
&rect, i, &csi_info);
if (input_fmt && (input_fmt->mbus_code == MEDIA_BUS_FMT_RGB888_1X24 ||
input_fmt->mbus_code == MEDIA_BUS_FMT_BGR888_1X24))
size = rect.width * rect.height * 3;
if (tmp_dev->terminal_sensor.sd) {
for (j = 0; j < 32; j++) {
memset(&fie, 0, sizeof(fie));
fie.index = j;
fie.pad = 0;
fie.which = V4L2_SUBDEV_FORMAT_ACTIVE;
ret = v4l2_subdev_call(tmp_dev->terminal_sensor.sd,
pad, enum_frame_interval,
NULL, &fie);
if (!ret) {
if (fie.code == MEDIA_BUS_FMT_RGB888_1X24)
size = fie.width * fie.height * 3;
else
size = rect.width * rect.height * 2;
if (size > max_size)
max_size = size;
size = fie.width * fie.height * 2;
v4l2_dbg(1, rkcif_debug, &dev->v4l2_dev,
"%s enum fmt, width %d, height %d\n",
__func__, fie.width, fie.height);
} else {
continue;
break;
}
if (size > max_size)
max_size = size;
}
} else {
continue;
}
}
dummy_buf->size = max_size;