本帖最后由 一只耳朵怪 于 2018-5-31 11:16 编辑
我现在让DM368输出colorbar到电视上显示, 使用pRGB格式输出时, colorbar的显示是正常的, 如下所示:
寄存器的配置如下:
sta
tic void davinci_enc_set_prgb(struct vid_enc_mode_info *mode_info)
[
u32 reg;
if ((strcmp(mode_info->name, VID_ENC_STD_480P_60) == 0) || (strcmp(mode_info->name, VID_ENC_STD_576P_50) == 0))
[
enableDigitalOutput(0);
]
else // 720p, 1080i
[
enableDigitalOutput(1);
]
dispc_reg_out(VENC_VIDCTL, 0x141);
dispc_reg_out(VENC_DCLKCTL, 0);
dispc_reg_out(VENC_DCLKPTN0, 0);
/* Set the OSD Divisor to 1. */
dispc_reg_out(VENC_OSDCLK0, 0);
dispc_reg_out(VENC_OSDCLK1, 1);
/* Clear composite mode register */
dispc_reg_out(VENC_CVBS, 0);
/* DM365 pinmux */
dispc_reg_out(VENC_CLKCTL, 0x11);
davinci_cfg_reg(DM365_VOUT_HVSYNC);
davinci_cfg_reg(DM365_VOUT_COUTL_EN);
davinci_cfg_reg(DM365_VOUT_COUTH_EN);
reg = __raw_readl(IO_ADDRESS(0x01c40004)); //pin mux 1
reg &= ~(3 << 18);
reg |= (2 << 18);
reg &= ~(3 << 20);
reg |= (1 << 20);
__raw_writel(reg, IO_ADDRESS(0x01c40004));
reg = __raw_readl(IO_ADDRESS(0x01c40010)); //pin mux 4
reg |= (0xf << 10);
reg |= 0xff;
__raw_writel(reg, IO_ADDRESS(0x01c40010));
reg = __raw_readl(IO_ADDRESS(0x01c40004));
printk("pinmux1:0x%08xn", reg);
osd_write_left_margin(mode_info->left_margin - get_venc_xoff());
osd_write_upper_margin(mode_info->upper_margin);
/* Set VIDCTL to select VCLKE = 1,
VCLKZ =0, SYDIR = 0 (set o/p), DOMD = 0 */
dispc_reg_merge(VENC_VIDCTL, 1 << VENC_VIDCTL_VCLKE_SHIFT,
VENC_VIDCTL_VCLKE);
dispc_reg_merge(VENC_VIDCTL, 0 << VENC_VIDCTL_VCLKZ_SHIFT,
VENC_VIDCTL_VCLKZ);
dispc_reg_merge(VENC_VIDCTL, 0 << VENC_VIDCTL_SYDIR_SHIFT,
VENC_VIDCTL_SYDIR);
dispc_reg_merge(VENC_VIDCTL, 0 << VENC_VIDCTL_YCDIR_SHIFT,
VENC_VIDCTL_YCDIR);
dispc_reg_merge(VENC_DCLKCTL,
1 << VENC_DCLKCTL_DCKEC_SHIFT, VENC_DCLKCTL_DCKEC);
dispc_reg_out(VENC_DCLKPTN0, 0x1);
davinci_enc_set_display_timing(mode_info);
if ((strcmp(mode_info->name, VID_ENC_STD_480P_60) == 0) || (strcmp(mode_info->name, VID_ENC_STD_576P_50) == 0))
[
dispc_reg_out(VENC_SYNCCTL, (VENC_SYNCCTL_SYEV | VENC_SYNCCTL_SYEH | VENC_SYNCCTL_HPL | VENC_SYNCCTL_VPL));
]
else // 720p, 1080i
[
dispc_reg_out(VENC_SYNCCTL, (VENC_SYNCCTL_SYEV | VENC_SYNCCTL_SYEH));
]
/* Configure VMOD. No change in VENC bit */
if (!mode_info->interlaced)
[
dispc_reg_out(VENC_VMOD, 0x2011);
]
else
[
dispc_reg_out(VENC_VMOD, 0x2211);
]
dispc_reg_out(VENC_LCDOUT, 0x1);
]
当让DM368输出colorbar到电视上显示, 使用YUV422格式输出时, colorbar的颜色显示不对, 白色的变成黑色了, 黄色变成了棕色, 如下所示:
寄存器的配置如下:
static void davinci_enc_set_ycbcr16(struct vid_enc_mode_info *mode_info)
[
u32 reg;
if ((strcmp(mode_info->name, VID_ENC_STD_480P_60) == 0) || (strcmp(mode_info->name, VID_ENC_STD_576P_50) == 0))
[
enableDigitalOutput(0);
]
else // 720p, 1080i
[
enableDigitalOutput(1);
]
dispc_reg_out(VENC_VIDCTL, 0x141);
dispc_reg_out(VENC_DCLKCTL, 0);
dispc_reg_out(VENC_DCLKPTN0, 0);
/* Set the OSD Divisor to 1. */
dispc_reg_out(VENC_OSDCLK0, 0);
dispc_reg_out(VENC_OSDCLK1, 1);
/* Clear composite mode register */
dispc_reg_out(VENC_CVBS, 0);
/* DM365 pinmux */
dispc_reg_out(VENC_CLKCTL, 0x11);
davinci_cfg_reg(DM365_VOUT_HVSYNC);
davinci_cfg_reg(DM365_VOUT_COUTL_EN);
davinci_cfg_reg(DM365_VOUT_COUTH_EN);
reg = __raw_readl(IO_ADDRESS(0x01c40004)); //pin mux 1
reg &= ~(3 << 20);
reg |= (1 << 20);
__raw_writel(reg, IO_ADDRESS(0x01c40004));
reg = __raw_readl(IO_ADDRESS(0x01c40004));
printk("pinmux1:0x%08xn", reg);
osd_write_left_margin(mode_info->left_margin - get_venc_xoff());
osd_write_upper_margin(mode_info->upper_margin);
/* Set VIDCTL to select VCLKE = 1,
VCLKZ =0, SYDIR = 0 (set o/p), DOMD = 0 */
dispc_reg_merge(VENC_VIDCTL, 1 << VENC_VIDCTL_VCLKE_SHIFT,
VENC_VIDCTL_VCLKE);
dispc_reg_merge(VENC_VIDCTL, 0 << VENC_VIDCTL_VCLKZ_SHIFT,
VENC_VIDCTL_VCLKZ);
dispc_reg_merge(VENC_VIDCTL, 0 << VENC_VIDCTL_SYDIR_SHIFT,
VENC_VIDCTL_SYDIR);
dispc_reg_merge(VENC_VIDCTL, 0 << VENC_VIDCTL_YCDIR_SHIFT,
VENC_VIDCTL_YCDIR);
dispc_reg_merge(VENC_DCLKCTL,
1 << VENC_DCLKCTL_DCKEC_SHIFT, VENC_DCLKCTL_DCKEC);
dispc_reg_out(VENC_DCLKPTN0, 0x1);
davinci_enc_set_display_timing(mode_info);
if ((strcmp(mode_info->name, VID_ENC_STD_480P_60) == 0) || (strcmp(mode_info->name, VID_ENC_STD_576P_50) == 0))
[
dispc_reg_out(VENC_SYNCCTL, (VENC_SYNCCTL_SYEV | VENC_SYNCCTL_SYEH | VENC_SYNCCTL_HPL | VENC_SYNCCTL_VPL));
]
else // 720p, 1080i
[
dispc_reg_out(VENC_SYNCCTL, (VENC_SYNCCTL_SYEV | VENC_SYNCCTL_SYEH));
]
/* Configure VMOD. No change in VENC bit */
if (!mode_info->interlaced)
[
dispc_reg_out(VENC_VMOD, 0x0011);
]
else
[
dispc_reg_out(VENC_VMOD, 0x0211);
]
dispc_reg_out(VENC_LCDOUT, 0x1);
]
请问下是什么原因导致颜色显示不正常的? 有哪些寄存器还需要配置, 谢谢.