linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 0/5] SM501 and S3C24XX framebuffer updates
@ 2008-01-30  1:30 ben
  2008-01-30  1:30 ` [patch 1/5] FB/SM501: Ensure console suspended before saving state ben
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: ben @ 2008-01-30  1:30 UTC (permalink / raw)
  To: Linux FB; +Cc: Andrew Morton, Vincent Sanders, Ben Dooks

These updates are mostly re-send of patches that do not
seem to have been applied. Please consider these for the
current merge window.

-- 
Ben

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

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

* [patch 1/5] FB/SM501: Ensure console suspended before saving state
  2008-01-30  1:30 [patch 0/5] SM501 and S3C24XX framebuffer updates ben
@ 2008-01-30  1:30 ` ben
  2008-01-30  1:30 ` [patch 2/5] FB/S3C2412: Add S3C2412 support to S3C2410 fb driver ben
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: ben @ 2008-01-30  1:30 UTC (permalink / raw)
  To: Linux FB; +Cc: Andrew Morton, Vincent Sanders, Ben Dooks

[-- Attachment #1: simtec/simtec-drivers-fb-sm501-suspendbeforecopy.patch --]
[-- Type: text/plain, Size: 1627 bytes --]

Move the console suspend to before we save the state of
the framebuffer to ensure that it does not try and change
the fb state again once we have copied it out.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>

Index: linux-2.6.22-quilt9/drivers/video/sm501fb.c
===================================================================
--- linux-2.6.22-quilt9.orig/drivers/video/sm501fb.c
+++ linux-2.6.22-quilt9/drivers/video/sm501fb.c
@@ -1681,6 +1681,15 @@ static int sm501fb_suspend_fb(struct sm5
 	if (par->screen.size == 0)
 		return 0;
 
+	/* blank the relevant interface to ensure unit power minimised */
+	(par->ops.fb_blank)(FB_BLANK_POWERDOWN, fbi);
+
+	/* tell console/fb driver we are suspending */
+
+	acquire_console_sem();
+	fb_set_suspend(fbi, 1);
+	release_console_sem();
+
 	/* backup copies in case chip is powered down over suspend */
 
 	par->store_fb = vmalloc(par->screen.size);
@@ -1700,12 +1709,6 @@ static int sm501fb_suspend_fb(struct sm5
 
 	memcpy_fromio(par->store_fb, par->screen.k_addr, par->screen.size);
 	memcpy_fromio(par->store_cursor, par->cursor.k_addr, par->cursor.size);
-	/* blank the relevant interface to ensure unit power minimised */
-	(par->ops.fb_blank)(FB_BLANK_POWERDOWN, fbi);
-
-	acquire_console_sem();
-	fb_set_suspend(fbi, 1);
-	release_console_sem();
 
 	return 0;
 

-- 
Ben (ben@fluff.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

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

* [patch 2/5] FB/S3C2412: Add S3C2412 support to S3C2410 fb driver
  2008-01-30  1:30 [patch 0/5] SM501 and S3C24XX framebuffer updates ben
  2008-01-30  1:30 ` [patch 1/5] FB/SM501: Ensure console suspended before saving state ben
@ 2008-01-30  1:30 ` ben
  2008-01-30  1:30 ` [patch 3/5] FB/S3C2410: Update debugging in S3C2410 framebuffer driver ben
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: ben @ 2008-01-30  1:30 UTC (permalink / raw)
  To: Linux FB; +Cc: Andrew Morton, Vincent Sanders, Ben Dooks

[-- Attachment #1: simtec/simtec-drivers-fb-s3c2412-support.patch --]
[-- Type: text/plain, Size: 7092 bytes --]

Add support for the S3C2412 to the S3C2410 frame buffer driver
by ensuring that any moved registers can be dealt with.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>

Index: linux-2.6.24-git6-fb1/drivers/video/s3c2410fb.c
===================================================================
--- linux-2.6.24-git6-fb1.orig/drivers/video/s3c2410fb.c
+++ linux-2.6.24-git6-fb1/drivers/video/s3c2410fb.c
@@ -110,6 +110,11 @@ static int debug	= 0;
 
 /* useful functions */
 
+static int is_s3c2412(struct s3c2410fb_info *fbi)
+{
+	return (fbi->drv_type == DRV_S3C2412);
+}
+
 /* s3c2410fb_set_lcdaddr
  *
  * initialise lcd controller address pointers
@@ -501,7 +506,7 @@ static void schedule_palette_update(stru
 {
 	unsigned long flags;
 	unsigned long irqen;
-	void __iomem *regs = fbi->io;
+	void __iomem *irq_base = fbi->irq_base;
 
 	local_irq_save(flags);
 
@@ -511,9 +516,9 @@ static void schedule_palette_update(stru
 		fbi->palette_ready = 1;
 
 		/* enable IRQ */
-		irqen = readl(regs + S3C2410_LCDINTMSK);
+		irqen = readl(irq_base + S3C24XX_LCDINTMSK);
 		irqen &= ~S3C2410_LCDINT_FRSYNC;
-		writel(irqen, regs + S3C2410_LCDINTMSK);
+		writel(irqen, irq_base + S3C24XX_LCDINTMSK);
 	}
 
 	local_irq_restore(flags);
@@ -594,15 +599,17 @@ static int s3c2410fb_setcolreg(unsigned 
 static int s3c2410fb_blank(int blank_mode, struct fb_info *info)
 {
 	struct s3c2410fb_info *fbi = info->par;
-	void __iomem *regs = fbi->io;
+	void __iomem *tpal_reg = fbi->io;
 
 	dprintk("blank(mode=%d, info=%p)\n", blank_mode, info);
 
+	tpal_reg += is_s3c2412(fbi) ? S3C2412_TPAL : S3C2410_TPAL;
+
 	if (blank_mode == FB_BLANK_UNBLANK)
-		writel(0x0, regs + S3C2410_TPAL);
+		writel(0x0, tpal_reg);
 	else {
 		dprintk("setting TPAL to output 0x000000\n");
-		writel(S3C2410_TPAL_EN, regs + S3C2410_TPAL);
+		writel(S3C2410_TPAL_EN, tpal_reg);
 	}
 
 	return 0;
@@ -709,6 +716,16 @@ static int s3c2410fb_init_registers(stru
 	struct s3c2410fb_mach_info *mach_info = fbi->dev->platform_data;
 	unsigned long flags;
 	void __iomem *regs = fbi->io;
+	void __iomem *tpal;
+	void __iomem *lpcsel;
+
+	if (is_s3c2412(fbi)) {
+		tpal = regs + S3C2412_TPAL;
+		lpcsel = regs + S3C2412_TCONSEL;
+	} else {
+		tpal = regs + S3C2410_TPAL;
+		lpcsel = regs + S3C2410_LPCSEL;
+	}
 
 	/* Initialise LCD with values from haret */
 
@@ -724,12 +741,12 @@ static int s3c2410fb_init_registers(stru
 	local_irq_restore(flags);
 
 	dprintk("LPCSEL    = 0x%08lx\n", mach_info->lpcsel);
-	writel(mach_info->lpcsel, regs + S3C2410_LPCSEL);
+	writel(mach_info->lpcsel, lpcsel);
 
-	dprintk("replacing TPAL %08x\n", readl(regs + S3C2410_TPAL));
+	dprintk("replacing TPAL %08x\n", readl(tpal));
 
 	/* ensure temporary palette disabled */
-	writel(0x00, regs + S3C2410_TPAL);
+	writel(0x00, tpal);
 
 	return 0;
 }
@@ -763,15 +780,15 @@ static void s3c2410fb_write_palette(stru
 static irqreturn_t s3c2410fb_irq(int irq, void *dev_id)
 {
 	struct s3c2410fb_info *fbi = dev_id;
-	void __iomem *regs = fbi->io;
-	unsigned long lcdirq = readl(regs + S3C2410_LCDINTPND);
+	void __iomem *irq_base = fbi->irq_base;
+	unsigned long lcdirq = readl(irq_base + S3C24XX_LCDINTPND);
 
 	if (lcdirq & S3C2410_LCDINT_FRSYNC) {
 		if (fbi->palette_ready)
 			s3c2410fb_write_palette(fbi);
 
-		writel(S3C2410_LCDINT_FRSYNC, regs + S3C2410_LCDINTPND);
-		writel(S3C2410_LCDINT_FRSYNC, regs + S3C2410_LCDSRCPND);
+		writel(S3C2410_LCDINT_FRSYNC, irq_base + S3C24XX_LCDINTPND);
+		writel(S3C2410_LCDINT_FRSYNC, irq_base + S3C24XX_LCDSRCPND);
 	}
 
 	return IRQ_HANDLED;
@@ -779,7 +796,8 @@ static irqreturn_t s3c2410fb_irq(int irq
 
 static char driver_name[] = "s3c2410fb";
 
-static int __init s3c2410fb_probe(struct platform_device *pdev)
+static int __init s3c24xxfb_probe(struct platform_device *pdev,
+				  enum s3c_drv_type drv_type)
 {
 	struct s3c2410fb_info *info;
 	struct s3c2410fb_display *display;
@@ -815,6 +833,7 @@ static int __init s3c2410fb_probe(struct
 
 	info = fbinfo->par;
 	info->dev = &pdev->dev;
+	info->drv_type = drv_type;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (res == NULL) {
@@ -838,6 +857,8 @@ static int __init s3c2410fb_probe(struct
 		goto release_mem;
 	}
 
+	info->irq_base = info->io + ((drv_type == DRV_S3C2412) ? S3C2412_LCDINTBASE : S3C2410_LCDINTBASE);
+
 	dprintk("devinit\n");
 
 	strcpy(fbinfo->fix.id, driver_name);
@@ -946,6 +967,16 @@ dealloc_fb:
 	return ret;
 }
 
+static int __init s3c2410fb_probe(struct platform_device *pdev)
+{
+	return s3c24xxfb_probe(pdev, DRV_S3C2410);
+}
+
+static int __init s3c2412fb_probe(struct platform_device *pdev)
+{
+	return s3c24xxfb_probe(pdev, DRV_S3C2412);
+}
+
 /* s3c2410fb_stop_lcd
  *
  * shutdown the lcd controller
@@ -1047,14 +1078,31 @@ static struct platform_driver s3c2410fb_
 	},
 };
 
+static struct platform_driver s3c2412fb_driver = {
+	.probe		= s3c2412fb_probe,
+	.remove		= s3c2410fb_remove,
+	.suspend	= s3c2410fb_suspend,
+	.resume		= s3c2410fb_resume,
+	.driver		= {
+		.name	= "s3c2412-lcd",
+		.owner	= THIS_MODULE,
+	},
+};
+
 int __init s3c2410fb_init(void)
 {
-	return platform_driver_register(&s3c2410fb_driver);
+	int ret = platform_driver_register(&s3c2410fb_driver);
+
+	if (ret == 0)
+		ret = platform_driver_register(&s3c2412fb_driver);;
+
+	return ret;
 }
 
 static void __exit s3c2410fb_cleanup(void)
 {
 	platform_driver_unregister(&s3c2410fb_driver);
+	platform_driver_unregister(&s3c2412fb_driver);
 }
 
 module_init(s3c2410fb_init);
Index: linux-2.6.24-git6-fb1/drivers/video/s3c2410fb.h
===================================================================
--- linux-2.6.24-git6-fb1.orig/drivers/video/s3c2410fb.h
+++ linux-2.6.24-git6-fb1/drivers/video/s3c2410fb.h
@@ -25,13 +25,20 @@
 #ifndef __S3C2410FB_H
 #define __S3C2410FB_H
 
+enum s3c_drv_type {
+	DRV_S3C2410,
+	DRV_S3C2412,
+};
+
 struct s3c2410fb_info {
 	struct device		*dev;
 	struct clk		*clk;
 
 	struct resource		*mem;
 	void __iomem		*io;
+	void __iomem		*irq_base;
 
+	enum s3c_drv_type	drv_type;
 	struct s3c2410fb_hw	regs;
 
 	unsigned int		palette_ready;
Index: linux-2.6.24-git6-fb1/include/asm-arm/arch-s3c2410/regs-lcd.h
===================================================================
--- linux-2.6.24-git6-fb1.orig/include/asm-arm/arch-s3c2410/regs-lcd.h
+++ linux-2.6.24-git6-fb1/include/asm-arm/arch-s3c2410/regs-lcd.h
@@ -147,7 +147,16 @@
 
 #define S3C2412_FRCPAT(x)	S3C2410_LCDREG(0xB4 + ((x)*4))
 
-#endif /* ___ASM_ARCH_REGS_LCD_H */
+/* general registers */
+
+/* base of the LCD registers, where INTPND, INTSRC and then INTMSK
+ * are available. */
 
+#define S3C2410_LCDINTBASE	S3C2410_LCDREG(0x54)
+#define S3C2412_LCDINTBASE	S3C2410_LCDREG(0x24)
 
+#define S3C24XX_LCDINTPND	(0x00)
+#define S3C24XX_LCDSRCPND	(0x04)
+#define S3C24XX_LCDINTMSK	(0x08)
 
+#endif /* ___ASM_ARCH_REGS_LCD_H */

-- 
Ben (ben@fluff.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

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

* [patch 3/5] FB/S3C2410: Update debugging in S3C2410 framebuffer driver
  2008-01-30  1:30 [patch 0/5] SM501 and S3C24XX framebuffer updates ben
  2008-01-30  1:30 ` [patch 1/5] FB/SM501: Ensure console suspended before saving state ben
  2008-01-30  1:30 ` [patch 2/5] FB/S3C2412: Add S3C2412 support to S3C2410 fb driver ben
@ 2008-01-30  1:30 ` ben
  2008-01-30  1:30 ` [patch 4/5] FB/S3C2410: Ensure S3C2410 framebuffer clears initial memory to black ben
  2008-01-30  1:30 ` [patch 5/5] FB/S3C2410: Check default_display parameter passed in platform data ben
  4 siblings, 0 replies; 6+ messages in thread
From: ben @ 2008-01-30  1:30 UTC (permalink / raw)
  To: Linux FB; +Cc: Andrew Morton, Vincent Sanders, Ben Dooks

[-- Attachment #1: simtec/simtec-drivers-fb-s3c2410-debug-update.patch --]
[-- Type: text/plain, Size: 1001 bytes --]

Update the debugging in the s3c2410 framebuffer driver.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>

Index: linux-2.6.22-simtec14/drivers/video/s3c2410fb.c
===================================================================
--- linux-2.6.22-simtec14.orig/drivers/video/s3c2410fb.c
+++ linux-2.6.22-simtec14/drivers/video/s3c2410fb.c
@@ -670,7 +670,7 @@ static int __init s3c2410fb_map_video_me
 	dma_addr_t map_dma;
 	unsigned map_size = PAGE_ALIGN(info->fix.smem_len);
 
-	dprintk("map_video_memory(fbi=%p)\n", fbi);
+	dprintk("map_video_memory(fbi=%p) map_size %u\n", fbi, map_size);
 
 	info->screen_base = dma_alloc_writecombine(fbi->dev, map_size,
 						   &map_dma, GFP_KERNEL);

-- 
Ben (ben@fluff.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

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

* [patch 4/5] FB/S3C2410: Ensure S3C2410 framebuffer clears initial memory to black
  2008-01-30  1:30 [patch 0/5] SM501 and S3C24XX framebuffer updates ben
                   ` (2 preceding siblings ...)
  2008-01-30  1:30 ` [patch 3/5] FB/S3C2410: Update debugging in S3C2410 framebuffer driver ben
@ 2008-01-30  1:30 ` ben
  2008-01-30  1:30 ` [patch 5/5] FB/S3C2410: Check default_display parameter passed in platform data ben
  4 siblings, 0 replies; 6+ messages in thread
From: ben @ 2008-01-30  1:30 UTC (permalink / raw)
  To: Linux FB; +Cc: Andrew Morton, Vincent Sanders, Ben Dooks

[-- Attachment #1: simtec/simtec-drivers-fb-s3c2410-cleartoblack.patch --]
[-- Type: text/plain, Size: 974 bytes --]

Change the initial pattern in the s3c2410 framebuffer driver
to black.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>

Index: linux-2.6.23-quilt3/drivers/video/s3c2410fb.c
===================================================================
--- linux-2.6.23-quilt3.orig/drivers/video/s3c2410fb.c
+++ linux-2.6.23-quilt3/drivers/video/s3c2410fb.c
@@ -679,7 +679,7 @@ static int __init s3c2410fb_map_video_me
 		/* prevent initial garbage on screen */
 		dprintk("map_video_memory: clear %p:%08x\n",
 			info->screen_base, map_size);
-		memset(info->screen_base, 0xf0, map_size);
+		memset(info->screen_base, 0x00, map_size);
 
 		info->fix.smem_start = map_dma;
 

-- 
Ben (ben@fluff.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

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

* [patch 5/5] FB/S3C2410: Check default_display parameter passed in platform data
  2008-01-30  1:30 [patch 0/5] SM501 and S3C24XX framebuffer updates ben
                   ` (3 preceding siblings ...)
  2008-01-30  1:30 ` [patch 4/5] FB/S3C2410: Ensure S3C2410 framebuffer clears initial memory to black ben
@ 2008-01-30  1:30 ` ben
  4 siblings, 0 replies; 6+ messages in thread
From: ben @ 2008-01-30  1:30 UTC (permalink / raw)
  To: Linux FB; +Cc: Andrew Morton, Vincent Sanders, Ben Dooks

[-- Attachment #1: simtec/simtec-drivers-fb-s3c2410-check-default-display.patch --]
[-- Type: text/plain, Size: 1323 bytes --]

Ensure that the default display parameter passed in via the
device's platform data is valid. It turns out when mach-bast.c
was updated, the default_display was set outside of the display
array bounds, causing a panic on startup.

If the default_display is bigger than num_displays, then generate
an error and refuse to initialise the driver.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>

Index: linux-2.6.23-quilt5/drivers/video/s3c2410fb.c
===================================================================
--- linux-2.6.23-quilt5.orig/drivers/video/s3c2410fb.c
+++ linux-2.6.23-quilt5/drivers/video/s3c2410fb.c
@@ -817,6 +817,12 @@ static int __init s3c24xxfb_probe(struct
 		return -EINVAL;
 	}
 
+	if (mach_info->default_display >= mach_info->num_displays) {
+		dev_err(&pdev->dev, "default is %d but only %d displays\n",
+			mach_info->default_display, mach_info->num_displays);
+		return -EINVAL;
+	}
+
 	display = mach_info->displays + mach_info->default_display;
 
 	irq = platform_get_irq(pdev, 0);

-- 
Ben (ben@fluff.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

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

end of thread, other threads:[~2008-01-30  1:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-30  1:30 [patch 0/5] SM501 and S3C24XX framebuffer updates ben
2008-01-30  1:30 ` [patch 1/5] FB/SM501: Ensure console suspended before saving state ben
2008-01-30  1:30 ` [patch 2/5] FB/S3C2412: Add S3C2412 support to S3C2410 fb driver ben
2008-01-30  1:30 ` [patch 3/5] FB/S3C2410: Update debugging in S3C2410 framebuffer driver ben
2008-01-30  1:30 ` [patch 4/5] FB/S3C2410: Ensure S3C2410 framebuffer clears initial memory to black ben
2008-01-30  1:30 ` [patch 5/5] FB/S3C2410: Check default_display parameter passed in platform data ben

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).