OV9732 Camera Bringup on TX2

Hi Shane,

The ov9732 probe success is happening now,

[ 1.484438] i2c /dev entries driver
[ 1.485961] ov9732 7-0036: probing v4l2 sensor.
[ 1.490566] ov9732 7-0036: ov9732_common_ops called here
[ 1.496421] ov9732 7-0036: ov9732_subdev_internal_ops called here
[ 1.503048] ov9732 7-0036: ov9732_ctrl_ops
[ 1.507768] ov9732 7-0036: ov9732_parse_dt called here
[ 1.513450] ov9732 7-0036: mclk in DT extperiph2
[ 1.518092] ov9732 7-0036: power down gpio not in DT: -2
[ 1.523418] ov9732 7-0036: power down gpio in DT: 0
[ 1.528557] ov9732 7-0036: reset gpios in DT: 457
[ 1.533795] ov9732 7-0036: get mclk extperiph2
[ 1.538792] ov9732 7-0036: ov9732_power_get can’t request pwdn_gpio -517
[ 1.540567] tegra-pcie 10003000.pcie-controller: link 0 down, retrying
[ 1.545624] ov9732 7-0036: ov9732_power_get request success reset_gpio 0
[ 1.552566] ov9732 7-0036: tegracam sensor driver:ov9732_v2.0.6
[ 1.552569] ov9732 7-0036: VVDN: tegra camera driver registration success
[ 1.559385] ov9732 7-0036: ov9732_probe: initialize ov9732_board_setup
[ 1.566447] ov9732 7-0036: ov9732_board_setup called here ++
[ 1.572119] ov9732 7-0036: ov9732_board_setup: going to enable camera_common_mclk
[ 1.580139] ov9732 7-0036: camera_common_mclk_enable: camera_common_mclk_enable called
[ 1.588592] ov9732 7-0036: camera_common_mclk_enable: enable MCLK with 24000000 Hz
[ 1.597267] ov9732 7-0036: camera_common_mclk_enable: MCLK rate24000000 Hz
[ 1.604938] ov9732 7-0036: ov9732_power_on: power on
[ 1.604999] ata1: SATA link down (SStatus 0 SControl 300)
[ 1.614523] ov9732 7-0036: ov9732_power_on: Power ON success
[ 1.622755] ov9732 7-0036: ov9732_probe: initialize v4l2subdev_register
[ 1.629947] ov9732 7-0036: ov9732_probe: ov9732_debugfs_create called
[ 1.636925] ov9732 7-0036: Detected OV9732 sensor

But no video node and subdev node is coming in /dev
I have seen some errors related to nvcsi and vi as below

root@localhost:/home/ubuntu# dmesg | grep nvcsi
[ 0.573086] iommu: Adding device 150c0000.nvcsi to group 30
[ 22.087451] nvcsi 150c0000.nvcsi: initialized
[ 22.087698] nvcsi: probe of 150c0000.nvcsi failed with error -22
root@localhost:/home/ubuntu# dmesg | grep tegra-vi4
[ 22.093716] tegra-vi4 15700000.vi: using default number of vi channels,15
[ 22.103124] tegra-vi4 15700000.vi: initialized
[ 22.104903] tegra-vi4 15700000.vi: ep of_device is not enabled /host1x/vi@15700000/ports/port@0/endpoint.
[ 22.104911] tegra-vi4 15700000.vi: ep of_device is not enabled /host1x/vi@15700000/ports/port@1/endpoint.
[ 22.114530] tegra-vi4: probe of 15700000.vi failed with error -22

is this the reason for no video node ??

JFI, In our design ov9732 is connected to CSI port 5 and we are using single lane. and below are the changes done for this in kernel_source/hardware/nvidia/platform/t18x/common/kernel-dts/t18x-common-modules/tegra186-camera-e3326-a00.dtsi

    vi@15700000 {
        num-channels = <1>;
        ports {
            #address-cells = <1>;
            #size-cells = <0>;
            port@0 {
                reg = <0>;
                e3326_vi_in0: endpoint {
                    status = "okay";
                    port-index = <5>;
                    bus-width = <1>;
                    remote-endpoint = <&e3326_csi_out0>;
    nvcsi@150c0000 {
        num-channels = <1>;
        #address-cells = <1>;
        #size-cells = <0>;
        channel@0 {
            reg = <0>;
            ports {
                #address-cells = <1>;
                #size-cells = <0>;
                port@0 {
                    reg = <0>;
                    e3326_csi_in0: endpoint@0 {
                        port-index = <5>;
                        bus-width = <1>;
                        remote-endpoint = <&e3326_ov5693_out0>;
                    };
                };
                port@1 {
                    reg = <1>;
                    e3326_csi_out0: endpoint@1 {
                        remote-endpoint = <&e3326_vi_in0>;

Please suggest what could the possible reason for nvcsi failure or some configuration issue in my dtsi related to mipi ?

Please check the extracted_proc.dts have define below context for nvcsi and vi.

                nvcsi@150c0000 {
                        compatible = "nvidia,tegra186-nvcsi";
                        power-domains = <0x1f 0xb>;
                        reg = <0x0 0x150c0000 0x0 0x40000>;
                        resets = <0x10 0x58>;
                        clocks = <0x10 0xb4 0x10 0xb5 0x10 0x20e 0x10 0x10d>;
                        clock-names = "nvcsi", "nvcsilp", "nvcsi_parent", "nvcsilp_parent";
                        interrupts = <0x0 0x77 0x4>;
                        iommus = <0x11 0x2>;
                        iommu-group-id = <0x1>;
                        status = "okay";
                        num-ports = <0x6>;
                        nvidia,csi_regulator = "avdd_dsi_csi";
                        num-channels = <0x2>;
                        #address-cells = <0x1>;
                        #size-cells = <0x0>;
                        linux,phandle = <0x131>;
                        phandle = <0x131>;

in my extracted dts, this node is present as below:

            nvcsi@150c0000 {
                    num-channels = <0x2>;
                    power-domains = <0x1f 0xb>;
                    compatible = "nvidia,tegra186-nvcsi";
                    clocks = <0x10 0xb4 0x10 0xb5 0x10 0x20e 0x10 0x10d>;
                    resets = <0x10 0x58>;
                    num-ports = <0x6>;
                    clock-names = "nvcsi", "nvcsilp", "nvcsi_parent", "nvcsilp_parent";
                    status = "okay";
                    #address-cells = <0x1>;
                    interrupts = <0x0 0x77 0x4>;
                    #size-cells = <0x0>;
                    phandle = <0x119>;
                    iommu-group-id = <0x1>;
                    reg = <0x0 0x150c0000 0x0 0x40000>;
                    iommus = <0x11 0x2>;
                    nvidia,csi_regulator = "avdd_dsi_csi";
                    linux,phandle = <0x119>;

Can you please explain how we can debug the nvcsi and vi errors ?

Please have narrow the probe() function to figure where failed in below files

../kernel/nvidia/drivers/video/tegra/host/nvcsi/nvcsi.c
../kernel/nvidia/drivers/video/tegra/host/vi/vi4.c

Hi Shane,

I tried to debug the nvcsi errors but no success yet still i am getting error as below:

[ 22.072949] isp 15600000.isp: initialized
[ 22.073182] isp 15600000.isp: isp_probe: failed
[ 22.077911] isp: probe of 15600000.isp failed with error -22
[ 22.086912] nvcsi 150c0000.nvcsi: initialized
[ 22.087145] nvcsi: probe of 150c0000.nvcsi failed with error -22
[ 22.089550] tegra-vi4 15700000.vi: using default number of vi channels,15
[ 22.099696] tegra-vi4 15700000.vi: initialized
[ 22.101441] tegra-xusb-padctl 3520000.xusb_padctl: failed to setup XUSB ports: -517
[ 22.102940] tegra-vi4: probe of 15700000.vi failed with error -22

============below are the camera probe success logs========================
[ 1.965397] ov9732 7-0036: probing v4l2 sensor.
[ 1.969956] ov9732 7-0036: VVDN: ov9732_common_ops called here
[ 1.975802] ov9732 7-0036: VVDN: ov9732_subdev_internal_ops called here
[ 1.982429] ov9732 7-0036: VVDN: ov9732_ctrl_ops
[ 1.987108] ov9732 7-0036: VVDN: ov9732_parse_dt called here
[ 1.992785] ov9732 7-0036: mclk in DT extperiph2
[ 1.997419] ov9732 7-0036: power down gpio not in DT: -2
[ 2.002745] ov9732 7-0036: power down gpio in DT: 0
[ 2.007691] ov9732 7-0036: reset gpios in DT: 457
[ 2.012444] ov9732 7-0036: VVDN: get mclk extperiph2
[ 2.017425] ov9732 7-0036: ov9732_power_get can’t request pwdn_gpio -517
[ 2.024140] ov9732 7-0036: ov9732_power_get can’t request reset_gpio -16
[ 2.030878] ov9732 7-0036: ov9732_power_get request success reset_gpio -16
[ 2.037772] ov9732 7-0036: camera_common_parse_ports: port 5 num of lanes 1
[ 2.044744] ov9732 7-0036: Success to find port info.
[ 2.049317] tegra-pcie 10003000.pcie-controller: link 0 down, retrying
[ 2.049811] ov9732 7-0036: Success to find general properties.
[ 2.055721] ov9732 7-0036: ov9732_probe: name ov9732_f
[ 2.060875] ov9732 7-0036: camera_common_create_debugfs ov9732_f
[ 2.066909] ov9732 7-0036: tegracam sensor driver:ov9732_v2.0.6
[ 2.066912] ov9732 7-0036: VVDN: tegra camera driver registration success
[ 2.073712] ov9732 7-0036: ov9732_probe: VVDN: initialize ov9732_board_setup
[ 2.080772] ov9732 7-0036: ov9732_board_setup called here ++
[ 2.086443] ov9732 7-0036: ov9732_board_setup: VVDN: going to enable camera_common_mclk
[ 2.094461] ov9732 7-0036: camera_common_mclk_enable: VVDN: camera_common_mclk_enable called
[ 2.102914] ov9732 7-0036: camera_common_mclk_enable: VVDN: enable MCLK with 24000000 Hz
[ 2.111451] ov9732 7-0036: camera_common_mclk_enable: VVDN: MCLK rate24000000 Hz
[ 2.118955] ov9732 7-0036: ov9732_power_on: VVDN: power on
[ 2.128518] ov9732 7-0036: ov9732_power_on: Power ON success
[ 2.134237] ov9732 7-0036: ov9732_set_gain: gain 0 val: 0
[ 2.140877] ov9732 7-0036: ov9732_set_gain: gain 16 val: 10
[ 2.147502] ov9732 7-0036: ov9732_probe: VVDN: initialize v4l2subdev_register
[ 2.154669] ov9732 7-0036: ov9732_probe: VVDN: ov9732_debugfs_create called
[ 2.161643] ov9732 7-0036: VVDN: Detected OV9732 sensor

Please suggest a way around to debug the nvcsi, isp and vi errors.

Try to use default dtb to check if the ISP/NVCSI/VI still probe failed to narrow down the problem.

Hi Shane,

I have tried to trace back the nvcsi, isp and vi failures. attaching the logs below for reference

================================================
[ 22.089432] isp 15600000.isp: VVDN: isp_probe called
[ 22.094492] isp 15600000.isp: VVDN: tegra_isp_of_match
[ 22.102119] isp 15600000.isp: VVDN: nvhost_module_init
[ 22.108016] isp 15600000.isp: initialized
[ 22.108298] isp 15600000.isp: VVDN: nvhost_client_device_init

[ 22.114186] VVDN: dev_get_drvdata error //error case
[ 22.114194] isp 15600000.isp: VVDN: tegra_camera_device_register
[ 22.120214] isp 15600000.isp: VVDN: tegra_camera_device_register error calling free_isr
[ 22.128312] isp 15600000.isp: isp_probe:VVDN free_isr done
[ 22.133808] isp 15600000.isp: isp_probe:VVDN failed
[ 22.138820] isp: probe of 15600000.isp failed with error -22
[ 22.151009] nvcsi 150c0000.nvcsi: initialized
[ 22.151095] nvcsi 150c0000.nvcsi: VVDN: tegra_camera_device_register called(0)

[ 22.158379] VVDN: dev_get_drvdata error //error case
[ 22.158384] nvcsi 150c0000.nvcsi: VVDN: err_module_init (-22)
[ 22.164311] nvcsi: probe of 150c0000.nvcsi failed with error -22

[ 22.170248] tegra-vi4 15700000.vi: VVDN: tegra_vi4_probe
[ 22.175845] tegra-vi4 15700000.vi: VVDN: match found
[ 22.180959] tegra-vi4 15700000.vi: VVDN: device data found
[ 22.181571] tegra-xusb-padctl 3520000.xusb_padctl: failed to setup XUSB ports: -517
[ 22.185973] tegra-usb-cd usb_cd: otg phy is not available yet
[ 22.188702] gpio tegra-gpio-aon wake29 for gpio=56(FF:0)
[ 22.188804] gpio tegra-gpio-aon wake67 for gpio=57(FF:1)
[ 22.188893] gpio tegra-gpio-aon wake68 for gpio=58(FF:2)
[ 22.189144] input: gpio-keys as /devices/gpio-keys/input/input2
[ 22.194397] tegra-vi4 15700000.vi: using default number of vi channels,15
[ 22.194402] tegra-vi4 15700000.vi: num vi channels : 15
[ 22.194634] tegra-xusb-padctl 3520000.xusb_padctl: failed to setup XUSB ports: -517
[ 22.199257] tegra-usb-cd usb_cd: otg phy is not available yet
[ 22.212159] tegra-vi4 15700000.vi: VVDN: nvhost_module_init
[ 22.218226] tegra-vi4 15700000.vi: initialized
[ 22.219898] tegra-vi4 15700000.vi: ep of_device is not enabled /host1x/vi@15700000/ports/port@0/endpoint.
[ 22.219906] tegra-vi4 15700000.vi: ep of_device is not enabled /host1x/vi@15700000/ports/port@1/endpoint.
[ 22.219909] tegra-vi4 15700000.vi: VVDN: tegra_vi_media_controller_init called

[ 22.233366] VVDN: dev_get_drvdata error //error case
[ 22.233374] tegra-vi4 15700000.vi: VVDN: tegra_camera_device_register
[ 22.251659] tegra-vi4: probe of 15700000.vi failed with error -22

=================================================================
Could you please suggest what could be the possible reason for the failure of the ā€œdev_get_drvdata errorā€

Suppose it could be the device tree have problem cause the dev_get_drvdata error.

Hi Shane,

We are facing tegra_camera_platform probe failures due to which subdev bound is failing for our camera. I have attached the full logs for your reference .

[ 1.298215] tegra-pcie 10003000.pcie-controller: PCIE: Enable power rails
[ 1.298794] tegra_camera_platform tegra-camera-platform: tegra_camera_probe: VVDN: camera_platform_driver probe
[ 1.298857] tegra-pcie 10003000.pcie-controller: probing port 0, using 4 lanes
[ 1.299052] misc tegra_camera_ctrl: tegra_camera_isomgr_register tpg_max_iso = 3916800KBs
[ 1.299059] misc tegra_camera_ctrl: tegra_camera_isomgr_register isp_iso_bw=4687500, vi_iso_bw=2000000, max_bw=4687500
[ 1.299069] pre_t19x_iso_plat_register(): iso bandwidth 4687500KB is not available, client tegra_camera_ctrl
[ 1.299116] misc tegra_camera_ctrl: tegra_camera_isomgr_register: unable to register to isomgr
[ 1.299138] misc tegra_camera_ctrl: tegra_camera_probe: VVDN: failed to register CAMERA as isomgr client
[ 1.299172] tegra_camera_platform: probe of tegra-camera-platform failed with error -12
[ 1.305145] tegra-pcie 10003000.pcie-controller: probing port 2, using 1 lanes

Any help will be appreciated.

dmesg_logs.txt (57.7 KB)

Hi Shane,

Please share your feedback.

Check device tree in your device /proc/device-tree/ have the tegra-camera-platform {}

Hi Shane,

ov9732 driver is probed successfully and now i am getting video/subdev nodes also. but the video which is captured using gst-launch is not proper used below command to capture video:
gst-launch-1.0 nvarguscamerasrc num-buffers=200 ! ā€˜video/x-raw(memory:NVMM),width=1280, height=720, framerate=30/1, format=NV12’ ! omxh264enc ! qtmux ! filesink location=test2.mp4 -e

I had checked regarding the sensor register configuration from the vendor and they said its fine. As per their response the issue is from the platform configuration.

I am attaching the camera dtsi and captured image. Please suggest how can i fix the camera preview.tegra186-camera-ov9732_ntdi.dtsi.txt (14.7 KB) tegra186-quill-camera-ov9732-a00.dtsi.txt (3.4 KB)

Any response will be appreciated.

Have a try v4l2-ctl --set-ctrl preferred_stride=256, or some other value.

Hi Shane,

Issue is resolved now.
Thanks for the support.