linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/5] ARM: mach-shmobile: mackerel: Add LCDC support
@ 2010-11-29  2:21 Kuninori Morimoto
  2010-11-29  4:30 ` Magnus Damm
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Kuninori Morimoto @ 2010-11-29  2:21 UTC (permalink / raw)
  To: linux-sh

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 arch/arm/mach-shmobile/board-mackerel.c |   86 +++++++++++++++++++++++++++++++
 1 files changed, 86 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index e2def7e..21443fe 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -34,6 +34,8 @@
 #include <linux/mtd/physmap.h>
 #include <linux/smsc911x.h>
 
+#include <video/sh_mobile_lcdc.h>
+
 #include <mach/common.h>
 #include <mach/sh7372.h>
 
@@ -138,9 +140,64 @@ static struct platform_device smc911x_device = {
 	},
 };
 
+/* LCDC */
+static struct fb_videomode mackerel_lcdc_modes[] = {
+	{
+		.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,
+	},
+};
+
+static struct sh_mobile_lcdc_info lcdc_info = {
+	.clock_source = LCDC_CLK_BUS,
+	.ch[0] = {
+		.chan = LCDC_CHAN_MAINLCD,
+		.bpp = 16,
+		.lcd_cfg = mackerel_lcdc_modes,
+		.num_cfg = ARRAY_SIZE(mackerel_lcdc_modes),
+		.interface_type		= RGB24,
+		.clock_divider		= 2,
+		.flags			= 0,
+		.lcd_size_cfg.width	= 152,
+		.lcd_size_cfg.height	= 91,
+	}
+};
+
+static struct resource lcdc_resources[] = {
+	[0] = {
+		.name	= "LCDC",
+		.start	= 0xfe940000,
+		.end	= 0xfe943fff,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.start	= intcs_evt2irq(0x580),
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device lcdc_device = {
+	.name		= "sh_mobile_lcdc_fb",
+	.num_resources	= ARRAY_SIZE(lcdc_resources),
+	.resource	= lcdc_resources,
+	.dev	= {
+		.platform_data	= &lcdc_info,
+		.coherent_dma_mask = ~0,
+	},
+};
+
 static struct platform_device *mackerel_devices[] __initdata = {
 	&nor_flash_device,
 	&smc911x_device,
+	&lcdc_device,
 };
 
 static struct map_desc mackerel_io_desc[] __initdata = {
@@ -176,6 +233,35 @@ static void __init mackerel_init(void)
 	gpio_request(GPIO_FN_CS5A,	NULL);
 	gpio_request(GPIO_FN_IRQ6_39,	NULL);
 
+	/* LCDC */
+	gpio_request(GPIO_FN_LCDD17,   NULL);
+	gpio_request(GPIO_FN_LCDD16,   NULL);
+	gpio_request(GPIO_FN_LCDD15,   NULL);
+	gpio_request(GPIO_FN_LCDD14,   NULL);
+	gpio_request(GPIO_FN_LCDD13,   NULL);
+	gpio_request(GPIO_FN_LCDD12,   NULL);
+	gpio_request(GPIO_FN_LCDD11,   NULL);
+	gpio_request(GPIO_FN_LCDD10,   NULL);
+	gpio_request(GPIO_FN_LCDD9,    NULL);
+	gpio_request(GPIO_FN_LCDD8,    NULL);
+	gpio_request(GPIO_FN_LCDD7,    NULL);
+	gpio_request(GPIO_FN_LCDD6,    NULL);
+	gpio_request(GPIO_FN_LCDD5,    NULL);
+	gpio_request(GPIO_FN_LCDD4,    NULL);
+	gpio_request(GPIO_FN_LCDD3,    NULL);
+	gpio_request(GPIO_FN_LCDD2,    NULL);
+	gpio_request(GPIO_FN_LCDD1,    NULL);
+	gpio_request(GPIO_FN_LCDD0,    NULL);
+	gpio_request(GPIO_FN_LCDDISP,  NULL);
+	gpio_request(GPIO_FN_LCDDCK,   NULL);
+
+	gpio_request(GPIO_PORT31, NULL); /* backlight */
+	gpio_direction_output(GPIO_PORT31, 1);
+
+	gpio_request(GPIO_PORT151, NULL); /* LCDDON */
+	gpio_direction_output(GPIO_PORT151, 1);
+
+
 	sh7372_add_standard_devices();
 
 	platform_add_devices(mackerel_devices, ARRAY_SIZE(mackerel_devices));
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 3/5] ARM: mach-shmobile: mackerel: Add LCDC support
  2010-11-29  2:21 [PATCH 3/5] ARM: mach-shmobile: mackerel: Add LCDC support Kuninori Morimoto
@ 2010-11-29  4:30 ` Magnus Damm
  2010-11-29  6:03 ` Kuninori Morimoto
  2012-11-23 16:35 ` [PATCH 3/5] ARM: mach-shmobile: mackerel: Use gpio-backlight Laurent Pinchart
  2 siblings, 0 replies; 5+ messages in thread
From: Magnus Damm @ 2010-11-29  4:30 UTC (permalink / raw)
  To: linux-sh

Hi Morimoto-san,

On Mon, Nov 29, 2010 at 11:21 AM, Kuninori Morimoto
<kuninori.morimoto.gx@renesas.com> wrote:
> +static struct sh_mobile_lcdc_info lcdc_info = {
> +       .clock_source = LCDC_CLK_BUS,
> +       .ch[0] = {
> +               .chan = LCDC_CHAN_MAINLCD,
> +               .bpp = 16,
> +               .lcd_cfg = mackerel_lcdc_modes,
> +               .num_cfg = ARRAY_SIZE(mackerel_lcdc_modes),
> +               .interface_type         = RGB24,

..and..

> +       /* LCDC */
> +       gpio_request(GPIO_FN_LCDD17,   NULL);
> +       gpio_request(GPIO_FN_LCDD16,   NULL);
> +       gpio_request(GPIO_FN_LCDD15,   NULL);
> +       gpio_request(GPIO_FN_LCDD14,   NULL);
> +       gpio_request(GPIO_FN_LCDD13,   NULL);
> +       gpio_request(GPIO_FN_LCDD12,   NULL);
> +       gpio_request(GPIO_FN_LCDD11,   NULL);
> +       gpio_request(GPIO_FN_LCDD10,   NULL);
> +       gpio_request(GPIO_FN_LCDD9,    NULL);
> +       gpio_request(GPIO_FN_LCDD8,    NULL);
> +       gpio_request(GPIO_FN_LCDD7,    NULL);
> +       gpio_request(GPIO_FN_LCDD6,    NULL);
> +       gpio_request(GPIO_FN_LCDD5,    NULL);
> +       gpio_request(GPIO_FN_LCDD4,    NULL);
> +       gpio_request(GPIO_FN_LCDD3,    NULL);
> +       gpio_request(GPIO_FN_LCDD2,    NULL);
> +       gpio_request(GPIO_FN_LCDD1,    NULL);
> +       gpio_request(GPIO_FN_LCDD0,    NULL);

Hm, it looks like you are requesting too few pins here.

Today you request 18 data pins (LCDD0 -> LCDD17) for the pinmux, but
the platform data for the LCDC is set to RGB24.

With RGB24 I think you should select 24 data pins (LCDD0 -> LCDD23).

Or perhaps there is some magic bus switch somewhere that I am not seeing? =)

Thanks,

/ magnus

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 3/5] ARM: mach-shmobile: mackerel: Add LCDC support
  2010-11-29  2:21 [PATCH 3/5] ARM: mach-shmobile: mackerel: Add LCDC support Kuninori Morimoto
  2010-11-29  4:30 ` Magnus Damm
@ 2010-11-29  6:03 ` Kuninori Morimoto
  2012-11-23 16:35 ` [PATCH 3/5] ARM: mach-shmobile: mackerel: Use gpio-backlight Laurent Pinchart
  2 siblings, 0 replies; 5+ messages in thread
From: Kuninori Morimoto @ 2010-11-29  6:03 UTC (permalink / raw)
  To: linux-sh


Hi Magnus

Thank you for checking patch

> Hm, it looks like you are requesting too few pins here.
> 
> Today you request 18 data pins (LCDD0 -> LCDD17) for the pinmux, but
> the platform data for the LCDC is set to RGB24.
> 
> With RGB24 I think you should select 24 data pins (LCDD0 -> LCDD23).

Ohh. sorry.
Thats my miss.
I send modification patch soon

Best regards
--
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 3/5] ARM: mach-shmobile: mackerel: Use gpio-backlight
  2010-11-29  2:21 [PATCH 3/5] ARM: mach-shmobile: mackerel: Add LCDC support Kuninori Morimoto
  2010-11-29  4:30 ` Magnus Damm
  2010-11-29  6:03 ` Kuninori Morimoto
@ 2012-11-23 16:35 ` Laurent Pinchart
  2012-11-26  1:10   ` Simon Horman
  2 siblings, 1 reply; 5+ messages in thread
From: Laurent Pinchart @ 2012-11-23 16:35 UTC (permalink / raw)
  To: linux-fbdev

Replace the backlight callback with a gpio-backlight platform device.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 arch/arm/mach-shmobile/board-mackerel.c |   34 +++++++++++++++---------------
 1 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index bfd2dc8..ea35727 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -48,7 +48,7 @@
 #include <linux/tca6416_keypad.h>
 #include <linux/usb/renesas_usbhs.h>
 #include <linux/dma-mapping.h>
-
+#include <video/gpio_backlight.h>
 #include <video/sh_mobile_hdmi.h>
 #include <video/sh_mobile_lcdc.h>
 #include <media/sh_mobile_ceu.h>
@@ -347,7 +347,7 @@ static struct platform_device meram_device = {
 	},
 };
 
-/* LCDC */
+/* LCDC and backlight */
 static struct fb_videomode mackerel_lcdc_modes[] = {
 	{
 		.name		= "WVGA Panel",
@@ -363,13 +363,6 @@ static struct fb_videomode mackerel_lcdc_modes[] = {
 	},
 };
 
-static int mackerel_set_brightness(int brightness)
-{
-	gpio_set_value(GPIO_PORT31, brightness);
-
-	return 0;
-}
-
 static const struct sh_mobile_meram_cfg lcd_meram_cfg = {
 	.icb[0] = {
 		.meram_size     = 0x40,
@@ -394,11 +387,6 @@ static struct sh_mobile_lcdc_info lcdc_info = {
 			.width		= 152,
 			.height		= 91,
 		},
-		.bl_info = {
-			.name = "sh_mobile_lcdc_bl",
-			.max_brightness = 1,
-			.set_brightness = mackerel_set_brightness,
-		},
 		.meram_cfg = &lcd_meram_cfg,
 	}
 };
@@ -426,6 +414,20 @@ static struct platform_device lcdc_device = {
 	},
 };
 
+static struct gpio_backlight_platform_data gpio_backlight_data = {
+	.fbdev = &lcdc_device.dev,
+	.gpio = GPIO_PORT31,
+	.def_value = 1,
+	.name = "backlight",
+};
+
+static struct platform_device gpio_backlight_device = {
+	.name = "gpio-backlight",
+	.dev = {
+		.platform_data = &gpio_backlight_data,
+	},
+};
+
 /* HDMI */
 static struct sh_mobile_hdmi_info hdmi_info = {
 	.flags		= HDMI_SND_SRC_SPDIF,
@@ -1322,6 +1324,7 @@ static struct platform_device *mackerel_devices[] __initdata = {
 	&nor_flash_device,
 	&smc911x_device,
 	&lcdc_device,
+	&gpio_backlight_device,
 	&usbhs0_device,
 	&usbhs1_device,
 	&leds_device,
@@ -1472,9 +1475,6 @@ static void __init mackerel_init(void)
 	gpio_request(GPIO_FN_LCDDISP,  NULL);
 	gpio_request(GPIO_FN_LCDDCK,   NULL);
 
-	gpio_request(GPIO_PORT31, NULL); /* backlight */
-	gpio_direction_output(GPIO_PORT31, 0); /* off by default */
-
 	gpio_request(GPIO_PORT151, NULL); /* LCDDON */
 	gpio_direction_output(GPIO_PORT151, 1);
 
-- 
1.7.8.6


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 3/5] ARM: mach-shmobile: mackerel: Use gpio-backlight
  2012-11-23 16:35 ` [PATCH 3/5] ARM: mach-shmobile: mackerel: Use gpio-backlight Laurent Pinchart
@ 2012-11-26  1:10   ` Simon Horman
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2012-11-26  1:10 UTC (permalink / raw)
  To: linux-fbdev

On Fri, Nov 23, 2012 at 05:35:13PM +0100, Laurent Pinchart wrote:
> Replace the backlight callback with a gpio-backlight platform device.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

Acked-by: Simon Horman <horms@verge.net.au>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-11-26  1:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-29  2:21 [PATCH 3/5] ARM: mach-shmobile: mackerel: Add LCDC support Kuninori Morimoto
2010-11-29  4:30 ` Magnus Damm
2010-11-29  6:03 ` Kuninori Morimoto
2012-11-23 16:35 ` [PATCH 3/5] ARM: mach-shmobile: mackerel: Use gpio-backlight Laurent Pinchart
2012-11-26  1:10   ` Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).