2012-11-10 02:28:52 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2012 Freescale Semiconductor, Inc.
|
|
|
|
* Fabio Estevam <fabio.estevam@freescale.com>
|
|
|
|
*
|
2013-07-08 07:37:19 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
2012-11-10 02:28:52 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <linux/list.h>
|
|
|
|
#include <asm/gpio.h>
|
2013-05-03 10:32:27 +00:00
|
|
|
#include <asm/arch/iomux-mx51.h>
|
2012-11-10 02:28:52 +00:00
|
|
|
#include <linux/fb.h>
|
|
|
|
#include <ipu_pixfmt.h>
|
|
|
|
|
|
|
|
#define MX51EVK_LCD_3V3 IMX_GPIO_NR(4, 9)
|
|
|
|
#define MX51EVK_LCD_5V IMX_GPIO_NR(4, 10)
|
|
|
|
#define MX51EVK_LCD_BACKLIGHT IMX_GPIO_NR(3, 4)
|
|
|
|
|
|
|
|
static struct fb_videomode const claa_wvga = {
|
|
|
|
.name = "CLAA07LC0ACW",
|
|
|
|
.refresh = 57,
|
|
|
|
.xres = 800,
|
|
|
|
.yres = 480,
|
|
|
|
.pixclock = 37037,
|
|
|
|
.left_margin = 40,
|
|
|
|
.right_margin = 60,
|
|
|
|
.upper_margin = 10,
|
|
|
|
.lower_margin = 10,
|
|
|
|
.hsync_len = 20,
|
|
|
|
.vsync_len = 10,
|
|
|
|
.sync = 0,
|
|
|
|
.vmode = FB_VMODE_NONINTERLACED
|
|
|
|
};
|
|
|
|
|
2013-01-09 04:55:09 +00:00
|
|
|
static struct fb_videomode const dvi = {
|
|
|
|
.name = "DVI panel",
|
|
|
|
.refresh = 60,
|
|
|
|
.xres = 1024,
|
|
|
|
.yres = 768,
|
|
|
|
.pixclock = 15385,
|
|
|
|
.left_margin = 220,
|
|
|
|
.right_margin = 40,
|
|
|
|
.upper_margin = 21,
|
|
|
|
.lower_margin = 7,
|
|
|
|
.hsync_len = 60,
|
|
|
|
.vsync_len = 10,
|
|
|
|
.sync = 0,
|
|
|
|
.vmode = FB_VMODE_NONINTERLACED
|
|
|
|
};
|
|
|
|
|
2012-11-10 02:28:52 +00:00
|
|
|
void setup_iomux_lcd(void)
|
|
|
|
{
|
|
|
|
/* DI2_PIN15 */
|
2013-05-03 10:32:27 +00:00
|
|
|
imx_iomux_v3_setup_pad(MX51_PAD_DI_GP4__DI2_PIN15);
|
2012-11-10 02:28:52 +00:00
|
|
|
|
2013-05-03 10:32:27 +00:00
|
|
|
/* Pad settings for DI2_DISP_CLK */
|
|
|
|
imx_iomux_v3_setup_pad(NEW_PAD_CTRL(MX51_PAD_DI2_DISP_CLK__DI2_DISP_CLK,
|
|
|
|
PAD_CTL_PKE | PAD_CTL_DSE_MAX | PAD_CTL_SRE_SLOW));
|
2012-11-10 02:28:52 +00:00
|
|
|
|
|
|
|
/* Turn on 3.3V voltage for LCD */
|
2013-05-03 10:32:27 +00:00
|
|
|
imx_iomux_v3_setup_pad(NEW_PAD_CTRL(MX51_PAD_CSI2_D12__GPIO4_9,
|
|
|
|
NO_PAD_CTRL));
|
2012-11-10 02:28:52 +00:00
|
|
|
gpio_direction_output(MX51EVK_LCD_3V3, 1);
|
|
|
|
|
|
|
|
/* Turn on 5V voltage for LCD */
|
2013-05-03 10:32:27 +00:00
|
|
|
imx_iomux_v3_setup_pad(NEW_PAD_CTRL(MX51_PAD_CSI2_D13__GPIO4_10,
|
|
|
|
NO_PAD_CTRL));
|
2012-11-10 02:28:52 +00:00
|
|
|
gpio_direction_output(MX51EVK_LCD_5V, 1);
|
|
|
|
|
|
|
|
/* Turn on GPIO backlight */
|
2013-05-03 10:32:27 +00:00
|
|
|
imx_iomux_v3_setup_pad(NEW_PAD_CTRL(MX51_PAD_DI1_D1_CS__GPIO3_4,
|
|
|
|
NO_PAD_CTRL));
|
2012-11-10 02:28:52 +00:00
|
|
|
gpio_direction_output(MX51EVK_LCD_BACKLIGHT, 1);
|
|
|
|
}
|
|
|
|
|
2013-01-09 04:55:09 +00:00
|
|
|
int board_video_skip(void)
|
2012-11-10 02:28:52 +00:00
|
|
|
{
|
2013-01-09 04:55:09 +00:00
|
|
|
int ret;
|
|
|
|
char const *e = getenv("panel");
|
|
|
|
|
|
|
|
if (e) {
|
|
|
|
if (strcmp(e, "claa") == 0) {
|
|
|
|
ret = ipuv3_fb_init(&claa_wvga, 1, IPU_PIX_FMT_RGB565);
|
|
|
|
if (ret)
|
|
|
|
printf("claa cannot be configured: %d\n", ret);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 'panel' env variable not found or has different value than 'claa'
|
|
|
|
* Defaulting to dvi output.
|
|
|
|
*/
|
|
|
|
ret = ipuv3_fb_init(&dvi, 0, IPU_PIX_FMT_RGB24);
|
2012-11-10 02:28:52 +00:00
|
|
|
if (ret)
|
2013-01-09 04:55:09 +00:00
|
|
|
printf("dvi cannot be configured: %d\n", ret);
|
|
|
|
return ret;
|
2012-11-10 02:28:52 +00:00
|
|
|
}
|