From: Hans de Goede Date: Fri, 19 Dec 2014 12:46:33 +0000 (+0100) Subject: sunxi: video: Use video-mode/-timing from videomodes X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=be8ec6330627c8413e5bd15ccf6c32a98677e704;p=u-boot.git sunxi: video: Use video-mode/-timing from videomodes Switch from fb_videomode to ctfb_res_modes and use the predefined videotimings from videomodes.c, rather then defining our own. Signed-off-by: Hans de Goede Acked-by: Ian Campbell Acked-by: Anatolij Gustschin --- diff --git a/drivers/video/Makefile b/drivers/video/Makefile index 00b563f26a..42b1eaaf76 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile @@ -39,7 +39,7 @@ obj-$(CONFIG_VIDEO_SANDBOX_SDL) += sandbox_sdl.o obj-$(CONFIG_VIDEO_SED13806) += sed13806.o obj-$(CONFIG_VIDEO_SM501) += sm501.o obj-$(CONFIG_VIDEO_SMI_LYNXEM) += smiLynxEM.o videomodes.o -obj-$(CONFIG_VIDEO_SUNXI) += sunxi_display.o +obj-$(CONFIG_VIDEO_SUNXI) += sunxi_display.o videomodes.o obj-$(CONFIG_VIDEO_TEGRA) += tegra.o obj-$(CONFIG_VIDEO_VCXK) += bus_vcxk.o obj-$(CONFIG_VIDEO_X86) += x86_fb.o diff --git a/drivers/video/sunxi_display.c b/drivers/video/sunxi_display.c index d2413971c0..cedb56ecb9 100644 --- a/drivers/video/sunxi_display.c +++ b/drivers/video/sunxi_display.c @@ -15,8 +15,8 @@ #include #include #include -#include #include +#include "videomodes.h" DECLARE_GLOBAL_DATA_PTR; @@ -97,7 +97,7 @@ static void sunxi_composer_init(void) setbits_le32(&de_be->mode, SUNXI_DE_BE_MODE_ENABLE); } -static void sunxi_composer_mode_set(struct fb_videomode *mode, +static void sunxi_composer_mode_set(const struct ctfb_res_modes *mode, unsigned int address) { struct sunxi_de_be_reg * const de_be = @@ -205,7 +205,7 @@ static void sunxi_lcdc_init(void) writel(0xffffffff, &lcdc->tcon1_io_tristate); } -static void sunxi_lcdc_mode_set(struct fb_videomode *mode, +static void sunxi_lcdc_mode_set(const struct ctfb_res_modes *mode, int *clk_div, int *clk_double) { struct sunxi_lcdc_reg * const lcdc = @@ -240,7 +240,7 @@ static void sunxi_lcdc_mode_set(struct fb_videomode *mode, writel(SUNXI_LCDC_X(mode->hsync_len) | SUNXI_LCDC_Y(mode->vsync_len), &lcdc->tcon1_timing_sync); - sunxi_lcdc_pll_set(mode->pixclock, clk_div, clk_double); + sunxi_lcdc_pll_set(mode->pixclock_khz, clk_div, clk_double); } #ifdef CONFIG_MACH_SUN6I @@ -255,7 +255,7 @@ static void sunxi_drc_init(void) } #endif -static void sunxi_hdmi_mode_set(struct fb_videomode *mode, +static void sunxi_hdmi_mode_set(const struct ctfb_res_modes *mode, int clk_div, int clk_double) { struct sunxi_hdmi_reg * const hdmi = @@ -310,7 +310,7 @@ static void sunxi_engines_init(void) #endif } -static void sunxi_mode_set(struct fb_videomode *mode, unsigned int address) +static void sunxi_mode_set(const struct ctfb_res_modes *mode, unsigned int address) { struct sunxi_de_be_reg * const de_be = (struct sunxi_de_be_reg *)SUNXI_DE_BE0_BASE; @@ -358,26 +358,7 @@ retry: void *video_hw_init(void) { static GraphicDevice *graphic_device = &sunxi_display.graphic_device; - /* - * Vesa standard 1024x768@60 - * 65.0 1024 1048 1184 1344 768 771 777 806 -hsync -vsync - */ - struct fb_videomode mode = { - .name = "1024x768", - .refresh = 60, - .xres = 1024, - .yres = 768, - .pixclock = 65000, - .left_margin = 160, - .right_margin = 24, - .upper_margin = 29, - .lower_margin = 3, - .hsync_len = 136, - .vsync_len = 6, - .sync = 0, - .vmode = 0, - .flag = 0, - }; + const struct ctfb_res_modes *mode = &res_mode_init[RES_MODE_1024x768]; int ret; memset(&sunxi_display, 0, sizeof(struct sunxi_display)); @@ -393,9 +374,9 @@ void *video_hw_init(void) printf("HDMI connected.\n"); sunxi_display.enabled = true; - printf("Setting up a %s console.\n", mode.name); + printf("Setting up a %dx%d console.\n", mode->xres, mode->yres); sunxi_engines_init(); - sunxi_mode_set(&mode, gd->fb_base - CONFIG_SYS_SDRAM_BASE); + sunxi_mode_set(mode, gd->fb_base - CONFIG_SYS_SDRAM_BASE); /* * These are the only members of this structure that are used. All the @@ -405,8 +386,8 @@ void *video_hw_init(void) graphic_device->frameAdrs = gd->fb_base; graphic_device->gdfIndex = GDF_32BIT_X888RGB; graphic_device->gdfBytesPP = 4; - graphic_device->winSizeX = mode.xres; - graphic_device->winSizeY = mode.yres; + graphic_device->winSizeX = mode->xres; + graphic_device->winSizeY = mode->yres; return graphic_device; } diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h index f7e87a2c37..4741b2ec57 100644 --- a/include/configs/sunxi-common.h +++ b/include/configs/sunxi-common.h @@ -215,6 +215,7 @@ #define CONFIG_CFB_CONSOLE #define CONFIG_VIDEO_SW_CURSOR #define CONFIG_VIDEO_LOGO +#define CONFIG_VIDEO_STD_TIMINGS /* allow both serial and cfb console. */ #define CONFIG_CONSOLE_MUX