rk3036/rk312x tve: add test mode for cvbs electrical capacity test.
authorZheng Yang <zhengyang@rock-chips.com>
Fri, 26 Sep 2014 10:51:41 +0000 (18:51 +0800)
committerZheng Yang <zhengyang@rock-chips.com>
Fri, 26 Sep 2014 10:51:41 +0000 (18:51 +0800)
arch/arm/boot/dts/rk3128-box.dts
drivers/video/rockchip/tve/rk3036/rk3036_tve.c
drivers/video/rockchip/tve/rk3036/rk3036_tve.h

index 55b86e8c31da7c390911bdbb9f58714661535e46..d71b76e77aadf6321b8b3598b865643988d58086 100755 (executable)
 
 &tve {
        status = "okay";
+       test_mode = <0>;
 };
 
 &i2c2 {
index 04afe3a7108d6be84e94d15ef4d1bc07f40975d9..e73fe0213e04066bffe4f3c553c9f2bb4db9fdf3 100644 (file)
@@ -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;
index aaa6ecd860593aad9e82b6a35b163e0e613a8ebe..ffe6c18f5d18745b98da448e93a1b9e3b1afecd5 100644 (file)
@@ -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