summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Waters <justin.waters@timesys.com>2010-03-31 14:17:59 -0400
committerJustin Waters <justin.waters@timesys.com>2010-03-31 14:17:59 -0400
commitc696fbf09561dab90ecc4a2e368e355f84314ef9 (patch)
tree847840baa831f5b53b263ae23dfeabe7cde1fb64
parentc484375779096047ecaa0bfd63599fde850bf3c3 (diff)
Add support for LCD on the Digi CCWMX51JS
-rw-r--r--arch/arm/mach-mx51/mx51_ccwmx51js.c54
-rw-r--r--arch/arm/mach-mx51/mx51_ccwmx51js_gpio.c12
2 files changed, 58 insertions, 8 deletions
diff --git a/arch/arm/mach-mx51/mx51_ccwmx51js.c b/arch/arm/mach-mx51/mx51_ccwmx51js.c
index a1637173c4d6..108d0ad4a79f 100644
--- a/arch/arm/mach-mx51/mx51_ccwmx51js.c
+++ b/arch/arm/mach-mx51/mx51_ccwmx51js.c
@@ -121,9 +121,29 @@ static void mxc_nop_release(struct device *dev)
#if defined(CONFIG_FB_MXC_SYNC_PANEL) || \
defined(CONFIG_FB_MXC_SYNC_PANEL_MODULE)
+static struct fb_videomode wvga_video_mode =
+{
+ .name = "Digi LCD",
+ .xres = 800,
+ .yres = 480,
+ .refresh = 60,
+ .pixclock = 30062,
+ .left_margin = 64,
+ .right_margin = 64,
+ .lower_margin = 10,
+ .upper_margin = 30,
+ .hsync_len = 128,
+ .vsync_len = 5,
+ .vmode = FB_VMODE_NONINTERLACED,
+ .flag = FB_MODE_IS_DETAILED,
+// Digi says that inverting the clock is necessary
+// to avoid problems with video.
+// .sync = FB_SYNC_CLK_LAT_FALL,
+
+};
+
static struct mxc_fb_platform_data fb_data_vga = {
.interface_pix_fmt = IPU_PIX_FMT_RGB24,
- .mode_str = "1024x768M-16@60", /* Default */
};
static struct resource mxcfb_resources[] = {
@@ -162,12 +182,21 @@ static struct platform_device mxc_fb_device[] = {
},
};
+extern void gpio_lcd_active(void);
+
+// We let the user specify e.g. 800x600x24, but pay attention
+// only to the 800x600 part, and use 24-bit color regardless.
+static int video_matches(char *user, char *template)
+{
+ return !strncasecmp(user, template, strlen(template));
+}
+
static int __init ccwmx51_init_fb(void)
{
char *options = NULL, *p;
if (fb_get_options("displayfb", &options))
- pr_warning("no display information available in commnad line\n");
+ pr_warning("no display information available in command line\n");
if (!options)
return -ENODEV;
@@ -175,28 +204,37 @@ static int __init ccwmx51_init_fb(void)
if (!strncasecmp(options, "VGA", 3)) {
pr_info("VGA interface is primary\n");
+ fb_data_vga.mode = 0; // Do not use LCD timings.
+ strcpy(fb_data_vga.mode_str, "1024x768M-16@60"); /* Default */
+
/* Get the desired configuration provided by the bootloader */
if (options[3] != '@') {
pr_info("Video resolution for VGA interface not provided, using default\n");
- /* TODO set default video here */
} else {
options = &options[4];
if (((p = strsep (&options, "@")) != NULL) && *p) {
- if (!strcmp(p, "640x480x16")) {
+ if (video_matches(p, "640x480")) {
strcpy(fb_data_vga.mode_str, "640x480M-16@60");
- } else if (!strcmp(p, "800x600x16")) {
+ } else if (video_matches(p, "800x600")) {
strcpy(fb_data_vga.mode_str, "800x600M-16@60");
- } else if (!strcmp(p, "1024x768x16")) {
+ } else if (video_matches(p, "1024x768")) {
strcpy(fb_data_vga.mode_str, "1024x768M-16@60");
- } else if (!strcmp(p, "1280x1024x16")) {
+ } else if (video_matches(p, "1280x1024")) {
strcpy(fb_data_vga.mode_str, "1280x1024M-16@60");
- } else if (!strcmp(p, "1280x1024x16")) {
+ } else if (video_matches(p, "1280x1024")) {
strcpy(fb_data_vga.mode_str, "1280x1024M-16@60");
} else
pr_warning("Unsuported video resolution: %s, using default\n", p);
}
}
(void)platform_device_register(&mxc_fb_device[0]); /* VGA */
+
+ } else if (!strncasecmp(options, "LCD", 3)){
+ gpio_lcd_active();
+ fb_data_vga.mode = &wvga_video_mode; // Use timings for Digi LCD.
+ fb_data_vga.mode_str = "800x480-16@60", // 16-bit color more compatible with Factory apps
+ pr_info("Using LDC wvga video timings and mode %s\n", fb_data_vga.mode_str);
+ platform_device_register(&mxc_fb_device[0]); /* LCD */
}
return 0;
diff --git a/arch/arm/mach-mx51/mx51_ccwmx51js_gpio.c b/arch/arm/mach-mx51/mx51_ccwmx51js_gpio.c
index 028ce7db01a5..de7d5f3cc811 100644
--- a/arch/arm/mach-mx51/mx51_ccwmx51js_gpio.c
+++ b/arch/arm/mach-mx51/mx51_ccwmx51js_gpio.c
@@ -55,6 +55,10 @@ static struct mxc_iomux_pin_cfg __initdata mxc_iomux_pins[] = {
},
#if defined(CONFIG_FB_MXC_SYNC_PANEL) || defined(CONFIG_FB_MXC_SYNC_PANEL_MODULE)
{
+ MX51_PIN_DI1_PIN11, IOMUX_CONFIG_ALT4,
+ (PAD_CTL_HYS_NONE | PAD_CTL_DRV_LOW | PAD_CTL_SRE_FAST),
+ },
+ {
MX51_PIN_DISP1_DAT0, IOMUX_CONFIG_ALT0,
(PAD_CTL_HYS_NONE | PAD_CTL_DRV_LOW | PAD_CTL_SRE_FAST),
},
@@ -382,3 +386,11 @@ void __init mx51_ccwmx51js_io_init(void)
mxc_iomux_pins[i].in_mode);
}
}
+
+void gpio_lcd_active(void)
+{
+ gpio_direction_output(IOMUX_TO_GPIO(MX51_PIN_DI1_PIN11), 0);
+}
+
+
+EXPORT_SYMBOL(gpio_lcd_active);