media: rockchip: vicap: mipi csi2 set default lane to 4 while not connect to sensor

fixes:

[    2.431002][    T1] rkcif rkcif-mipi-lvds: clear unready subdev num: 1
[    2.431031][    T1] ================================================================================
[    2.431039][    T1] UBSAN: shift-out-of-bounds in drivers/media/platform/rockchip/cif/mipi-csi2.c:523:18
[    2.431048][    T1] shift exponent -1 is negative
[    2.431059][    T1] CPU: 3 PID: 1 Comm: swapper/0 Not tainted 5.10.198 #14
[    2.431065][    T1] Hardware name: Rockchip RK3588 EVB1 LP4 V10 Board (DT)
[    2.431072][    T1] Call trace:
[    2.431088][    T1]  dump_backtrace+0x0/0x1dc
[    2.431096][    T1]  show_stack+0x18/0x24
[    2.431107][    T1]  dump_stack_lvl+0xe4/0x12c
[    2.431114][    T1]  dump_stack+0x18/0x3c
[    2.431126][    T1]  __ubsan_handle_shift_out_of_bounds+0x2dc/0x30c
[    2.431137][    T1]  csi2_g_mbus_config+0xf8/0x100
[    2.431147][    T1]  call_get_mbus_config+0x2c/0x44
[    2.431154][    T1]  subdev_notifier_complete+0xec/0x6dc
[    2.431162][    T1]  v4l2_async_notifier_clr_unready_dev+0xd0/0xd8
[    2.431168][    T1]  rkcif_clr_unready_dev+0x38/0x6c
[    2.431175][    T1]  do_one_initcall+0xe8/0x320
[    2.431186][    T1]  do_initcall_level+0xd4/0x1d8
[    2.431193][    T1]  do_initcalls+0x54/0x94
[    2.431199][    T1]  do_basic_setup+0x24/0x30
[    2.431205][    T1]  kernel_init_freeable+0xf0/0x168
[    2.431212][    T1]  kernel_init+0x14/0x1ac
[    2.431219][    T1]  ret_from_fork+0x10/0x18
[    2.431225][    T1] ================================================================================
[    2.431639][    T1] rkcif-mipi-lvds: rkcif_update_sensor_info: stream[0] get remote terminal sensor failed!
[    2.431662][    T1] rkcif-mipi-lvds: Async subdev notifier completed
[    2.431679][    T1] rkcif-mipi-lvds: rkcif_update_sensor_info: stream[0] get remote terminal sensor failed!
[    2.431687][    T1] rkcif-mipi-lvds: There is not terminal subdev, not synchronized with ISP

Signed-off-by: Zefa Chen <zefa.chen@rock-chips.com>
Change-Id: Id6bebc37a2e649a856ae12cbe3eb60917ecdf165
This commit is contained in:
Zefa Chen
2023-11-17 11:59:00 +08:00
committed by Tao Huang
parent 0aa6d336c0
commit 0e02eaa9e3

View File

@@ -141,7 +141,7 @@ static void csi2_update_sensor_info(struct csi2_dev *csi2)
break;
default:
v4l2_warn(&csi2->sd, "lane num is invalid\n");
csi2->bus.num_data_lanes = 0;
csi2->bus.num_data_lanes = 4;
break;
}
@@ -399,6 +399,7 @@ static int csi2_media_init(struct v4l2_subdev *sd)
csi2->crop.left = 0;
csi2->crop.width = RKCIF_DEFAULT_WIDTH;
csi2->crop.height = RKCIF_DEFAULT_HEIGHT;
csi2->bus.num_data_lanes = 4;
return media_entity_pads_init(&sd->entity, num_pads, csi2->pad);
}
@@ -664,16 +665,11 @@ static int csi2_parse_endpoint(struct device *dev,
struct v4l2_fwnode_endpoint *vep,
struct v4l2_async_subdev *asd)
{
struct v4l2_subdev *sd = dev_get_drvdata(dev);
struct csi2_dev *csi2 = sd_to_dev(sd);
if (vep->base.port != 0) {
dev_err(dev, "The csi host node needs to parse port 0\n");
return -EINVAL;
}
csi2->bus = vep->bus.mipi_csi2;
return 0;
}