how to use adv7480 for TV-in function on i.mx6DL?

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

how to use adv7480 for TV-in function on i.mx6DL?

Jump to solution
2,762 Views
wallyyeh
Contributor V

Hi, Guys:

   Our boss loves i.mx6DL, and decide to use it attach an adv7480 for HDMI-to-MIPI_CSI2 chip for TV-in function.

I read lots post and i.mx6DL Reference Manual, like:

Re: MIPI CSI-2 frame dump

Re: MIPI CSI and IPU questions

Re: imx6 mipi csi2 question

    Our product using SDK_3.0.35_4.1.0 and I have some question wanna to ask:

1.  in reference kernel/arch/arm/mach-mx6/board-mx6q_sabreauto.c, there are some device register calls:

imx6q_add_mipi_csi2(&mipi_csi2_pdata);

imx6q_add_v4l2_capture(0, &capture_data[0]);

imx6q_add_v4l2_capture(1, &capture_data[1]);

since adv7480 is not a webcam, does I still need call imx6q_add_v4l2_capture()?

2.  I've merge the adv7480 driver into the kernel, and call mxc_iomux_set_gpr_register(13, 3, 3, 0); for configure IPU 0 , CSI-1, virtual channel 0.

and how does I grab some picture from IPU? I can't find some clues from the i.mx6DL Reference Manual. may I missed some thing?

3. imx6q_add_v4l2_capture() calls in board file had create two device node -- "/dev/video0" and "/dev/video1".

but when I want to access them, kernel will warning me "ERROR: v4l2 capture: slave not found!". does I need configure anything else?

    Any answer & suggestion would be appreciated, thanks for help.

Wally

Labels (1)
Tags (2)
1 Solution
8 Replies
1,492 Views
wallyyeh
Contributor V
1,491 Views
wallyyeh
Contributor V

it's clearly that kernel/drivers/media/video/mxc/capture/adv7280_mipi_tvin.c definitely won't work. since it never call v4l2_int_device_register() to register a v4l2 device into mxc_v4l2_capture driver. so I rewrite my driver by referencing adv7180.c, ov5640_mipi.c, and ov8820_mipi.c.

now my new question is what is "mclk"? I see both ov5640_mipi.c and ov8820_mipi.c will call set_mclk_rate(),  but I couldn't find the meaning on reference manual.

mipi dphy only have 10 pins - mipi_clk +/-, mipi_data_lane0 +/-, mipi_data_lane1 +/-, mipi_data_lane2 +/-, mipi_data_lane3 +/-; but I don't think mipi_clk is mclk since I measure its frequency - only 100Hz.

does anyone can tell me what the mclk mean?

Wally

0 Kudos
1,491 Views
jamesbone
NXP TechSupport
NXP TechSupport

Hello Wally,

mclk it is the max pixel clock (mclk) frequencies.  You are going to see something like:

#define OV5640_MCLK_MIN 48000000

#define OV5640_MCLK_TYP 48000000

#define OV5640_MCLK_MAX 96000000


Have a great day,
Jaime

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,491 Views
wallyyeh
Contributor V

Really not understand the difference between pixel clock, mipi clock lane freq, and mipi data lane freq.

my HW coworker told me that pixel clock = frequency on mipi clock lane, and frequency on mipi data lane is another thing.

so, from the thread - Some Experience When Enable MIPI Camera

I should figure out mipi clock lane's freq, and multiply 2 to set the freq range by:

mipi_csi2_write(info, 0x000000XX, CSI2_PHY_TST_CTRL1); ?

About calculating maximum pixel clock(the max case is 1920x1080, pixel clock is 148.5MHz), so I better call set_mclk_rate() to 150MHz?

0 Kudos
1,491 Views
wallyyeh
Contributor V

OK... I got it all.

pixel clock is fixed once resolution is fixed. for example, 720p(1280x720) pixel clock must be 74.25Mhz. so go on and find the table on web.

mipi clock lane freq, form ADV7480 manual, there's an enquation: (pixel_clock * bit_per_pixel * 4) / (mipi_lane * 2)

so if I use 720p, 2 mipi data lanes, and output the format of RGB888, the mipi clock lane freq is (74.25M * 24 * 4) / (2 * 2) = 445.5MHz

mipi data lane freq, just mutiply 2 with mipi clock lane freq, since mipi always transfer data in DDR mode, so it will be 445.5 * 2 = 891MHz.

the most important thing:

you must set i.MX6 mipi csi2 controller 's register correct for mipi data lane freq, in this example, I should modified the

mipi_csi2_reset(), and change mipi_csi2_write(info, 0x00000014, CSI2_PHY_TST_CTRL1); to mipi_csi2_write(info, 0x00000034, CSI2_PHY_TST_CTRL1);    since 0x34 is for 850MHz - 900MHz.

I'll share what I've done once I finished my driver.

0 Kudos
1,491 Views
wallyyeh
Contributor V

Hi, Jamesbone:

    thanks for reply! I've got lots advance with your help but still can't let adv7480 work with MIPI-CSI2 host controller.

   in ov5640_init_mode() and ov8820_init_mode(), both will check the value of CSI2_PHY_STATE register value,

and will print error message "mipi csi2 can not receive sensor clk!" if CSI2_PHY_STATE value keep in 0x200.

since my driver will configure adv7480 using 2 data lanes, I'm expecting the value of CSI2_PHY_STATE will be 0x330.

but the our custom board, value of CSI2_PHY_STATE keep 0x230, does this mean MIPI-CSI2 host controller can't got the mipi_clk +/- pins setting correctly?

0 Kudos
1,491 Views
jamesbone
NXP TechSupport
NXP TechSupport

Hello Wally,

It is great to see that our i.MX products are consider for your new design let me try to answer your questions :

1.- Yes, it is still needed since the path for the ADV7480 to be attach to the i.MX it is through the CSI port which it is part of the IPU and the way the driver of the IPU has been design it uses V4L2 as the API to the user.

2.-In order to use it, you need to use something like Gstreamer to make the call to the V4L2 layer to get the snapshot.

3.- Yes, do you setup the device tree (DTS) and also maybe something about the driver to configure the ADV7480


Have a great day,
Jaime

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
1,491 Views
wallyyeh
Contributor V

Dear Jamesbone:

   So appreciated your answer! question 1 & 2 are gracefully resolved.

   In your answer to question 3, you mention DTS configuration, but since SDK_3.0.35 not introduced DTS yet, I believe you want me to check if I configure my board file in kernel/arch/arm/mach-mx6/ correctly or not. I do have more question when I examine the board file between "board-mx6q_sabresd.c" & "board-mx6q_sabreauto.c":

in kernel/arch/arm/mach-mx6/board-mx6q_sabresd.c, it attach i2c device "ov5640_mipi" on its IPU0, CSI1, virtural channel 0:

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",

};

but callback func ".io_init" in sabresd fsl_mxc_camera_platform_data mipi_csi2_data tell me it will using virtual channel 1:

static void mx6q_mipi_sensor_io_init(void)

{

......

  /*for mx6dl, mipi virtual channel 1 connect to csi 1*/

  if (cpu_is_mx6dl())

  mxc_iomux_set_gpr_register(13, 3, 3, 1);

}

    I have another question about comparing "kernel/drivers/media/video/mxc/capture/ov5640_mipi.c" and "kernel/drivers/media/video/mxc/capture/adv7280_mipi_tvin.c" -- why ov5640_mipi.c would call mipi_csi2_enable() and adv7280_mipi_tvin.c not? as I dig the adv7280_mipi driver source code, find out it simply doing 15 times i2c write commands, and why it never calling  mipi_csi2_get_info() for mipi D-phy configuration? Since I reference lots initialization codes from adv7280_mipi_tvin.c; I want to check is this codes take action correctly first.

  I also wonder I lost something should be turn-on in kernel config file. in kernel/arch/arm/configs/imx6_defconfig, it also turn on following configs, should I also turn them on in my custom kernel?

CONFIG_VIDEO_MXC_CAMERA=m

CONFIG_VIDEO_MXC_IPU_CAMERA=y

CONFIG_MXC_CAMERA_SENSOR_CLK=m

CONFIG_MXC_IPU_DEVICE_QUEUE_SDC=m

CONFIG_MXC_IPU_PRP_ENC=m

CONFIG_MXC_IPU_CSI_ENC=m

and CONFIG_MXC_MIPI_CSI2_TVIN_ADV7280 is not defined, does this mean no one had been successfully tried adv7280 on imx6 mipi interface?

0 Kudos