kernel error when build camera driver.

I tried to build a driver for another ov sensor og02b10
The driver seems loading correctly but when I try to get image from the sensor using v4l2-ctl I got kernel error

Opening in BLOCKING MODE 
VIDIOC_QUERYCAP: ok
VIDIOC_S_EXT_CTRLS: ok
VIDIOC_G_FMT: ok
VIDIOC_S_FMT: ok
Format Video Capture:
	Width/Height      : 1600/1300
	Pixel Format      : 'RG10'
	Field             : None
	Bytes per Line    : 3200
	Size Image        : 4160000
	Colorspace        : sRGB
	Transfer Function : Default (maps to sRGB)
	YCbCr/HSV Encoding: Default (maps to ITU-R 601)
	Quantization      : Default (maps to Full Range)
	Flags             : 
VIDIOC_REQBUFS: ok
VIDIOC_QUERYBUF: ok
VIDIOC_QBUF: ok
VIDIOC_QUERYBUF: ok
VIDIOC_QBUF: ok
VIDIOC_QUERYBUF: ok
VIDIOC_QBUF: ok
VIDIOC_QUERYBUF: ok
VIDIOC_QBUF: ok
VIDIOC_STREAMON: ok

and it stuck here.
the dmesg error shows:

[ 6649.251584] og02b10 6-0010: og02b10_power_off: power off
[ 6649.272323] og02b10 6-0010: og02b10_power_on: power on
[ 6649.458655] Unable to handle kernel read from unreadable memory at virtual address 000000a0
[ 6649.467027] Mem abort info:
[ 6649.469813]   ESR = 0x96000005
[ 6649.472881]   Exception class = DABT (current EL), IL = 32 bits
[ 6649.478838]   SET = 0, FnV = 0
[ 6649.481888]   EA = 0, S1PTW = 0
[ 6649.485036] Data abort info:
[ 6649.487928]   ISV = 0, ISS = 0x00000005
[ 6649.491769]   CM = 0, WnR = 0
[ 6649.494745] user pgtable: 4k pages, 39-bit VAs, pgd = ffffffc0eaad1000
[ 6649.501275] [00000000000000a0] *pgd=0000000000000000, *pud=0000000000000000
[ 6649.508265] Internal error: Oops: 96000005 [#1] PREEMPT SMP
[ 6649.513824] Modules linked in: fuse overlay zram binfmt_misc nvgpu bluedroid_pm ip_tables x_tables
[ 6649.522969] CPU: 3 PID: 9018 Comm: vi-output, og02 Not tainted 4.9.140-tegra #30
[ 6649.530376] Hardware name: NVIDIA Jetson Nano Developer Kit (DT)
[ 6649.536398] task: ffffffc0f29b8000 task.stack: ffffffc0be294000
[ 6649.542368] PC is at tegra_camera_update_clknbw+0x28/0x2a8
[ 6649.547895] LR is at tegra_channel_set_stream+0x1a8/0x4c8
[ 6649.553325] pc : [<ffffff8008529fe0>] lr : [<ffffff8008b2e048>] pstate: 20400045
[ 6649.560736] sp : ffffffc0be297c80
[ 6649.564076] x29: ffffffc0be297c80 x28: ffffffc0f97b1e28 
[ 6649.569451] x27: ffffffc0f97b1018 x26: 0000000000000000 
[ 6649.574828] x25: 0000000000000001 x24: 0000000000000001 
[ 6649.580244] x23: ffffffc0f97b1018 x22: ffffffc0be297dec 
[ 6649.585690] x21: 0000000000000001 x20: 0000000000000000 
[ 6649.591134] x19: ffffffc0f97b1018 x18: 0000000000000000 
[ 6649.596574] x17: 0000000000000001 x16: 0000000000000000 
[ 6649.602015] x15: 0000000000000000 x14: ffffffc0fa7bc600 
[ 6649.607459] x13: 00000040f5801000 x12: 0000000034d5d91d 
[ 6649.612905] x11: 000000000000000b x10: 0000000000000a20 
[ 6649.618346] x9 : ffffffc0be297d70 x8 : ffffffc0f29b8a80 
[ 6649.623787] x7 : 0000000000085c00 x6 : 00000000000efc00 
[ 6649.629230] x5 : 000000000000000f x4 : 0000000000000000 
[ 6649.634672] x3 : 0000000000000008 x2 : ffffffc0f97b1018 
[ 6649.640115] x1 : 0000000000000001 x0 : 0000000000000000 

[ 6649.647126] Process vi-output, og02 (pid: 9018, stack limit = 0xffffffc0be294000)
[ 6649.654679] Call trace:
[ 6649.657227] [<ffffff8008529fe0>] tegra_camera_update_clknbw+0x28/0x2a8
[ 6649.663841] [<ffffff8008b2e048>] tegra_channel_set_stream+0x1a8/0x4c8
[ 6649.670367] [<ffffff8008b309e8>] tegra_channel_enable_stream+0x48/0x60
[ 6649.676976] [<ffffff8008b32390>] tegra_channel_kthread_capture_start+0x760/0x8b0
[ 6649.684461] [<ffffff80080dbee4>] kthread+0xec/0xf0
[ 6649.689339] [<ffffff8008083850>] ret_from_fork+0x10/0x40
[ 6649.694745] ---[ end trace 82c7752a97d9c5b8 ]---

How can I debug this kind of error. Where I can start? thanks,

traced error to

kernel\kernel\nvidia\drivers\video\tegra\camera\tegra_camera_platform.c

to the function:

tegra_camera_update_clknbw

may need some more input

Did you modify below properties?

num_csi_lanes = <2>;
 		max_lane_speed = <1500000>;
 		min_bits_per_pixel = <10>;
 		vi_peak_byte_per_pixel = <2>;
 		vi_bw_margin_pct = <25>;
 		max_pixel_rate = <160000>;
 		isp_peak_byte_per_pixel = <5>;
 		isp_bw_margin_pct = <25>;

Yes I changed here as well. still exact the same issue.

further debug found the crush point at calling of

info = dev_get_drvdata(tegra_camera_misc.parent);

inside the function

tegra_camera_update_clknbw

it seems that “tegra_camera_misc.parent” is not existed.
which is supposed to be initialized by function tegra_camera_probe

static int tegra_camera_probe(struct platform_device *pdev)
{
	int ret;
	struct tegra_camera_info *info;

	dev_info(&pdev->dev, "%s:camera_platform_driver probe\n", __func__);

	tegra_camera_misc.minor = MISC_DYNAMIC_MINOR;
	tegra_camera_misc.name = CAMDEV_NAME;
	tegra_camera_misc.fops = &tegra_camera_ops;
	tegra_camera_misc.parent = &pdev->dev;
...

However I check through dmesg log, it (tegra_camera_probe) seems not run at all.
(“sudo dmesg | grep camera_platform_driver” returns me nothing)

ps:
also found exact same issue in this topic:

Someone mentioned this is not issue for previously jetpack release. I believe it is a driver issue somewhere.

Could you check the status is set as okay in the tegra-camera-platform and the modules/modulex

    tegra-camera-platform {
            compatible = "nvidia, tegra-camera-platform";

            status = "okay";

Hi Shane,

I made the change you suggested, also rebuild the kernel with latest JetPack 32.2.3 (previously using 32.2.1) and was able to solve the problem. thank you. I still don’t know if the error is from dedicated JetPack version or from my hardware settings.

also I noticed that tegra-camera-platform appears on several dtsi files besides my new device dtsi files, such as:

tegra210-porg-plugin-manager.dtsi
tegra210-porg-camera.dtsi

I don’t know which one is the critical one but I changed them all.

hi @sunxishan I hope you had solved your issue related to this sensor 0g02b10.
could you please help me to write the drivers for the same 0g02b10, I am trying to write a cam_sensor.h (3.1 KB)
user space application, my registers space seems to be wrong. I would like to attach the .h file for your reference