From: ZHW Date: Mon, 5 Aug 2013 01:36:07 +0000 (+0800) Subject: rk3026: fix lvds finishing the recent changes X-Git-Tag: firefly_0821_release~6758 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b86e931a4e23a3a6378b2e46ff9677a4b7160d67;p=firefly-linux-kernel-4.4.55.git rk3026: fix lvds finishing the recent changes --- diff --git a/drivers/video/rockchip/transmitter/rk3026_lvds.c b/drivers/video/rockchip/transmitter/rk3026_lvds.c index b7f699345744..a4d5f39dbeb9 100755 --- a/drivers/video/rockchip/transmitter/rk3026_lvds.c +++ b/drivers/video/rockchip/transmitter/rk3026_lvds.c @@ -22,35 +22,25 @@ static void rk3026_output_lvds(rk_screen *screen) { - u32 val =0; + + #if defined(CONFIG_LCDC0_RK3188) + val |= LVDS_DATA_SEL(0); + #else + val |= LVDS_DATA_SEL(1); + #endif - /* - Choise LVDS transmitter source from LCDC or EBC - */ -#if defined(CONFIG_LCDC0_RK3188) - val |= LVDS_DATA_SEL; -#else - val &= ~(LVDS_DATA_SEL); -#endif - /* - When LVDS output format is 8bit mode format-1/8bit mode format-2, configure - grf_lvds_con0 in 24-bit color mode. - When LVDS output format is 8bit mode format-3/6bit mode, configure - grf_lvds_con0 in 18-bit color mode. - */ if(screen->lvds_format == 0 || screen->lvds_format == 1) - val |= LVDS_CBS_COL_SEL(2); + val |= LVDS_CBS_COL_SEL(2); //24bit lvds else - val |= LVDS_CBS_COL_SEL(1); - - - val &= ~(LVDS_CBG_PWR_EN | LVDS_OUTPUT_EN | LVDS_SWING_SEL); - val |= (LVDS_OUTPUT_FORMAT(screen->lvds_format) | LVDS_PLL_PWR_EN | LVDS_SWING_SEL); + val |= LVDS_CBS_COL_SEL(1); //16bit lvds + + val |= ((LVDS_OUTPUT_FORMAT(screen->lvds_format))|LVDS_INPUT_FORMAT(1)|LVDS_OUTPUT_LOAD_SEL(0)| + LVDS_CBG_PWD_EN(1)|LVDS_PLL_PWD_EN(0)|LVDS_OUTPUT_EN(0)|LVDS_SWING_SEL(0)); + + val |= ((m_DATA_SEL|m_CBS_COL_SEL|m_OUTPUT_FORMAT|m_INPUT_FORMAT|m_OUTPUT_LOAD_SEL| + m_CBG_PWD_EN|m_PLL_PWD_EN|m_OUTPUT_EN|m_SWING_SEL)<<16); - val |= (LVDS_DATA_SEL | LVDS_OUTPUT_FORMAT(3) | LVDS_CBG_PWR_EN | LVDS_PLL_PWR_EN | - LVDS_OUTPUT_EN | LVDS_CBS_COL_SEL(3) | LVDS_SWING_SEL) << 16; - val = LVDS_OUT_CONFIG; lvds_writel(val,CRU_LVDS_CON0); return; @@ -58,33 +48,12 @@ static void rk3026_output_lvds(rk_screen *screen) static void rk3026_output_lvttl(rk_screen *screen) { - u32 val =0; - - /* - Choise LVDS transmitter source from LCDC or EBC - */ -#if defined(CONFIG_LCDC0_RK3188) - val |= LVDS_DATA_SEL; -#else - val &= ~(LVDS_DATA_SEL); -#endif - /* - When LVDS output format is 8bit mode format-1/8bit mode format-2, configure - grf_lvds_con0 in 24-bit color mode. - When LVDS output format is 8bit mode format-3/6bit mode, configure - grf_lvds_con0 in 18-bit color mode. - */ - if(screen->lvds_format == 0 || screen->lvds_format == 1) - val |= LVDS_CBS_COL_SEL(2); - else - val |= LVDS_CBS_COL_SEL(1); - - val &= ~(LVDS_DATA_SEL | LVDS_CBG_PWR_EN | LVDS_SWING_SEL); - val |= (LVDS_OUTPUT_FORMAT(screen->lvds_format) | LVDS_PLL_PWR_EN | LVDS_OUTPUT_EN | LVDS_CBS_COL_SEL(3)); - val |= ((LVDS_DATA_SEL | LVDS_CBG_PWR_EN | LVDS_SWING_SEL | LVDS_OUTPUT_FORMAT(screen->lvds_format) | - LVDS_PLL_PWR_EN | LVDS_OUTPUT_EN | LVDS_CBS_COL_SEL(3)) << 16); + u32 val =0; + val |= (LVDS_CBG_PWD_EN(0)|LVDS_PLL_PWD_EN(1)|LVDS_OUTPUT_EN(1)); + val |= ((m_CBG_PWD_EN|m_PLL_PWD_EN|m_OUTPUT_EN)<<16); + lvds_writel(val,CRU_LVDS_CON0); return; @@ -92,13 +61,14 @@ static void rk3026_output_lvttl(rk_screen *screen) static void rk3026_output_disable(void) { + u32 val =0; - - val |= ((LVDS_CBG_PWR_EN | LVDS_PLL_PWR_EN | LVDS_CBS_COL_SEL(3)) << 16); - val &= ~(LVDS_CBG_PWR_EN); - val |= (LVDS_PLL_PWR_EN | LVDS_CBS_COL_SEL(3)); - + + val |= (LVDS_CBG_PWD_EN(1)|LVDS_PLL_PWD_EN(0)|LVDS_OUTPUT_EN(0)|LVDS_CBS_COL_SEL(0)); + val |= ((m_CBG_PWD_EN|m_PLL_PWD_EN|m_OUTPUT_EN|m_CBS_COL_SEL)<<16); + lvds_writel(val,CRU_LVDS_CON0); + } diff --git a/drivers/video/rockchip/transmitter/rk3026_lvds.h b/drivers/video/rockchip/transmitter/rk3026_lvds.h index 02c2674d7a16..6c5789e2273b 100755 --- a/drivers/video/rockchip/transmitter/rk3026_lvds.h +++ b/drivers/video/rockchip/transmitter/rk3026_lvds.h @@ -2,16 +2,27 @@ #define CRU_LVDS_CON0 0x0150 -#define LVDS_SWING_SEL (1<<12) -#define LVDS_CBS_COL_SEL(x) ((x&3)<<10) -#define LVDS_OUTPUT_EN (1<<9) -#define LVDS_PLL_PWR_EN (1<<8) -#define LVDS_CBG_PWR_EN (1<<7) -#define LVDS_CH_LOAD (1<<4) -#define LVDS_INPUT_FORMAT (1<<3) -#define LVDS_OUTPUT_FORMAT(x) (((x)&3)<<1) -#define LVDS_DATA_SEL (1<<0) -#define LVDS_OUT_CONFIG 0xffff088a +#define LVDS_SWING_SEL(x) (((x)&1)<<12)//0:250mv-450mv;1:150mv-250mv +#define LVDS_CBS_COL_SEL(x) (((x)&3)<<10)// 1:18-bit lvds 2:24-bit lvds; 3:all lvds power down +#define LVDS_OUTPUT_EN(x) (((x)&1)<<9) //0:lvds; 1:lvttl +#define LVDS_PLL_PWD_EN(x) (((x)&1)<<8) //0:enable; 1:disable +#define LVDS_CBG_PWD_EN(x) (((x)&1)<<7) //0:disable; 1:enable +#define LVDS_OUTPUT_LOAD_SEL(X) (((X)&3)<<4) //0:3pf; 1:6pf; 2:10pf; 3:15pf +#define LVDS_INPUT_FORMAT(x) (((x)&1)<<3) //0:MSB is on D7; 1:MSB is on D0; +#define LVDS_OUTPUT_FORMAT(x) (((x)&3)<<1) //0:LVDS_8BIT_1; 1:LVDS_8BIT_2; 2:LVDS_8BIT_3; 3:LVDS_6BIT +#define LVDS_DATA_SEL(x) (((x)&1)<<0) //0:from lcdc; 1:from ebc; + + +#define m_SWING_SEL (1<<12) +#define m_CBS_COL_SEL (3<<10) +#define m_OUTPUT_EN (1<<9) +#define m_PLL_PWD_EN (1<<8) +#define m_CBG_PWD_EN (1<<7) +#define m_OUTPUT_LOAD_SEL (3<<4) +#define m_INPUT_FORMAT (1<<3) +#define m_OUTPUT_FORMAT (3<<1) +#define m_DATA_SEL (1<<0) + enum{ OUT_DISABLE=0,