iMX8QM MIPI CSI2 virtual channel setting

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

iMX8QM MIPI CSI2 virtual channel setting

ソリューションへジャンプ
2,104件の閲覧回数
aso
Contributor III

Hello Community!

 
I am developing an ISP board that connects to iMX8QM MEK.
The hardware configuration diagram is below.
The software is Linux 6.1.22, and the sensor driver is created based on gmsl-max9286.c.
WS000000.JPG

 

Now I get an exception when starting Linux.
The sensor board outputs virtual channel 2ch via MIPI, and I have an inquiry regarding the kernel 2ch settings.

[ question 1 ]
I changed the kernel dts and sensor driver as shown below, but are there any mistakes in the settings?

dts:

&isi_0 {
	status = "okay";

	cap_device {
		status = "okay";
	};

	m2m_device {
		status = "okay";
	};
};

&isi_1 {
	status = "okay";

	cap_device {
		status = "okay";
	};
};

&isi_2 {
	status = "disabled";		//[sdi] to disabled

	cap_device {
		status = "disabled";	//[sdi] to disabled
	};
};

&isi_3 {
	status = "disabled";		//[sdi] to disabled

	cap_device {
		status = "disabled";	//[sdi] to disabled
	};
};

&isi_4 {
	status = "disabled";		//[sdi] to disabled

	cap_device {
		status = "disabled";	//[sdi] to disabled
	};
};

&isi_5 {
	status = "disabled";		//[sdi] to disabled

	cap_device {
		status = "disabled";	//[sdi] to disabled
	};
};

&isi_6 {
	status = "disabled";		//[sdi] to disabled

	cap_device {
		status = "disabled";	//[sdi] to disabled
	};
};

&isi_7 {
	status = "disabled";		//[sdi] to disabled

	cap_device {
		status = "disabled";	//[sdi] to disabled
	};
};

&mipi_csi_0 {
	#address-cells = <1>;
	#size-cells = <0>;
	virtual-channel;
	status = "okay";

	/* Camera 0  MIPI CSI-2 (CSIS0) */
	port@0 {
		reg = <0>;
		mipi_csi0_ep: endpoint {
			remote-endpoint = <&max9286_0_ep>;
			data-lanes = <1 2 3 4>;
		};
	};
};

&i2c_mipi_csi0 {
	#address-cells = <1>;
	#size-cells = <0>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_i2c_mipi_csi0>;
	clock-frequency = <100000>;
	status = "okay";

	max9286_mipi@6a {
		compatible = "sdi,isp_mipi";
		reg = <0x6a>;
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_mipi_csi0>;
		clocks = <&clk_dummy>;
		clock-names = "capture_mclk";
		mclk = <27000000>;
		mclk_source = <0>;
		pwn-gpios = <&lsio_gpio1 27 GPIO_ACTIVE_HIGH>;
		virtual-channel;
		status = "okay";
		port {
			max9286_0_ep: endpoint {
				remote-endpoint = <&mipi_csi0_ep>;
				data-lanes = <1 2 3 4>;
			};
		};
	};
};

 

senser driver probe function:

#define MIPI_CSI2_SENS_VC0_PAD_SOURCE	0
#define MIPI_CSI2_SENS_VC1_PAD_SOURCE	1
#define MIPI_CSI2_SENS_VC2_PAD_SOURCE	2
#define MIPI_CSI2_SENS_VCX_PADS_NUM		2

struct sensor_data {
		:
	struct media_pad pads[MIPI_CSI2_SENS_VCX_PADS_NUM];
		:
}

sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
sd->entity.function = MEDIA_ENT_F_CAM_SENSOR;
max9286_data->pads[MIPI_CSI2_SENS_VC0_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE;
max9286_data->pads[MIPI_CSI2_SENS_VC1_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE;
retval = media_entity_pads_init(&sd->entity, MIPI_CSI2_SENS_VCX_PADS_NUM, max9286_data->pads);

 

Linux dmesg:

[    2.428771] isp_mipi 2-006a: isp_mipi is found, name isp_mipi 2-006a

[   10.169351] imx8_media_dev: module is from the staging directory, the quality is unknown, you have been warned.
[   10.196793] mx8-img-md: Registered mxc_isi.0.capture as /dev/video3
[   10.214497] mx8-img-md: Registered mxc_isi.1.capture as /dev/video4
[   10.221031] mx8-img-md: Registered sensor subdevice: isp_mipi_cam 2-006a (1)
[   10.241443] mx8-img-md: created link [mxc_isi.0] => [mxc_isi.0.capture]
[   10.285198] mx8-img-md: created link [mxc-mipi-csi2.0] => [mxc_isi.0]
[   10.304164] mx8-img-md: created link [mxc_isi.1] => [mxc_isi.1.capture]
[   10.323244] mx8-img-md: created link [mxc-mipi-csi2.0] => [mxc_isi.1]
[   10.364732] ------------[ cut here ]------------
[   10.369366] WARNING: CPU: 0 PID: 337 at drivers/media/mc/mc-entity.c:1021 media_create_pad_link+0x8c/0x220
[   10.379044] Modules linked in: flexcan(+) can_dev snd_soc_fsl_sai(+) snd_soc_fsl_audmix imx8_media_dev(C+) snd_soc_fsl_asrc snd_soc_fsl_utils snd_soc_fsl_esai caam error imx_dsp_rproc fuse
[   10.395873] CPU: 0 PID: 337 Comm: (udev-worker) Tainted: G         C         6.1.22 #51
[   10.403888] Hardware name: Freescale i.MX8QM MEK (DT)
[   10.408945] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[   10.415911] pc : media_create_pad_link+0x8c/0x220
[   10.420629] lr : media_create_pad_link+0x58/0x220
[   10.425338] sp : ffff80000c1db6f0
[   10.428655] x29: ffff80000c1db6f0 x28: ffff000811dcd080 x27: ffff0008119e0880
[   10.435805] x26: 0000000000000004 x25: 0000000000000040 x24: ffff00081a5d6650
[   10.442954] x23: 0000000000000002 x22: 0000000000000002 x21: 0000000000000003
[   10.450096] x20: ffff000811dcd080 x19: ffff0008119e0880 x18: 0000000000000006
[   10.457245] x17: 730a323d6461705f x16: 6b6e697320323d64 x15: 61705f656372756f
[   10.464386] x14: 7320383639333836 x13: 383d736461705f6d x12: 756e3e2d6b6e6973
[   10.471527] x11: 20323d736461705f x10: 0000000000000a70 x9 : ffff8000081e329c
[   10.478668] x8 : ffff0008155655d0 x7 : 0000000000000000 x6 : 0000000000000015
[   10.485809] x5 : ffff0008ff32ea18 x4 : ffff0008ff32ea18 x3 : 0000000000000000
[   10.492950] x2 : 0000000000000000 x1 : ffff000815564b00 x0 : 0000000000000002
[   10.500092] Call trace:
[   10.502535]  media_create_pad_link+0x8c/0x220
[   10.506903]  subdev_notifier_complete+0x4ac/0x6c0 [imx8_media_dev]
[   10.513106]  v4l2_async_nf_try_complete+0x84/0x9c
[   10.517823]  __v4l2_async_nf_register+0xe8/0x140
[   10.522444]  v4l2_async_nf_register+0x4c/0x74
[   10.526805]  mxc_md_probe+0x674/0xa40 [imx8_media_dev]
[   10.531957]  platform_probe+0x70/0xcc
[   10.535623]  really_probe+0xc8/0x3e0
[   10.539203]  __driver_probe_device+0x84/0x190
[   10.543564]  driver_probe_device+0x44/0x120
[   10.547751]  __driver_attach+0xfc/0x204
[   10.551591]  bus_for_each_dev+0x7c/0xe0
[   10.555431]  driver_attach+0x2c/0x40
[   10.559010]  bus_add_driver+0x184/0x240
[   10.562850]  driver_register+0x80/0x13c
[   10.566690]  __platform_driver_register+0x30/0x3c
[   10.571399]  mxc_md_driver_init+0x28/0x1000 [imx8_media_dev]
[   10.577071]  do_one_initcall+0x60/0x2d0
[   10.580911]  do_init_module+0x50/0x1f0
[   10.584664]  load_module+0x1c44/0x2024
[   10.588418]  __do_sys_finit_module+0xac/0x12c
[   10.592779]  __arm64_sys_finit_module+0x28/0x34
[   10.597313]  invoke_syscall+0x50/0x120
[   10.601066]  el0_svc_common.constprop.0+0xd4/0xf4
[   10.605775]  do_el0_svc+0x34/0xd0
[   10.609093]  el0_svc+0x2c/0x84
[   10.612154]  el0t_64_sync_handler+0xf4/0x120
[   10.616426]  el0t_64_sync+0x18c/0x190
[   10.620093] ---[ end trace 0000000000000000 ]---
[   10.636501] mx8-img-md: subdev_notifier_complete error exit
[   10.642194] mxc-md bus@58000000:camera: Sensor register failed
[   10.648142] mxc-md: probe of bus@58000000:camera failed with error -22

 

The causes of the exception are as follows.

drivers/media/mc/mc-entity.c:1035

WARN_ON(source_pad >= source->num_pads) ||

This is because source_pad=2, source->num_pads=2.

 

[ question 2 ]

I think gmsl-max9286.c is virtual channel 4ch. With this 4ch setting, no exception occurs, but is it okay to use the 4ch setting even with 2ch output?


All suggestions welcome. 
Best regards.

0 件の賞賛
返信
1 解決策
1,992件の閲覧回数
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @aso,

I hope you are doing well.

There seem to be redundant nodes of mipi_csi_0 in shared dts.

It looks like virtual channels are hardcoded to 1 or 4 in imx8-media-dev.c driver.

mipi_vc = (mipi_csi2->vchannel) ? 4 : 1;

One can try changing it in /drivers/staging/media/imx/imx8-media-dev.c

Thanks & Regards,
Dhruvit Vasavada

元の投稿で解決策を見る

0 件の賞賛
返信
4 返答(返信)
2,035件の閲覧回数
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @aso,

I hope you are doing well.

Have you disabled mipi_csi_1 and i2c_mipi_csi1 nodes also?

There seems to be some issue with the configuration of source pad mappings.

Please share the full device tree.

Thanks & Regards,
Dhruvit Vasavada

0 件の賞賛
返信
2,023件の閲覧回数
aso
Contributor III

Hi, @Dhruvit

Thank you for your reply.
Yes, it's disabled.
I have attached a dts file, so please check it.

Best regards.

0 件の賞賛
返信
1,993件の閲覧回数
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @aso,

I hope you are doing well.

There seem to be redundant nodes of mipi_csi_0 in shared dts.

It looks like virtual channels are hardcoded to 1 or 4 in imx8-media-dev.c driver.

mipi_vc = (mipi_csi2->vchannel) ? 4 : 1;

One can try changing it in /drivers/staging/media/imx/imx8-media-dev.c

Thanks & Regards,
Dhruvit Vasavada

0 件の賞賛
返信
1,949件の閲覧回数
aso
Contributor III

Hi, @Dhruvit

Thanks for your support.
I modified imx8-media-dev.c and succeeded in avoiding the exception.

Now I started Linux and started debugging the sensor driver, but camera capture fails.
I'll post this issue in a separate thread.

Best regards.

0 件の賞賛
返信