From bdbccee43a700b2c81c6f0b2588068629f90708f Mon Sep 17 00:00:00 2001 From: Zheng Yang Date: Fri, 26 Sep 2014 18:51:41 +0800 Subject: [PATCH] rk3036/rk312x tve: add test mode for cvbs electrical capacity test. --- arch/arm/boot/dts/rk3128-box.dts | 1 + .../video/rockchip/tve/rk3036/rk3036_tve.c | 24 ++++++++++++------- .../video/rockchip/tve/rk3036/rk3036_tve.h | 1 + 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/arch/arm/boot/dts/rk3128-box.dts b/arch/arm/boot/dts/rk3128-box.dts index 55b86e8c31da..d71b76e77aad 100755 --- a/arch/arm/boot/dts/rk3128-box.dts +++ b/arch/arm/boot/dts/rk3128-box.dts @@ -204,6 +204,7 @@ &tve { status = "okay"; + test_mode = <0>; }; &i2c2 { diff --git a/drivers/video/rockchip/tve/rk3036/rk3036_tve.c b/drivers/video/rockchip/tve/rk3036/rk3036_tve.c index 04afe3a7108d..e73fe0213e04 100644 --- a/drivers/video/rockchip/tve/rk3036/rk3036_tve.c +++ b/drivers/video/rockchip/tve/rk3036/rk3036_tve.c @@ -53,8 +53,7 @@ static void dac_enable(bool enable) if (rk3036_tve->soctype == SOC_RK312X) { val = m_VBG_EN | m_DAC_EN | v_DAC_GAIN(0x3a); grfreg = RK312X_GRF_TVE_CON; - } - else if (rk3036_tve->soctype == SOC_RK3036) { + } else if (rk3036_tve->soctype == SOC_RK3036) { val = m_VBG_EN | m_DAC_EN | v_DAC_GAIN(0x3e); grfreg = RK3036_GRF_SOC_CON3; } @@ -124,14 +123,14 @@ static void tve_set_mode(int mode) tve_writel(TV_ADJ_TIMING, (0xc << 28) | 0x06c00800 | 0x80); tve_writel(TV_ACT_ST, 0x001500F6); tve_writel(TV_ACT_TIMING, 0x0694011D | (1 << 12) | (2 << 28)); - if (rk3036_tve->soctype == SOC_RK312X){ - tve_writel(TV_ADJ_TIMING, (0xa<< 28) | 0x06c00800 | 0x80); + if (rk3036_tve->soctype == SOC_RK312X) { + tve_writel(TV_ADJ_TIMING, (0xa << 28) | 0x06c00800 | 0x80); udelay(100); - tve_writel(TV_ADJ_TIMING, (0xa<< 28) | 0x06c00800 | 0x80); + tve_writel(TV_ADJ_TIMING, (0xa << 28) | 0x06c00800 | 0x80); tve_writel(TV_ACT_TIMING, 0x0694011D | (1 << 12) | (2 << 28)); + } else { + tve_writel(TV_ADJ_TIMING, (0xa << 28) | 0x06c00800 | 0x80); } - else - tve_writel(TV_ADJ_TIMING, (0xa<< 28) | 0x06c00800 | 0x80); } } @@ -144,7 +143,10 @@ static int tve_switch_fb(const struct fb_videomode *modedb, int enable) memset(screen, 0, sizeof(struct rk_screen)); /* screen type & face */ - screen->type = SCREEN_TVOUT; + if (rk3036_tve->test_mode) + screen->type = SCREEN_TVOUT_TEST; + else + screen->type = SCREEN_TVOUT; screen->face = OUT_P888; screen->color_mode = COLOR_YCBCR; screen->mode = *modedb; @@ -335,6 +337,7 @@ static int rk3036_tve_probe(struct platform_device *pdev) struct resource *res; const struct of_device_id *match; int i; + int val = 0 ; match = of_match_node(rk3036_tve_dt_ids, np); if (!match) @@ -347,6 +350,11 @@ static int rk3036_tve_probe(struct platform_device *pdev) return -ENOMEM; } + if (of_property_read_u32(np, "test_mode", &val)) + rk3036_tve->test_mode = 0; + else + rk3036_tve->test_mode = val; + if (!strcmp(match->compatible, "rockchip,rk3036-tve")) { rk3036_tve->soctype = SOC_RK3036; rk3036_tve->inputformat = INPUT_FORMAT_RGB; diff --git a/drivers/video/rockchip/tve/rk3036/rk3036_tve.h b/drivers/video/rockchip/tve/rk3036/rk3036_tve.h index aaa6ecd86059..ffe6c18f5d18 100644 --- a/drivers/video/rockchip/tve/rk3036/rk3036_tve.h +++ b/drivers/video/rockchip/tve/rk3036/rk3036_tve.h @@ -113,6 +113,7 @@ struct rk3036_tve { struct fb_videomode *mode; struct list_head modelist; struct rk_screen screen; + int test_mode; }; #endif \ No newline at end of file -- 2.34.1