how to let kernel(3.0.35) support csi0(parallel camera) + csi1(parallel tvin) +mipi csi2 three camera

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

how to let kernel(3.0.35) support csi0(parallel camera) + csi1(parallel tvin) +mipi csi2 three camera

跳至解决方案
4,693 次查看
liyu1
Contributor III

Dear :

     All !

 

  my platform is:

 imx6Q

   OS: android 4.2.2 jb_1.1.0


   I want to open csi0(parallel camera) + csi1(parallel tvin) + mipi three camera functions in the following ways:


 static struct fsl_mxc_camera_platform_data camera_data = {

    .mclk = 24000000,

    .mclk_source = 0,

   .csi = 0,

    .io_init = mx6q_csi0_io_init,

    .pwdn = mx6q_csi0_cam_powerdown,

};

static struct fsl_mxc_tvin_platform_data adv7180_data = {

    .dvddio_reg    = NULL,

    .dvdd_reg    = NULL,

    .avdd_reg    = NULL,

    .pvdd_reg    = NULL,

    .pwdn        = adv7180_pwdn,

    .reset        = adv7180_reset,

    .cvbs        = true,

    .io_init    = mx6q_csi1_io_init,

};

  adv7180 driver probe is as follows:

memset(&adv7180_data, 0, sizeof(adv7180_data));

    adv7180_data.sen.i2c_client = client;

    adv7180_data.sen.streamcap.timeperframe.denominator = 30;

    adv7180_data.sen.streamcap.timeperframe.numerator = 1;

    adv7180_data.std_id = V4L2_STD_ALL;

    video_idx = ADV7180_NOT_LOCKED;

    adv7180_data.sen.pix.width = video_fmts[video_idx].raw_width;

    adv7180_data.sen.pix.height = video_fmts[video_idx].raw_height;

    adv7180_data.sen.pix.pixelformat = V4L2_PIX_FMT_UYVY;  /* YUV422 */

    adv7180_data.sen.pix.priv = 1;  /* 1 is used to indicate TV in */

    adv7180_data.sen.on = true;

    adv7180_data.sen.csi = 1;

static struct fsl_mxc_camera_platform_data mipi_csi2_data = {

    .mclk = 24000000,

    .mclk_source = 0,

    .csi = 1,

    .io_init = mx6q_mipi_sensor_io_init,

    .pwdn = mx6q_mipi_powerdown,

};

static struct mipi_csi2_platform_data mipi_csi2_pdata = {

    .ipu_id     = 0,

    .csi_id = 1,

    .v_channel = 0,

    .lanes = 2,

    .dphy_clk = "mipi_pllref_clk",

    .pixel_clk = "emi_clk",

};

static struct fsl_mxc_capture_platform_data capture_data[] = {

    {

        .csi = 0,

        .ipu = 0,

        .mclk_source = 0,

        .is_mipi = 0,

    }, {

        .csi = 1,

        .ipu = 0,

        .mclk_source = 0,

        .is_mipi = 1,

    },{

        .csi = 1,

        .ipu = 1,

        .mclk_source = 0,

        .is_mipi = 0,

    },

};

//register

 imx6q_add_v4l2_capture(0, &capture_data[0]);

    imx6q_add_v4l2_capture(1, &capture_data[1]);

    imx6q_add_v4l2_capture(2, &capture_data[2]);

   imx6q_add_mipi_csi2(&mipi_csi2_pdata);

  ls /dev/video*                                   

  video0  video1  video16 video17 video18 video19 video2

 init.freescale.rc prop setting is as follows:

    setprop back_camera_name ov5640_mipi,adv7180_decoder

    setprop back_camera_orient 90

    setprop front_camera_name mt9d112

    setprop front_camera_orient 90

   When registering using the above methods, I found mipi cameracan not be used

 Because the camera is not detected,log is as follows:
root@android:/ # logcat |grep aHAL
I/FslCameraHAL( 2389): Face Back Camera is ov5640_mipi,adv7180_decoder, orient is 90
 

I/FslCameraHAL( 2389): Face Front Camera is mt9d112, orient is 90

I/FslCameraHAL( 2389): Checking the camera ov5640_mipi

I/FslCameraHAL( 2389): Checking the camera adv7180_decoder

I/FslCameraHAL( 2389): Get sensor adv7180_decoder's dev path /dev/video2

I/FslCameraHAL( 2389): Camera ID 0: name adv7180_decoder, Facing 0, orientation 90, dev path /dev/video2

I/FslCameraHAL( 2389): Checking the camera mt9d112

I/FslCameraHAL( 2389): Get sensor mt9d112's dev path /dev/video0

I/FslCameraHAL( 2389): Camera ID 1: name mt9d112, Facing 1, orientation 90, dev path /dev/video0


/dev/video1 is ov5640_mipi Not been detected !

 But when I commented :

   //imx6q_add_v4l2_capture(2, &capture_data[2]);

 /*{

        I2C_BOARD_INFO("adv7180", 0x21),

        .platform_data = (void *)&adv7180_data,

    },*/

root@android:/ # logcat |grep aHAL

I/FslCameraHAL( 2384): Face Back Camera is ov5640_mipi,adv7180_decoder, orient is 90

I/FslCameraHAL( 2384): Face Front Camera is mt9d112, orient is 90

I/FslCameraHAL( 2384): Checking the camera ov5640_mipi

I/FslCameraHAL( 2384): Get sensor ov5640_mipi's dev path /dev/video1

I/FslCameraHAL( 2384): Camera ID 0: name ov5640_mipi, Facing 0, orientation 90, dev path /dev/video1

I/FslCameraHAL( 2384): Checking the camera mt9d112

I/FslCameraHAL( 2384): Get sensor mt9d112's dev path /dev/video0

I/FslCameraHAL( 2384): Camera ID 1: name mt9d112, Facing 1, orientation 90, dev path /dev/video0

mipi camera and mt9d112 work fine !

  Please help me !

  how to let kernel(3.0.35) support csi0(parallel camera) + csi1(parallel tvin) +mipi csi2 three camera in kernel ?

Abstraction layer has been completed  !
 

I have achieved csi0 (parallel camera) +  mipi + uvc switch  between three camera .

But our projects have to support  csi0 (parallel camera) + csi1 (parallel tvin) + mipi csi2 three camera!

I feel android 4.2.2 mipi camera and csi1 (parallel tvin) can not be registered at the same time

Please help me !


 

标签 (2)
1 解答
2,626 次查看
igorpadykov
NXP Employee
NXP Employee

Hi li

probably you can look at

Some Experience When Enable MIPI Camera

"In BSP default setting, ov5640_mipi is routed to IPU0, CSI1. According to the doc, the virtual

channel in MX6x side is 1, so virtual channel 1 should be enabled in camera sensor side."

So if you connected MIPI to IPU2CSI0 , virtual channel (VC) should be 2

Figure 19-1. CSI2IPU gasket connectivity IMX6DQRM

Best regards

igor

在原帖中查看解决方案

0 项奖励
回复
16 回复数
2,627 次查看
igorpadykov
NXP Employee
NXP Employee

Hi li

probably you can look at

Some Experience When Enable MIPI Camera

"In BSP default setting, ov5640_mipi is routed to IPU0, CSI1. According to the doc, the virtual

channel in MX6x side is 1, so virtual channel 1 should be enabled in camera sensor side."

So if you connected MIPI to IPU2CSI0 , virtual channel (VC) should be 2

Figure 19-1. CSI2IPU gasket connectivity IMX6DQRM

Best regards

igor

0 项奖励
回复
2,626 次查看
liyu1
Contributor III

我已经实现四个摄像头之间切换! mt9d112 ov5640_mipi  adv7180  uvc

0 项奖励
回复
2,626 次查看
luciuslu
Contributor I

你就是一个自私的lase,出问题的时候求爷爷告奶奶!恨不得所有人帮助你,解决问题后,从不分享!自私的东西。

0 项奖励
回复
2,626 次查看
mayqueen
Contributor IV

你怎麼知道我有解決?兩年前我最後沒解掉阿...還因此被革職了,脾氣好一點,問題可以更容易解決謝謝

0 项奖励
回复
2,626 次查看
mayqueen
Contributor IV

請問可以教我嗎?我只有單一個ov5640 mipi camera卻無法通到上層,我使用的是Android 4.4.2,

卡很久了,IPU與CSI之間的關係大概清楚,但怎麼改都一樣HAL層沒偵測到,請問是哪邊需要改呢。

謝謝 我有skype與QQ 再麻煩您了!

0 项奖励
回复
2,626 次查看
liyu1
Contributor III

hi:

     igorpadykov !

                please help me !

            thanks !

0 项奖励
回复
2,626 次查看
igorpadykov
NXP Employee
NXP Employee

Hi li

I am afraid this use case was not validated

since reference boards have not all these cameras connected.

Best regards

igor

0 项奖励
回复
2,626 次查看
liyu1
Contributor III

Why do not you help me change code, I can help you verify

0 项奖励
回复
2,626 次查看
igorpadykov
NXP Employee
NXP Employee

Hi li

please look below for example with 3 cameras

Re: i.MX6Q : Parallel CSI#2 not working

Best regards

igor

0 项奖励
回复
2,626 次查看
liyu1
Contributor III

问题我已经解决了,谢谢!

0 项奖励
回复
2,626 次查看
liyu1
Contributor III

Hi igorpadykov !


      I follow the "Re: i.MX6Q : Parallel CSI#2 not working" said, But still the registration is not successful , the reason I judge: should be IPU and CSI channel selection error causes,

  

code :


camera 1 :mt9d112

Parallel 0 :  ipu 0 csi 0


static void mx6q_csi0_io_init(void)

{

      ........

    /* For MX6Q:

    * GPR1 bit19 and bit20 meaning:

    * Bit19:      0 - Enable mipi to IPU1 CSI0

    *                      virtual channel is fixed to 0

    *              1 - Enable parallel interface to IPU1 CSI0

    * Bit20:      0 - Enable mipi to IPU2 CSI1

    *                      virtual channel is fixed to 3

    *              1 - Enable parallel interface to IPU2 CSI1

    * IPU1 CSI1 directly connect to mipi csi2,

    *      virtual channel is fixed to 1

    * IPU2 CSI0 directly connect to mipi csi2,

    *      virtual channel is fixed to 2

    *

    * For MX6DL:

    * GPR13 bit 0-2 IPU_CSI0_MUX

    *  000 MIPI_CSI0

    *  100 IPU CSI0

    */

    if (cpu_is_mx6q())

        mxc_iomux_set_gpr_register(1, 19, 1, 1);

    else if (cpu_is_mx6dl())

        mxc_iomux_set_gpr_register(13, 0, 3, 4);

}

static struct fsl_mxc_camera_platform_data camera_data = {

    .mclk = 24000000,

    .mclk_source = 0,

    .ipu = 0,

    .csi = 0,

    .io_init = mx6q_csi0_io_init,

    .pwdn = mx6q_csi0_cam_powerdown,

};

camera 2 :  ov5640_mipi

mipi csi2 : ipu 0, csi1 , v_channel -> 1


static void mx6q_mipi_sensor_io_init(void)

{

  ......

    mxc_iomux_set_gpr_register(1, 19, 1,1);

}

static struct fsl_mxc_camera_platform_data mipi_csi2_data = {

    .mclk = 24000000,

    .mclk_source = 0,

    .ipu = 0,

    .csi = 1,

    .io_init = mx6q_mipi_sensor_io_init,

    .pwdn = mx6q_mipi_powerdown,

};

static struct mipi_csi2_platform_data mipi_csi2_pdata = {

    .ipu_id     = 0,

    .csi_id = 1,

    .v_channel = 1,

    .lanes = 2,

    .dphy_clk = "mipi_pllref_clk",

    .pixel_clk = "emi_clk",

};


static int ov5640_probe(struct i2c_client *client,

            const struct i2c_device_id *id)

{

  

   .......

    sensor->mipi_camera =1;

   ......

   ov5640_data.csi = plat_data->csi;

    ov5640_data.ipu = plat_data->ipu;

 

    //    sensor->virtual_channel =sensor->csi | (sensor->ipu << 1);

  

    ov5640_int_device.priv = &ov5640_data;

    retval = v4l2_int_device_register(&ov5640_int_device);

       

    ............

    printk("ov5640_probe ok\n");

    ............

}

camera3 :  adv7180

Parallel 1 :  ipu 1 csi 1


static void mx6q_csi1_io_init(void)

{

      .........

    if (cpu_is_mx6q()){

        //printk("==== mx6q_csi1_io_init cpu_is_mx6q ====\n");

      mxc_iomux_set_gpr_register(1, 20, 1, 1);

    }else if (cpu_is_mx6dl()){

        //printk("==== mx6q_csi1_io_init cpu_is_mx6dl ====\n");

        mxc_iomux_set_gpr_register(13, 0, 3, 4);

        }

}

static struct fsl_mxc_tvin_platform_data adv7180_data = {

    //.dvddio_reg    = NULL,

    //.dvdd_reg    = NULL,

    //.avdd_reg    = NULL,

    //.pvdd_reg    = NULL,

    .pwdn        = adv7180_pwdn,

    .reset        = adv7180_reset,

    .cvbs        = true,

    .ipu        = 1,

    .csi        = 1,

    .io_init    = mx6q_csi1_io_init,

};

static int adv7180_probe(struct i2c_client *client,

             const struct i2c_device_id *id)

{

    int rev_id;

    int ret = 0;

  

    .........

    adv7180_data.sen.csi = 1;//tvin_plat->csi;

    adv7180_data.sen.ipu = 1;

    //adv7180_data.sen.mclk = 28000000;

    ............

    /* This function attaches this structure to the /dev/video0 device.

    * The pointer in priv points to the mt9v111_data structure here.*/

   

    adv7180_int_device.priv = &adv7180_data;

    ret = v4l2_int_device_register(&adv7180_int_device);

    return ret;

}

    imx6q_add_v4l2_capture(0, &capture_data[0]);

    imx6q_add_v4l2_capture(1, &capture_data[1]);

    imx6q_add_v4l2_capture(2, &capture_data[2]);

    imx6q_add_mipi_csi2(&mipi_csi2_pdata);

   But cant't find ov5640_mipi

logcat |grep HAL

I/FslCameraHAL( 2395): Face Back Camera is ov5640_mipi,adv7180_decoder,uvc, orient is 90

I/FslCameraHAL( 2395): Face Front Camera is mt9d112, orient is 90

I/FslCameraHAL( 2395): Checking the camera ov5640_mipi

I/FslCameraHAL( 2395): Checking the camera adv7180_decoder

I/FslCameraHAL( 2395): Get sensor adv7180_decoder's dev path /dev/video2

I/FslCameraHAL( 2395): Camera ID 0: name adv7180_decoder, Facing 0, orientation 90, dev path /dev/video2

I/FslCameraHAL( 2395): Checking the camera mt9d112

I/FslCameraHAL( 2395): Get sensor mt9d112's dev path /dev/video0

I/FslCameraHAL( 2395): Camera ID 1: name mt9d112, Facing 1, orientation 90, dev path /dev/video0

I/SWITCHPROFILE( 2705): Switchprofile thread received GOV_INTERACTIVE from Power HAL

These two cameras can be captured images.


But I modify the code to


   static int adv7180_probe(struct i2c_client *client,

             const struct i2c_device_id *id)

{

    int rev_id;

    int ret = 0;

   

    .........

   // adv7180_data.sen.csi = 1;//tvin_plat->csi;

   //  adv7180_data.sen.ipu = 1;

    ............

    /* This function attaches this structure to the /dev/video0 device.

    * The pointer in priv points to the mt9v111_data structure here.*/

   

    adv7180_int_device.priv = &adv7180_data;

    ret = v4l2_int_device_register(&adv7180_int_device);

    return ret;

}


root@android:/ # logcat |grep HAL

I/FslCameraHAL( 2395): Face Back Camera is ov5640_mipi,adv7180_decoder,uvc, orient is 90

I/FslCameraHAL( 2395): Face Front Camera is mt9d112, orient is 90

I/FslCameraHAL( 2395): Checking the camera ov5640_mipi

I/SWITCHPROFILE( 2705): Switchprofile thread received GOV_INTERACTIVE from Power HAL

I/FslCameraHAL( 2395): Get sensor ov5640_mipi's dev path /dev/video2

I/FslCameraHAL( 2395): Camera ID 0: name ov5640_mipi, Facing 0, orientation 90, dev path /dev/video2

I/FslCameraHAL( 2395): Checking the camera mt9d112

It can find ov5640_mipi .

Not only can not find the other two cameras ,Butov5640 can't get image !


I just comment out :

 

  // adv7180_data.sen.csi = 1;//tvin_plat->csi;

   //  adv7180_data.sen.ipu = 1;


Therefore I judge registration is not successful reason, is because the IPU and CSI channel selection error.


But how to modify the code  !


   Thanks !

0 项奖励
回复
2,626 次查看
liyu1
Contributor III

hi igorpadykov


I've spent a lot of time to do this thing

2,626 次查看
liyu1
Contributor III

hi igorpadykov

But we have to  switch between these three,


Please help me solve this problem ! thanks!

0 项奖励
回复
2,626 次查看
liyu1
Contributor III

hi igorpadykov

   Now , I follow your practice , but the effect is still the same
static struct mipi_csi2_platform_data mipi_csi2_pdata = {
.ipu_id = 0,
.csi_id = 1,
.v_channel = 2,
.lanes = 2,
.dphy_clk = "mipi_pllref_clk",
.pixel_clk = "emi_clk",
};

0 项奖励
回复
2,626 次查看
jimmychan
NXP TechSupport
NXP TechSupport

pastedImage_0.png

According to the figure, for your case please try the VC1 (v_channel = 1) for the MIPI.

0 项奖励
回复
2,626 次查看
liyu1
Contributor III

Hi jimmychan:

How to use the virtual channel 1 ?

0 项奖励
回复