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: 'Unsupported media bus type' when probing dummy CSI2 sensor

Part Number: J722SXH01EVM


Tool/software:

Hi,

I am trying to add a 'dummy' sensor that just receives CSI-2 data without any configuration over I2C, based on this IMX219-based reference: https://github.com/raspberrypi/linux/pull/4226/

Background

  1. Added the sensor driver source code to drivers/media/i2c/dummy_sensor.c, based on the reference driver
    1. Added sensor_get_frame_desc function based on the TI IMX219 driver
  2. Add the sensor configuration in drivers/media/i2c/Kconfig:

    ...
    	  IMX214 camera.
    
    	  To compile this driver as a module, choose M here: the
    	  module will be called imx214.
    
    config VIDEO_IMX219
    	tristate "Sony IMX219 sensor support"
    	select V4L2_CCI_I2C
    	help
    	  This is a Video4Linux2 sensor driver for the Sony
    	  IMX219 camera.
    
    	  To compile this driver as a module, choose M here: the
    	  module will be called imx219.
    
    config VIDEO_IMX258
    	tristate "Sony IMX258 sensor support"
    	help
    ...
     
  3. Enable the compilation of the sensor driver in drivers/media/i2c/Makefile:

    ...
    obj-$(CONFIG_VIDEO_S5C73M3) += s5c73m3/
    obj-$(CONFIG_VIDEO_S5K5BAF) += s5k5baf.o
    obj-$(CONFIG_VIDEO_DUMMY_SENSOR) += dummy_sensor.o
    obj-$(CONFIG_VIDEO_S5K6A3) += s5k6a3.o
    obj-$(CONFIG_VIDEO_SAA6588) += saa6588.o
    ...
  4. Enable the kernel module for the sensor in arch/arm64/configs/defconfig:

    ...
    CONFIG_CORESIGHT_CTI=m
    CONFIG_MEMTEST=y
    CONFIG_VIDEO_DUMMY_SENSOR=m
    
  5. Create a device tree overlay for the sensor and add it to arch/arm64/boot/dts/ti:

    // SPDX-License-Identifier: GPL-2.0-only
    // Definitions for Dummy CSI2 sensor
    /dts-v1/;
    /plugin/;
    
    /{
    	compatible = "brcm,bcm2835";
    
    	fragment@0 {
    		target-path = "/";
    		__overlay__ {
    			sensor: sensor {
    				compatible = "raspberrypi,dummy-csi2-sensor";
    				status = "okay";
    
    				port {
    					sensor_0: endpoint {
    						remote-endpoint = <&csi2rx0_in_sensor>;
                            bus-type = <5>; /* CSI2 DPHY */
    					};
    				};
    			};
    		};
    	};
    
    	fragment@1 {
    		target = <&csi0_port0>;
    		__overlay__ {
    			status = "okay";
    
    			port {
    				csi2rx0_in_sensor: endpoint {
    					remote-endpoint = <&sensor_0>;
                        bus-type = <5>;
    					clock-lanes = <0>;
    				};
    			};
    		};
    	};
    
    	fragment@2 {
    		target = <&csi2rx0_in_sensor>;
    		__overlay__ {
    			data-lanes = <1>;
    		};
    	};
    
        fragment@3 {
            target = <&ti_csi2rx0>;
            __overlay__ {
                status = "okay";
            };
        };
    
        fragment@4 {
            target = <&dphy0>;
            __overlay__ {
                status = "okay";
            };
        };
    
    	fragment@5 {
    		target = <&csi2rx0_in_sensor>;
    		__dormant__ {
    			data-lanes = <1 2>;
    		};
    	};
    
    	fragment@6 {
    		target = <&csi2rx0_in_sensor>;
    		__dormant__ {
    			data-lanes = <1 2 3 4>;
    		};
    	};
    
    	fragment@7 {
    		target = <&csi2rx0_in_sensor>;
    		__dormant__ {
    			clock-noncontinuous;
    		};
    	};
    
    	fragment@8 {
    		target = <&sensor_0>;
    		__overlay__ {
    			data-lanes = <1>;
    		};
    	};
    
    	fragment@9 {
    		target = <&sensor_0>;
    		__dormant__ {
    			data-lanes = <1 2>;
    		};
    	};
    
    	fragment@10 {
    		target = <&sensor_0>;
    		__dormant__ {
    			data-lanes = <1 2 3 4>;
    		};
    	};
    
    	fragment@11 {
    		target = <&sensor_0>;
    		__dormant__ {
    			clock-noncontinuous;
    		};
    	};
    
    	__overrides__ {
    		2lanes = <0>, "-2+3-6+7";
    		4lanes = <0>, "-2+4-6+8";
    		noncontinuous = <0>, "+5+9";
    	};
    };
  6. Add the device tree overlay to arch/arm64/boot/dts/ti/Makefile:

    ...
    # Boards with J722s SoC
    dtb-$(CONFIG_ARCH_K3) += k3-j722s-evm.dtb
    dtb-$(CONFIG_ARCH_K3) += k3-j722s-evm-csi2-ov5640.dtbo
    dtb-$(CONFIG_ARCH_K3) += k3-j722s-evm-csi2-quad-rpi-cam-imx219.dtbo
    dtb-$(CONFIG_ARCH_K3) += k3-j722s-evm-csi2-quad-tevi-ov5640.dtbo
    dtb-$(CONFIG_ARCH_K3) += k3-j722s-evm-dsi-rpi-7inch-panel.dtbo
    dtb-$(CONFIG_ARCH_K3) += k3-j722s-evm-fpdlink-fusion.dtbo
    dtb-$(CONFIG_ARCH_K3) += k3-j722s-evm-microtips-mf101hie-panel.dtbo
    dtb-$(CONFIG_ARCH_K3) += k3-j722s-evm-v3link-fusion.dtbo
    dtb-$(CONFIG_ARCH_K3) += k3-j722s-evm-pwm.dtbo
    dtb-$(CONFIG_ARCH_K3) += k3-j722s-evm-dummy.dtbo
    ...

Problem

When I build, install, and boot the kernel with these updates, I get the following error:

root@j722s-evm:~# dmesg | grep csi
[ 8.853457] cdns-csi2rx 30101000.csi-bridge: Unsupported media bus type: 0x2
[ 8.891400] cdns-csi2rx: probe of 30101000.csi-bridge failed with error -22

The error is thrown when the cdns-csi2rx.c driver is probed, in csi2rx_parse_dt:

}

	if (v4l2_ep.bus_type != V4L2_MBUS_CSI2_DPHY) {
		dev_err(csi2rx->dev, "Unsupported media bus type: 0x%x\n",
			v4l2_ep.bus_type);
		of_node_put(ep);
		return -EINVAL;
	}

Digging into the v4l2 functions, I can't find where/why the media bus type is being initialized to 0x2. 

How can I property initialize it to V4L2_MBUS_CSI2_DPHY?

Thank you,

Jin

  • Hi Jin,

    What SDK version are you working with? There is an issue with the device tree overlay you have created for your sensor. If you are using imx219 as a reference, I recommend using the supported imx219.c and imx219 device tree overlay for this platform as a reference.

    Thank you,

    Fabiana

  • Hi Fabiana, I am working with the J722S Linux SDK 10.0.0.8. 

    I reformatted the overlay to match the imx219 overlay in the SDK and the bus error seems to be gone. 

    // SPDX-License-Identifier: GPL-2.0-only
    // Definitions for Dummy CSI2 sensor
    /dts-v1/;
    /plugin/;
    
    &{/} {
    	clk_imx219_fixed: imx219-xclk {
    		compatible = "fixed-clock";
    		#clock-cells = <0>;
    		clock-frequency = <24000000>;
    	};
    
    	sensor: sensor {
    		compatible = "raspberrypi,dummy-csi2-sensor";
    		status = "okay";
    
    		port {
    			sensor_0: endpoint {
    				remote-endpoint = <&csi2rx0_in_sensor>;
                    bus-type = <4>; /* CSI2 DPHY */
    			};
    		};
    	};
    };
    
    &cdns_csi2rx0 {
    	ports {
    		csi0_port0: port {
    			status = "okay";
    
    			csi2rx0_in_sensor: endpoint {
    				remote-endpoint = <&sensor_0>;
    				bus-type = <4>; /* CSI2 DPHY. */
    				clock-lanes = <0>;
    				data-lanes = <1 2>;
    			};
    		};
    	};
    };
    
    &ti_csi2rx0 {
    	status = "okay";
    };
    
    &dphy0 {
    	status = "okay";
    };
    

    Now, I get the following message:

    root@j722s-evm:~# dmesg | grep csi
    [    7.944430] platform sensor: Fixed dependency cycle(s) with /bus@f0000/ticsi2rx@30102000/csi-bridge@30101000
    [    8.027301] platform 30101000.csi-bridge: Fixed dependency cycle(s) with /sensor
    [    9.253851] cdns-csi2rx 30101000.csi-bridge: Probed CSI2RX with 2/4 lanes, 4 streams, external D-PHY
    

    And sensor shows up in the device tree:

    root@j722s-evm:/proc/device-tree# ls | grep sensor
    sensor
    

    Does the sensor seem properly initialized based on these?

    Thank you,

    Jin

  • Hi Jin,

    I'm glad you were able to clear the errors and yes, this output looks good.

    Thank you,

    Fabiana