Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 44432407 authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by Paul Mundt
Browse files

fbdev: sh_mobile_lcdcfb: Support multiple video modes in platform data



This is a preparation for HDMI hotplug support. This patch just moves all
platform defined video modes for the sh_mobile_lcdcfb driver to separate
arrays and switches all users to use element 0 of that array, so, this patch
doesn't introduce any functional changes and as such should not cause any
regressions.

Signed-off-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
parent 01ac25b5
Loading
Loading
Loading
Loading
+57 −41
Original line number Diff line number Diff line
@@ -375,10 +375,40 @@ static struct platform_device usb1_host_device = {
	.resource	= usb1_host_resources,
};

const static struct fb_videomode ap4evb_lcdc_modes[] = {
	{
#ifdef CONFIG_AP4EVB_QHD
		.name		= "R63302(QHD)",
		.xres		= 544,
		.yres		= 961,
		.left_margin	= 72,
		.right_margin	= 600,
		.hsync_len	= 16,
		.upper_margin	= 8,
		.lower_margin	= 8,
		.vsync_len	= 2,
		.sync		= FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
#else
		.name		= "WVGA Panel",
		.xres		= 800,
		.yres		= 480,
		.left_margin	= 220,
		.right_margin	= 110,
		.hsync_len	= 70,
		.upper_margin	= 20,
		.lower_margin	= 5,
		.vsync_len	= 5,
		.sync		= 0,
#endif
	},
};

static struct sh_mobile_lcdc_info lcdc_info = {
	.ch[0] = {
		.chan = LCDC_CHAN_MAINLCD,
		.bpp = 16,
		.lcd_cfg = ap4evb_lcdc_modes,
		.num_cfg = ARRAY_SIZE(ap4evb_lcdc_modes),
	}
};

@@ -569,19 +599,12 @@ static struct platform_device fsi_device = {
	},
};

static struct sh_mobile_lcdc_info sh_mobile_lcdc1_info = {
	.clock_source = LCDC_CLK_EXTERNAL,
	.ch[0] = {
		.chan = LCDC_CHAN_MAINLCD,
		.bpp = 16,
		.interface_type = RGB24,
		.clock_divider = 1,
		.flags = LCDC_FLAGS_DWPOL,
		.lcd_cfg = {
			.name = "HDMI",
			/* So far only 720p is supported */
const static struct fb_videomode ap4evb_hdmi_modes[] = {
	{
		.name = "HDMI 720p",
		.xres = 1280,
		.yres = 720,

		/*
		 * If left and right margins are not multiples of 8,
		 * LDHAJR will be adjusted accordingly by the LCDC
@@ -591,12 +614,26 @@ static struct sh_mobile_lcdc_info sh_mobile_lcdc1_info = {
		.left_margin = 200,
		.right_margin = 88,
		.hsync_len = 48,

		.upper_margin = 20,
		.lower_margin = 5,
		.vsync_len = 5,

		.pixclock = 13468,
		.sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
	},
};

static struct sh_mobile_lcdc_info sh_mobile_lcdc1_info = {
	.clock_source = LCDC_CLK_EXTERNAL,
	.ch[0] = {
		.chan = LCDC_CHAN_MAINLCD,
		.bpp = 16,
		.interface_type = RGB24,
		.clock_divider = 1,
		.flags = LCDC_FLAGS_DWPOL,
		.lcd_cfg = ap4evb_hdmi_modes,
		.num_cfg = ARRAY_SIZE(ap4evb_hdmi_modes),
	}
};

@@ -960,17 +997,6 @@ static void __init ap4evb_init(void)
	lcdc_info.ch[0].interface_type		= RGB24;
	lcdc_info.ch[0].clock_divider		= 1;
	lcdc_info.ch[0].flags			= LCDC_FLAGS_DWPOL;
	lcdc_info.ch[0].lcd_cfg.name		= "R63302(QHD)";
	lcdc_info.ch[0].lcd_cfg.xres		= 544;
	lcdc_info.ch[0].lcd_cfg.yres		= 961;
	lcdc_info.ch[0].lcd_cfg.left_margin	= 72;
	lcdc_info.ch[0].lcd_cfg.right_margin	= 600;
	lcdc_info.ch[0].lcd_cfg.hsync_len	= 16;
	lcdc_info.ch[0].lcd_cfg.upper_margin	= 8;
	lcdc_info.ch[0].lcd_cfg.lower_margin	= 8;
	lcdc_info.ch[0].lcd_cfg.vsync_len	= 2;
	lcdc_info.ch[0].lcd_cfg.sync		= FB_SYNC_VERT_HIGH_ACT |
						  FB_SYNC_HOR_HIGH_ACT;
	lcdc_info.ch[0].lcd_size_cfg.width	= 44;
	lcdc_info.ch[0].lcd_size_cfg.height	= 79;

@@ -1013,16 +1039,6 @@ static void __init ap4evb_init(void)
	lcdc_info.ch[0].interface_type		= RGB18;
	lcdc_info.ch[0].clock_divider		= 2;
	lcdc_info.ch[0].flags			= 0;
	lcdc_info.ch[0].lcd_cfg.name		= "WVGA Panel";
	lcdc_info.ch[0].lcd_cfg.xres		= 800;
	lcdc_info.ch[0].lcd_cfg.yres		= 480;
	lcdc_info.ch[0].lcd_cfg.left_margin	= 220;
	lcdc_info.ch[0].lcd_cfg.right_margin	= 110;
	lcdc_info.ch[0].lcd_cfg.hsync_len	= 70;
	lcdc_info.ch[0].lcd_cfg.upper_margin	= 20;
	lcdc_info.ch[0].lcd_cfg.lower_margin	= 5;
	lcdc_info.ch[0].lcd_cfg.vsync_len	= 5;
	lcdc_info.ch[0].lcd_cfg.sync		= 0;
	lcdc_info.ch[0].lcd_size_cfg.width	= 152;
	lcdc_info.ch[0].lcd_size_cfg.height	= 91;

+17 −12
Original line number Diff line number Diff line
@@ -176,14 +176,8 @@ static void ap320_wvga_power_off(void *board_data)
	__raw_writew(0, FPGA_LCDREG);
}

static struct sh_mobile_lcdc_info lcdc_info = {
	.clock_source = LCDC_CLK_EXTERNAL,
	.ch[0] = {
		.chan = LCDC_CHAN_MAINLCD,
		.bpp = 16,
		.interface_type = RGB18,
		.clock_divider = 1,
		.lcd_cfg = {
const static struct fb_videomode ap325rxa_lcdc_modes[] = {
	{
		.name = "LB070WV1",
		.xres = 800,
		.yres = 480,
@@ -195,6 +189,17 @@ static struct sh_mobile_lcdc_info lcdc_info = {
		.vsync_len = 1,
		.sync = 0, /* hsync and vsync are active low */
	},
};

static struct sh_mobile_lcdc_info lcdc_info = {
	.clock_source = LCDC_CLK_EXTERNAL,
	.ch[0] = {
		.chan = LCDC_CHAN_MAINLCD,
		.bpp = 16,
		.interface_type = RGB18,
		.clock_divider = 1,
		.lcd_cfg = ap325rxa_lcdc_modes,
		.num_cfg = ARRAY_SIZE(ap325rxa_lcdc_modes),
		.lcd_size_cfg = { /* 7.0 inch */
			.width = 152,
			.height = 91,
+36 −24
Original line number Diff line number Diff line
@@ -231,14 +231,41 @@ static struct platform_device usb1_common_device = {
};

/* LCDC */
const static struct fb_videomode ecovec_lcd_modes[] = {
	{
		.name		= "Panel",
		.xres		= 800,
		.yres		= 480,
		.left_margin	= 220,
		.right_margin	= 110,
		.hsync_len	= 70,
		.upper_margin	= 20,
		.lower_margin	= 5,
		.vsync_len	= 5,
		.sync		= 0, /* hsync and vsync are active low */
	},
};

const static struct fb_videomode ecovec_dvi_modes[] = {
	{
		.name		= "DVI",
		.xres		= 1280,
		.yres		= 720,
		.left_margin	= 220,
		.right_margin	= 110,
		.hsync_len	= 40,
		.upper_margin	= 20,
		.lower_margin	= 5,
		.vsync_len	= 5,
		.sync = 0, /* hsync and vsync are active low */
	},
};

static struct sh_mobile_lcdc_info lcdc_info = {
	.ch[0] = {
		.interface_type = RGB18,
		.chan = LCDC_CHAN_MAINLCD,
		.bpp = 16,
		.lcd_cfg = {
			.sync = 0, /* hsync and vsync are active low */
		},
		.lcd_size_cfg = { /* 7.0 inch */
			.width = 152,
			.height = 91,
@@ -1079,33 +1106,18 @@ static int __init arch_setup(void)
	if (gpio_get_value(GPIO_PTE6)) {
		/* DVI */
		lcdc_info.clock_source			= LCDC_CLK_EXTERNAL;
		lcdc_info.ch[0].clock_divider		= 1,
		lcdc_info.ch[0].lcd_cfg.name		= "DVI";
		lcdc_info.ch[0].lcd_cfg.xres		= 1280;
		lcdc_info.ch[0].lcd_cfg.yres		= 720;
		lcdc_info.ch[0].lcd_cfg.left_margin	= 220;
		lcdc_info.ch[0].lcd_cfg.right_margin	= 110;
		lcdc_info.ch[0].lcd_cfg.hsync_len	= 40;
		lcdc_info.ch[0].lcd_cfg.upper_margin	= 20;
		lcdc_info.ch[0].lcd_cfg.lower_margin	= 5;
		lcdc_info.ch[0].lcd_cfg.vsync_len	= 5;
		lcdc_info.ch[0].clock_divider		= 1;
		lcdc_info.ch[0].lcd_cfg			= ecovec_dvi_modes;
		lcdc_info.ch[0].num_cfg			= ARRAY_SIZE(ecovec_dvi_modes);

		gpio_set_value(GPIO_PTA2, 1);
		gpio_set_value(GPIO_PTU1, 1);
	} else {
		/* Panel */

		lcdc_info.clock_source			= LCDC_CLK_PERIPHERAL;
		lcdc_info.ch[0].clock_divider		= 2,
		lcdc_info.ch[0].lcd_cfg.name		= "Panel";
		lcdc_info.ch[0].lcd_cfg.xres		= 800;
		lcdc_info.ch[0].lcd_cfg.yres		= 480;
		lcdc_info.ch[0].lcd_cfg.left_margin	= 220;
		lcdc_info.ch[0].lcd_cfg.right_margin	= 110;
		lcdc_info.ch[0].lcd_cfg.hsync_len	= 70;
		lcdc_info.ch[0].lcd_cfg.upper_margin	= 20;
		lcdc_info.ch[0].lcd_cfg.lower_margin	= 5;
		lcdc_info.ch[0].lcd_cfg.vsync_len	= 5;
		lcdc_info.ch[0].clock_divider		= 2;
		lcdc_info.ch[0].lcd_cfg			= ecovec_lcd_modes;
		lcdc_info.ch[0].num_cfg			= ARRAY_SIZE(ecovec_lcd_modes);

		gpio_set_value(GPIO_PTR1, 1);

+17 −12
Original line number Diff line number Diff line
@@ -126,15 +126,8 @@ static struct platform_device kfr2r09_sh_keysc_device = {
	},
};

static struct sh_mobile_lcdc_info kfr2r09_sh_lcdc_info = {
	.clock_source = LCDC_CLK_BUS,
	.ch[0] = {
		.chan = LCDC_CHAN_MAINLCD,
		.bpp = 16,
		.interface_type = SYS18,
		.clock_divider = 6,
		.flags = LCDC_FLAGS_DWPOL,
		.lcd_cfg = {
const static struct fb_videomode kfr2r09_lcdc_modes[] = {
	{
		.name = "TX07D34VM0AAA",
		.xres = 240,
		.yres = 400,
@@ -146,6 +139,18 @@ static struct sh_mobile_lcdc_info kfr2r09_sh_lcdc_info = {
		.vsync_len = 1,
		.sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
	},
};

static struct sh_mobile_lcdc_info kfr2r09_sh_lcdc_info = {
	.clock_source = LCDC_CLK_BUS,
	.ch[0] = {
		.chan = LCDC_CHAN_MAINLCD,
		.bpp = 16,
		.interface_type = SYS18,
		.clock_divider = 6,
		.flags = LCDC_FLAGS_DWPOL,
		.lcd_cfg = kfr2r09_lcdc_modes,
		.num_cfg = ARRAY_SIZE(kfr2r09_lcdc_modes),
		.lcd_size_cfg = {
			.width = 35,
			.height = 58,
+31 −27
Original line number Diff line number Diff line
@@ -213,51 +213,55 @@ static struct platform_device migor_nand_flash_device = {
	}
};

static struct sh_mobile_lcdc_info sh_mobile_lcdc_info = {
#ifdef CONFIG_SH_MIGOR_RTA_WVGA
	.clock_source = LCDC_CLK_BUS,
	.ch[0] = {
		.chan = LCDC_CHAN_MAINLCD,
		.bpp = 16,
		.interface_type = RGB16,
		.clock_divider = 2,
		.lcd_cfg = {
const static struct fb_videomode migor_lcd_modes[] = {
	{
#if defined(CONFIG_SH_MIGOR_RTA_WVGA)
		.name = "LB070WV1",
		.xres = 800,
		.yres = 480,
		.left_margin = 64,
		.right_margin = 16,
		.hsync_len = 120,
		.sync = 0,
#elif defined(CONFIG_SH_MIGOR_QVGA)
		.name = "PH240320T",
		.xres = 320,
		.yres = 240,
		.left_margin = 0,
		.right_margin = 16,
		.hsync_len = 8,
		.sync = FB_SYNC_HOR_HIGH_ACT,
#endif
		.upper_margin = 1,
		.lower_margin = 17,
		.vsync_len = 2,
			.sync = 0,
	},
};

static struct sh_mobile_lcdc_info sh_mobile_lcdc_info = {
#if defined(CONFIG_SH_MIGOR_RTA_WVGA)
	.clock_source = LCDC_CLK_BUS,
	.ch[0] = {
		.chan = LCDC_CHAN_MAINLCD,
		.bpp = 16,
		.interface_type = RGB16,
		.clock_divider = 2,
		.lcd_cfg = migor_lcd_modes,
		.num_cfg = ARRAY_SIZE(migor_lcd_modes),
		.lcd_size_cfg = { /* 7.0 inch */
			.width = 152,
			.height = 91,
		},
	}
#endif
#ifdef CONFIG_SH_MIGOR_QVGA
#elif defined(CONFIG_SH_MIGOR_QVGA)
	.clock_source = LCDC_CLK_PERIPHERAL,
	.ch[0] = {
		.chan = LCDC_CHAN_MAINLCD,
		.bpp = 16,
		.interface_type = SYS16A,
		.clock_divider = 10,
		.lcd_cfg = {
			.name = "PH240320T",
			.xres = 320,
			.yres = 240,
			.left_margin = 0,
			.right_margin = 16,
			.hsync_len = 8,
			.upper_margin = 1,
			.lower_margin = 17,
			.vsync_len = 2,
			.sync = FB_SYNC_HOR_HIGH_ACT,
		},
		.lcd_cfg = migor_lcd_modes,
		.num_cfg = ARRAY_SIZE(migor_lcd_modes),
		.lcd_size_cfg = { /* 2.4 inch */
			.width = 49,
			.height = 37,
Loading