有一些客户有时会用到低分辨率的LVDS LCD在 i.MX6的平台上,例如320 x240的,但是在默认的Linux BSP并不支持低频率像素时钟的LVDS的输入。
问题:当客户移植 320x240的 LVDS LCD到android4.2.2上,发现pixel clock不正确,它总是38.9MHz,当设置更大的分辨率的时候是没有问题的,1024x768这个是可以正常使用的。在使用320x240的时候,clock需要的是6.4MHz。
以这个问题为例, 我们查看一下IPU & LDB clock 在 i.MX6 datasheet :
移植步骤如下所示:
1. 添加 LVDS LCD timing structure to ldb.cstatic structfb_videomode ldb_modedb[] = {
{
"LDB-XGA", 60, 320, 240, 155914,
38, 20,
15, 4,
30, 3,
0,
FB_VMODE_NONINTERLACED,
FB_MODE_IS_DETAILED,}, "LDB-1080P60", 60, 1920, 1080, 7692,
100, 40,
30, 3,
10, 2,
0,
FB_VMODE_NONINTERLACED, FB_MODE_IS_DETAILED,
};
2.修改 clock source of ldb module
Checking /arch/arm/mach-mx6/clock.c,we can find there are 3 ldb's clock source :
&pll5_video_main_clk, &
pll2_pfd_352M,&
pll2_pfd_400M,
static int_clk_ldb_di1_set_parent(struct clk *clk, struct clk *parent)
{
u32 reg, mux;
int rev = mx6q_revision();
reg = __raw_readl(MXC_CCM_CS2CDR)
& ~MXC_CCM_CS2CDR_LDB_DI1_CLK_SEL_MASK;
mux = _get_mux6(parent, &pll5_video_main_clk,
&pll2_pfd_352M, &pll2_pfd_400M,
(rev == IMX_CHIP_REVISION_1_0) ?
&pll3_pfd_540M : /* MX6Q TO1.0 */
&mmdc_ch1_axi_clk[0], /* MX6Q TO1.1 and MX6DL */
&pll3_usb_otg_main_clk, NULL);
reg |= (mux << MXC_CCM_CS2CDR_LDB_DI1_CLK_SEL_OFFSET);
__raw_writel(reg, MXC_CCM_CS2CDR);
return 0;
} ;
默认的 pll2_pfd_352M 在ldb的源码中是作为clock source:
clk_set_parent(&ldb_di0_clk,&pll2_pfd_352M);
clk_set_parent(&ldb_di1_clk, &pll2_pfd_352M);
修改 clock source 为 pll5_video_main_clk
clk_set_parent(&ldb_di0_clk, &pll5_video_main_clk,);
clk_set_parent(&ldb_di1_clk, &pll5_video_main_clk,);
3. 配置 initial clock 在 board-mx6q_sabresd.c
static struct ipuv3_fb_platform_datasabresd_fb_data[] = {
{ /*fb0*/
.disp_dev = "ldb",
.interface_pix_fmt = IPU_PIX_FMT_RGB666,
.mode_str = "LDB-XGA",
.default_bpp = 16,
.int_clk =
false,
.late_init = false,
}
int_clk=false means LDB clock isfrom PLL2_PFD_352 or pll5_video_main_clk;int_clk=true mean LDB clock if from IPU.