Patch to Support BT656 and BT1120 Output For i.MX6 BSP

cancel
Showing results for 
Search instead for 
Did you mean: 

Patch to Support BT656 and BT1120 Output For i.MX6 BSP

No ratings

Patch to Support BT656 and BT1120 Output For i.MX6 BSP

Here are two patches to support BT656 and BT1120 output for i.MX6 ipuv3. With this patch, the i.MX6 can support the CVBS output on TV encoder. It is useful for a TV box.

"L3.0.35_1.1.0_GA_bt656_output_patch.zip" is the patch for Freescale L3.0.35_1.1.0_GA_iMX6DQ BSP.

"r13.4.1_bt656_output_patch.zip" is the patch for Freescale Android R13.4.1 BSP.

1. Features supported:

    1) Support BT656(8 bits) and BT1120 (16 bits)interlaced output on display port.
    2) Support both RGB and YUV frame buffer for BT656/BT1120 output.
    3) Support PAL and NTSC mode.
    4) Support on the fly switch between PAL and NTSC mode.
    5) Support CVBS output based on adv7391 TV encoder.

2. Hardware link between iMX6 and adv7391 TV encoder chip.
    IPU1_DI0_DISP_CLK connected to adv7391 CLKIN pin.
    IPU1_DISP0_DAT_23~DISP0_DAT_16 connected to adv7391 P7~P0 pins.
    IPU1_DI0_PIN2 connected to adv7391 HSYNC pin. (option)
    IPU1_DI0_PIN4 connected to adv7391 VSYNC pin. (option)
 
- Android R13.4.1 kernel.


3. How to use

-- Copy the two patch files to kernel folder.
    $ git apply ./0001-Support-BT656-and-BT1120-output-for-iMX6-ipuv3.patch
    $ git apply ./0002-Support-adv739x-TV-encoder-for-BT656-output.patch

-- Select them in kernel config and build the new kernel image:
                    Device Drivers  --->
                      Graphics support  --->
                          [*]   MXC BT656 and BT1120 output
                          [*]   ADV7390/7391 TV Output Encoder

-- Uboot parameters for video mode
   Output BT656 NTSC data to display port with UVYV frame buffer mode:
      "video=mxcfb0:dev=bt656,BT656-NTSC,if=BT656,fbpix=UYVY16"

   Output BT656 NTSC data to display port with RGB565 frame buffer mode:
      "video=mxcfb0:dev=bt656,BT656-NTSC,if=BT656,fbpix=RGB565"

   Output BT656 PAL data to display port with RGB24 frame buffer mode:
      "video=mxcfb0:dev=bt656,BT656-PAL,if=BT656,fbpix=RGB24"

   Output CVBS NTSC signal on adv7391 with UYVY frame buffer mode:
      "video=mxcfb0:dev=adv739x,BT656-NTSC,if=BT656,fbpix=UYVY16"

   Output CVBS PAL signal on adv7391 with RGB565 frame buffer mode:
      "video=mxcfb0:dev=adv739x,BT656-PAL,if=BT656,fbpix=RGB565"

-- Switch between PAL and NTSC
   $ echo D:720x480i-60 > /sys/class/graphics/fb0/mode
   $ echo D:720x576i-50 > /sys/class/graphics/fb0/mode


4. Note
    1) For 8 bits BT656 interface, the default data pins are "DISP0_DAT_23~DISP0_DAT_16", it can also
       be any other continued display data pins, for example if "DISP0_DAT_7~DISP0_DAT_0" are used, the
       macro "BT656_IF_DI_MSB" in "kernel_imx/drivers/mxc/ipu3/ipu_disp.c" should be changed from "23"
       to "7".

    2) For 16 bits BT1120 interface, the default data pins are "DISP0_DAT_23~DISP0_DAT_8", it can also
       be any other continued display data pins, the macro "BT656_IF_DI_MSB" should be modified if the
       hardware pins are changed.

    3) When bt656 interface is the second display for each IPU,1-layer-fb (it can be checked with command
       "$ cat /sys/class/graphics/fbx/fsl_disp_propperty"), the frame buffer can only be YUV format. In this
       case, the IPU DC channel was used for BT656 display, it has no CSC function, so RGB frame buffer was
       not supported.

2013-08-09 updated:

The new release package "L3.0.35_1.1.0_GA_bt656_output_patch_2013-08-09.zip" had fixed the BT656 dual display issue on iMX6S/DL.

Removed the old release package.

2013-09-04 updated:

The new release package "r13.4.1_bt656_output_patch_2013-09-04.zip" had fixed the BT656 dual display issue on iMX6S/DL.

For default, the dual display was tested with HDMI + CVBS, HDMI is the main display and adv739x CVBS output is the second display.

For iMX6DQ which has two IPUs, please assign dual display to two IPUs, for example adv739x is on IPU1 DI0, it is fixed, because hardware pins used for it is fixed. Then we can assign HDMI or LVDS to another IPU (IPU2).

For iMX6S/DL which has only one IPU, since adv739x had used IPU1 DI0, another display should be IPU1 DI1.

2013-09-30 updated:

Added patch for L3.0.35_4.1.0_GA BSP, the file is "L3.0.35_4.1.0_GA_bt656_output_patch_2013-09-30.zip".

2014-07-21 updated:

Added patch for L3.10.17_1.0.0_GA BSP, the file is "L3.10.17_1.0.0_GA_bt656_output_patch_2014-07-21.zip".

2015-01-26 updated:

Updated the IPU microcode for 1080i50 and 1080i60 BT1120 output, the parameters "N" for command BMA is a 8 bits parameters, so its max value is 255, but for 1080i50 and 1080i60 output, it needs more blank data in each line, the "N" will be bigger than 255, the updated IPU microcode can fix this limitation.

The updated file is "IPU_Microcode_Update_for_BT1120_1080i_20150126.zip". You can update the macro "DC_MCODE_BT656_xxx"  and function _ipu_dc_setup_bt656_interlaced() to the old patch if you used BT1120 mode to support 1080i display.

The verified 1080i display mode is:

{

   /* 1080I60 Interlaced output */

  "BT1120-1080I60", 30, 1920, 1080, 13468,

  20, 3,

  20, 2,

  280, 1,

  FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,

  FB_VMODE_INTERLACED,

  FB_MODE_IS_DETAILED,},

{

  /* 1080I50 Interlaced output */

  "BT1120-1080I50", 25, 1920, 1080, 13468,

  20, 3,

  20, 2,

  720, 1,

  FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,

  FB_VMODE_INTERLACED,

  FB_MODE_IS_DETAILED,},

2016-01-28 updated:

Updated IPU microcode to align with BT656.4 specification for NTSC output. For other BSP version with NTSC format support, please reference to ipu_disp_update.c for the final microcode.

File "L3.0.35_4.1.0_GA_bt656_output_patch_20160128.zip"., Details, please reference to the readme.txt file in the package.

2016-06-24 update:

Added BT656 and BT1120 progressive mode support.

File "L3.0.35_4.1.0_GA_bt656_output_patch_20160624.zip". Details, please reference to the readme.txt file in the package.

The patch for 3.14.52 GA1.1.0 BSP will be released in next week.

2016-06-27 update:

Add BT656 and BT1120 display patch for 3.14.52 BSP. File "L3.14.52_1.1.0_GA_bt656_output_patch_2016-06-27.zip", details, please reference to the readme.txt in the package.

2017-03-10 update:

Fixed a hard coding DC macro issue for progressive mode. Added patch "0008-Fixed-a-hard-coding-DC-macro-issue-for-progressive-m.patch" in L3.0.35_4.1.0_GA_bt656_output_patch_2017-03-10.zip.

The code in patch "L3.14.52_1.1.0_GA_bt656_output_patch_2016-06-27" is correct.

Attachments
Comments

每一行的Blank数据太多了,超出寄存器能支持的最大值,你要想办法减少blank数据,比如降低pixel clock频率。

Qiang_FSL‌ Dear Qiang,do we have a patch to support dual BT656 display?

No patch is needed, if you are using iMX6DQ, which has two IPU, you just need assign the two BT656 displays to two IPUs. Then in kernel command line, add two video mode for them:

video=mxcfb0:dev=bt656,BT656-NTSC,if=BT656,fbpix=RGB32 video=mxcfb1:dev=bt656,BT656-NTSC,if=BT656,fbpix=RGB32

If it is iMX6S/DL which has only one IPU, it can't support such use case, because there is no enough space in CPMEM to run two BT656 microcode in one IPU.

Qiang_FSL Hi,Qiang,
按照你的提示,一路BT656分配到ipu1-di0,一路分配到ipu0-di1, 单独测试都ok,

但两路同时开启,就只能注册成功一个,注册另一个就报错 ipu0-di1 already in use, 

目前是不是一种类型只能支持一个设备?应该如何修改?谢谢!


以下是我的dts:
mxcfb1: fb@0 {

  compatible = "fsl,mxc_sdc_fb";
  disp_dev = "bt656";
  interface_pix_fmt = "BT656";
  default_bpp = <16>;
  mode_str = "BT656-NTS";
  int_clk = <0>;
  late_init = <0>;
  status = "okay";
};
mxcfb2: fb@1 {
  compatible = "fsl,mxc_sdc_fb";
  disp_dev = "bt656";
  interface_pix_fmt = "BT656";
  default_bpp = <16>;
  mode_str = "BT656-NTS";
  int_clk = <0>;
  late_init = <0>;
  status = "okay";
};
lcd@0 {
  compatible = "fsl,bt656";
  ipu_id = <1>;
  disp_id = <0>;
  default_ifmt = "BT656";
  pinctrl-names = "default";
  pinctrl-0 = <&pinctrl_ipu1_bt656>;
  status = "okay";
};
lcd@1 {
  compatible = "fsl,bt656";
  ipu_id = <0>;
  disp_id = <1>;
  default_ifmt = "BT656";
  pinctrl-names = "default";
  pinctrl-0 = <&pinctrl_ipu2_bt656>;
  status = "okay";
};

You can remove the other displays from device tree:

&mxcfb3 {
 status = "disabled";
};

&mxcfb4 {
 status = "disabled";
};

这两个是有去掉的,但是仍然不能注册两个BT656

Kernel启动log看一下,如果kernel command line设置了LVDS和 HDMI display,他是可以覆盖device tree的设置的。

你也可以直接用kernel command line设置 2个BT656 display:

video=mxcfb0:dev=bt656,BT656-NTSC,if=BT656,fbpix=RGB32 video=mxcfb1:dev=bt656,BT656-NTSC,if=BT656,fbpix=RGB32

这些都是有修改的,第一个BT656可以注册成功,第二个就提示已经占用了

内核驱动需要修改吗?

如果是iMX6DQ的板子,注册在2个IPU上,是不存在DI被占用的问题的。

HI, Qiang,

平台是IMX6D,没有问题,原驱动patch的确在注册第二个BT656的时候提示被占用,客户修改了BT656的驱动,目前已注册上了两个设备,

但是两个同时工作时仍然不正常,只有DISP的那组能出clock,EIM那组没有时钟出来,(如果单独只开EIM那组,是有时钟的)

还请帮忙协助提供意见,感谢!

BRs

Allon

寄件者: Qiang_FSL

寄件日期: 2020年3月10日 16:49

收件者: Allon Li(李新龍)(SZX)

主旨: Re: - Patch to Support BT656 and BT1120 Output For i.MX6 BSP

NXP Community <https://community.freescale.com/resources/statics/1000/35400-NXP-Community-Email-banner-600x75.jpg>

Patch to Support BT656 and BT1120 Output For i.MX6 BSP

new comment by Qiang Li - Mpu Se<https://community.nxp.com/people/Qiang_FSL?et=watches.email.document_comment> View all comments on this document<https://community.nxp.com/docs/DOC-94019?commentID=75192&et=watches.email.document_comment#comment-75192>

从现象来看,2个IPU始终没有分离清楚,所以会互相影响。如果2个IPU上使用的PIN是不同的,比如一个是DATA0-7,另一个是DATA16-23,那个ipu_disp.c里面的BT656_IF_DI_MSB,针对2个IPU要使用不同的值,但是这个只会影响data,不影响clock。

2个BT656的clock source可以使用同一个,比如 clock.c里面,2个BT656分别是IPU1_DI0和IPU2_DI1:

 clk_set_parent(&ipu1_di_clk[0], &pll3_pfd_540M);  /* For CVBS 27MHz clock */
 clk_set_parent(&ipu1_di_clk[1], &pll5_video_main_clk);
 clk_set_parent(&ipu2_di_clk[0], &pll2_pfd_352M);
 clk_set_parent(&ipu2_di_clk[1], &pll3_pfd_540M);  /* For CVBS 27MHz clock */

在drver里面,你可以把ipu_id和ipu_di打印出来,就很容易知道哪里出的问题。

Hi,Qiang,

以下是内核打印的信息,使用的是IPU2-DI0 和IPU1-DI1,是正确的,

Clock source是设的pll3

寄件者: Qiang_FSL

寄件日期: 2020年3月11日 11:40

收件者: Allon Li(李新龍)(SZX)

主旨: Re: - Patch to Support BT656 and BT1120 Output For i.MX6 BSP

NXP Community <https://community.freescale.com/resources/statics/1000/35400-NXP-Community-Email-banner-600x75.jpg>

Patch to Support BT656 and BT1120 Output For i.MX6 BSP

new comment by Qiang Li - Mpu Se<https://community.nxp.com/people/Qiang_FSL?et=watches.email.document_comment> View all comments on this document<https://community.nxp.com/docs/DOC-94019?commentID=75195&et=watches.email.document_comment#comment-75195>

没有log。

IOMUX看看有没有设对。

内核打印信息:

kernel dbg come in, ipu_id:1, disp_id:0, ret:0

kernel dbg end ret:1

mxc_sdc_fb fb.20: registered mxc display driver bt656-0

Console: switching to colour frame buffer device 90x30

kernel deg come in, ipu_id:0, disp_id:1, ret:0

kernel dbg end ret:1

mxc_sdc_fb fb.21: registered mxc display driver bt656-1

clock的设置:

/* ipu clock initialization */

imx_clk_set_parent(clk[IMX6QDL_CLK_IPU1_DI0_PRE_SEL], clk[IMX6QDL_CLK_PLL5_VIDEO_DIV]);

imx_clk_set_parent(clk[IMX6QDL_CLK_IPU1_DI1_PRE_SEL], clk[IMX6QDL_CLK_PLL3_PFD1_540M]);

imx_clk_set_parent(clk[IMX6QDL_CLK_IPU2_DI0_PRE_SEL], clk[IMX6QDL_CLK_PLL3_PFD1_540M]);

imx_clk_set_parent(clk[IMX6QDL_CLK_IPU2_DI1_PRE_SEL], clk[IMX6QDL_CLK_PLL5_VIDEO_DIV]);

iomux也是对的,

分别单独只开一组BT656输出的话,两路都是可以有clock输出的,就是一起开启的时候EIM那组就没有了

寄件者: Qiang_FSL

寄件日期: 2020年3月11日 13:14

收件者: Allon Li(李新龍)(SZX)

主旨: Re: - Patch to Support BT656 and BT1120 Output For i.MX6 BSP

NXP Community <https://community.freescale.com/resources/statics/1000/35400-NXP-Community-Email-banner-600x75.jpg>

Patch to Support BT656 and BT1120 Output For i.MX6 BSP

new comment by Qiang Li - Mpu Se<https://community.nxp.com/people/Qiang_FSL?et=watches.email.document_comment> View all comments on this document<https://community.nxp.com/docs/DOC-94019?commentID=75196&et=watches.email.document_comment#comment-75196>

系统跑起来,第二个display默认是blank的,你需要去unblank它,才会有clock出来。

echo 0 > /sys/class/graphics/fb2/blank

Version history
Revision #:
1 of 1
Last update:
‎02-01-2013 12:22 AM
Updated by: