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:未构建定制 CSI-2传感器

Guru**** 2487425 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1438142/j722sxh01evm-custom-csi-2-sensor-not-being-built

器件型号:J722SXH01EVM

工具与软件:

您好!

我正在尝试启用新的虚拟 CSI-2传感器、但无法构建驱动程序。

如相关问题所述、我做了以下工作:

  • 在 drivers/media/i2c 下添加传感器驱动程序源代码
  • 在 drivers/media/i2c/Kconfig 中添加传感器配置
  • 启用 drivers/media/i2c/Makefile 中的传感器驱动程序编译
  • 在 arch/arm64/configs/defconfig 中启用传感器的内核模块
  • 为传感器创建器件树叠加层并将其添加到 arch/arm64/boot/dts/ti (更新了格式以匹配其他包含的传感器)
  • 向 arch/arm64/boot/dts/ti/Makefile 添加了器件树叠加层。

传感器显示在器件树中、CSI2 Rx 似乎已正确探测。

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

不过、当我尝试查询传感器时、不会显示传感器、只有 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

在执行  make Linux 后查看日志、似乎没有构建 dummy-sensor.c (但 media/i2c 下的其他驱动程序是):

...
  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
...

与 IMX219驱动程序相比、我似乎要添加相同的更改来启用虚拟传感器、但出于某种原因、在 make Linux 期间跳过了虚拟传感器

  • 我在驱动程序代码中添加了拼写错误以查看使 Linux 抛出错误-该错误不是针对 dummy-sensor.c、而是针对 imx219.c

问题

  1. 是什么导致构建上述特定的/media/i2c 驱动程序、而 defconfig 和 Makefile 中定义的其他驱动程序不是?  
  2. 为什么可能导致跳过虚拟传感器驱动程序?

谢谢!

Jin

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Jin:

    您是否在构建前清理内核源?  

    请参阅此处的《内核用户指南》: https://software-dl.ti.com/jacinto7/esd/processor-sdk-linux-j722s/10_00_00_08/exports/docs/linux/Foundational_Components_Kernel_Users_Guide .html

    谢谢!

    Fabiana

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Fabiana:  

    除了在构建前"清理 Linux"外、我还按照用户指南中的说明使用"make ARCH=ARM64 CROSS_COMPILE="$CROSS_COMPILE_64" distclean"清除了内核源代码、但得到了相同的结果(未构建 dummy-sensor.ko)。

    谢谢!

    Jin

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Jin:

    是否 在 ti_config_fragements/v8_audio_display.cfg 中启用传感器?

    请按照本指南的"启用新的 CSI2传感器"部分进行操作: https://dev.ti.com/tirex/explore/node?node=A__AR3wevo2133UK-QLr4RUgQ__AM67-ACADEMY__XufTZAH__LATEST

    谢谢!

    Fabiana

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Fabiana:

    内核文件夹或 v8_audio_display.cfg 中似乎没有 ti_config_fragments。 我不记得删除 SDK 附带的任何文件夹、但它可能已被 make 删除?

    我没有此文件夹($kernel/configs)

    默认情况下、ti_config_fragments 文件夹是否应包含在 J722 Linux SDK 中?

    谢谢!

    Jin

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Jin:

    浏览过这个页面后、我发现它似乎已经过时了。 不这样做、而是在 arch/arm64/configs/defconfig 中为传感器启用内核模块:

    CONFIG_VIDEO_ =m

    谢谢!

    Fabiana

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Fabiana:  

    谢谢你。 会相应地修改 defconfig。

    经过一些测试后、我发现配置由于依赖 VIDEO_V4L2而无法通过。 如果不考虑此依赖项、则会正确更新.config 文件。  

    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.

    如何将 VIDEO_V4L2添加到内核中? 我看到"config video_V4L2_SUBDEV_API"是在($kernel/drivers/media/v4l2-core/Kconfig)中定义的、但不包含 VIDEO_V4L2。

    谢谢!

    Jin

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    似乎 VIDEO_V4L2已与 v5.18中的 VIDEO_DEV 合并。

    需要相应地更新 Kconfig。

    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.

    编辑:复制显示传感器正在注册的日志。

    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]