mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* fb patches
@ 2011-02-03  9:57 Sascha Hauer
  2011-02-03  9:57 ` [PATCH 1/2] fb: For multiple video modes print the available modes in devinfo Sascha Hauer
  2011-02-03  9:57 ` [PATCH 2/2] ARM tx28: Add hook for enabling the display Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Sascha Hauer @ 2011-02-03  9:57 UTC (permalink / raw)
  To: barebox


Two small patches, one for printing out the available videomodes when there
are multiple modes, the other for enabling the display on an Karo tx28 module.

Sascha Hauer (2):
      fb: For multiple video modes print the available modes in devinfo
      ARM tx28: Add hook for enabling the display

 arch/arm/boards/karo-tx28/tx28-stk5.c |   27 ++++++++++++++++++++---
 drivers/video/fb.c                    |   38 +++++++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+), 4 deletions(-)


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 1/2] fb: For multiple video modes print the available modes in devinfo
  2011-02-03  9:57 fb patches Sascha Hauer
@ 2011-02-03  9:57 ` Sascha Hauer
  2011-02-03  9:57 ` [PATCH 2/2] ARM tx28: Add hook for enabling the display Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2011-02-03  9:57 UTC (permalink / raw)
  To: barebox

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/video/fb.c |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index cf21c4b..85db904 100644
--- a/drivers/video/fb.c
+++ b/drivers/video/fb.c
@@ -5,6 +5,7 @@
 #include <getopt.h>
 #include <fcntl.h>
 #include <fs.h>
+#include <init.h>
 
 static int fb_ioctl(struct cdev* cdev, int req, void *data)
 {
@@ -135,3 +136,40 @@ int register_framebuffer(struct fb_info *info)
 	return 0;
 }
 
+static void fb_info(struct device_d *dev)
+{
+	struct fb_info *info = dev->priv;
+	int i;
+
+	if (!info->num_modes)
+		return;
+
+	printf("available modes:\n");
+
+	for (i = 0; i < info->num_modes; i++) {
+		struct fb_videomode *mode = &info->mode_list[i];
+
+		printf("%-10s %dx%d@%d\n", mode->name,
+				mode->xres, mode->yres, mode->refresh);
+	}
+
+	printf("\n");
+}
+
+static int fb_probe(struct device_d *hw_dev)
+{
+	return 0;
+}
+
+static struct driver_d fb_driver = {
+	.name  = "fb",
+	.probe = fb_probe,
+	.info = fb_info,
+};
+
+static int fb_init_driver(void)
+{
+	register_driver(&fb_driver);
+	return 0;
+}
+device_initcall(fb_init_driver);
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 2/2] ARM tx28: Add hook for enabling the display
  2011-02-03  9:57 fb patches Sascha Hauer
  2011-02-03  9:57 ` [PATCH 1/2] fb: For multiple video modes print the available modes in devinfo Sascha Hauer
@ 2011-02-03  9:57 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2011-02-03  9:57 UTC (permalink / raw)
  To: barebox

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/boards/karo-tx28/tx28-stk5.c |   27 +++++++++++++++++++++++----
 1 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boards/karo-tx28/tx28-stk5.c b/arch/arm/boards/karo-tx28/tx28-stk5.c
index e8338a3..d5a7831 100644
--- a/arch/arm/boards/karo-tx28/tx28-stk5.c
+++ b/arch/arm/boards/karo-tx28/tx28-stk5.c
@@ -186,20 +186,39 @@ static struct fb_videomode tx28evk_vmodes[] = {
 
 #define MAX_FB_SIZE SZ_2M
 
-static struct imx_fb_videomode imxfb_mode = {
+#define GPIO_LCD_RESET	126 /* 1 -> Reset  */
+#define GPIO_BACKLIGHT	112 /* 0 -> backlight active */
+#define GPIO_LCD_ENABLE	 63 /* 1 -> LCD enabled */
+
+static void tx28_fb_enable(int enable)
+{
+	gpio_direction_output(GPIO_LCD_RESET, enable);
+	gpio_direction_output(GPIO_LCD_ENABLE, enable);
+
+	/* Give the display a chance to sync before we enable
+	 * the backlight to avoid flickering
+	 */
+	if (enable)
+		mdelay(100);
+
+	gpio_direction_output(GPIO_BACKLIGHT, !enable);
+}
+
+static struct imx_fb_platformdata tx28_fb_pdata = {
 	.mode_list = tx28evk_vmodes,
 	.mode_cnt = ARRAY_SIZE(tx28evk_vmodes),
 	.dotclk_delay = 0,	/* no adaption required */
 	.ld_intf_width = STMLCDIF_24BIT,	/* full 24 bit */
 	.fixed_screen = (void *)(0x40000000 + SZ_128M - MAX_FB_SIZE),
 	.fixed_screen_size = MAX_FB_SIZE,
+	.enable = tx28_fb_enable,
 };
 
 static struct device_d ldcif_dev = {
 	.name = "stmfb",
 	.map_base = IMX_FB_BASE,
 	.size = 4096,
-	.platform_data = &imxfb_mode,
+	.platform_data = &tx28_fb_pdata,
 };
 
 static const uint32_t tx28_starterkit_pad_setup[] = {
@@ -360,9 +379,9 @@ void base_board_init(void)
 
 	register_device(&mci_socket);
 
-	if (imxfb_mode.fixed_screen < (void *)&_end) {
+	if (tx28_fb_pdata.fixed_screen < (void *)&_end) {
 		printf("Warning: fixed_screen overlaps barebox\n");
-		imxfb_mode.fixed_screen = NULL;
+		tx28_fb_pdata.fixed_screen = NULL;
 	}
 
 	register_device(&ldcif_dev);
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2011-02-03  9:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-03  9:57 fb patches Sascha Hauer
2011-02-03  9:57 ` [PATCH 1/2] fb: For multiple video modes print the available modes in devinfo Sascha Hauer
2011-02-03  9:57 ` [PATCH 2/2] ARM tx28: Add hook for enabling the display Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox