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
- Added the sensor driver source code to drivers/media/i2c/dummy_sensor.c, based on the reference driver
- Added sensor_get_frame_desc function based on the TI IMX219 driver
-
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 ...
-
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 ...
-
Enable the kernel module for the sensor in arch/arm64/configs/defconfig:
... CONFIG_CORESIGHT_CTI=m CONFIG_MEMTEST=y CONFIG_VIDEO_DUMMY_SENSOR=m
-
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"; }; }; -
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