From 97561eb8e133b29e89269eab2ccf2cb0d891c7d9 Mon Sep 17 00:00:00 2001 From: Zheng Yang Date: Wed, 27 Aug 2014 18:33:03 +0800 Subject: [PATCH] 1. rk3128-box.dts: enable tve. 2. rk_fb: set_par did not covert display window infomation set from user space to screen size, it will be calculate in user space. --- arch/arm/boot/dts/rk3128-box.dts | 6 +++++- drivers/video/rockchip/lcdc/rk312x_lcdc.c | 2 +- drivers/video/rockchip/rk_fb.c | 14 ++++++++------ drivers/video/rockchip/tve/rk3036/rk3036_tve.c | 10 ++++++---- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/arch/arm/boot/dts/rk3128-box.dts b/arch/arm/boot/dts/rk3128-box.dts index 9eaf8a89edbc..f68cadc6c249 100755 --- a/arch/arm/boot/dts/rk3128-box.dts +++ b/arch/arm/boot/dts/rk3128-box.dts @@ -135,13 +135,17 @@ display-timings = <&disp_timings>; }; +&fb { + rockchip,disp-mode = ; +}; + &lcdc { status = "okay"; rockchip,fb-win-map = ; }; &tve { - status = "disabled"; + status = "okay"; }; &i2c2 { diff --git a/drivers/video/rockchip/lcdc/rk312x_lcdc.c b/drivers/video/rockchip/lcdc/rk312x_lcdc.c index 90d36b666fe1..995118182a0b 100755 --- a/drivers/video/rockchip/lcdc/rk312x_lcdc.c +++ b/drivers/video/rockchip/lcdc/rk312x_lcdc.c @@ -2037,9 +2037,9 @@ static int rk312x_lcdc_parse_dt(struct lcdc_device *lcdc_dev) struct device_node *np = lcdc_dev->dev->of_node; const struct of_device_id *match; const struct rk_lcdc_drvdata *lcdc_drvdata; + int val; #if defined(CONFIG_ROCKCHIP_IOMMU) - int val; if (of_property_read_u32(np, "rockchip,iommu-enabled", &val)) lcdc_dev->driver.iommu_enabled = 0; else diff --git a/drivers/video/rockchip/rk_fb.c b/drivers/video/rockchip/rk_fb.c index 0c412dcb8459..9d734bfaf8f2 100755 --- a/drivers/video/rockchip/rk_fb.c +++ b/drivers/video/rockchip/rk_fb.c @@ -2725,7 +2725,6 @@ static int rk_fb_set_par(struct fb_info *info) struct rk_lcdc_win *extend_win = NULL; struct rk_lcdc_win *win = NULL; struct rk_screen *screen = dev_drv->cur_screen; - struct rk_screen screen_primary; int win_id = 0; u32 cblen = 0, crlen = 0; u16 xsize = 0, ysize = 0; /* winx display window height/width --->LCDC_WINx_DSP_INFO */ @@ -2764,6 +2763,10 @@ static int rk_fb_set_par(struct fb_info *info) if (var->grayscale >> 8) { xsize = (var->grayscale >> 8) & 0xfff; ysize = (var->grayscale >> 20) & 0xfff; + if (xsize > screen->mode.xres) + xsize = screen->mode.xres; + if (ysize > screen->mode.yres) + ysize = screen->mode.yres; } else { /*ohterwise full screen display */ xsize = screen->mode.xres; ysize = screen->mode.yres; @@ -2861,14 +2864,13 @@ static int rk_fb_set_par(struct fb_info *info) } } - rk_fb_get_prmry_screen(&screen_primary); win->format = fb_data_fmt; win->area[0].y_vir_stride = stride >> 2; win->area[0].uv_vir_stride = uv_stride >> 2; - win->area[0].xpos = xpos*screen->mode.xres/screen_primary.mode.xres; - win->area[0].ypos = ypos*screen->mode.yres/screen_primary.mode.yres; - win->area[0].xsize = screen->mode.xres*xsize/screen_primary.mode.xres; - win->area[0].ysize = screen->mode.yres*ysize/screen_primary.mode.yres; + win->area[0].xpos = xpos; + win->area[0].ypos = ypos; + win->area[0].xsize = xsize; + win->area[0].ysize = ysize; win->area[0].xact = var->xres; /* winx active window height,is a wint of vir */ win->area[0].yact = var->yres; win->area[0].xvir = var->xres_virtual; /* virtual resolution stride --->LCDC_WINx_VIR */ diff --git a/drivers/video/rockchip/tve/rk3036/rk3036_tve.c b/drivers/video/rockchip/tve/rk3036/rk3036_tve.c index 47b888cc24a7..7c354e85e75c 100644 --- a/drivers/video/rockchip/tve/rk3036/rk3036_tve.c +++ b/drivers/video/rockchip/tve/rk3036/rk3036_tve.c @@ -23,8 +23,10 @@ static const struct fb_videomode rk3036_cvbs_mode[] = { /*name refresh xres yres pixclock h_bp h_fp v_bp v_fp h_pw v_pw polariry PorI flag*/ - {"NTSC", 60, 720, 480, 27000000, 57, 19, 19, 0, 62, 3, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_INTERLACED, 0}, - {"PAL", 50, 720, 576, 27000000, 69, 12, 19, 2, 63, 3, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_INTERLACED, 0}, +/* {"NTSC", 60, 720, 480, 27000000, 57, 19, 19, 0, 62, 3, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_INTERLACED, 0}, + {"PAL", 50, 720, 576, 27000000, 69, 12, 19, 2, 63, 3, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_INTERLACED, 0}, +*/ {"NTSC", 60, 720, 480, 27000000, 43, 33, 19, 0, 62, 3, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_INTERLACED, 0}, + {"PAL", 50, 720, 576, 27000000, 52, 29, 19, 2, 63, 3, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_INTERLACED, 0}, }; static struct rk3036_tve *rk3036_tve; @@ -140,7 +142,7 @@ static int tve_switch_fb(const struct fb_videomode *modedb, int enable) /* screen type & face */ screen->type = SCREEN_TVOUT; screen->face = OUT_P888; - + screen->color_mode = COLOR_YCBCR; screen->mode = *modedb; /* Pin polarity */ @@ -403,7 +405,7 @@ static void __exit rk3036_tve_exit(void) platform_driver_unregister(&rk3036_tve_driver); } -module_init(rk3036_tve_init); +late_initcall(rk3036_tve_init); module_exit(rk3036_tve_exit); /* Module information */ -- 2.34.1