This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

J722SXH01EVM: Custom CSI-2 Sensor not being built

Part Number: J722SXH01EVM

Tool/software:

Hi,

I am trying to enable a new dummy CSI-2 sensor and unable to build the driver.

As described in the related question, I did the following:

  • Add the sensor driver source code under drivers/media/i2c
  • Add the sensor configuration in drivers/media/i2c/Kconfig
  • Enable compilation of the sensor driver in drivers/media/i2c/Makefile
  • Enable the kernel module for the sensor in arch/arm64/configs/defconfig
  • Create a device tree overlay for the sensor and add it to arch/arm64/boot/dts/ti (updated formatting to match the other included sensors)
  • Added the device tree overlay to arch/arm64/boot/dts/ti/Makefile.

The sensor shows up in the device tree, and CSI2 Rx seems to be properly probed.

root@j722s-evm:/proc/device-tree# ls | grep sensor
sensor
root@j722s-evm:/proc/device-tree# dmesg | grep csi2                                                                                                                                                                
[    7.937727] platform sensor: Fixed dependency cycle(s) with /bus@f0000/ticsi2rx@30102000/csi-bridge@30101000
[    9.004053] cdns-csi2rx 30101000.csi-bridge: Probed CSI2RX with 2/4 lanes, 4 streams, external D-PHY

However, when I try to query the sensor, the sensor does not show up, Only the csi2rx.  

root@j722s-evm:/proc/device-tree# v4l2-ctl --list-devices
TI-CSI2RX (platform:30102000.ticsi2rx):
        /dev/media0

wave5-dec (platform:30210000.video-codec):
        /dev/video0
        /dev/video1

root@j722s-evm:/proc/device-tree# media-ctl -p      
Media controller API version 6.6.32

Media device information
------------------------
driver          j721e-csi2rx
model           TI-CSI2RX
serial          
bus info        platform:30102000.ticsi2rx
hw revision     0x1
driver version  6.6.32

Device topology
- entity 1: 30102000.ticsi2rx (7 pads, 0 link, 0 routes)
            type V4L2 subdev subtype Unknown flags 0
        pad0: Sink
        pad1: Source
        pad2: Source
        pad3: Source
        pad4: Source
        pad5: Source
        pad6: Source

- entity 9: cdns_csi2rx.30101000.csi-bridge (5 pads, 0 link, 0 routes)
            type V4L2 subdev subtype Unknown flags 0
        pad0: Sink
        pad1: Source
        pad2: Source
        pad3: Source
        pad4: Source

Looking at the log after doing make linux, it seems like dummy-sensor.c is not being built (but the other drivers under media/i2c are):

...
  LD [M]  drivers/media/i2c/ds90ub953.ko
  LD [M]  drivers/media/i2c/ds90ub960.ko
  LD [M]  drivers/media/i2c/imx219.ko
  LD [M]  drivers/media/i2c/imx390.ko
  LD [M]  drivers/media/i2c/imx412.ko
  LD [M]  drivers/media/i2c/ov2312.ko
  LD [M]  drivers/media/i2c/ov5640.ko
  LD [M]  drivers/media/i2c/ov5645.ko
  LD [M]  drivers/media/i2c/ox05b1s.ko
...

When comparing to the IMX219 driver, it seems like I'm adding the same changes to enable the dummy sensor, but for some reason the dummy sensor is getting skipped during make linux.

  • I added typos in the driver code to see make linux would throw an error - it did not for dummy-sensor.c, but did for imx219.c

Questions

  1. What is causing the specific /media/i2c/ drivers above to be built while the other drivers defined in defconfig and Makefile are not? 
  2. Why might cause the dummy sensor driver to be skipped?

Thank you,

Jin

  • Hi Fabiana, 

    I cleaned the kernel source w/ "make ARCH=arm64 CROSS_COMPILE="$CROSS_COMPILE_64" distclean" as instructed in the user guide in addition to "make linux clean" before building, but getting the same result (dummy-sensor.ko not built).

    Thank you,

    Jin

  • Hi Jin,

    Are you enabling the sensor in ti_config_fragments/v8_audio_display.cfg?

    Follow the "Enable a New CSI2 Sensor" section of this guide: https://dev.ti.com/tirex/explore/node?node=A__AR3wevo2133UK-QLr4RUgQ__AM67-ACADEMY__XufTZAH__LATEST

    Thank you,

    Fabiana

  • Hi Fabiana,

    I don't seem to have ti_config_fragments in the kernel folder, or the v8_audio_display.cfg. I don't recall deleting any folders that came with the SDK but maybe it could've been deleted by a make?

    I do have this folder ($kernel/configs)

    Should the ti_config_fragments folder be included in the J722 Linux SDK by default?

    Thank you,

    Jin

  • Hi Jin,

    After reviewing the page, I see it appears to be out of date. Instead of doing this, enable the kernel module for the sensor in arch/arm64/configs/defconfig:

    CONFIG_VIDEO_<SENSOR_NAME>=m

    Thank you,

    Fabiana

  • Hi Fabiana, 

    Thank you. The defconfig is modified accordingly.

    After some testing, I discovered that the configuration fails to pass due to its dependency on VIDEO_V4L2. Excluding this dependency updates the .config file properly. 

    config VIDEO_DUMMY_SENSOR
    	tristate "Dummy sensor support"
    	depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API # <- this dependency causes fail
    #	depends on VIDEO_V4L2_SUBDEV_API <- this works
    	select V4L2_FWNODE
    	help
    	  This is a V4L2 sensor driver for CSI2 sources that have no controls 
    	  but need to hook into a V4L2 receiver subdevice.

    How can I add VIDEO_V4L2 to the kernel? I see that the 'config VIDEO_V4L2_SUBDEV_API' is defined in ($kernel/drivers/media/v4l2-core/Kconfig), but VIDEO_V4L2 is not included.

    Thank you,

    Jin

  • Seems VIDEO_V4L2 was merged with VIDEO_DEV in v5.18.

    the Kconfig needs to be updated accordingly.

    config VIDEO_DUMMY_SENSOR
    	tristate "Dummy sensor support"
    	depends on VIDEO_DEV && VIDEO_V4L2_SUBDEV_API # <- Updated dependency
    	select V4L2_FWNODE
    	help
    	  This is a V4L2 sensor driver for CSI2 sources that have no controls 
    	  but need to hook into a V4L2 receiver subdevice.

    Edit: Copying log showing that the sensor is registering now.

    root@j722s-evm:~# v4l2-ctl --list-devices
    j721e-csi2rx (platform:30102000.ticsi2rx):
            /dev/video2
            /dev/video3
            /dev/video4
            /dev/video5
            /dev/video6
            /dev/video7
            /dev/media0
    
    wave5-dec (platform:30210000.video-codec):
            /dev/video0
            /dev/video1
    
    root@j722s-evm:~# media-ctl -p
    Media controller API version 6.6.32
    
    Media device information
    ------------------------
    driver          j721e-csi2rx
    model           TI-CSI2RX
    serial          
    bus info        platform:30102000.ticsi2rx
    hw revision     0x1
    driver version  6.6.32
    
    Device topology
    - entity 1: 30102000.ticsi2rx (7 pads, 7 links, 1 route)
                type V4L2 subdev subtype Unknown flags 0
                device node name /dev/v4l-subdev0
            routes:
                    0/0 -> 1/0 [ACTIVE]
            pad0: Sink
                    [stream:0 fmt:UYVY8_1X16/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:lim-range]
                    <- "cdns_csi2rx.30101000.csi-bridge":1 [ENABLED,IMMUTABLE]
            pad1: Source
                    [stream:0 fmt:UYVY8_1X16/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:lim-range]
                    -> "30102000.ticsi2rx context 0":0 [ENABLED,IMMUTABLE]
            pad2: Source
                    -> "30102000.ticsi2rx context 1":0 [ENABLED,IMMUTABLE]
            pad3: Source
                    -> "30102000.ticsi2rx context 2":0 [ENABLED,IMMUTABLE]
            pad4: Source
                    -> "30102000.ticsi2rx context 3":0 [ENABLED,IMMUTABLE]
            pad5: Source
                    -> "30102000.ticsi2rx context 4":0 [ENABLED,IMMUTABLE]
            pad6: Source
                    -> "30102000.ticsi2rx context 5":0 [ENABLED,IMMUTABLE]
    
    - entity 9: cdns_csi2rx.30101000.csi-bridge (5 pads, 2 links, 1 route)
                type V4L2 subdev subtype Unknown flags 0
                device node name /dev/v4l-subdev1
            routes:
                    0/0 -> 1/0 [ACTIVE]
            pad0: Sink
                    [stream:0 fmt:UYVY8_1X16/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:lim-range]
                    <- "dummy_csi2_sensor":0 [ENABLED,IMMUTABLE]
            pad1: Source
                    [stream:0 fmt:UYVY8_1X16/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:lim-range]
                    -> "30102000.ticsi2rx":0 [ENABLED,IMMUTABLE]
            pad2: Source
            pad3: Source
            pad4: Source
    
    - entity 15: dummy_csi2_sensor (1 pad, 1 link, 0 routes)
                 type V4L2 subdev subtype Sensor flags 0
                 device node name /dev/v4l-subdev2
            pad0: Source
                    [stream:0 fmt:SBGGR8_1X8/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:full-range
                     crop:(0,0)/640x480]
                    -> "cdns_csi2rx.30101000.csi-bridge":0 [ENABLED,IMMUTABLE]
    
    - entity 21: 30102000.ticsi2rx context 0 (1 pad, 1 link)
                 type Node subtype V4L flags 0
                 device node name /dev/video2
            pad0: Sink
                    <- "30102000.ticsi2rx":1 [ENABLED,IMMUTABLE]
    
    - entity 27: 30102000.ticsi2rx context 1 (1 pad, 1 link)
                 type Node subtype V4L flags 0
                 device node name /dev/video3
            pad0: Sink
                    <- "30102000.ticsi2rx":2 [ENABLED,IMMUTABLE]
    
    - entity 33: 30102000.ticsi2rx context 2 (1 pad, 1 link)
                 type Node subtype V4L flags 0
                 device node name /dev/video4
            pad0: Sink
                    <- "30102000.ticsi2rx":3 [ENABLED,IMMUTABLE]
    
    - entity 39: 30102000.ticsi2rx context 3 (1 pad, 1 link)
                 type Node subtype V4L flags 0
                 device node name /dev/video5
            pad0: Sink
                    <- "30102000.ticsi2rx":4 [ENABLED,IMMUTABLE]
    
    - entity 45: 30102000.ticsi2rx context 4 (1 pad, 1 link)
                 type Node subtype V4L flags 0
                 device node name /dev/video6
            pad0: Sink
                    <- "30102000.ticsi2rx":5 [ENABLED,IMMUTABLE]
    
    - entity 51: 30102000.ticsi2rx context 5 (1 pad, 1 link)
                 type Node subtype V4L flags 0
                 device node name /dev/video7
            pad0: Sink
                    <- "30102000.ticsi2rx":6 [ENABLED,IMMUTABLE]