Commit 4966b5b61a4034ed4b9ec0d4de3fe384edddbb3a

Authored by Ye.Li
Committed by Ye Li
1 parent 77cce162b5

ENGR00315894-70 iMX6SX:Video Update MXS LCDIF driver

Add a new interface "mxs_lcd_panel_setup" to setup fb parameters and
specifies the LCDIF controller for multiple controllers of iMX6SX.
Pass fb parameters via "videomode" env remains work if the new interface
is not called before video initialization.

Modify LCDIF clock interface "mxs_set_lcdclk" to support multiple
LCDIF controllers on iMX6SX.

Signed-off-by: Ye.Li <B37916@freescale.com>
Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
(cherry picked from commit d7f49b9378547c3a57b96bcdb907fc44616beb3d)
(cherry picked from commit e1343191b9de227c582847e7eeb5ce9238be0754)
(cherry picked from commit 9632ebeccc34d663e21bd19f2fe62de51947296e)
Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 948c5c95e87a47bb3a80c8e67b67fe70e1e4a569)

Showing 3 changed files with 90 additions and 10 deletions Side-by-side Diff

arch/arm/cpu/arm926ejs/mxs/clock.c
... ... @@ -7,6 +7,8 @@
7 7 *
8 8 * Based on code from LTIB:
9 9 * Copyright (C) 2010 Freescale Semiconductor, Inc.
  10 + * Copyright (C) 2010-2014 Freescale Semiconductor, Inc.
  11 + *
10 12 */
11 13  
12 14 #include <common.h>
drivers/video/mxsfb.c
... ... @@ -3,6 +3,8 @@
3 3 * Freescale i.MX23/i.MX28 LCDIF driver
4 4 *
5 5 * Copyright (C) 2011-2013 Marek Vasut <marex@denx.de>
  6 + * Copyright (C) 2014-2016 Freescale Semiconductor, Inc.
  7 + *
6 8 */
7 9 #include <common.h>
8 10 #include <malloc.h>
9 11  
... ... @@ -17,7 +19,12 @@
17 19 #include <asm/mach-imx/dma.h>
18 20  
19 21 #include "videomodes.h"
  22 +#include <linux/string.h>
  23 +#include <linux/list.h>
  24 +#include <linux/fb.h>
  25 +#include <mxsfb.h>
20 26  
  27 +
21 28 #define PS2KHZ(ps) (1000000000UL / (ps))
22 29  
23 30 static GraphicDevice panel;
... ... @@ -34,6 +41,31 @@
34 41 {
35 42 }
36 43  
  44 +static int setup;
  45 +static struct fb_videomode fbmode;
  46 +static int depth;
  47 +
  48 +int mxs_lcd_panel_setup(struct fb_videomode mode, int bpp,
  49 + uint32_t base_addr)
  50 +{
  51 + fbmode = mode;
  52 + depth = bpp;
  53 + panel.isaBase = base_addr;
  54 +
  55 + setup = 1;
  56 +
  57 + return 0;
  58 +}
  59 +
  60 +void mxs_lcd_get_panel(struct display_panel *dispanel)
  61 +{
  62 + dispanel->width = fbmode.xres;
  63 + dispanel->height = fbmode.yres;
  64 + dispanel->reg_base = panel.isaBase;
  65 + dispanel->gdfindex = panel.gdfIndex;
  66 + dispanel->gdfbytespp = panel.gdfBytesPP;
  67 +}
  68 +
37 69 /*
38 70 * ARIES M28EVK:
39 71 * setenv videomode
40 72  
... ... @@ -49,12 +81,12 @@
49 81 static void mxs_lcd_init(GraphicDevice *panel,
50 82 struct ctfb_res_modes *mode, int bpp)
51 83 {
52   - struct mxs_lcdif_regs *regs = (struct mxs_lcdif_regs *)MXS_LCDIF_BASE;
  84 + struct mxs_lcdif_regs *regs = (struct mxs_lcdif_regs *)(panel->isaBase);
53 85 uint32_t word_len = 0, bus_width = 0;
54 86 uint8_t valid_data = 0;
55 87  
56 88 /* Kick in the LCDIF clock */
57   - mxs_set_lcdclk(MXS_LCDIF_BASE, PS2KHZ(mode->pixclock));
  89 + mxs_set_lcdclk(panel->isaBase, PS2KHZ(mode->pixclock));
58 90  
59 91 /* Restart the LCDIF block */
60 92 mxs_reset_block(&regs->hw_lcdif_ctrl_reg);
... ... @@ -132,7 +164,7 @@
132 164  
133 165 void lcdif_power_down(void)
134 166 {
135   - struct mxs_lcdif_regs *regs = (struct mxs_lcdif_regs *)MXS_LCDIF_BASE;
  167 + struct mxs_lcdif_regs *regs = (struct mxs_lcdif_regs *)(panel.isaBase);
136 168 int timeout = 1000000;
137 169  
138 170 if (!panel.frameAdrs)
139 171  
140 172  
141 173  
... ... @@ -159,19 +191,37 @@
159 191  
160 192 puts("Video: ");
161 193  
162   - /* Suck display configuration from "videomode" variable */
163   - penv = env_get("videomode");
164   - if (!penv) {
165   - puts("MXSFB: 'videomode' variable not set!\n");
166   - return NULL;
167   - }
  194 + if (!setup) {
168 195  
169   - bpp = video_get_params(&mode, penv);
  196 + /* Suck display configuration from "videomode" variable */
  197 + penv = env_get("videomode");
  198 + if (!penv) {
  199 + printf("MXSFB: 'videomode' variable not set!\n");
  200 + return NULL;
  201 + }
170 202  
  203 + bpp = video_get_params(&mode, penv);
  204 + panel.isaBase = MXS_LCDIF_BASE;
  205 + } else {
  206 + mode.xres = fbmode.xres;
  207 + mode.yres = fbmode.yres;
  208 + mode.pixclock = fbmode.pixclock;
  209 + mode.left_margin = fbmode.left_margin;
  210 + mode.right_margin = fbmode.right_margin;
  211 + mode.upper_margin = fbmode.upper_margin;
  212 + mode.lower_margin = fbmode.lower_margin;
  213 + mode.hsync_len = fbmode.hsync_len;
  214 + mode.vsync_len = fbmode.vsync_len;
  215 + mode.sync = fbmode.sync;
  216 + mode.vmode = fbmode.vmode;
  217 + bpp = depth;
  218 + }
  219 +
171 220 /* fill in Graphic device struct */
172 221 sprintf(panel.modeIdent, "%dx%dx%d",
173 222 mode.xres, mode.yres, bpp);
174 223  
  224 +
175 225 panel.winSizeX = mode.xres;
176 226 panel.winSizeY = mode.yres;
177 227 panel.plnSizeX = mode.xres;
... ... @@ -197,6 +247,7 @@
197 247 }
198 248  
199 249 panel.memSize = mode.xres * mode.yres * panel.gdfBytesPP;
  250 +
200 251  
201 252 /* Allocate framebuffer */
202 253 fb = memalign(ARCH_DMA_MINALIGN,
  1 +/*
  2 + * Copyright (C) 2014-2016 Freescale Semiconductor, Inc.
  3 + *
  4 + * SPDX-License-Identifier: GPL-2.0+
  5 + */
  6 +
  7 +#ifndef __MXSFB_H__
  8 +#define __MXSFB_H__
  9 +
  10 +#include <linux/fb.h>
  11 +
  12 +#ifdef CONFIG_VIDEO_MXS
  13 +struct display_panel {
  14 + unsigned int reg_base;
  15 + unsigned int width;
  16 + unsigned int height;
  17 + unsigned int gdfindex;
  18 + unsigned int gdfbytespp;
  19 +};
  20 +
  21 +void mxs_lcd_get_panel(struct display_panel *panel);
  22 +void lcdif_power_down(void);
  23 +int mxs_lcd_panel_setup(struct fb_videomode mode, int bpp,
  24 + uint32_t base_addr);
  25 +#endif
  26 +
  27 +#endif /* __MXSFB_H__ */