MIPI-CSI Media Pipeline on IMX8M Mini not Working Hi team, I for the life of me, can not get the /dev/media0 node to show up in user space when trying to configure the media pipeline.I am using the Compulab IMX8M Mini SOM on a custom integration board with a YOCTO build for our use case. I am trying to integrate an Allied Vision camera with their Alvium CSI2 Drivers. A main baseline question: if the kernel and device tree are set up correctly, the /dev/media0 node will still show up if the pipeline is configured correctly? Or does a driver need to be loaded for the pipeline to initiated successfully? Because regardless, nothing I do can make the media0 node to show up. At boot time, the camera is not ready to go due to some board setup. Once in user space I (after the power regulators are setup and the camera is ready to go) I rebind the drivers to this output: root@b2qt-imx8mm-lpddr4-evk:/usr/share/BoardSetup-scripts# ./RebindCamera.sh Rebinding AVT camera driver... ./RebindCamera.sh: line 7: echo: write error: No such device [ 43.335322] avt_csi2 0-003c: avt_probe[5107]: /usr/src/debug/avt-csi2/1.2.0+git/avt-csi2.c [ 43.344799] avt_csi2 0-003c: avt_probe[5147]: no powerdown-gpios defined [ 43.351676] avt_csi2 0-003c: avt_probe[5164]: devm_gpiod_get_optional(dev, "reset-gpios" succeeded [ 43.360713] avt_csi2 0-003c: avt_probe[5171]: fwnode_property_present failed to find mipi_csi [ 43.369373] avt_csi2 0-003c: avt_probe[5188]: bcrm_wait_timeout not found, use default value [ 43.377842] avt_csi2 0-003c: avt_probe[5191]: bcrm_wait_timeout set to 3000ms [ 43.385046] avt_csi2 0-003c: avt_csi2_check_mipicfg[4586]: ep_cfg.bus.mipi_csi2.num_data_lanes 1 [ 43.393965] avt_csi2 0-003c: avt_csi2_check_mipicfg[4588]: v4l2_fwnode_ep.nr_of_link_frequencies 2 [ 43.402965] avt_csi2 0-003c: avt_csi2_check_mipicfg[4593]: v4l2_fwnode_ep.link-frequencies 0 value 445500000 [ 43.412824] avt_csi2 0-003c: avt_csi2_check_mipicfg[4593]: v4l2_fwnode_ep.link-frequencies 1 value 891000000 [ 43.422688] avt_csi2 0-003c: avt_probe[5213]: no powerdown-gpios powerdown defined [ 43.430332] avt_csi2 0-003c: avt_probe[5228]: no reset-gpios defined [ 43.436726] avt_csi2 0-003c: avt_reset[2080] [ 43.443043] avt_csi2 0-003c: wait_camera_available[2025]: Waiting for camera to shutdown... [ 44.648643] avt_csi2 0-003c: wait_camera_available[2033]: Waiting for camera to respond to I2C transfers... [ 45.269281] kauditd_printk_skb: 15 callbacks suppressed [ 45.269292] audit: type=1334 audit(1723754849.880:26): prog-id=21 op=UNLOAD [ 46.664540] avt_csi2 0-003c: wait_camera_available[2054]: Heartbeat supported, waiting for heartbeat to become active [ 49.878985] avt_csi2 0-003c: wait_camera_available[2064]: Heartbeat active [ 49.949573] avt_csi2 0-003c: read_cci_registers[748]: regmap_bulk_read(camera->regmap8, cci_cmd_tbl[CCI_REGISTER_LAYOUT_VERSION ].address ret 540 [ 49.969505] avt_csi2 0-003c: cci layout version b: 0x00000100 [ 49.975362] avt_csi2 0-003c: cci layout version a: 0x00010000 [ 49.981170] avt_csi2 0-003c: avt_probe[5285]: read_cci_registers succeeded [ 49.989267] avt_csi2 0-003c: avt_probe[5302]: bcrm_version_check succeeded [ 49.996951] avt_csi2 0-003c: bcrm_get_write_handshake_availibility[704]: BCRM write handshake supported! [ 49.996975] avt_csi2 0-003c: Found camera ALVIUM 1500 C-501c NIR [ 50.014014] avt_csi2 0-003c: avt_probe[5315]: Firmware version: 0.6.0.8c98 ret = 0 [ 50.024773] avt_csi2 0-003c: correct gcprm version [ 50.029887] avt_csi2 0-003c: avt_probe[5353]: INIT_WORK(&camera->bcrm_wrhs_work, bcrm_wrhs_work_func); [ 50.046953] avt_csi2 0-003c: avt_get_sensor_capabilities[4409]: csi clocks [ 50.046953] camera range: 40000000:750000000 Hz [ 50.046953] dts nr_of_link_frequencies 2 [ 50.046953] dts link_frequencies[0] 445500000 Hz [ 50.103673] avt_csi2 0-003c: avt_get_sensor_capabilities[4450]: csi clock read from camera: 443750000 Hz [ 50.113207] avt_csi2 0-003c: avt_get_sensor_capabilities[4454]: get minimal and maximal resolutions [ 50.128752] avt_csi2 0-003c: avt_init_avail_formats[1840]: add MEDIA_BUS_FMT_UYVY8_2X8/V4L2_PIX_FMT_UYVY/MIPI_CSI2_DT_YUV422_8B to list of available formats -1 - 1 [ 50.152546] avt_csi2 0-003c: avt_init_avail_formats[1841]: add MEDIA_BUS_FMT_UYVY8_1X16/V4L2_PIX_FMT_UYVY/MIPI_CSI2_DT_YUV422_8 B to list of available formats -1 - 1 [ 50.167322] avt_csi2 0-003c: avt_init_avail_formats[1842]: add MEDIA_BUS_FMT_YUYV8_1X16/V4L2_PIX_FMT_YUV422P/MIPI_CSI2_DT_YUV42 2_8B to list of available formats -1 - 1 [ 50.182333] avt_csi2 0-003c: avt_init_avail_formats[1843]: add MEDIA_BUS_FMT_YUYV8_2X8/V4L2_PIX_FMT_YUYV/MIPI_CSI2_DT_YUV422_8B to list of available formats -1 - 1 [ 50.197003] avt_csi2 0-003c: avt_init_avail_formats[1844]: add MEDIA_BUS_FMT_VYUY8_2X8/V4L2_PIX_FMT_VYUY/MIPI_CSI2_DT_YUV422_8B to list of available formats -1 - 1 [ 50.211670] avt_csi2 0-003c: avt_init_avail_formats[1849]: add MEDIA_BUS_FMT_RGB888_1X24/V4L2_PIX_FMT_RGB24/MIPI_CSI2_DT_RGB888 to list of available formats -1 - 1 [ 50.226343] avt_csi2 0-003c: avt_init_avail_formats[1850]: add MEDIA_BUS_FMT_RBG888_1X24/V4L2_PIX_FMT_RGB24/MIPI_CSI2_DT_RGB888 to list of available formats -1 - 1 [ 50.241008] avt_csi2 0-003c: avt_init_avail_formats[1851]: add MEDIA_BUS_FMT_BGR888_1X24/V4L2_PIX_FMT_RGB24/MIPI_CSI2_DT_RGB888 to list of available formats -1 - 1 [ 50.255682] avt_csi2 0-003c: avt_init_avail_formats[1852]: add MEDIA_BUS_FMT_RGB888_3X8/V4L2_PIX_FMT_RGB24/MIPI_CSI2_DT_RGB888 to list of available formats -1 - 1 [ 50.270271] avt_csi2 0-003c: avt_init_avail_formats[1856]: add MEDIA_BUS_FMT_SGRBG8_1X8/V4L2_PIX_FMT_SGRBG8/MIPI_CSI2_DT_RAW8 t o list of available formats 1 - 1 [ 50.284685] avt_csi2 0-003c: avt_init_avail_formats[1863]: add MEDIA_BUS_FMT_SGRBG10_1X10/V4L2_PIX_FMT_SGRBG10/MIPI_CSI2_DT_RAW 10 to list of available formats 1 - 1 [ 50.320636] avt_csi2 0-003c: avt_init_controls[3359]: Control Contrast (0x980901) not supported by camera [ 50.357183] avt_csi2 0-003c: avt_init_controls[3359]: Control Sharpness (0x98091b) not supported by camera [ 50.367712] avt_csi2 0-003c: avt_update_sw_ctrl_state[2840]: Software trigger control not found! [ 50.369213] avt_csi2 0-003c: avt_update_sw_ctrl_state[2840]: Software trigger control not found! [ 50.378025] avt_csi2 0-003c: avt_update_sw_ctrl_state[2840]: Software trigger control not found! [ 50.412857] mxc_mipi-csi 32e30000.mipi_csi: Registered sensor subdevice: avt_csi2 0-003c [ 50.429900] avt_csi2 0-003c: camera avt_csi2 0-003c registered [ 50.435940] avt_csi2 0-003c: -> avt_probe[5420]: sysfs group created! (0) [ 50.446676] avt_csi2 0-003c: avt_probe[5442]: probe success ! [ 50.378025] avt_csi2 0-003c: avt_update_sw_ctrl_state[2840]: Software trigger control not found! [ 50.412857] mxc_mipi-csi 32e30000.mipi_csi: Registered sensor subdevice: avt_csi2 0-003c [ 50.429900] avt_csi2 0-003c: camera avt_csi2 0-003c registered [ 50.435940] avt_csi2 0-003c: -> avt_probe[5420]: sysfs group created! (0) [ 50.446676] avt_csi2 0-003c: avt_probe[5442]: probe success ! root@b2qt-imx8mm-lpddr4-evk:/usr/share/BoardSetup-scripts# At this point I would assume the camera is set up and ready to stream but I cannot get any frames or data in to user space. I use the attached TestStream.sh script: root@b2qt-imx8mm-lpddr4-evk:/usr/share/BoardSetup-scripts# ./TestStream.sh ./TestStream.sh: line 1: amera: command not found === CAMERA STREAMING CONTROL === 1. Check current camera status: [ 76.502724] avt_csi2 0-003c: avt_core_ops_s_power[2156]+: on 1, camera->power_count 0 Format Video Capture:[ 76.511315] mxc_mipi-csi 32e30000.mipi_csi: format not match Width/Height : 0/0 [ 76.519017] avt_csi2 0-003c: avt_core_ops_s_power[2156]+: on 0, camera->power_count 1 Pixel Format : '' Field : Any Bytes per Line : 0 Size Image : 0 Colorspace : Default Tra[ 76.537857] avt_csi2 0-003c: avt_core_ops_s_power[2156]+: on 1, camera->power_count 0 nsfer Function : Default (maps to[ 76.548706] avt_csi2 0-003c: avt_core_ops_s_power[2156]+: on 0, camera->power_count 1 Rec. 709) YCbCr/HSV Encoding: Default (maps to ITU-R 601) Quantization : Default (maps to Full Range) Flags : 2. List available co[ 76.570719] avt_csi2 0-003c: avt_core_ops_s_power[2156]+: on 1, camera->power_count 0 ntrols: 3. List available form[ 76.581151] mxc_mipi-csi 32e30000.mipi_csi: format not match ats: ioctl: VIDIOC_ENUM_FMT Ty[ 76.589396] avt_csi2 0-003c: avt_core_ops_s_power[2156]+: on 0, camera->power_count 1 pe: Video Capture 4. Set a basic format: [ 76.611180] avt_csi2 0-003c: avt_core_ops_s_power[2156]+: on 1, camera->power_count 0 [ 76.619262] mxc_mipi-csi 32e30000.mipi_csi: format not match The pixelformat 'UYVY' is invalid[ 76.625042] avt_csi2 0-003c: avt_core_ops_s_power[2156]+: on 0, camera->power_count 1 5. Check if there's a streaming control: [ 76.647122] avt_csi2 0-003c: avt_core_ops_s_power[2156]+: on 1, camera->power_count 0 [ 76.655283] avt_csi2 0-003c: avt_core_ops_s_power[2156]+: on 0, camera->power_count 1 6. Try to enable streaming (if control exists): [ 76.672441] avt_csi2 0-003c: avt_core_ops_s_power[2156]+: on 1, camera->power_count 0 [ 76.682040] avt_csi2 0-003c: avt_core_ops_s_power[2156]+: on 0, camera->power_count 1 No streaming V4L2 control found [ 76.699454] avt_csi2 0-003c: avt_core_ops_s_power[2156]+: on 1, camera->power_count 0 [ 76.708214] avt_csi2 0-003c: avt_core_ops_s_power[2156]+: on 0, camera->power_count 1 No stream_enable control found 7. Try acquisition start (AVT specific): [ 76.724226] avt_csi2 0-003c: avt_core_ops_s_power[2156]+: on 1, camera->power_count 0 [ 76.733618] avt_csi2 0-003c: avt_core_ops_s_power[2156]+: on 0, camera->power_count 1 No acquisition_start control found 8. Check exposure and gain (make sure they're reasonable): [ 76.749702] avt_csi2 0-003c: avt_core_ops_s_power[2156]+: on 1, camera->power_count 0 [ 76.759271] avt_csi2 0-003c: avt_core_ops_s_power[2156]+: on 0, camera->power_count 1 No exposure control [ 76.775975] avt_csi2 0-003c: avt_core_ops_s_power[2156]+: on 1, camera->power_count 0 [ 76.784748] avt_csi2 0-003c: avt_core_ops_s_power[2156]+: on 0, camera->power_count 1 No gain control 9. Set reasonable exposure/gain if controls exist: [ 76.801835] avt_csi2 0-003c: avt_core_ops_s_power[2156]+: on 1, camera->power_count 0 [ 76.810768] avt_csi2 0-003c: avt_core_ops_s_power[2156]+: on 0, camera->power_count 1 Cannot set exposure [ 76.827415] avt_csi2 0-003c: avt_core_ops_s_power[2156]+: on 1, camera->power_count 0 [ 76.837494] avt_csi2 0-003c: avt_core_ops_s_power[2156]+: on 0, camera->power_count 1 Cannot set gain 10. Try to capture a frame after configuration: ./TestStream.sh: line 47: timeout: command not found ❌ Still no data after streaming configuration 11. Check kernel messages for streaming status: [ 76.784748] avt_csi2 0-003c: avt_core_ops_s_power[2156]+: on 0, camera->power_count 1 [ 76.801835] avt_csi2 0-003c: avt_core_ops_s_power[2156]+: on 1, camera->power_count 0 [ 76.810768] avt_csi2 0-003c: avt_core_ops_s_power[2156]+: on 0, camera->power_count 1 [ 76.827415] avt_csi2 0-003c: avt_core_ops_s_power[2156]+: on 1, camera->power_count 0 [ 76.837494] avt_csi2 0-003c: avt_core_ops_s_power[2156]+: on 0, camera->power_count 1 root@b2qt-imx8mm-lpddr4-evk:/usr/share/BoardSetup-scripts# Now because the format mismatch, I intend to reset change it through media-ctl on the /dev/media0 node. But that doesn't show up. Bellow is the core parts of the DTS that are relevant. // Define your camera on I2C bus &i2c1 { /* * Define the PCAL6416A GPIO expander at I2C address 0x21. * We give it a label 'gpio_expander' so we can reference it. */ gpio_expander: pcal6416a@21 { compatible = "nxp,pcal6416"; reg = <0x21>; gpio-controller; #gpio-cells = <2>; }; alvium: alvium@3c { compatible = "alliedvision,avt_csi2"; reg = <0x3c>; status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_alvium_clk>, <&pinctrl_alvium_gpio>; // Attollo Specifc Hardware setup for day cam power-supply = <&dayCam_step2>; reset-gpios = <&gpio1 15 GPIO_ACTIVE_LOW>; clocks = <&clk IMX8MM_CLK_CLKO1>; clock-names = "csi_mclk"; assigned-clocks = <&clk IMX8MM_CLK_CLKO1>; assigned-clock-parents = <&clk IMX8MM_CLK_24M>; assigned-clock-rates = <24000000>; port { reg = <0>; alvium_mipi_ep: endpoint { remote-endpoint = <&mipi1_sensor_ep>; data-lanes = <2>; link-frequencies = /bits/ 64 <445500000 891000000>; mipi-csi; }; }; }; }; &mipi_csi_1 { status = "okay"; /delete-node/ port; port { mipi1_sensor_ep: endpoint@1 { reg = <1>; remote-endpoint = <&alvium_mipi_ep>; data-lanes = <2>; csis-hs-settle = <13>; csis-clk-settle = <2>; csis-wclk; }; csi1_mipi_ep: endpoint@2 { reg = <2>; remote-endpoint = <&csi1_bridge_in>; }; }; }; &csi1_bridge { status = "okay"; fsl,mipi-mode; /delete-node/ port; port { csi1_bridge_in: endpoint { remote-endpoint = <&csi1_mipi_ep>; }; }; }; / { dayCam_step1: camPowerEnable { compatible = "regulator-fixed"; regulator-name = "dayCam-Power-Enable"; gpio = <&gpio_expander 5 GPIO_ACTIVE_HIGH>; enable-active-high; regulator-always-on; }; dayCam_step2: dayCamI2cEnable { compatible = "regulator-fixed"; regulator-name = "dayCam-i2c-Power-Enable"; vin-supply = <&dayCam_step1>; gpio = <&gpio4 26 GPIO_ACTIVE_HIGH>; enable-active-high; regulator-always-on; // startup-delay-us = <2600000>; // Wait 100ms }; }; Please help or ideas would be greatly appropriated.
查看全文