Skip to content

Commit

Permalink
LF-13106: media: imx-csi-formatter: Fix kernel oops issue
Browse files Browse the repository at this point in the history
Fix kernel oops issue when capture without pipeline setup, log
as bellow:

[   65.185151] Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
[   65.217211] CPU: 2 PID: 730 Comm: v4l2-ctl Not tainted 6.6.36-g7bb0a8c6ab3d #31
[   65.224506] Hardware name: NXP i.MX95 19X19 board (DT)
[   65.229635] pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[   65.236579] pc : formatter_subdev_enable_streams+0xb0/0x22c
[   65.242143] lr : formatter_subdev_enable_streams+0x188/0x22c
[   65.247794] sp : ffff80008576b940
[   65.251096] x29: ffff80008576b940 x28: ffff000085b3e180 x27: ffff0000806844b0
[   65.258220] x26: 0000000000000002 x25: ffff000080684480 x24: 0000000000000001
[   65.265344] x23: ffff000080f37010 x22: 0000000000000000 x21: ffff00008442cae0
[   65.272468] x20: ffff0000810e3498 x19: ffff0000810e3480 x18: ffffffffffffffff
[   65.279592] x17: 6d6920646c756f68 x16: 7320312064617020 x15: 6e6f206563697665
[   65.286724] x14: 642d627573206574 x13: ffff800082091528 x12: 000000000000081c
[   65.293848] x11: 00000000000002b4 x10: ffff8000820e9528 x9 : 0000000000000000
[   65.300972] x8 : ffff80008576b7e4 x7 : 0000000000000000 x6 : ffff000080f37190
[   65.308096] x5 : 0000000000000000 x4 : 0000000000000000 x3 : 0000000000000000
[   65.315220] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff8000816e7000
[   65.322345] Call trace:
[   65.324781]  formatter_subdev_enable_streams+0xb0/0x22c
[   65.329997]  v4l2_subdev_enable_streams+0xe8/0x26c
[   65.334781]  mxc_isi_crossbar_enable_streams+0x12c/0x1d0
[   65.340085]  v4l2_subdev_enable_streams+0xe8/0x26c
[   65.344869]  mxc_isi_pipe_enable+0x204/0x2ac
[   65.349124]  mxc_isi_vb2_start_streaming+0xa0/0xe4
[   65.353908]  vb2_start_streaming+0x68/0x15c
[   65.358086]  vb2_core_streamon+0xf8/0x1bc
[   65.362081]  vb2_streamon+0x18/0x64
[   65.365565]  mxc_isi_video_streamon+0x28c/0x314
[   65.370080]  v4l_streamon+0x24/0x30
[   65.373564]  __video_do_ioctl+0x32c/0x3f8
[   65.377568]  video_usercopy+0x2c8/0x658
[   65.381399]  video_ioctl2+0x18/0x24
[   65.384883]  v4l2_ioctl+0x40/0x60
[   65.388194]  __arm64_sys_ioctl+0xac/0xf0
[   65.392111]  invoke_syscall+0x48/0x114
[   65.395855]  el0_svc_common.constprop.0+0xc0/0xe0
[   65.400552]  do_el0_svc+0x1c/0x28
[   65.403863]  el0_svc+0x40/0xe4
[   65.406914]  el0t_64_sync_handler+0x120/0x12c
[   65.411264]  el0t_64_sync+0x190/0x194
[   65.414916] Code: a8c57bfd d50323bf d65f03c0 f0004320 (39401085)
[   65.420998] ---[ end trace 0000000000000000 ]---

Reproduce step:
  Run command as bellow after system boot.
  $ v4l2-ctl -v width=1920,height=1080,pixelformat=YUYV --stream-mmap

The reason is that it will try to get data type index by searching map
between data type and its index when start capture, but the data type
is missing by default if no pipepline setup. So initialize the data type
to default value aligned to subdev format.

Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
  • Loading branch information
Guoniu.zhou committed Aug 6, 2024
1 parent 1ce9d0a commit d257108
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/media/platform/nxp/imx-csi-formatter.c
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,9 @@ static int csi_formatter_probe(struct platform_device *pdev)
return ret;
}

/* Initialize formatter pixel format */
formatter->fmt = find_csi_format(formatter_default_fmt.code);

ret = csi_formatter_async_register(formatter);
if (ret < 0) {
v4l2_subdev_cleanup(&formatter->sd);
Expand Down

0 comments on commit d257108

Please sign in to comment.