These settings used to be specified per-mode. But the device tree bindings have these two values attached to the display and not to each mode. Also for the supported boards it doesn't matter as they all only have a single mode. This is preparatory work to add devicetree support for the imxfb driver. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx> --- Hello, I'm not sure when I will come around to add devicetree support to imxfb. It's a bigger task than I expected so I put that on hold for now. Still I wanted to send out this first preparatory patch. Best regards Uwe .../boards/eukrea_cpuimx25/eukrea_cpuimx25.c | 30 +++++----- .../boards/eukrea_cpuimx27/eukrea_cpuimx27.c | 31 +++++----- arch/arm/boards/freescale-mx21-ads/imx21ads.c | 34 +++++------ arch/arm/boards/guf-neso/board.c | 58 +++++++++---------- arch/arm/boards/karo-tx25/board.c | 34 +++++------ arch/arm/boards/phytec-phycore-imx27/pcm038.c | 46 +++++++-------- arch/arm/mach-imx/include/mach/imxfb.h | 10 +--- drivers/video/imx.c | 23 ++------ 8 files changed, 120 insertions(+), 146 deletions(-) diff --git a/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c b/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c index 25bf40ce7923..76d6f5ba8605 100644 --- a/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c +++ b/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c @@ -56,22 +56,18 @@ struct imx_nand_platform_data nand_info = { .hw_ecc = 1, }; -static struct imx_fb_videomode imxfb_mode = { - .mode = { - .name = "CMO-QVGA", - .refresh = 60, - .xres = 320, - .yres = 240, - .pixclock = KHZ2PICOS(6500), - .hsync_len = 30, - .left_margin = 38, - .right_margin = 20, - .vsync_len = 3, - .upper_margin = 15, - .lower_margin = 4, - }, - .pcr = 0xCAD08B80, - .bpp = 16, +static struct fb_videomode imxfb_mode = { + .name = "CMO-QVGA", + .refresh = 60, + .xres = 320, + .yres = 240, + .pixclock = KHZ2PICOS(6500), + .hsync_len = 30, + .left_margin = 38, + .right_margin = 20, + .vsync_len = 3, + .upper_margin = 15, + .lower_margin = 4, }; static struct imx_fb_platform_data eukrea_cpuimx25_fb_data = { @@ -80,6 +76,8 @@ static struct imx_fb_platform_data eukrea_cpuimx25_fb_data = { .pwmr = 0x00A903FF, .lscr1 = 0x00120300, .dmacr = 0x80040060, + .pcr = 0xCAD08B80, + .bpp = 16, }; struct gpio_led led0 = { diff --git a/arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c b/arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c index 63034e2755f6..52971ed7ee79 100644 --- a/arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c +++ b/arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c @@ -80,22 +80,19 @@ static struct i2c_board_info i2c_devices[] = { }; #ifdef CONFIG_DRIVER_VIDEO_IMX -static struct imx_fb_videomode imxfb_mode = { - .mode = { - .name = "CMO-QVGA", - .refresh = 60, - .xres = 320, - .yres = 240, - .pixclock = 156000, - .hsync_len = 30, - .left_margin = 38, - .right_margin = 20, - .vsync_len = 3, - .upper_margin = 15, - .lower_margin = 4, - }, - .pcr = 0xFAD08B80, - .bpp = 16,}; +static struct fb_videomode imxfb_mode = { + .name = "CMO-QVGA", + .refresh = 60, + .xres = 320, + .yres = 240, + .pixclock = 156000, + .hsync_len = 30, + .left_margin = 38, + .right_margin = 20, + .vsync_len = 3, + .upper_margin = 15, + .lower_margin = 4, +}; static struct imx_fb_platform_data eukrea_cpuimx27_fb_data = { .mode = &imxfb_mode, @@ -103,6 +100,8 @@ static struct imx_fb_platform_data eukrea_cpuimx27_fb_data = { .pwmr = 0x00A903FF, .lscr1 = 0x00120300, .dmacr = 0x00020010, + .pcr = 0xFAD08B80, + .bpp = 16, }; #endif diff --git a/arch/arm/boards/freescale-mx21-ads/imx21ads.c b/arch/arm/boards/freescale-mx21-ads/imx21ads.c index aa654da494ed..2c54cd703074 100644 --- a/arch/arm/boards/freescale-mx21-ads/imx21ads.c +++ b/arch/arm/boards/freescale-mx21-ads/imx21ads.c @@ -47,24 +47,20 @@ struct imx_nand_platform_data nand_info = { }; /* Sharp LQ035Q7DB02 QVGA display */ -static struct imx_fb_videomode imx_fb_modedata = { - .mode = { - .name = "Sharp-LQ035Q7", - .refresh = 60, - .xres = 240, - .yres = 320, - .pixclock = 188679, - .left_margin = 6, - .right_margin = 16, - .upper_margin = 8, - .lower_margin = 10, - .hsync_len = 2, - .vsync_len = 1, - .sync = 0, - .vmode = FB_VMODE_NONINTERLACED, - }, - .pcr = 0xfb108bc7, - .bpp = 16, +static struct fb_videomode imx_fb_modedata = { + .name = "Sharp-LQ035Q7", + .refresh = 60, + .xres = 240, + .yres = 320, + .pixclock = 188679, + .left_margin = 6, + .right_margin = 16, + .upper_margin = 8, + .lower_margin = 10, + .hsync_len = 2, + .vsync_len = 1, + .sync = 0, + .vmode = FB_VMODE_NONINTERLACED, }; static struct imx_fb_platform_data imx_fb_data = { @@ -76,6 +72,8 @@ static struct imx_fb_platform_data imx_fb_data = { .pwmr = 0x00a903ff, .lscr1 = 0x00120300, .dmacr = 0x00020008, + .pcr = 0xfb108bc7, + .bpp = 16, }; static int imx21ads_timing_init(void) diff --git a/arch/arm/boards/guf-neso/board.c b/arch/arm/boards/guf-neso/board.c index 2a64bc14fcb6..6846ba5793ff 100644 --- a/arch/arm/boards/guf-neso/board.c +++ b/arch/arm/boards/guf-neso/board.c @@ -62,36 +62,18 @@ static struct imx_nand_platform_data nand_info = { .flash_bbt = 1, }; -static struct imx_fb_videomode imxfb_mode = { - .mode = { - .name = "CPT CLAA070LC0JCT", - .refresh = 60, - .xres = 800, - .yres = 480, - .pixclock = KHZ2PICOS(27000), - .hsync_len = 1, /* DE only sync */ - .left_margin = 50, - .right_margin = 50, - .vsync_len = 1, /* DE only sync */ - .upper_margin = 10, - .lower_margin = 10, - }, - /* - * - TFT style panel - * - clk enabled while idle - * - clock inverted - * - data not inverted - * - data enable high active - */ - .pcr = PCR_TFT | - PCR_COLOR | - PCR_PBSIZ_8 | - PCR_BPIX_16 | - PCR_CLKPOL | - PCR_SCLK_SEL | - PCR_LPPOL | - PCR_FLMPOL, - .bpp = 16, /* TODO 32 bit does not work: The 'green' component is lacking in this mode */ +static struct fb_videomode imxfb_mode = { + .name = "CPT CLAA070LC0JCT", + .refresh = 60, + .xres = 800, + .yres = 480, + .pixclock = KHZ2PICOS(27000), + .hsync_len = 1, /* DE only sync */ + .left_margin = 50, + .right_margin = 50, + .vsync_len = 1, /* DE only sync */ + .upper_margin = 10, + .lower_margin = 10, }; static void neso_fb_enable(int enable) @@ -109,6 +91,22 @@ static struct imx_fb_platform_data neso_fb_data = { .dmacr = (0 << 31) | (4 << 16) | 96, .enable = neso_fb_enable, .framebuffer_ovl = (void *)0xa7f00000, + /* + * - TFT style panel + * - clk enabled while idle + * - clock inverted + * - data not inverted + * - data enable high active + */ + .pcr = PCR_TFT | + PCR_COLOR | + PCR_PBSIZ_8 | + PCR_BPIX_16 | + PCR_CLKPOL | + PCR_SCLK_SEL | + PCR_LPPOL | + PCR_FLMPOL, + .bpp = 16, /* TODO 32 bit does not work: The 'green' component is lacking in this mode */ }; #if defined(CONFIG_USB) && defined(CONFIG_USB_ULPI) diff --git a/arch/arm/boards/karo-tx25/board.c b/arch/arm/boards/karo-tx25/board.c index ebebd58d801c..a4d4af57a3b7 100644 --- a/arch/arm/boards/karo-tx25/board.c +++ b/arch/arm/boards/karo-tx25/board.c @@ -125,24 +125,20 @@ static iomux_v3_cfg_t tx25_lcdc_gpios[] = { MX25_PAD_OE_ACD__OE_ACD, }; -static struct imx_fb_videomode stk5_fb_mode = { - .bpp = 16, - .mode = { - .name = "G-ETV570G0DMU", - .pixclock = 33333, - - .xres = 640, - .yres = 480, - - .hsync_len = 64, - .left_margin = 96, - .right_margin = 80, - - .vsync_len = 3, - .upper_margin = 46, - .lower_margin = 39, - }, - .pcr = PCR_TFT | PCR_COLOR | PCR_FLMPOL | PCR_LPPOL | PCR_SCLK_SEL, +static struct fb_videomode stk5_fb_mode = { + .name = "G-ETV570G0DMU", + .pixclock = 33333, + + .xres = 640, + .yres = 480, + + .hsync_len = 64, + .left_margin = 96, + .right_margin = 80, + + .vsync_len = 3, + .upper_margin = 46, + .lower_margin = 39, }; #define STK5_LCD_BACKLIGHT_GPIO IMX_GPIO_NR(1, 26) @@ -168,6 +164,8 @@ static struct imx_fb_platform_data tx25_fb_data = { .num_modes = 1, .dmacr = 0x80040060, .enable = tx25_fb_enable, + .bpp = 16, + .pcr = PCR_TFT | PCR_COLOR | PCR_FLMPOL | PCR_LPPOL | PCR_SCLK_SEL, }; static int tx25_init_fb(void) diff --git a/arch/arm/boards/phytec-phycore-imx27/pcm038.c b/arch/arm/boards/phytec-phycore-imx27/pcm038.c index 5ebef516a759..008346faf1e1 100644 --- a/arch/arm/boards/phytec-phycore-imx27/pcm038.c +++ b/arch/arm/boards/phytec-phycore-imx27/pcm038.c @@ -34,20 +34,26 @@ #define PCM038_GPIO_OTG_STP (GPIO_PORTE + 1) -static struct imx_fb_videomode imxfb_mode = { - .mode = { - .name = "Sharp-LQ035Q7", - .refresh = 60, - .xres = 240, - .yres = 320, - .pixclock = 188679, /* in ps (5.3MHz) */ - .hsync_len = 7, - .left_margin = 5, - .right_margin = 16, - .vsync_len = 1, - .upper_margin = 7, - .lower_margin = 9, - }, +static struct fb_videomode imxfb_mode = { + .name = "Sharp-LQ035Q7", + .refresh = 60, + .xres = 240, + .yres = 320, + .pixclock = 188679, /* in ps (5.3MHz) */ + .hsync_len = 7, + .left_margin = 5, + .right_margin = 16, + .vsync_len = 1, + .upper_margin = 7, + .lower_margin = 9, +}; + +static struct imx_fb_platform_data pcm038_fb_data = { + .mode = &imxfb_mode, + .num_modes = 1, + .pwmr = 0x00a903ff, + .lscr1 = 0x00120300, + .dmacr = 0x00020010, /* * - HSYNC active high * - VSYNC active high @@ -57,16 +63,8 @@ static struct imx_fb_videomode imxfb_mode = { * - data enable low active * - enable sharp mode */ - .pcr = 0xf00080c0, - .bpp = 16, -}; - -static struct imx_fb_platform_data pcm038_fb_data = { - .mode = &imxfb_mode, - .num_modes = 1, - .pwmr = 0x00a903ff, - .lscr1 = 0x00120300, - .dmacr = 0x00020010, + .pcr = 0xf00080c0, + .bpp = 16, }; static const unsigned int pcm038_pins[] = { diff --git a/arch/arm/mach-imx/include/mach/imxfb.h b/arch/arm/mach-imx/include/mach/imxfb.h index ea39e3198ec5..6df7a14ddeda 100644 --- a/arch/arm/mach-imx/include/mach/imxfb.h +++ b/arch/arm/mach-imx/include/mach/imxfb.h @@ -52,17 +52,11 @@ #define DMACR_HM(x) (((x) & 0xf) << 16) #define DMACR_TM(x) ((x) & 0xf) -struct imx_fb_videomode { - struct fb_videomode mode; - u32 pcr; - unsigned char bpp; -}; - /** * Define relevant framebuffer information */ struct imx_fb_platform_data { - struct imx_fb_videomode *mode; + struct fb_videomode *mode; u_int num_modes; u_int cmap_greyscale:1, @@ -73,6 +67,8 @@ struct imx_fb_platform_data { u_int pwmr; u_int lscr1; u_int dmacr; + u32 pcr; + unsigned char bpp; /** force a memory area to be used, else NULL for dynamic allocation */ void *framebuffer; diff --git a/drivers/video/imx.c b/drivers/video/imx.c index 947f8d534911..d15c2d88fb91 100644 --- a/drivers/video/imx.c +++ b/drivers/video/imx.c @@ -152,8 +152,6 @@ struct imxfb_info { cmap_static:1, unused:30; - struct imx_fb_videomode *mode; - struct fb_info info; struct device_d *dev; @@ -293,14 +291,6 @@ static int imxfb_activate_var(struct fb_info *info) unsigned long long tmp; struct imxfb_info *fbi = info->priv; u32 pcr; - int i; - - for (i = 0; i < info->modes.num_modes; i++) { - if (!strcmp(fbi->mode[i].mode.name, mode->name)) { - fbi->pcr = fbi->mode[i].pcr; - break; - } - } /* physical screen start address */ writel(VPW_VPW(mode->xres * info->bits_per_pixel / 8 / 4), @@ -556,7 +546,7 @@ static int imxfb_probe(struct device_d *dev) mode_list = xzalloc(sizeof(*mode_list) * pdata->num_modes); for (i = 0; i < pdata->num_modes; i++) - mode_list[i] = pdata->mode[i].mode; + mode_list[i] = pdata->mode[i]; fbi = xzalloc(sizeof(*fbi)); info = &fbi->info; @@ -573,13 +563,12 @@ static int imxfb_probe(struct device_d *dev) if (IS_ERR(fbi->ipg_clk)) return PTR_ERR(fbi->ipg_clk); - fbi->mode = pdata->mode; iores = dev_request_mem_resource(dev, 0); if (IS_ERR(iores)) return PTR_ERR(iores); fbi->regs = IOMEM(iores->start); - fbi->pcr = pdata->mode->pcr; + fbi->pcr = pdata->pcr; fbi->pwmr = pdata->pwmr; fbi->lscr1 = pdata->lscr1; fbi->dmacr = pdata->dmacr; @@ -588,10 +577,10 @@ static int imxfb_probe(struct device_d *dev) info->priv = fbi; info->modes.modes = mode_list; info->modes.num_modes = pdata->num_modes; - info->mode = &pdata->mode->mode; - info->xres = pdata->mode->mode.xres; - info->yres = pdata->mode->mode.yres; - info->bits_per_pixel = pdata->mode->bpp; + info->mode = pdata->mode; + info->xres = pdata->mode->xres; + info->yres = pdata->mode->yres; + info->bits_per_pixel = pdata->bpp; info->fbops = &imxfb_ops; dev_info(dev, "i.MX Framebuffer driver\n"); -- 2.23.0 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox