Bring up of the imx708 sensor on CSI0

Hi there.
Probably I’m not the first one who’s trying to use imx708 (RPI camera module 3) with BYAI, but unfortunately I cannot find much of the information about it and thus decided to “port it” on my own. However I faced problems, and lack of experience in this particular area blocks me from the further progress, and thus looking for hints advises and help. So, what do I have at this moment:

  • BYAI 6.1 kernel, which I’m rebuilding on my own;
  • I created a patch which brings imx708 driver(copied from RPI repo) into BYAI kernel. I am able to rebuild kernel with no issues, deploy it, and it works fine (oh well, I have added the only driver, and no other modifications, so that is expected);
  • I created a device tree overlay file for this sensor deriving it from the existing imx219 overlay file;
  • On the device I’m successfully loading both driver and DT via extlinux config, and in kernel logs I do not see any errors, and also kernel driver is able to properly detect that I have a “_wide” version of the sensor, thus, I assume at least i2c communication is working.

But that’s it, I’m actually stuck here and have no idea how to progress further.

  • From the kernel logs it is unclear if corresponding sensor was successfully connected to the v4l subsystem and if so, which particular device to be used.
  • If I’m trying to use libcamera tools I’m getting multiple errors, which are not too meaningful for me.

I have some doubts thought, which I’m not able to answer/address on my own:

  • In RPI there are a dedicated supply regulators configuration, while in BYAI I commented it out, thus using “default” one, not sure if this is a problem or not for this particular board, but anyways having a hard time to understand how properly configure it
  • I assume CSI related configuration is similar to imx219, but is it? :slight_smile: (I mean different freq - I changed that, but is there something else I’m missing)
  • There are some worrying me messages which I do not understand like following ones, and I cannot make much sense of them and if I need to fix that:
    • From kernel
      [ 12.325087] imx708 5-001a: Consider updating driver imx708 to match on endpoints
    • From libcamera tool
      [15:17:42.373858813] [9952] ERROR V4L2 v4l2_subdevice.cpp:1047 '30102000.ticsi2rx': Unable to set client capabilities: Inappropriate ioctl for device
Errors while running libcamera's qcam tool
debian@BeagleY-AI:~$ qcam 
[15:17:42.339476751] [9948] ERROR IPAModule ipa_module.cpp:172 Symbol ipaModuleInfo not found
[15:17:42.339630818] [9948] ERROR IPAModule ipa_module.cpp:292 v4l2-compat.so: IPA module has no valid info
[15:17:42.339876766] [9948]  INFO Camera camera_manager.cpp:313 libcamera v0.3.0
[15:17:42.373233375] [9952] ERROR V4L2 v4l2_subdevice.cpp:1047 'cdns_csi2rx.30101000.csi-bridge': Unable to set client capabilities: Inappropriate ioctl for device
[15:17:42.373858813] [9952] ERROR V4L2 v4l2_subdevice.cpp:1047 '30102000.ticsi2rx': Unable to set client capabilities: Inappropriate ioctl for device
[15:17:42.374868261] [9952]  WARN CameraSensor camera_sensor.cpp:259 'imx708_wide': Recommended V4L2 control 0x009a0922 not supported
[15:17:42.375038963] [9952]  WARN CameraSensor camera_sensor.cpp:331 'imx708_wide': The sensor kernel driver needs to be fixed
[15:17:42.375096514] [9952]  WARN CameraSensor camera_sensor.cpp:333 'imx708_wide': See Documentation/sensor_driver_requirements.rst in the libcamera sources for more information
[15:17:42.376789941] [9952]  WARN CameraSensorProperties camera_sensor_properties.cpp:274 No static properties available for 'imx708_wide'
[15:17:42.376881832] [9952]  WARN CameraSensorProperties camera_sensor_properties.cpp:276 Please consider updating the camera sensor properties database
[15:17:42.376922093] [9952]  WARN CameraSensor camera_sensor.cpp:479 'imx708_wide': Failed to retrieve the camera location
[15:17:42.376957208] [9952]  WARN CameraSensor camera_sensor.cpp:501 'imx708_wide': Rotation control not available, default to 0 degrees
[15:17:42.377175901] [9952] ERROR V4L2 v4l2_subdevice.cpp:1047 'cdns_csi2rx.30101000.csi-bridge': Unable to set client capabilities: Inappropriate ioctl for device
[15:17:42.377263842] [9952] ERROR SimplePipeline simple.cpp:1610 Failed to open /dev/v4l-subdev1: Inappropriate ioctl for device
Related kernel logs while systems is booting up
[    1.296728] i2c 5-001a: Fixed dependency cycle(s) with /bus@f0000/ticsi2rx@30102000/csi-bridge@30101000
[    8.766288] imx708 5-001a: supply vana1 not found, using dummy regulator
[    8.766606] imx708 5-001a: supply vana2 not found, using dummy regulator
[    8.766691] imx708 5-001a: supply vdig not found, using dummy regulator
[    8.766761] imx708 5-001a: supply vddl not found, using dummy regulator
[    8.801560] imx708 5-001a: camera module ID 0x0302
[   12.325087] imx708 5-001a: Consider updating driver imx708 to match on endpoints
[   12.339146] cdns-csi2rx 30101000.csi-bridge: Probed CSI2RX with 2/4 lanes, 4 streams, external D-PHY

Here is a device tree overlay
// SPDX-License-Identifier: GPL-2.0
/dts-v1/;
/plugin/;
#include <dt-bindings/gpio/gpio.h>

&{/chosen} {
	overlays {
		k3-am67a-beagley-ai-csi0-imx708.kernel = __TIMESTAMP__;
	};
};
&{/} {
	clk_csi0_imx708_fixed: csi0-imx708-xclk {
		compatible = "fixed-clock";
		#clock-cells = <0>;
		clock-frequency = <24000000>;
	};
/*
	cam1_reg: cam-reg {
		startup-delay-us = <70000>;
		off-on-delay-us = <30000>;
		regulator-min-microvolt = <2700000>;
		regulator-max-microvolt = <2700000>;
	};
*/
};

&mcu_gpio0 {
	status = "okay";
};

&main_i2c2 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&main_i2c2_pins_default>;
	clock-frequency = <400000>;

	#address-cells = <1>;
	#size-cells = <0>;

	imx708: camera-sensor@1a {
		compatible = "sony,imx708";
		reg = <0x1a>;

		clocks = <&clk_csi0_imx708_fixed>;
		clock-names = "inclk";

		pinctrl-names = "default";
		pinctrl-0 = <&csi0_gpio_pins_default>;

		reset-gpios = <&mcu_gpio0 15 GPIO_ACTIVE_HIGH>;
/*
		vana1-supply = <&cam1_reg>;
		vana2-supply = <&cam_dummy_reg>;
		vdig-supply = <&cam_dummy_reg>;
		vddl-supply = <&cam_dummy_reg>;
*/
		port {
			imx708_csi0_ep: endpoint {
				clock-lanes = <0>;
				data-lanes = <1 2>;
				clock-noncontinuous;
				link-frequencies = /bits/ 64 <450000000>;
				remote-endpoint = <&csi2rx0_in_sensor>;
			};
		};

	};
};

&cdns_csi2rx0 {
	ports {
		#address-cells = <1>;
		#size-cells = <0>;

		csi0_port0: port@0 {
			reg = <0>;
			status = "okay";

			csi2rx0_in_sensor: endpoint {
				remote-endpoint = <&imx708_csi0_ep>;
				bus-type = <4>; /* CSI2 DPHY */
				clock-lanes = <0>;
				data-lanes = <1 2>;
			};
		};
	};
};

&ti_csi2rx0 {
	status = "okay";
};
&dphy0 {
	status = "okay";
};

Okay, so I have some progress here, I think I’m close enough to the success. Meantime I’ve created a bunch of merge requests, one more to go.

2 Likes

Did you manage to fix the " Inappropriate ioctl for device" issue too?

No, I didn’t. However I would say that imx219 camera had the same, when I was testing it, and you are still able to use that sensor/camera. So it seems it is not a critical “issue”.

Apart from that, I’m still struggling to find a way how to collect an image from the sensor, still working on that.

Two more merge requests for kernels 6.6 and 6.12

So all kernels will have that driver