IMX8MM : Gerneric MIPI CSI driver available

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

IMX8MM : Gerneric MIPI CSI driver available

2,351 Views
santhosh2
Contributor IV

Hi,

I am using the hd camera thats already configured and I am able to see data on oscilloscope on MIPI  line, can you help me with the driver

Regards

Santhosh kumar S

0 Kudos
6 Replies

2,219 Views
joanxie
NXP TechSupport
NXP TechSupport

could you give more detailed information? what camera and bsp do you use? anything changes from the default bsp?

0 Kudos

2,219 Views
santhosh2
Contributor IV

Hi,

We are using  two types of camera and there are HDMI and LVDS camera and we have used bridge IC to convert to MIPI output

1. To convert HDMI to MIPI  we are using Toshiba IC (Clock is generated from camera and has 3 data lanes )

2. To convert LVDS to MIPI we are using lattice chip (Clock is generated from camera and has 4 data lanes )

schematic, Camera and Bridge IC data sheet are attached in below link

https://drive.google.com/drive/folders/1Fzdc7LQeoV7bxyn-l2BOS7QPAhfvVjcR?usp=sharing 

Currently iam working HDMI camera and Toshiba IC

I have modified the fsl-imx8mm-evk.dts as below (fsl-imx8mm-evk.dts is also attached)

-----------------------fs-imx8mm-evk.dts-----------------------------------------
&csi1_bridge {
status = "okay";
port@0 {
csi1_ep: endpoint {
remote-endpoint = <&csi1_mipi_ep>;
data-lanes = <3>;
/*clock-lanes = <0>;
clock-noncontinuous;*/
csis-hs-settle = <13>;
csis-clk-settle = <2>;
/*https://www.kernel.org/doc/Documentation/devicetree/bindings/media/samsung-mipi-csis.txt*/
csis-wclk; /*CSI-2 wrapper clock selection. If this property is present
external clock from CMU will be used, or the bus clock if
it's not specified.*/
link-frequencies = /bits/ 64 <297000000>;
};
};
};
&mipi_csi_1 {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
port {
mipi1_sensor_ep: endpoint1 {
remote-endpoint = <&tc9590_out>;
data-lanes = <2>;
csis-hs-settle = <13>;
csis-clk-settle = <2>;
csis-wclk;
};
csi1_mipi_ep: endpoint2 {
remote-endpoint = <&csi1_ep>;
};
};
};
tc9590: tc9590@0F {
compatible = "toshiba,tc9590";
/*reg = <0x3c>;*/
reg = <0x0F>;
status = "okay";
pinctrl-names = "default";
/*Commented by santhosh*/
/*pinctrl-0 =  <&pinctrl_h100_tc358743>;*/
pinctrl-0 = <&pinctrl_csi_pwn>, <&pinctrl_csi_rst>;
clocks = <&hdmi_osc>;
clock-names = "refclk";
/*clocks = <&clk IMX8MM_CLK_CLKO1_DIV>;
clock-names = "csi_mclk";*/
/*pwn-gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;*/
/*reset-gpios = <&gpio6 15 GPIO_ACTIVE_LOW>;*/
/* IRQ has a wrong pull resistor which renders it useless  */
port@0 {
tc9590_out: endpoint {
remote-endpoint = <&mipi1_sensor_ep>;
data-lanes = <3>;
/*clock-lanes = <0>;*/
/*https://community.nxp.com/thread/463777*/
csis-hs-settle = <13>;
csis-clk-settle = <2>;
/*https://www.kernel.org/doc/Documentation/devicetree/bindings/media/samsung-mipi-csis.txt*/
csis-wclk; /*CSI-2 wrapper clock selection. If this property is present
  external clock from CMU will be used, or the bus clock if
    if it's not specified.*/
/*clock-noncontinuous;*/
link-frequencies = /bits/ 64 <297000000>;
};
};
};
-------------------------------------------------------------------------------------------------------------------------------------

with the above configuration when i check the format i get the below error

v4l2-ctl.png

How to resolve this iam using a driver from toshiba

Regards

Santhosh

0 Kudos

2,219 Views
joanxie
NXP TechSupport
NXP TechSupport

refer to the error message, it seems that you don't set the correct data format, so what data format do you use? if you use raw data, did you add new format in the driver?

0 Kudos

2,219 Views
santhosh2
Contributor IV

Dear Joan,

after modifying the below files

----------------------------------mxc_mipi_csi.c ------------------------------------------
static const struct csis_pix_format mipi_csis_formats[] = {
{
.code = MEDIA_BUS_FMT_YUYV8_2X8,
.fmt_reg = MIPI_CSIS_ISPCFG_FMT_YCBCR422_8BIT,
.data_alignment = 16,
}, {
.code = MEDIA_BUS_FMT_VYUY8_2X8,
.fmt_reg = MIPI_CSIS_ISPCFG_FMT_YCBCR422_8BIT,
.data_alignment = 16,
}, {
.code = MEDIA_BUS_FMT_SBGGR8_1X8,
.fmt_reg = MIPI_CSIS_ISPCFG_FMT_RAW8,
.data_alignment = 8,
}, {
.code = MEDIA_BUS_FMT_RGB888_1X24,  /*Added by santhosh */
.fmt_reg = MIPI_CSIS_ISPCFG_MEM_FULL_GAP(4) ,
.data_alignment = 24,
}, {
.code = MEDIA_BUS_FMT_UYVY8_1X16,  /*Added by santhosh */
.fmt_reg = MIPI_CSIS_ISPCFG_MEM_FULL_GAP(4),
.data_alignment = 16,
}
};
---------------------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------mx6s_capture.c-----------------------------------------------------------------------------
static struct mx6s_fmt formats[] = {
{
.name = "UYVY-16",
.fourcc = V4L2_PIX_FMT_UYVY,
.pixelformat = V4L2_PIX_FMT_UYVY,
.mbus_code = MEDIA_BUS_FMT_UYVY8_2X8,
.bpp = 2,
}, {
.name = "YUYV-16",
.fourcc = V4L2_PIX_FMT_YUYV,
.pixelformat = V4L2_PIX_FMT_YUYV,
.mbus_code = MEDIA_BUS_FMT_YUYV8_2X8,
.bpp = 2,
}, {
.name = "YUV32 (X-Y-U-V)",
.fourcc = V4L2_PIX_FMT_YUV32,
.pixelformat = V4L2_PIX_FMT_YUV32,
.mbus_code = MEDIA_BUS_FMT_AYUV8_1X32,
.bpp = 4,
}, {
.name = "RAWRGB8 (SBGGR8)",
.fourcc = V4L2_PIX_FMT_SBGGR8,
.pixelformat = V4L2_PIX_FMT_SBGGR8,
.mbus_code = MEDIA_BUS_FMT_SBGGR8_1X8,
.bpp = 1,
}, {  
.name = "RAWRGB24 (RGB24)",  /*Added by santhosh*/
.fourcc = V4L2_PIX_FMT_RGB24,
.pixelformat = V4L2_PIX_FMT_RGB24,
.mbus_code = MEDIA_BUS_FMT_RGB888_1X24,
.bpp = 4,
}, {  
.name = "YUV 4:2:2 packed, CbYCrY",  /*Added by santhosh */
.fourcc = V4L2_PIX_FMT_UYVY,
.pixelformat = V4L2_PIX_FMT_UYVY,
.mbus_code = MEDIA_BUS_FMT_UYVY8_1X16,
.bpp = 4,
}
};

---------------------------------------------------------------------------------------------------------------------------------------------------------

I am getting below result for v4l2-ctl --list-formats cmd, but when gstreamer cmd i am getting internal data stream error 

root@imx8mmevk:~# v4l2-ctl --list-formats
ioctl: VIDIOC_ENUM_FMT
[ 1407.029321] mxc_mipi-csi 32e30000.mipi_csi: LVDS find_csis_format(code->code):0x100A
        Index       : 0
[ 1407.039216] mxc_mipi-csi 32e30000.mipi_csi: LVDS find_csis_format(code->code):0x200F
        Type        : Video Capture
        Pixel Format: 'RGB3'
        Name        : 24-bit RGB 8-8-8

        Index       : 1
        Type        : Video Capture
        Pixel Format: 'UYVY'
        Name        : UYVY 4:2:2

root@imx8mmevk:~#

I am getting below error now, when run the gstreamer

gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,width=800,height=600 ! jpegenc ! rtpjpegpay ! multiudpsink auto-multicast=true send-duplicates = true bind-port=5000 clients="255.255.255.255:5000"

Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
plicates = true bind-port=5000 clients="255.255.255.255:5000"ticast=true send-du
Setting pipeline to PAUSED ...
[ 1175.961562] mxc_mipi-csi 32e30000.mipi_csi: LVDS find_csis_format(code->code):0x100A
Pipeline is live and does not nee[ 1175.970469] mxc_mipi-csi 32e30000.mipi_csi: LVDS find_csis_format(code->code):0x200F
d PREROLL ...
Setting pipeline t[ 1175.981140] LVDS Santhosh tc358743_set_fmt
o PLAYING ...
New clock: GstSyst[ 1175.988446] LVDS Santhosh tc358743_set_fmt:0x2006
emClock
[ 1175.995640] LVDS  tc358743_set_fmt default:
[ 1176.001317] LVDS  tc358743_set_fmt
[ 1176.005800] LVDS  tc358743_set_fmt:0x2006
[ 1176.010522] LVDS  tc358743_set_fmt default:
[ 1176.015519] LVDS  tc358743_set_fmt
[ 1176.019992] LVDS  tc358743_set_fmt:0x100A
[ 1176.024717] LVDS  tc358743_set_fmt if (format->which == V4L2_SUBDEV_FORMAT_TRY):
[ 1176.032824] LVDS  enable_stream()
[ 1176.037170] LVDS enable_stream mute video
[ 1176.041890] LVDS  tc358743_set_csi_color_space : 0x100A
[ 1176.047829] LVDS MEDIA_BUS_FMT_RGB888_1X24
[ 1176.053984] LVDS  tc358743_set_fmt
[ 1176.058436] LVDS  tc358743_set_fmt:0x100A
[ 1176.063173] LVDS  tc358743_set_fmt if (format->which == V4L2_SUBDEV_FORMAT_TRY):
[ 1176.071291] LVDS  enable_stream()
[ 1176.075581] LVDS enable_stream mute video
[ 1176.080293] LVDS  tc358743_set_csi_color_space : 0x100A
[ 1176.086249] LVDS MEDIA_BUS_FMT_RGB888_1X24
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
Additional debug info:
../../../../git/libs/gst/base/gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4)
Execution ended after 0:00:00.122250125
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

0 Kudos

2,219 Views
joanxie
NXP TechSupport
NXP TechSupport

you still don't tell me what input format you use? did you use rgb888 from your camera?

0 Kudos

2,219 Views
santhosh2
Contributor IV

Dear Joan,

Yes i am using rgb888 format

Regards

Santhosh Kumar S

0 Kudos