Qcom-camss: /dev/media1 device node missing on latest release/qcomlt-4.9

Hi community,

We are going from 4.4 to 4.9. (We expect the latest changes related to DMIC support will arrive on 4.9 only)

I am using release/qcomlt-4.9(180b1b7c70a3c567b72421dd9ac1b465527bdf65)

When I enable OV5645 in the device tree /dev/video0-5 are created as expected, but only /dev/media0. /dev/media1 is not created.

So I’m not able to configure the topology of camss.

Got any ideas on how to fix this?

Hi,

When there are any camera sensors enabled in the device tree (and connected to camss device by endpoint nodes) the camss driver will wait for these camera devices to be probed and their subdevs to be registered. Only then the camss will register the media device. So media node can be missing if there is some problem with a camera sensor which is defined in DT but not probed successfully. Reason that can be that the camera sensor is not connected at all to the board or there is some other problem. Please check the kernel log after boot for any error messages from ov5645 probe. Also it can happen if you have enabled two camera sensors in device tree but only one is connected to the board.

Hope this will help. Please share your progress. Thank you.

1 Like

Error messages and output related to qcom-camss and ov5645:

    root@av2:~# dmesg|grep -i "camss\|ov56\|error\|fail"
    [    0.185165] Error: Driver 'msm_iommu' is already registered, aborting...
    [    0.185174] qcom_iommu: Failed to register IOMMU driver
    [    0.185179] Failed to initialise IOMMU /soc/qcom,iommu@1e00000
    [    0.244919] dmi: Firmware registration failed.
    [    0.263976] Initramfs unpacking failed: junk in compressed archive
    [    1.578206] qcom-tsens 4a8000.thermal-sensor: tsens calibration failed
    [    1.743595] remoteproc remoteproc0: Direct firmware load for mba.mbn failed with error -2
    [    1.753952] apq8016-lpass-cpu 7708000.lpass: asoc_qcom_lpass_cpu_platform_probe() error getting mi2s-osr-clk: -2
    [    1.754011] apq8016-lpass-cpu 7708000.lpass: asoc_qcom_lpass_cpu_platform_probe() error getting mi2s-osr-clk: -2
    [    1.754079] apq8016-lpass-cpu 7708000.lpass: asoc_qcom_lpass_cpu_platform_probe() error getting mi2s-osr-clk: -2
    [    1.754155] apq8016-lpass-cpu 7708000.lpass: asoc_qcom_lpass_cpu_platform_probe() error getting mi2s-osr-clk: -2
    [    2.138019] remoteproc remoteproc0: Direct firmware load for mba.mbn failed with error -2
    [    2.138026] remoteproc remoteproc0: request_firmware failed: -2
    [    2.314225] cpu cpu1: opp_list_debug_create_link: Failed to create link
    [    2.333748] cpu cpu1: _add_opp_dev: Failed to register opp debugfs (-12)
    [    2.337221] cpu cpu2: opp_list_debug_create_link: Failed to create link
    [    2.344085] cpu cpu2: _add_opp_dev: Failed to register opp debugfs (-12)
    [    2.350424] cpu cpu3: opp_list_debug_create_link: Failed to create link
    [    2.357366] cpu cpu3: _add_opp_dev: Failed to register opp debugfs (-12)
    [    3.939084] iommu: Adding device 1b0ac00.camss to group 0
    [    3.943896] qcom-camss 1b0ac00.camss: Entity type for entity msm_csiphy0 was not initialized!
    [    3.943946] qcom-camss 1b0ac00.camss: Entity type for entity msm_csiphy1 was not initialized!
    [    3.962841] qcom-camss 1b0ac00.camss: Entity type for entity msm_csid0 was not initialized!
    [    3.962885] qcom-camss 1b0ac00.camss: Entity type for entity msm_csid1 was not initialized!
    [    3.978313] qcom-camss 1b0ac00.camss: Entity type for entity msm_ispif0 was not initialized!
    [    3.978342] qcom-camss 1b0ac00.camss: Entity type for entity msm_ispif1 was not initialized!
    [    3.987071] qcom-camss 1b0ac00.camss: Entity type for entity msm_vfe0_rdi0 was not initialized!
    [    3.995023] qcom-camss 1b0ac00.camss: Entity type for entity msm_vfe0_rdi1 was not initialized!
    [    4.003644] qcom-camss 1b0ac00.camss: Entity type for entity msm_vfe0_rdi2 was not initialized!
    [    4.012021] qcom-camss 1b0ac00.camss: Entity type for entity msm_vfe0_pix was not initialized!
    [    4.232045] ov5645 1-0078: OV5645 detected at address 0x78

As you can see bellow, I have only enabled one camera. The device-tree configuration is the same as on my local release/qcomlt-4.4 branch, where I’m able to configure the topologi of camss through the media framework and use the ov5645 camera.

diff --git a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
index 0a8e3bd..294d462 100644
--- a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
+++ b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
@@ -410,7 +410,7 @@
                                data-lanes = <0 2>;
                                qcom,settle-cnt = <0xe>;
                                remote-endpoint = <&ov5645_2_ep>;
-                               status = "disabled";
+                               status = "okay";
                        };
                };
        };
@@ -447,9 +447,9 @@
                };
        };
 
-       camera_front@74 {
+       camera_front@78 {
                compatible = "ovti,ov5645";
-               reg = <0x74>;
+               reg = <0x78>;
 
                enable-gpios = <&msmgpio 33 0>;
                reset-gpios = <&msmgpio 28 1>;
@@ -464,7 +464,7 @@
                vdda-supply = <&camera_vdda_2v8>;
                vddd-supply = <&camera_vddd_1v5>;
 
-               status = "disabled";
+               status = "okay";
 
                port {
                        ov5645_2_ep: endpoint {
@@ -609,4 +609,4 @@
 
 &venus {
        status = "okay";
-};
\ No newline at end of file
+};

In my case I have two OV5645 cameras attached to my 410c. I was able to turn them both on by starting with the build #236 and reversing the patch that disabled the cameras. I did not change the reg from 0x74 to 0x78.

cd kernel
git show bffd64e24b45824e495532b0521cb5c5568c6ee0 | patch -p 1 -R

Full disclosure. I am an employee of Qualcomm Canada, Any opinions I may have expressed in this or any other post may not reflect the views of my employer.

You are refering to build #236, on what commit is this build based? Where can I find the builds?

All builds are available here:

http://builds.96boards.org/snapshots/dragonboard410c/linaro/debian/

for each build has detailed info about the build itself in the page header, and you will find the commit info.

1 Like

To get camera_front working i had to comment out camera_rear:

diff --git a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
index 0a8e3bd..9ca2dc1 100644
--- a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
+++ b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
@@ -393,6 +393,7 @@
 	ports {
 		#address-cells = <1>;
 		#size-cells = <0>;
+/*
 		port@0 {
 			reg = <0>;
 			csiphy0_ep: endpoint {
@@ -403,6 +404,7 @@
 				status = "disabled";
 			};
 		};
+*/
 		port@1 {
 			reg = <1>;
 			csiphy1_ep: endpoint {
@@ -410,7 +412,7 @@
 				data-lanes = <0 2>;
 				qcom,settle-cnt = <0xe>;
 				remote-endpoint = <&ov5645_2_ep>;
-				status = "disabled";
+				status = "okay";
 			};
 		};
 	};
@@ -418,7 +420,7 @@
 
 &blsp_i2c6 {
 	status = "ok";
-
+/*
 	camera_rear@76 {
 		compatible = "ovti,ov5645";
 		reg = <0x76>;
@@ -446,7 +448,7 @@
 			};
 		};
 	};
-
+*/
 	camera_front@74 {
 		compatible = "ovti,ov5645";
 		reg = <0x74>;
@@ -464,7 +466,7 @@
 		vdda-supply = <&camera_vdda_2v8>;
 		vddd-supply = <&camera_vddd_1v5>;
 
-		status = "disabled";
+		status = "okay";
 
 		port {
 			ov5645_2_ep: endpoint {
@@ -609,4 +611,4 @@
 
 &venus {
 	status = "okay";
-};
\ No newline at end of file
+};
-- 
2.7.4

Hello,

You have discovered a bug in the driver…
You can try this small diff with your initial configuration (enabled front camera and not commented rear camera) - this should fix you problem. Thank you for this report!

diff --git a/drivers/media/platform/qcom/camss-8x16/camss.c b/drivers/media/platform/qcom/camss-8x16/camss.c
index 6224e61..0cd366f 100644
--- a/drivers/media/platform/qcom/camss-8x16/camss.c
+++ b/drivers/media/platform/qcom/camss-8x16/camss.c
@@ -306,6 +306,9 @@ static int camss_of_parse_ports(struct device *dev,
        while ((node = of_graph_get_next_endpoint(dev->of_node, node))) {
                struct camss_async_subdev *csd;
 
+               if (!of_device_is_available(node))
+                       continue;
+
                csd = devm_kzalloc(dev, sizeof(*csd), GFP_KERNEL);
                if (!csd) {
                        of_node_put(node);
2 Likes

I added the three lines to my camss.c. Now I only had to enable the front cam and the media1 device node was created. Thanks!

1 Like

Hi. I read your statement about the device tree:“the camss driver will wait for these camera devices to be probed and their subdevs to be registered”. What I have is a single CSI port but I would like to be able to switch sensors (imx230 and ov5640) on this port. Is this possible? Partial device tree looks like this and does not seem to work. I get an error when I run media-ctl setup, such as sudo media-ctl -d /dev/media0 -V ‘“imx230 12-0020”:0[fmt:UYVY2X8/1920x1080],“msm_csiphy0”:0[fmt:UYVY2X8/1920x1080],“msm_csid0”:0[fmt:UYVY2X8/1920x1
080],“msm_ispif0”:0[fmt:UYVY2X8/1920x1080],“msm_vfe0_rdi0”:0[fmt:UYVY2X8/1920x1080]’
Unable to setup formats: No such file or directory (2)

Can you help?
Thanks,
Kim

&i2c_12 {
status = “ok”;

ov5640: camera_rear@78 {
	cell-index = <1>;
	compatible = "ovti,ov5640";
	reg = <0x78>;

	enable-gpios = <&tlmm 29 0>;
	reset-gpios = <&tlmm 30 0>;
	mclk-gpios = <&tlmm 13 0>;

	pinctrl-names = "cam_default", "cam_suspend";
	pinctrl-0 = <&cam_sensor_mclk0_active &cam_csi0_sensor_active>;
	pinctrl-1 = <&cam_sensor_mclk0_suspend
			&cam_csi0_sensor_suspend>;

	vddd-supply = <&vph_pwr_vreg>;
	vdddo-supply = <&pm8994_lvs1>;
	vdda-supply = <&pm8994_l18>;
	clocks = <&clock_mmss clk_mclk0_clk_src>,
			<&clock_mmss clk_camss_mclk0_clk>;
	clock-names = "cam_src_clk", "xclk";
	clock-frequency = <23880000>;
	status = "ok";
            port {
                    ov5640_ep: endpoint {
                            clock-lanes = <1>;
                            data-lanes = <0 2>;
                            remote-endpoint = <&csiphy0_ep>;
                    };
            };

};
imx230: camera_rear@20 {
	cell-index = <1>;
	compatible = "sony,imx230";
	reg = <0x20>;

	enable-gpios = <&tlmm 29 0>;
	reset-gpios = <&tlmm 30 0>;
	mclk-gpios = <&tlmm 13 0>;

	pinctrl-names = "cam_default", "cam_suspend";
	pinctrl-0 = <&cam_sensor_mclk0_active &cam_csi0_sensor_active>;
	pinctrl-1 = <&cam_sensor_mclk0_suspend
			&cam_csi0_sensor_suspend>;

	vddd-supply = <&vph_pwr_vreg>;
	vdddo-supply = <&pm8994_lvs1>;
	vdda-supply = <&pm8994_l18>;
	clocks = <&clock_mmss clk_mclk0_clk_src>,
			<&clock_mmss clk_camss_mclk0_clk>;
	clock-names = "cam_src_clk", "xclk";
	clock-frequency = <23880000>;
	status = "ok";
            port {
                    imx230_ep: endpoint {
                            clock-lanes = <1>;
                            data-lanes = <0 2>;
                            remote-endpoint = <&csiphy0mt_ep>;
                    };
            };

};

&camss {
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
csiphy0_ep: endpoint@0 {
clock-lanes = <1>;
data-lanes = <0 2>;
qcom,settle-cnt = <0xe>;
remote-endpoint = <&ov5640_ep>;
status = “ok”;
};
csiphy0mt_ep: endpoint@1 {
clock-lanes = <1>;
data-lanes = <0 2>;
qcom,settle-cnt = <0xe>;
remote-endpoint = <&imx230_ep>;
status = “ok”;
};

            };
    };

};

You have to switch the device tree tree too. You have to describe only the sensor which is currently connected to the port.