From: Juergen Beisert <jbe@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 09/11] Provide more driver specific data in a videomode
Date: Fri, 19 Nov 2010 13:51:01 +0100 [thread overview]
Message-ID: <1290171063-28870-10-git-send-email-jbe@pengutronix.de> (raw)
In-Reply-To: <1290171063-28870-1-git-send-email-jbe@pengutronix.de>
In order to support more than one videomode in a binary barebox, some drivers
need more specific data to setup the requested video mode in a correct manner.
This patch adds the 'priv' field to the generic videomode description to give
any platform a chance to forward some video hardware specific information on
a per videomode base.
This is currently i.MX21/i.MX25/i.MX27 specific.
BTW: At least the 'pcr' value could be generated at runtime from the 'sync'
field in 'struct fb_videomode'.
Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
---
arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c | 21 +++++-----
arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c | 21 +++++-----
arch/arm/boards/guf-neso/board.c | 45 +++++++++++----------
arch/arm/boards/imx21ads/imx21ads.c | 24 ++++++------
arch/arm/boards/pcm038/pcm038.c | 40 +++++++++---------
arch/arm/mach-imx/include/mach/imxfb.h | 20 +++++----
drivers/video/imx.c | 19 +++++----
include/fb.h | 2 +
8 files changed, 99 insertions(+), 93 deletions(-)
diff --git a/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c b/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c
index 2b53766..a2bbaa3 100644
--- a/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c
+++ b/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c
@@ -107,7 +107,14 @@ struct imx_nand_platform_data nand_info = {
.hw_ecc = 1,
};
-static struct fb_videomode cmo_display = {
+static const struct imx_fb_driver_data driver_data = {
+ .pwmr = 0x00A903FF,
+ .lscr1 = 0x00120300,
+ .dmacr = 0x80040060,
+ .pcr = 0xCAD08B80,
+};
+
+static const struct fb_videomode cmo_display = {
.name = "CMO-QVGA",
.refresh = 60,
.xres = 320,
@@ -121,17 +128,9 @@ static struct fb_videomode cmo_display = {
.lower_margin = 4,
};
-static struct imx_fb_videomode imxfb_mode = {
- .mode = &cmo_display,
- .pcr = 0xCAD08B80,
- .bpp = 16,
-};
-
static struct imx_fb_platform_data eukrea_cpuimx25_fb_data = {
- .mode = &imxfb_mode,
- .pwmr = 0x00A903FF,
- .lscr1 = 0x00120300,
- .dmacr = 0x80040060,
+ .mode = &cmo_display,
+ .mode_cnt = 1,
};
#ifdef CONFIG_USB
diff --git a/arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c b/arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c
index 3ee1057..b162611 100644
--- a/arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c
+++ b/arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c
@@ -167,7 +167,14 @@ static void eukrea_cpuimx27_mmu_init(void)
#endif
#ifdef CONFIG_DRIVER_VIDEO_IMX
-static struct fb_videomode cmo_display = {
+static const struct imx_fb_driver_data driver_data = {
+ .pwmr = 0x00A903FF,
+ .lscr1 = 0x00120300,
+ .dmacr = 0x00020010,
+ .pcr = 0xFAD08B80,
+};
+
+static const struct fb_videomode cmo_display = {
.name = "CMO-QVGA",
.refresh = 60,
.xres = 320,
@@ -179,18 +186,12 @@ static struct fb_videomode cmo_display = {
.vsync_len = 3,
.upper_margin = 15,
.lower_margin = 4,
+ .priv = &driver_data,
};
-static struct imx_fb_videomode imxfb_mode = {
- .mode = &cmo_display,
- .pcr = 0xFAD08B80,
- .bpp = 16,};
-
static struct imx_fb_platform_data eukrea_cpuimx27_fb_data = {
- .mode = &imxfb_mode,
- .pwmr = 0x00A903FF,
- .lscr1 = 0x00120300,
- .dmacr = 0x00020010,
+ .mode = &cmo_display,
+ .mode_cnt = 1,
};
static struct device_d imxfb_dev = {
diff --git a/arch/arm/boards/guf-neso/board.c b/arch/arm/boards/guf-neso/board.c
index fba43bb..0c7a9fa 100644
--- a/arch/arm/boards/guf-neso/board.c
+++ b/arch/arm/boards/guf-neso/board.c
@@ -78,22 +78,11 @@ static struct imx_nand_platform_data nand_info = {
.flash_bbt = 1,
};
-static struct fb_videomode cpt_display = {
- .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 struct imx_fb_videomode imxfb_mode = {
- .mode = &cpt_display,
+static const struct imx_fb_driver_data driver_data = {
+ .pwmr = 0x00000000, /* doesn't matter */
+ .lscr1 = 0x00120300, /* doesn't matter */
+ /* dynamic mode -> using the reset values (as recommended in the datasheet) */
+ .dmacr = (0 << 31) | (4 << 16) | 96,
/*
* - TFT style panel
* - clk enabled while idle
@@ -109,7 +98,21 @@ static struct imx_fb_videomode imxfb_mode = {
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 cpt_display = {
+ .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,
+ .priv = &driver_data,
};
static void neso_fb_enable(int enable)
@@ -119,12 +122,10 @@ static void neso_fb_enable(int enable)
}
static struct imx_fb_platform_data neso_fb_data = {
- .mode = &imxfb_mode,
- .pwmr = 0x00000000, /* doesn't matter */
- .lscr1 = 0x00120300, /* doesn't matter */
- /* dynamic mode -> using the reset values (as recommended in the datasheet) */
- .dmacr = (0 << 31) | (4 << 16) | 96,
+ .mode = &cpt_display,
+ .mode_cnt = 1,
.enable = neso_fb_enable,
+ .bpp = 16, /* TODO 32 bit does not work: The 'green' component is lacking in this mode */
.framebuffer_ovl = (void *)0xa7f00000,
};
diff --git a/arch/arm/boards/imx21ads/imx21ads.c b/arch/arm/boards/imx21ads/imx21ads.c
index 8e145c7..299a3cd 100644
--- a/arch/arm/boards/imx21ads/imx21ads.c
+++ b/arch/arm/boards/imx21ads/imx21ads.c
@@ -73,7 +73,14 @@ static struct device_d cs8900_dev = {
// IRQ is connected to UART3_RTS
};
-static struct fb_videomode sharp_display = {
+static const struct imx_fb_driver_data driver_data = {
+ .pwmr = 0x00a903ff,
+ .lscr1 = 0x00120300,
+ .dmacr = 0x00020008,
+ .pcr = 0xfb108bc7,
+};
+
+static const struct fb_videomode sharp_display = {
.name = "Sharp-LQ035Q7",
.refresh = 60,
.xres = 240,
@@ -88,23 +95,16 @@ static struct fb_videomode sharp_display = {
.sync = 0,
.vmode = FB_VMODE_NONINTERLACED,
.flag = 0,
-};
-
-/* Sharp LQ035Q7DB02 QVGA display */
-static struct imx_fb_videomode imx_fb_modedata = {
- .mode = &sharp_display,
- .pcr = 0xfb108bc7,
- .bpp = 16,
+ .priv = &driver_data,
};
static struct imx_fb_platform_data imx_fb_data = {
- .mode = &imx_fb_modedata,
+/* Sharp LQ035Q7DB02 QVGA display */
+ .mode = &sharp_display,
+ .mode_cnt = 1,
.cmap_greyscale = 0,
.cmap_inverse = 0,
.cmap_static = 0,
- .pwmr = 0x00a903ff,
- .lscr1 = 0x00120300,
- .dmacr = 0x00020008,
};
static int imx21ads_timing_init(void)
diff --git a/arch/arm/boards/pcm038/pcm038.c b/arch/arm/boards/pcm038/pcm038.c
index 8cbb551..d5269f1 100644
--- a/arch/arm/boards/pcm038/pcm038.c
+++ b/arch/arm/boards/pcm038/pcm038.c
@@ -107,7 +107,23 @@ static struct imx_nand_platform_data nand_info = {
.flash_bbt = 1,
};
-static struct fb_videomode sharp_display = {
+static const struct imx_fb_driver_data driver_data = {
+ /*
+ * - HSYNC active high
+ * - VSYNC active high
+ * - clk notenabled while idle
+ * - clock not inverted
+ * - data not inverted
+ * - data enable low active
+ * - enable sharp mode
+ */
+ .pwmr = 0x00A903FF,
+ .lscr1 = 0x00120300,
+ .dmacr = 0x00020010,
+ .pcr = 0xF00080C0,
+};
+
+static const struct fb_videomode sharp_display = {
.name = "Sharp-LQ035Q7",
.refresh = 60,
.xres = 240,
@@ -119,28 +135,12 @@ static struct fb_videomode sharp_display = {
.vsync_len = 1,
.upper_margin = 7,
.lower_margin = 9,
-};
-
-static struct imx_fb_videomode imxfb_mode = {
- .mode = &sharp_display,
- /*
- * - HSYNC active high
- * - VSYNC active high
- * - clk notenabled while idle
- * - clock not inverted
- * - data not inverted
- * - data enable low active
- * - enable sharp mode
- */
- .pcr = 0xF00080C0,
- .bpp = 16,
+ .priv = &driver_data,
};
static struct imx_fb_platform_data pcm038_fb_data = {
- .mode = &imxfb_mode,
- .pwmr = 0x00A903FF,
- .lscr1 = 0x00120300,
- .dmacr = 0x00020010,
+ .mode = &sharp_display,
+ .mode_cnt = 1,
};
#ifdef CONFIG_USB
diff --git a/arch/arm/mach-imx/include/mach/imxfb.h b/arch/arm/mach-imx/include/mach/imxfb.h
index 4a890a7..f2083c4 100644
--- a/arch/arm/mach-imx/include/mach/imxfb.h
+++ b/arch/arm/mach-imx/include/mach/imxfb.h
@@ -52,28 +52,30 @@
#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;
+/**
+ * Videomode dependent, but driver specific data
+ */
+struct imx_fb_driver_data {
+ uint32_t pwmr; /**< refer datasheet: LPCCR register */
+ uint32_t lscr1; /**< refer datasheet: LSCR register */
+ uint32_t dmacr; /**< refer datasheet: LDCR register */
+ uint32_t pcr; /**< refer datasheet: LPCR register */
};
/**
* Define relevant framebuffer information
*/
struct imx_fb_platform_data {
- struct imx_fb_videomode *mode;
+ const struct fb_videomode *mode;
unsigned mode_cnt; /**< number of entries in 'mode' */
+ unsigned char bpp; /**< preferred colour depth for this device */
+
u_int cmap_greyscale:1,
cmap_inverse:1,
cmap_static:1,
unused:29;
- u_int pwmr;
- u_int lscr1;
- u_int dmacr;
-
/** force a memory area to be used, else NULL for dynamic allocation */
void *framebuffer;
/** force a memory area to be used, else NULL for dynamic allocation */
diff --git a/drivers/video/imx.c b/drivers/video/imx.c
index b13f39d..69ba3e7 100644
--- a/drivers/video/imx.c
+++ b/drivers/video/imx.c
@@ -332,6 +332,7 @@ static int imxfb_initialize_mode(struct fb_info *info,
unsigned long lcd_clk;
unsigned long long tmp;
struct imxfb_info *fbi = fb_info_to_imxfb_info(info);
+ const struct imx_fb_driver_data *drv_data = mode->priv;
u32 pcr;
unsigned size;
@@ -342,6 +343,11 @@ static int imxfb_initialize_mode(struct fb_info *info,
imxfb_memory_mmgt(info, size, MAIN_FBUFFER);
+ fbi->pcr = drv_data->pcr;
+ fbi->pwmr = drv_data->pwmr;
+ fbi->lscr1 = drv_data->lscr1;
+ fbi->dmacr = drv_data->dmacr;
+
/* physical screen start address */
writel(VPW_VPW(mode->xres * info->bits_per_pixel / 8 / 4),
fbi->regs + LCDC_VPW);
@@ -541,7 +547,7 @@ static int imxfb_register_overlay(struct imxfb_info *fbi,
overlay->fb_setcolreg = imxfb_overlay_setcolreg;
/* add runtime video info */
- overlay->mode = pdata->mode->mode;
+ overlay->mode = pdata->mode;
overlay->mode_cnt = 1; /* no choice */
overlay_dev = register_framebuffer(overlay);
@@ -591,17 +597,12 @@ static int imxfb_probe(struct device_d *dev)
fbi->fb_host.fb_setcolreg = imxfb_setcolreg;
fbi->regs = (void*)dev->map_base;
- fbi->pcr = pdata->mode->pcr;
- fbi->pwmr = pdata->pwmr;
- fbi->lscr1 = pdata->lscr1;
- fbi->dmacr = pdata->dmacr;
fbi->enable = pdata->enable;
/* add runtime video info */
- fbi->fb_host.mode = pdata->mode->mode;
- /* to be backward compatible */
- fbi->fb_host.mode_cnt = pdata->mode_cnt == 0 ? 1 : pdata->mode_cnt;
- fbi->fb_host.bits_per_pixel = 16; /* RGB565, the default */
+ fbi->fb_host.mode = pdata->mode;
+ fbi->fb_host.mode_cnt = pdata->mode_cnt;
+ fbi->fb_host.bits_per_pixel = pdata->bpp;
fb_dev = register_framebuffer(&fbi->fb_host);
if (dev == NULL) {
diff --git a/include/fb.h b/include/fb.h
index 7e01e87..a9ad447 100644
--- a/include/fb.h
+++ b/include/fb.h
@@ -69,6 +69,8 @@ struct fb_videomode {
unsigned sync; /**< sync information, refer FB_SYNC_* macros */
unsigned vmode; /**< video mode information, refer FB_VMODE_* macros */
unsigned flag;
+
+ const void *priv; /**< video driver related information */
};
/* Interpretation of offset for color fields: All offsets are from the right,
--
1.7.2.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2010-11-19 12:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-19 12:50 [PATCHv3] Add dynamic video initialization to barebox Juergen Beisert
2010-11-19 12:50 ` [PATCH 01/11] Separate framebuffer platformdata and the videomode Juergen Beisert
2010-11-19 12:50 ` [PATCH 02/11] Add more flags for sync control Juergen Beisert
2010-11-19 12:50 ` [PATCH 03/11] Bring in dynamic videomode selection at runtime Juergen Beisert
2010-11-19 12:50 ` [PATCH 04/11] Add verbose framebuffer device info Juergen Beisert
2010-11-19 12:50 ` [PATCH 05/11] Adapt the existing imx fb driver to support runtime videomode selection Juergen Beisert
2010-11-19 12:50 ` [PATCH 06/11] Adapt the existing imx-ipu " Juergen Beisert
2010-11-19 12:50 ` [PATCH 07/11] Remove variable size restrictions Juergen Beisert
2010-11-19 12:51 ` [PATCH 08/11] Add doxygen documentation to the framebfuffer code Juergen Beisert
2010-11-19 12:51 ` Juergen Beisert [this message]
2010-11-19 12:51 ` [PATCH 10/11] Add a video driver for S3C2440 bases platforms Juergen Beisert
2010-11-19 12:51 ` [PATCH 11/11] STM378x: Add video driver for this platform Juergen Beisert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1290171063-28870-10-git-send-email-jbe@pengutronix.de \
--to=jbe@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox