Linux Framebuffer Layer development
 help / color / mirror / Atom feed
* [PATCH 6/9] OMAP: DSS2: Add method for querying display dimensions from DSS drivers
From: Tomi Valkeinen @ 2011-03-31 10:11 UTC (permalink / raw)
  To: linux-omap, linux-fbdev; +Cc: Jani Nikula, Tomi Valkeinen
In-Reply-To: <1301566266-11187-1-git-send-email-tomi.valkeinen@ti.com>

From: Jani Nikula <ext-jani.1.nikula@nokia.com>

Add get_dimensions() to struct omap_dss_driver. Use the call, if supported
by the driver, in OMAPFB.

Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 arch/arm/plat-omap/include/plat/display.h |    2 ++
 drivers/video/omap2/omapfb/omapfb-ioctl.c |   12 ++++++++++--
 drivers/video/omap2/omapfb/omapfb-main.c  |   12 ++++++++++--
 3 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/display.h b/arch/arm/plat-omap/include/plat/display.h
index e10cfe2..f6e4b87 100644
--- a/arch/arm/plat-omap/include/plat/display.h
+++ b/arch/arm/plat-omap/include/plat/display.h
@@ -507,6 +507,8 @@ struct omap_dss_driver {
 
 	void (*get_resolution)(struct omap_dss_device *dssdev,
 			u16 *xres, u16 *yres);
+	void (*get_dimensions)(struct omap_dss_device *dssdev,
+			u32 *width, u32 *height);
 	int (*get_recommended_bpp)(struct omap_dss_device *dssdev);
 
 	int (*check_timings)(struct omap_dss_device *dssdev,
diff --git a/drivers/video/omap2/omapfb/omapfb-ioctl.c b/drivers/video/omap2/omapfb/omapfb-ioctl.c
index 6f43545..b4636b1 100644
--- a/drivers/video/omap2/omapfb/omapfb-ioctl.c
+++ b/drivers/video/omap2/omapfb/omapfb-ioctl.c
@@ -895,8 +895,16 @@ int omapfb_ioctl(struct fb_info *fbi, unsigned int cmd, unsigned long arg)
 
 		p.display_info.xres = xres;
 		p.display_info.yres = yres;
-		p.display_info.width = 0;
-		p.display_info.height = 0;
+
+		if (display->driver->get_dimensions) {
+			u32 w, h;
+			display->driver->get_dimensions(display, &w, &h);
+			p.display_info.width = w;
+			p.display_info.height = h;
+		} else {
+			p.display_info.width = 0;
+			p.display_info.height = 0;
+		}
 
 		if (copy_to_user((void __user *)arg, &p.display_info,
 					sizeof(p.display_info)))
diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c
index 505ec66..163fb8b 100644
--- a/drivers/video/omap2/omapfb/omapfb-main.c
+++ b/drivers/video/omap2/omapfb/omapfb-main.c
@@ -702,8 +702,16 @@ int check_fb_var(struct fb_info *fbi, struct fb_var_screeninfo *var)
 			var->xres, var->yres,
 			var->xres_virtual, var->yres_virtual);
 
-	var->height             = -1;
-	var->width              = -1;
+	if (display && display->driver->get_dimensions) {
+		u32 w, h;
+		display->driver->get_dimensions(display, &w, &h);
+		var->width = DIV_ROUND_CLOSEST(w, 1000);
+		var->height = DIV_ROUND_CLOSEST(h, 1000);
+	} else {
+		var->height = -1;
+		var->width = -1;
+	}
+
 	var->grayscale          = 0;
 
 	if (display && display->driver->get_timings) {
-- 
1.7.1


^ permalink raw reply related

* [PATCH 7/9] OMAP: DSS2: OMAPFB: Handle errors when initializing panel
From: Tomi Valkeinen @ 2011-03-31 10:11 UTC (permalink / raw)
  To: linux-omap, linux-fbdev; +Cc: Tomi Valkeinen
In-Reply-To: <1301566266-11187-1-git-send-email-tomi.valkeinen@ti.com>

Errors from the panel driver were ignored during panel initialization.
Handle the errors and fail accordingly.

Also move the display initialization to a separate function to make it
cleaner.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/video/omap2/omapfb/omapfb-main.c |   80 ++++++++++++++++++++++--------
 1 files changed, 59 insertions(+), 21 deletions(-)

diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c
index 163fb8b..1b89e28 100644
--- a/drivers/video/omap2/omapfb/omapfb-main.c
+++ b/drivers/video/omap2/omapfb/omapfb-main.c
@@ -2193,6 +2193,61 @@ static int omapfb_parse_def_modes(struct omapfb2_device *fbdev)
 	return r;
 }
 
+static int omapfb_init_display(struct omapfb2_device *fbdev,
+		struct omap_dss_device *dssdev)
+{
+	struct omap_dss_driver *dssdrv = dssdev->driver;
+	int r;
+
+	r = dssdrv->enable(dssdev);
+	if (r) {
+		dev_warn(fbdev->dev, "Failed to enable display '%s'\n",
+				dssdev->name);
+		return r;
+	}
+
+	if (dssdev->caps & OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE) {
+		u16 w, h;
+		if (dssdrv->enable_te) {
+			r = dssdrv->enable_te(dssdev, 1);
+			if (r) {
+				dev_err(fbdev->dev, "Failed to set TE\n");
+				return r;
+			}
+		}
+
+		if (dssdrv->set_update_mode) {
+			r = dssdrv->set_update_mode(dssdev,
+					OMAP_DSS_UPDATE_MANUAL);
+			if (r) {
+				dev_err(fbdev->dev,
+						"Failed to set update mode\n");
+				return r;
+			}
+		}
+
+		dssdrv->get_resolution(dssdev, &w, &h);
+		r = dssdrv->update(dssdev, 0, 0, w, h);
+		if (r) {
+			dev_err(fbdev->dev,
+					"Failed to update display\n");
+			return r;
+		}
+	} else {
+		if (dssdrv->set_update_mode) {
+			r = dssdrv->set_update_mode(dssdev,
+					OMAP_DSS_UPDATE_AUTO);
+			if (r) {
+				dev_err(fbdev->dev,
+						"Failed to set update mode\n");
+				return r;
+			}
+		}
+	}
+
+	return 0;
+}
+
 static int omapfb_probe(struct platform_device *pdev)
 {
 	struct omapfb2_device *fbdev = NULL;
@@ -2292,30 +2347,13 @@ static int omapfb_probe(struct platform_device *pdev)
 	}
 
 	if (def_display) {
-		struct omap_dss_driver *dssdrv = def_display->driver;
-
-		r = def_display->driver->enable(def_display);
+		r = omapfb_init_display(fbdev, def_display);
 		if (r) {
-			dev_warn(fbdev->dev, "Failed to enable display '%s'\n",
-					def_display->name);
+			dev_err(fbdev->dev,
+					"failed to initialize default "
+					"display\n");
 			goto cleanup;
 		}
-
-		if (def_display->caps & OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE) {
-			u16 w, h;
-			if (dssdrv->enable_te)
-				dssdrv->enable_te(def_display, 1);
-			if (dssdrv->set_update_mode)
-				dssdrv->set_update_mode(def_display,
-						OMAP_DSS_UPDATE_MANUAL);
-
-			dssdrv->get_resolution(def_display, &w, &h);
-			def_display->driver->update(def_display, 0, 0, w, h);
-		} else {
-			if (dssdrv->set_update_mode)
-				dssdrv->set_update_mode(def_display,
-						OMAP_DSS_UPDATE_AUTO);
-		}
 	}
 
 	DBG("create sysfs for fbs\n");
-- 
1.7.1


^ permalink raw reply related

* [PATCH 8/9] OMAP: DSS2: OMAPFB: Remove implicit display update on unblank
From: Tomi Valkeinen @ 2011-03-31 10:11 UTC (permalink / raw)
  To: linux-omap, linux-fbdev; +Cc: Jani Nikula, Tomi Valkeinen
In-Reply-To: <1301566266-11187-1-git-send-email-tomi.valkeinen@ti.com>

From: Jani Nikula <ext-jani.1.nikula@nokia.com>

Currently omapfb does an implicit display update (for manual update
displays) on unblank.

There is no guarantee that the framebuffer contains a valid image when
unblank is called. When using manual update displays it is the
responsibility of the user space to update the display, and so it should
be in this case also.

This patch removes the implicit display update on unblank.

Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
[tomi.valkeinen@ti.com: improved description]
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/video/omap2/omapfb/omapfb-main.c |   13 -------------
 1 files changed, 0 insertions(+), 13 deletions(-)

diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c
index 1b89e28..1f9cb3a 100644
--- a/drivers/video/omap2/omapfb/omapfb-main.c
+++ b/drivers/video/omap2/omapfb/omapfb-main.c
@@ -1271,7 +1271,6 @@ static int omapfb_blank(int blank, struct fb_info *fbi)
 	struct omapfb_info *ofbi = FB2OFB(fbi);
 	struct omapfb2_device *fbdev = ofbi->fbdev;
 	struct omap_dss_device *display = fb2display(fbi);
-	int do_update = 0;
 	int r = 0;
 
 	if (!display)
@@ -1287,11 +1286,6 @@ static int omapfb_blank(int blank, struct fb_info *fbi)
 		if (display->driver->resume)
 			r = display->driver->resume(display);
 
-		if (r = 0 && display->driver->get_update_mode &&
-				display->driver->get_update_mode(display) =
-				OMAP_DSS_UPDATE_MANUAL)
-			do_update = 1;
-
 		break;
 
 	case FB_BLANK_NORMAL:
@@ -1315,13 +1309,6 @@ static int omapfb_blank(int blank, struct fb_info *fbi)
 exit:
 	omapfb_unlock(fbdev);
 
-	if (r = 0 && do_update && display->driver->update) {
-		u16 w, h;
-		display->driver->get_resolution(display, &w, &h);
-
-		r = display->driver->update(display, 0, 0, w, h);
-	}
-
 	return r;
 }
 
-- 
1.7.1


^ permalink raw reply related

* [PATCH 9/9] OMAP: DSS2: VENC: Add missing start/stop_device calls
From: Tomi Valkeinen @ 2011-03-31 10:11 UTC (permalink / raw)
  To: linux-omap, linux-fbdev; +Cc: Tomi Valkeinen
In-Reply-To: <1301566266-11187-1-git-send-email-tomi.valkeinen@ti.com>

VENC code was missing omap_dss_start/stop_device calls. This didn't
cause any problems as VENC could not be compiled as a module, but
nevertheless it's better to add the calls.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/video/omap2/dss/venc.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c
index fe18800..b845c56 100644
--- a/drivers/video/omap2/dss/venc.c
+++ b/drivers/video/omap2/dss/venc.c
@@ -476,6 +476,12 @@ static int venc_panel_enable(struct omap_dss_device *dssdev)
 
 	mutex_lock(&venc.venc_lock);
 
+	r = omap_dss_start_device(dssdev);
+	if (r) {
+		DSSERR("failed to start device\n");
+		goto err0;
+	}
+
 	if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED) {
 		r = -EINVAL;
 		goto err1;
@@ -487,7 +493,11 @@ static int venc_panel_enable(struct omap_dss_device *dssdev)
 
 	dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
 
+	mutex_unlock(&venc.venc_lock);
+	return 0;
 err1:
+	omap_dss_stop_device(dssdev);
+err0:
 	mutex_unlock(&venc.venc_lock);
 
 	return r;
@@ -511,6 +521,8 @@ static void venc_panel_disable(struct omap_dss_device *dssdev)
 	venc_power_off(dssdev);
 
 	dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
+
+	omap_dss_stop_device(dssdev);
 end:
 	mutex_unlock(&venc.venc_lock);
 }
-- 
1.7.1


^ permalink raw reply related

* [PATCH 0/2] Support incorrect UEFI Graphics Output Protocol fields.
From: Peter Jones @ 2011-03-31 14:33 UTC (permalink / raw)
  To: linux-fbdev

This patchset allows us to handle UEFI machines that have fields which
have partially incorrect data in the GOP mode line by overriding individual
fields with our DMI table.


^ permalink raw reply

* [PATCH 1/2] Support overriding fields FW tells us with the DMI data.
From: Peter Jones @ 2011-03-31 14:33 UTC (permalink / raw)
  To: linux-fbdev

Some machines apparently give us bogus linelength/stride/pitch data, so
we need to support letting the DMI table override the supplied data.

I bet you can't guess whose machines I'm talking about.
---
 drivers/video/efifb.c |  149 +++++++++++++++++++++++++++++--------------------
 1 files changed, 88 insertions(+), 61 deletions(-)

diff --git a/drivers/video/efifb.c b/drivers/video/efifb.c
index a9645b8..2359b64 100644
--- a/drivers/video/efifb.c
+++ b/drivers/video/efifb.c
@@ -68,41 +68,48 @@ enum {
 	M_UNKNOWN	/* placeholder */
 };
 
+#define OVERRIDE_NONE	0x0
+#define OVERRIDE_BASE	0x1
+#define OVERRIDE_STRIDE	0x2
+#define OVERRIDE_HEIGHT	0x4
+#define OVERRIDE_WIDTH	0x8
+
 static struct efifb_dmi_info {
 	char *optname;
 	unsigned long base;
 	int stride;
 	int width;
 	int height;
+	int flags;
 } dmi_list[] __initdata = {
-	[M_I17] = { "i17", 0x80010000, 1472 * 4, 1440, 900 },
-	[M_I20] = { "i20", 0x80010000, 1728 * 4, 1680, 1050 }, /* guess */
-	[M_I20_SR] = { "imac7", 0x40010000, 1728 * 4, 1680, 1050 },
-	[M_I24] = { "i24", 0x80010000, 2048 * 4, 1920, 1200 }, /* guess */
-	[M_I24_8_1] = { "imac8", 0xc0060000, 2048 * 4, 1920, 1200 },
-	[M_I24_10_1] = { "imac10", 0xc0010000, 2048 * 4, 1920, 1080 },
-	[M_I27_11_1] = { "imac11", 0xc0010000, 2560 * 4, 2560, 1440 },
-	[M_MINI]= { "mini", 0x80000000, 2048 * 4, 1024, 768 },
-	[M_MINI_3_1] = { "mini31", 0x40010000, 1024 * 4, 1024, 768 },
-	[M_MINI_4_1] = { "mini41", 0xc0010000, 2048 * 4, 1920, 1200 },
-	[M_MB] = { "macbook", 0x80000000, 2048 * 4, 1280, 800 },
-	[M_MB_5_1] = { "macbook51", 0x80010000, 2048 * 4, 1280, 800 },
-	[M_MB_6_1] = { "macbook61", 0x80010000, 2048 * 4, 1280, 800 },
-	[M_MB_7_1] = { "macbook71", 0x80010000, 2048 * 4, 1280, 800 },
-	[M_MBA] = { "mba", 0x80000000, 2048 * 4, 1280, 800 },
-	[M_MBP] = { "mbp", 0x80010000, 1472 * 4, 1440, 900 },
-	[M_MBP_2] = { "mbp2", 0, 0, 0, 0 }, /* placeholder */
-	[M_MBP_2_2] = { "mbp22", 0x80010000, 1472 * 4, 1440, 900 },
-	[M_MBP_SR] = { "mbp3", 0x80030000, 2048 * 4, 1440, 900 },
-	[M_MBP_4] = { "mbp4", 0xc0060000, 2048 * 4, 1920, 1200 },
-	[M_MBP_5_1] = { "mbp51", 0xc0010000, 2048 * 4, 1440, 900 },
-	[M_MBP_5_2] = { "mbp52", 0xc0010000, 2048 * 4, 1920, 1200 },
-	[M_MBP_5_3] = { "mbp53", 0xd0010000, 2048 * 4, 1440, 900 },
-	[M_MBP_6_1] = { "mbp61", 0x90030000, 2048 * 4, 1920, 1200 },
-	[M_MBP_6_2] = { "mbp62", 0x90030000, 2048 * 4, 1680, 1050 },
-	[M_MBP_7_1] = { "mbp71", 0xc0010000, 2048 * 4, 1280, 800 },
-	[M_MBP_8_2] = { "mbp82", 0x90010000, 1472 * 4, 1440, 900 },
-	[M_UNKNOWN] = { NULL, 0, 0, 0, 0 }
+	[M_I17] = { "i17", 0x80010000, 1472 * 4, 1440, 900, OVERRIDE_NONE },
+	[M_I20] = { "i20", 0x80010000, 1728 * 4, 1680, 1050, OVERRIDE_NONE }, /* guess */
+	[M_I20_SR] = { "imac7", 0x40010000, 1728 * 4, 1680, 1050, OVERRIDE_NONE },
+	[M_I24] = { "i24", 0x80010000, 2048 * 4, 1920, 1200, OVERRIDE_NONE }, /* guess */
+	[M_I24_8_1] = { "imac8", 0xc0060000, 2048 * 4, 1920, 1200, OVERRIDE_NONE },
+	[M_I24_10_1] = { "imac10", 0xc0010000, 2048 * 4, 1920, 1080, OVERRIDE_NONE },
+	[M_I27_11_1] = { "imac11", 0xc0010000, 2560 * 4, 2560, 1440, OVERRIDE_NONE },
+	[M_MINI]= { "mini", 0x80000000, 2048 * 4, 1024, 768, OVERRIDE_NONE },
+	[M_MINI_3_1] = { "mini31", 0x40010000, 1024 * 4, 1024, 768, OVERRIDE_NONE },
+	[M_MINI_4_1] = { "mini41", 0xc0010000, 2048 * 4, 1920, 1200, OVERRIDE_NONE },
+	[M_MB] = { "macbook", 0x80000000, 2048 * 4, 1280, 800, OVERRIDE_NONE },
+	[M_MB_5_1] = { "macbook51", 0x80010000, 2048 * 4, 1280, 800, OVERRIDE_NONE },
+	[M_MB_6_1] = { "macbook61", 0x80010000, 2048 * 4, 1280, 800, OVERRIDE_NONE },
+	[M_MB_7_1] = { "macbook71", 0x80010000, 2048 * 4, 1280, 800, OVERRIDE_NONE },
+	[M_MBA] = { "mba", 0x80000000, 2048 * 4, 1280, 800, OVERRIDE_NONE },
+	[M_MBP] = { "mbp", 0x80010000, 1472 * 4, 1440, 900, OVERRIDE_NONE },
+	[M_MBP_2] = { "mbp2", 0, 0, 0, 0, OVERRIDE_NONE }, /* placeholder */
+	[M_MBP_2_2] = { "mbp22", 0x80010000, 1472 * 4, 1440, 900, OVERRIDE_NONE },
+	[M_MBP_SR] = { "mbp3", 0x80030000, 2048 * 4, 1440, 900, OVERRIDE_NONE },
+	[M_MBP_4] = { "mbp4", 0xc0060000, 2048 * 4, 1920, 1200, OVERRIDE_NONE },
+	[M_MBP_5_1] = { "mbp51", 0xc0010000, 2048 * 4, 1440, 900, OVERRIDE_NONE },
+	[M_MBP_5_2] = { "mbp52", 0xc0010000, 2048 * 4, 1920, 1200, OVERRIDE_NONE },
+	[M_MBP_5_3] = { "mbp53", 0xd0010000, 2048 * 4, 1440, 900, OVERRIDE_NONE },
+	[M_MBP_6_1] = { "mbp61", 0x90030000, 2048 * 4, 1920, 1200, OVERRIDE_NONE },
+	[M_MBP_6_2] = { "mbp62", 0x90030000, 2048 * 4, 1680, 1050, OVERRIDE_NONE },
+	[M_MBP_7_1] = { "mbp71", 0xc0010000, 2048 * 4, 1280, 800, OVERRIDE_NONE },
+	[M_MBP_8_2] = { "mbp82", 0x90010000, 1472 * 4, 1440, 900, OVERRIDE_NONE },
+	[M_UNKNOWN] = { NULL, 0, 0, 0, 0, OVERRIDE_NONE }
 };
 
 static int set_system(const struct dmi_system_id *id);
@@ -157,16 +164,22 @@ static const struct dmi_system_id dmi_system_table[] __initconst = {
 	{},
 };
 
+#define choose_value(dmivalue, fwvalue, field, flags) ({	\
+		typeof(fwvalue) _ret_ = fwvalue;		\
+		if ((flags) & (field))				\
+			_ret_ = dmivalue;			\
+		else if ((fwvalue) = 0)			\
+			_ret_ = dmivalue;			\
+		_ret_;						\
+	})
+
 static int set_system(const struct dmi_system_id *id)
 {
 	struct efifb_dmi_info *info = id->driver_data;
-	if (info->base = 0)
-		return 0;
 
-	printk(KERN_INFO "efifb: dmi detected %s - framebuffer at %p "
-			 "(%dx%d, stride %d)\n", id->ident,
-			 (void *)info->base, info->width, info->height,
-			 info->stride);
+	if (info->base = 0 && info->height = 0 && info->width = 0
+			&& info->stride = 0)
+		return 0;
 
 	/* Trust the bootloader over the DMI tables */
 	if (screen_info.lfb_base = 0) {
@@ -174,40 +187,47 @@ static int set_system(const struct dmi_system_id *id)
 		struct pci_dev *dev = NULL;
 		int found_bar = 0;
 #endif
-		screen_info.lfb_base = info->base;
+		if (info->base) {
+			screen_info.lfb_base = choose_value(info->base,
+				screen_info.lfb_base, OVERRIDE_BASE,
+				info->flags);
 
 #if defined(CONFIG_PCI)
-		/* make sure that the address in the table is actually on a
-		 * VGA device's PCI BAR */
-
-		for_each_pci_dev(dev) {
-			int i;
-			if ((dev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
-				continue;
-			for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
-				resource_size_t start, end;
-
-				start = pci_resource_start(dev, i);
-				if (start = 0)
-					break;
-				end = pci_resource_end(dev, i);
-				if (screen_info.lfb_base >= start &&
-						screen_info.lfb_base < end) {
-					found_bar = 1;
+			/* make sure that the address in the table is actually
+			 * on a VGA device's PCI BAR */
+
+			for_each_pci_dev(dev) {
+				int i;
+				if ((dev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
+					continue;
+				for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
+					resource_size_t start, end;
+
+					start = pci_resource_start(dev, i);
+					if (start = 0)
+						break;
+					end = pci_resource_end(dev, i);
+					if (screen_info.lfb_base >= start &&
+					    screen_info.lfb_base < end) {
+						found_bar = 1;
+					}
 				}
 			}
-		}
-		if (!found_bar)
-			screen_info.lfb_base = 0;
+			if (!found_bar)
+				screen_info.lfb_base = 0;
 #endif
+		}
 	}
 	if (screen_info.lfb_base) {
-		if (screen_info.lfb_linelength = 0)
-			screen_info.lfb_linelength = info->stride;
-		if (screen_info.lfb_width = 0)
-			screen_info.lfb_width = info->width;
-		if (screen_info.lfb_height = 0)
-			screen_info.lfb_height = info->height;
+		screen_info.lfb_linelength = choose_value(info->stride,
+			screen_info.lfb_linelength, OVERRIDE_STRIDE,
+			info->flags);
+		screen_info.lfb_width = choose_value(info->width,
+			screen_info.lfb_width, OVERRIDE_WIDTH,
+			info->flags);
+		screen_info.lfb_height = choose_value(info->height,
+			screen_info.lfb_height, OVERRIDE_HEIGHT,
+			info->flags);
 		if (screen_info.orig_video_isVGA = 0)
 			screen_info.orig_video_isVGA = VIDEO_TYPE_EFI;
 	} else {
@@ -217,6 +237,13 @@ static int set_system(const struct dmi_system_id *id)
 		screen_info.orig_video_isVGA = 0;
 		return 0;
 	}
+
+	printk(KERN_INFO "efifb: dmi detected %s - framebuffer at %p "
+			 "(%dx%d, stride %d)\n", id->ident,
+			 (void *)screen_info.lfb_base, screen_info.lfb_width,
+			 screen_info.lfb_height, screen_info.lfb_linelength);
+
+
 	return 1;
 }
 
-- 
1.7.4


^ permalink raw reply related

* [PATCH 2/2] efifb: Add override for 11" Macbook Air 3,1
From: Peter Jones @ 2011-03-31 14:33 UTC (permalink / raw)
  To: linux-fbdev

From: Matthew Garrett <mjg@redhat.com>

The 11" Macbook Air appears to claim that its stride is 1366, when it's
actually 2048. Override it.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Peter Jones <pjones@redhat.com>
---
 drivers/video/efifb.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/video/efifb.c b/drivers/video/efifb.c
index 2359b64..4eb38db 100644
--- a/drivers/video/efifb.c
+++ b/drivers/video/efifb.c
@@ -53,6 +53,7 @@ enum {
 	M_MB_7_1,	/* MacBook, 7th rev. */
 	M_MB_SR,	/* MacBook, 2nd gen, (Santa Rosa) */
 	M_MBA,		/* MacBook Air */
+	M_MBA_3,	/* Macbook Air, 3rd rev */
 	M_MBP,		/* MacBook Pro */
 	M_MBP_2,	/* MacBook Pro 2nd gen */
 	M_MBP_2_2,	/* MacBook Pro 2,2nd gen */
@@ -97,6 +98,8 @@ static struct efifb_dmi_info {
 	[M_MB_6_1] = { "macbook61", 0x80010000, 2048 * 4, 1280, 800, OVERRIDE_NONE },
 	[M_MB_7_1] = { "macbook71", 0x80010000, 2048 * 4, 1280, 800, OVERRIDE_NONE },
 	[M_MBA] = { "mba", 0x80000000, 2048 * 4, 1280, 800, OVERRIDE_NONE },
+	/* 11" Macbook Air 3,1 passes the wrong stride */
+	[M_MBA_3] = { "mba3", 0, 2048 * 4, 0, 0, OVERRIDE_STRIDE },
 	[M_MBP] = { "mbp", 0x80010000, 1472 * 4, 1440, 900, OVERRIDE_NONE },
 	[M_MBP_2] = { "mbp2", 0, 0, 0, 0, OVERRIDE_NONE }, /* placeholder */
 	[M_MBP_2_2] = { "mbp22", 0x80010000, 1472 * 4, 1440, 900, OVERRIDE_NONE },
@@ -147,6 +150,7 @@ static const struct dmi_system_id dmi_system_table[] __initconst = {
 	EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBook6,1", M_MB_6_1),
 	EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBook7,1", M_MB_7_1),
 	EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookAir1,1", M_MBA),
+	EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookAir3,1", M_MBA_3),
 	EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBookPro1,1", M_MBP),
 	EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBookPro2,1", M_MBP_2),
 	EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBookPro2,2", M_MBP_2_2),
-- 
1.7.4


^ permalink raw reply related

* Re: [PATCH 1/9] OMAP: DSS2: move dss device clock configuration
From: Tomi Valkeinen @ 2011-04-01  7:07 UTC (permalink / raw)
  To: Archit Taneja; +Cc: linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org
In-Reply-To: <4D957923.2030902@ti.com>

On Fri, 2011-04-01 at 12:35 +0530, Archit Taneja wrote:
> On Thursday 31 March 2011 03:40 PM, Valkeinen, Tomi wrote:
> > Clock configuration was defined inside dssdev.phy.dsi struct. The clock
> > config doesn't really belong there, and so it's moved to dssdev.clock
> > struct.
> >
> > Now the explicit clock configuration could also be used for other
> > interfaces than DSI, although there's no support for it currently.
> >
> > Signed-off-by: Tomi Valkeinen<tomi.valkeinen@ti.com>
> > ---
> >   arch/arm/mach-omap2/board-4430sdp.c       |   14 +++++++++-----
> >   arch/arm/plat-omap/include/plat/display.h |   28 ++++++++++++++++------------
> >   drivers/video/omap2/dss/dsi.c             |   14 +++++++-------
> >   3 files changed, 32 insertions(+), 24 deletions(-)
> >
> > diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
> > index 05288c9..626b16b 100644
> > --- a/arch/arm/mach-omap2/board-4430sdp.c
> > +++ b/arch/arm/mach-omap2/board-4430sdp.c

<snip>

> > @@ -424,6 +412,22 @@ struct omap_dss_device {
> >   	} phy;
> >
> >   	struct {
> > +		struct {
> > +			u16 lck_div;
> > +			u16 pck_div;
> 
> Is it possible to wrap these members around a channel member? The board 
> file can then fill up the lck_div and ppck_div based on what channel it 
> is using.

Hmm. What do you mean "wrap around"? The channel is defined a bit below
there.

 Tomi



^ permalink raw reply

* Re: [PATCH 1/9] OMAP: DSS2: move dss device clock configuration
From: Archit Taneja @ 2011-04-01  7:17 UTC (permalink / raw)
  To: Valkeinen, Tomi; +Cc: linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org
In-Reply-To: <1301566266-11187-2-git-send-email-tomi.valkeinen@ti.com>

On Thursday 31 March 2011 03:40 PM, Valkeinen, Tomi wrote:
> Clock configuration was defined inside dssdev.phy.dsi struct. The clock
> config doesn't really belong there, and so it's moved to dssdev.clock
> struct.
>
> Now the explicit clock configuration could also be used for other
> interfaces than DSI, although there's no support for it currently.
>
> Signed-off-by: Tomi Valkeinen<tomi.valkeinen@ti.com>
> ---
>   arch/arm/mach-omap2/board-4430sdp.c       |   14 +++++++++-----
>   arch/arm/plat-omap/include/plat/display.h |   28 ++++++++++++++++------------
>   drivers/video/omap2/dss/dsi.c             |   14 +++++++-------
>   3 files changed, 32 insertions(+), 24 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
> index 05288c9..626b16b 100644
> --- a/arch/arm/mach-omap2/board-4430sdp.c
> +++ b/arch/arm/mach-omap2/board-4430sdp.c
> @@ -766,17 +766,21 @@ static struct omap_dss_device sdp4430_lcd_device = {
>   		.data1_pol	= 0,
>   		.data2_lane	= 3,
>   		.data2_pol	= 0,
> -		.div		= {
> +	},
> +
> +	.clocks = {
> +		.dispc = {
> +			.lck_div	= 1,	/* Logic Clock = 172.8 MHz */
> +			.pck_div	= 5,	/* Pixel Clock = 34.56 MHz */
> +		},
> +
> +		.dsi = {
>   			.regn		= 16,	/* Fint = 2.4 MHz */
>   			.regm		= 180,	/* DDR Clock = 216 MHz */
>   			.regm_dispc	= 5,	/* PLL1_CLK1 = 172.8 MHz */
>   			.regm_dsi	= 5,	/* PLL1_CLK2 = 172.8 MHz */
>
>   			.lp_clk_div	= 10,	/* LP Clock = 8.64 MHz */
> -
> -			.lck_div	= 1,	/* Logic Clock = 172.8 MHz */
> -			.pck_div	= 5,	/* Pixel Clock = 34.56 MHz */
> -
>   		},
>   	},
>   	.channel		= OMAP_DSS_CHANNEL_LCD,
> diff --git a/arch/arm/plat-omap/include/plat/display.h b/arch/arm/plat-omap/include/plat/display.h
> index 5e04ddc..e10cfe2 100644
> --- a/arch/arm/plat-omap/include/plat/display.h
> +++ b/arch/arm/plat-omap/include/plat/display.h
> @@ -401,18 +401,6 @@ struct omap_dss_device {
>   			u8 data2_lane;
>   			u8 data2_pol;
>
> -			struct {
> -				u16 regn;
> -				u16 regm;
> -				u16 regm_dispc;
> -				u16 regm_dsi;
> -
> -				u16 lp_clk_div;
> -
> -				u16 lck_div;
> -				u16 pck_div;
> -			} div;
> -
>   			bool ext_te;
>   			u8 ext_te_gpio;
>   		} dsi;
> @@ -424,6 +412,22 @@ struct omap_dss_device {
>   	} phy;
>
>   	struct {
> +		struct {
> +			u16 lck_div;
> +			u16 pck_div;

Is it possible to wrap these members around a channel member? The board 
file can then fill up the lck_div and ppck_div based on what channel it 
is using.

Archit

> +		} dispc;
> +
> +		struct {
> +			u16 regn;
> +			u16 regm;
> +			u16 regm_dispc;
> +			u16 regm_dsi;
> +
> +			u16 lp_clk_div;
> +		} dsi;
> +	} clocks;
> +
> +	struct {
>   		struct omap_video_timings timings;
>
>   		int acbi;	/* ac-bias pin transitions per interrupt */
> diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
> index 23d9bbe..7304c87 100644
> --- a/drivers/video/omap2/dss/dsi.c
> +++ b/drivers/video/omap2/dss/dsi.c
> @@ -1026,7 +1026,7 @@ static int dsi_set_lp_clk_divisor(struct omap_dss_device *dssdev)
>   	unsigned lp_clk_div;
>   	unsigned long lp_clk;
>
> -	lp_clk_div = dssdev->phy.dsi.div.lp_clk_div;
> +	lp_clk_div = dssdev->clocks.dsi.lp_clk_div;
>
>   	if (lp_clk_div = 0 || lp_clk_div>  dsi.lpdiv_max)
>   		return -EINVAL;
> @@ -3388,10 +3388,10 @@ static int dsi_configure_dsi_clocks(struct omap_dss_device *dssdev)
>
>   	/* we always use DSS_CLK_SYSCK as input clock */
>   	cinfo.use_sys_clk = true;
> -	cinfo.regn  = dssdev->phy.dsi.div.regn;
> -	cinfo.regm  = dssdev->phy.dsi.div.regm;
> -	cinfo.regm_dispc = dssdev->phy.dsi.div.regm_dispc;
> -	cinfo.regm_dsi = dssdev->phy.dsi.div.regm_dsi;
> +	cinfo.regn  = dssdev->clocks.dsi.regn;
> +	cinfo.regm  = dssdev->clocks.dsi.regm;
> +	cinfo.regm_dispc = dssdev->clocks.dsi.regm_dispc;
> +	cinfo.regm_dsi = dssdev->clocks.dsi.regm_dsi;
>   	r = dsi_calc_clock_rates(dssdev,&cinfo);
>   	if (r) {
>   		DSSERR("Failed to calc dsi clocks\n");
> @@ -3415,8 +3415,8 @@ static int dsi_configure_dispc_clocks(struct omap_dss_device *dssdev)
>
>   	fck = dsi_get_pll_hsdiv_dispc_rate();
>
> -	dispc_cinfo.lck_div = dssdev->phy.dsi.div.lck_div;
> -	dispc_cinfo.pck_div = dssdev->phy.dsi.div.pck_div;
> +	dispc_cinfo.lck_div = dssdev->clocks.dispc.lck_div;
> +	dispc_cinfo.pck_div = dssdev->clocks.dispc.pck_div;
>
>   	r = dispc_calc_clock_rates(fck,&dispc_cinfo);
>   	if (r) {


^ permalink raw reply

* [PATCH] video: s3c-fb: fix checkpatch errors and warning
From: Jingoo Han @ 2011-04-01  7:17 UTC (permalink / raw)
  To: linux-fbdev

This patch fixes the checkpatch errors listed below:

ERROR: space required before the open parenthesis '('
ERROR: need consistent spacing around '+' (ctx:WxV)
ERROR: space prohibited before that close parenthesis ')'

Also, following warning is fixed by adding 'platid' variable
which can reduce number of lines exceeding 80 characters.

WARNING: line over 80 characters

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/video/s3c-fb.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c
index 6817d18..3b6cdca 100644
--- a/drivers/video/s3c-fb.c
+++ b/drivers/video/s3c-fb.c
@@ -48,7 +48,7 @@
 #undef writel
 #define writel(v, r) do { \
 	printk(KERN_DEBUG "%s: %08x => %p\n", __func__, (unsigned int)v, r); \
-	__raw_writel(v, r); } while(0)
+	__raw_writel(v, r); } while (0)
 #endif /* FB_S3C_DEBUG_REGWRITE */
 
 /* irq_flags bits */
@@ -518,7 +518,7 @@ static int s3c_fb_set_par(struct fb_info *info)
 
 		data = VIDTCON2_LINEVAL(var->yres - 1) |
 		       VIDTCON2_HOZVAL(var->xres - 1);
-		writel(data, regs +sfb->variant.vidtcon + 8 );
+		writel(data, regs + sfb->variant.vidtcon + 8);
 	}
 
 	/* write the buffer address */
@@ -1304,6 +1304,7 @@ static void s3c_fb_clear_win(struct s3c_fb *sfb, int win)
 
 static int __devinit s3c_fb_probe(struct platform_device *pdev)
 {
+	const struct platform_device_id *platid;
 	struct s3c_fb_driverdata *fbdrv;
 	struct device *dev = &pdev->dev;
 	struct s3c_fb_platdata *pd;
@@ -1312,7 +1313,8 @@ static int __devinit s3c_fb_probe(struct platform_device *pdev)
 	int win;
 	int ret = 0;
 
-	fbdrv = (struct s3c_fb_driverdata *)platform_get_device_id(pdev)->driver_data;
+	platid = platform_get_device_id(pdev);
+	fbdrv = (struct s3c_fb_driverdata *)platid->driver_data;
 
 	if (fbdrv->variant.nr_windows > S3C_FB_MAX_WIN) {
 		dev_err(dev, "too many windows, cannot attach\n");
-- 
1.7.1


^ permalink raw reply related

* Re: [PATCH 1/9] OMAP: DSS2: move dss device clock configuration
From: Archit Taneja @ 2011-04-01  7:47 UTC (permalink / raw)
  To: Valkeinen, Tomi; +Cc: linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org
In-Reply-To: <1301641628.3393.5.camel@deskari>

On Friday 01 April 2011 12:37 PM, Valkeinen, Tomi wrote:
> On Fri, 2011-04-01 at 12:35 +0530, Archit Taneja wrote:
>> On Thursday 31 March 2011 03:40 PM, Valkeinen, Tomi wrote:
>>> Clock configuration was defined inside dssdev.phy.dsi struct. The clock
>>> config doesn't really belong there, and so it's moved to dssdev.clock
>>> struct.
>>>
>>> Now the explicit clock configuration could also be used for other
>>> interfaces than DSI, although there's no support for it currently.
>>>
>>> Signed-off-by: Tomi Valkeinen<tomi.valkeinen@ti.com>
>>> ---
>>>    arch/arm/mach-omap2/board-4430sdp.c       |   14 +++++++++-----
>>>    arch/arm/plat-omap/include/plat/display.h |   28 ++++++++++++++++------------
>>>    drivers/video/omap2/dss/dsi.c             |   14 +++++++-------
>>>    3 files changed, 32 insertions(+), 24 deletions(-)
>>>
>>> diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
>>> index 05288c9..626b16b 100644
>>> --- a/arch/arm/mach-omap2/board-4430sdp.c
>>> +++ b/arch/arm/mach-omap2/board-4430sdp.c
>
> <snip>
>
>>> @@ -424,6 +412,22 @@ struct omap_dss_device {
>>>    	} phy;
>>>
>>>    	struct {
>>> +		struct {
>>> +			u16 lck_div;
>>> +			u16 pck_div;
>>
>> Is it possible to wrap these members around a channel member? The board
>> file can then fill up the lck_div and ppck_div based on what channel it
>> is using.
>
> Hmm. What do you mean "wrap around"? The channel is defined a bit below
> there.
>

I meant something like:
	
	...
	struct {
		struct {
			struct {
				u16 lck_div;
				u16 pck_div;
			} channel[MAX_CHANNELS];
		} dispc;

		...

		struct {

		} dsi;

	} clocks;
	...

Or something equivalent to the thing above, like using a pointer to an 
array.

Archit

^ permalink raw reply

* Re: [PATCH 1/9] OMAP: DSS2: move dss device clock configuration
From: Tomi Valkeinen @ 2011-04-01  7:50 UTC (permalink / raw)
  To: Archit Taneja; +Cc: linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org
In-Reply-To: <4D958407.1080505@ti.com>

On Fri, 2011-04-01 at 13:21 +0530, Archit Taneja wrote:
> On Friday 01 April 2011 12:37 PM, Valkeinen, Tomi wrote:
> > On Fri, 2011-04-01 at 12:35 +0530, Archit Taneja wrote:
> >> On Thursday 31 March 2011 03:40 PM, Valkeinen, Tomi wrote:
> >>> Clock configuration was defined inside dssdev.phy.dsi struct. The clock
> >>> config doesn't really belong there, and so it's moved to dssdev.clock
> >>> struct.
> >>>
> >>> Now the explicit clock configuration could also be used for other
> >>> interfaces than DSI, although there's no support for it currently.
> >>>
> >>> Signed-off-by: Tomi Valkeinen<tomi.valkeinen@ti.com>
> >>> ---
> >>>    arch/arm/mach-omap2/board-4430sdp.c       |   14 +++++++++-----
> >>>    arch/arm/plat-omap/include/plat/display.h |   28 ++++++++++++++++------------
> >>>    drivers/video/omap2/dss/dsi.c             |   14 +++++++-------
> >>>    3 files changed, 32 insertions(+), 24 deletions(-)
> >>>
> >>> diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
> >>> index 05288c9..626b16b 100644
> >>> --- a/arch/arm/mach-omap2/board-4430sdp.c
> >>> +++ b/arch/arm/mach-omap2/board-4430sdp.c
> >
> > <snip>
> >
> >>> @@ -424,6 +412,22 @@ struct omap_dss_device {
> >>>    	} phy;
> >>>
> >>>    	struct {
> >>> +		struct {
> >>> +			u16 lck_div;
> >>> +			u16 pck_div;
> >>
> >> Is it possible to wrap these members around a channel member? The board
> >> file can then fill up the lck_div and ppck_div based on what channel it
> >> is using.
> >
> > Hmm. What do you mean "wrap around"? The channel is defined a bit below
> > there.
> >
> 
> I meant something like:
> 	
> 	...
> 	struct {
> 		struct {
> 			struct {
> 				u16 lck_div;
> 				u16 pck_div;
> 			} channel[MAX_CHANNELS];
> 		} dispc;
> 
> 		...
> 
> 		struct {
> 
> 		} dsi;
> 
> 	} clocks;
> 	...
> 
> Or something equivalent to the thing above, like using a pointer to an 
> array.

What would be the benefit of that? A dss device can be connected only to
one channel. Now we have the dividers and the channel defined, and
omapdss can use this info to configure the dividers for that channel
properly.

 Tomi



^ permalink raw reply

* [PATCH] unicore32 framebuffer fix: get videomemory by __get_free_pages() and make it floatable
From: Guan Xuetao @ 2011-04-01  8:29 UTC (permalink / raw)
  To: 'Arnd Bergmann'; +Cc: 'Paul Mundt', linux-kernel, linux-fbdev


1. get videomemory by __get_free_pages() in fb-puv3.c
2. remove resource reservation for old fixed UNIGFX_MMAP & UVC_MMAP space
3. remove unused macros: PKUNTIY_UNIGFX_MMAP_BASE, PKUNITY_UNIGFX_MMAP_SIZE,
	PKUNITY_UVC_MMAP_BASE, PKUNITY_UVC_MMAP_SIZE and KUSER_UNIGFX_BASE
4. remove unused header linux/vmalloc.h in fb-puv3.h

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
---
 arch/unicore32/include/mach/PKUnity.h |   10 ----------
 arch/unicore32/include/mach/memory.h  |    1 -
 arch/unicore32/kernel/puv3-core.c     |    5 -----
 arch/unicore32/kernel/setup.c         |   15 ++-------------
 arch/unicore32/mm/mmu.c               |   20 --------------------
 drivers/video/fb-puv3.c               |   28 +++++++++++++++++-----------
 6 files changed, 19 insertions(+), 60 deletions(-)

diff --git a/arch/unicore32/include/mach/PKUnity.h b/arch/unicore32/include/mach/PKUnity.h
index a18bdc3..8040d57 100644
--- a/arch/unicore32/include/mach/PKUnity.h
+++ b/arch/unicore32/include/mach/PKUnity.h
@@ -24,16 +24,6 @@
 #define PKUNITY_MMIO_BASE		0x80000000 /* 0x80000000 - 0xFFFFFFFF 2GB */
 
 /*
- * PKUNITY Memory Map Addresses: 0x0D000000 - 0x0EFFFFFF (32MB)
- *	0x0D000000 - 0x0DFFFFFF 16MB: for UVC
- *	0x0E000000 - 0x0EFFFFFF 16MB: for UNIGFX
- */
-#define PKUNITY_UVC_MMAP_BASE		0x0D000000
-#define PKUNITY_UVC_MMAP_SIZE		0x01000000 /* 16MB */
-#define PKUNITY_UNIGFX_MMAP_BASE        0x0E000000
-#define PKUNITY_UNIGFX_MMAP_SIZE        0x01000000 /* 16MB */
-
-/*
  * PKUNITY System Bus Addresses (PCI): 0x80000000 - 0xBFFFFFFF (1GB)
  * 0x80000000 - 0x8000000B 12B    PCI Configuration regs
  * 0x80010000 - 0x80010250 592B   PCI Bridge Base
diff --git a/arch/unicore32/include/mach/memory.h b/arch/unicore32/include/mach/memory.h
index 0bf21c9..4be72c2 100644
--- a/arch/unicore32/include/mach/memory.h
+++ b/arch/unicore32/include/mach/memory.h
@@ -50,7 +50,6 @@ void puv3_pci_adjust_zones(unsigned long *size, unsigned long *holes);
 
 /* kuser area */
 #define KUSER_VECPAGE_BASE	(KUSER_BASE + UL(0x3fff0000))
-#define KUSER_UNIGFX_BASE	(PAGE_OFFSET + PKUNITY_UNIGFX_MMAP_BASE)
 /* kuser_vecpage (0xbfff0000) is ro, and vectors page (0xffff0000) is rw */
 #define kuser_vecpage_to_vectors(x)	((x) - (KUSER_VECPAGE_BASE)	\
 					+ (VECTORS_BASE))
diff --git a/arch/unicore32/kernel/puv3-core.c b/arch/unicore32/kernel/puv3-core.c
index 8b1b6be..1a505a7 100644
--- a/arch/unicore32/kernel/puv3-core.c
+++ b/arch/unicore32/kernel/puv3-core.c
@@ -99,11 +99,6 @@ static struct resource puv3_unigfx_resources[] = {
 		.end	= io_v2p(PKUNITY_UNIGFX_BASE) + 0xfff,
 		.flags	= IORESOURCE_MEM,
 	},
-	[1] = {
-		.start	= PKUNITY_UNIGFX_MMAP_BASE,
-		.end	= PKUNITY_UNIGFX_MMAP_BASE + PKUNITY_UNIGFX_MMAP_SIZE,
-		.flags	= IORESOURCE_MEM,
-	},
 };
 
 static struct resource puv3_rtc_resources[] = {
diff --git a/arch/unicore32/kernel/setup.c b/arch/unicore32/kernel/setup.c
index 1e175a8..471b6bc 100644
--- a/arch/unicore32/kernel/setup.c
+++ b/arch/unicore32/kernel/setup.c
@@ -64,12 +64,6 @@ static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
  */
 static struct resource mem_res[] = {
 	{
-		.name = "Video RAM",
-		.start = 0,
-		.end = 0,
-		.flags = IORESOURCE_MEM
-	},
-	{
 		.name = "Kernel text",
 		.start = 0,
 		.end = 0,
@@ -83,9 +77,8 @@ static struct resource mem_res[] = {
 	}
 };
 
-#define video_ram   mem_res[0]
-#define kernel_code mem_res[1]
-#define kernel_data mem_res[2]
+#define kernel_code mem_res[0]
+#define kernel_data mem_res[1]
 
 /*
  * These functions re-use the assembly code in head.S, which
@@ -224,10 +217,6 @@ request_standard_resources(struct meminfo *mi)
 		    kernel_data.end <= res->end)
 			request_resource(res, &kernel_data);
 	}
-
-	video_ram.start = PKUNITY_UNIGFX_MMAP_BASE;
-	video_ram.end   = PKUNITY_UNIGFX_MMAP_BASE + PKUNITY_UNIGFX_MMAP_SIZE;
-	request_resource(&iomem_resource, &video_ram);
 }
 
 static void (*init_machine)(void) __initdata;
diff --git a/arch/unicore32/mm/mmu.c b/arch/unicore32/mm/mmu.c
index 7bf3d58..db2d334 100644
--- a/arch/unicore32/mm/mmu.c
+++ b/arch/unicore32/mm/mmu.c
@@ -338,15 +338,6 @@ void __init uc32_mm_memblock_reserve(void)
 	 * and can only be in node 0.
 	 */
 	memblock_reserve(__pa(swapper_pg_dir), PTRS_PER_PGD * sizeof(pgd_t));
-
-#ifdef CONFIG_PUV3_UNIGFX
-	/*
-	 * These should likewise go elsewhere.  They pre-reserve the
-	 * screen/video memory region at the 48M~64M of main system memory.
-	 */
-	memblock_reserve(PKUNITY_UNIGFX_MMAP_BASE, PKUNITY_UNIGFX_MMAP_SIZE);
-	memblock_reserve(PKUNITY_UVC_MMAP_BASE, PKUNITY_UVC_MMAP_SIZE);
-#endif
 }
 
 /*
@@ -371,17 +362,6 @@ static void __init devicemaps_init(void)
 		pmd_clear(pmd_off_k(addr));
 
 	/*
-	 * Create a mapping for UniGFX VRAM
-	 */
-#ifdef CONFIG_PUV3_UNIGFX
-	map.pfn = __phys_to_pfn(PKUNITY_UNIGFX_MMAP_BASE);
-	map.virtual = KUSER_UNIGFX_BASE;
-	map.length = PKUNITY_UNIGFX_MMAP_SIZE;
-	map.type = MT_KUSER;
-	create_mapping(&map);
-#endif
-
-	/*
 	 * Create a mapping for the machine vectors at the high-vectors
 	 * location (0xffff0000).  If we aren't using high-vectors, also
 	 * create a mapping at the low-vectors virtual address.
diff --git a/drivers/video/fb-puv3.c b/drivers/video/fb-puv3.c
index dbd2dc4..27f2c57 100644
--- a/drivers/video/fb-puv3.c
+++ b/drivers/video/fb-puv3.c
@@ -13,7 +13,6 @@
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
-#include <linux/vmalloc.h>
 #include <linux/platform_device.h>
 #include <linux/clk.h>
 #include <linux/fb.h>
@@ -531,7 +530,7 @@ static int unifb_set_par(struct fb_info *info)
 		return -EINVAL;
 	}
 
-	writel(PKUNITY_UNIGFX_MMAP_BASE, UDE_FSA);
+	writel(info->fix.smem_start, UDE_FSA);
 	writel(info->var.yres, UDE_LS);
 	writel(get_line_length(info->var.xres,
 			info->var.bits_per_pixel) >> 3, UDE_PS);
@@ -680,13 +679,27 @@ static int unifb_probe(struct platform_device *dev)
 	struct fb_info *info;
 	u32 unifb_regs[UNIFB_REGS_NUM];
 	int retval = -ENOMEM;
-	struct resource *iomem, *mapmem;
+	struct resource *iomem;
+	void *videomemory;
+
+	videomemory = (void *)__get_free_pages(GFP_KERNEL | __GFP_COMP,
+				get_order(UNIFB_MEMSIZE));
+	if (!videomemory)
+		goto err;
+
+	memset(videomemory, 0, UNIFB_MEMSIZE);
+
+	unifb_fix.smem_start = virt_to_phys(videomemory);
+	unifb_fix.smem_len = UNIFB_MEMSIZE;
+
+	iomem = platform_get_resource(dev, IORESOURCE_MEM, 0);
+	unifb_fix.mmio_start = iomem->start;
 
 	info = framebuffer_alloc(sizeof(u32)*256, &dev->dev);
 	if (!info)
 		goto err;
 
-	info->screen_base = (char __iomem *)KUSER_UNIGFX_BASE;
+	info->screen_base = (char __iomem *)videomemory;
 	info->fbops = &unifb_ops;
 
 	retval = fb_find_mode(&info->var, info, NULL,
@@ -695,13 +708,6 @@ static int unifb_probe(struct platform_device *dev)
 	if (!retval || (retval = 4))
 		info->var = unifb_default;
 
-	iomem = platform_get_resource(dev, IORESOURCE_MEM, 0);
-	unifb_fix.mmio_start = iomem->start;
-
-	mapmem = platform_get_resource(dev, IORESOURCE_MEM, 1);
-	unifb_fix.smem_start = mapmem->start;
-	unifb_fix.smem_len = UNIFB_MEMSIZE;
-
 	info->fix = unifb_fix;
 	info->pseudo_palette = info->par;
 	info->par = NULL;
-- 
1.6.2.2



^ permalink raw reply related

* Re: [PATCH 1/9] OMAP: DSS2: move dss device clock configuration
From: Archit Taneja @ 2011-04-01  8:31 UTC (permalink / raw)
  To: Valkeinen, Tomi; +Cc: linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org
In-Reply-To: <1301644231.3393.20.camel@deskari>

On Friday 01 April 2011 01:20 PM, Valkeinen, Tomi wrote:
> On Fri, 2011-04-01 at 13:21 +0530, Archit Taneja wrote:
>> On Friday 01 April 2011 12:37 PM, Valkeinen, Tomi wrote:
>>> On Fri, 2011-04-01 at 12:35 +0530, Archit Taneja wrote:
>>>> On Thursday 31 March 2011 03:40 PM, Valkeinen, Tomi wrote:
>>>>> Clock configuration was defined inside dssdev.phy.dsi struct. The clock
>>>>> config doesn't really belong there, and so it's moved to dssdev.clock
>>>>> struct.
>>>>>
>>>>> Now the explicit clock configuration could also be used for other
>>>>> interfaces than DSI, although there's no support for it currently.
>>>>>
>>>>> Signed-off-by: Tomi Valkeinen<tomi.valkeinen@ti.com>
>>>>> ---
>>>>>     arch/arm/mach-omap2/board-4430sdp.c       |   14 +++++++++-----
>>>>>     arch/arm/plat-omap/include/plat/display.h |   28 ++++++++++++++++------------
>>>>>     drivers/video/omap2/dss/dsi.c             |   14 +++++++-------
>>>>>     3 files changed, 32 insertions(+), 24 deletions(-)
>>>>>

<snip>

>> I meant something like:
>> 	
>> 	...
>> 	struct {
>> 		struct {
>> 			struct {
>> 				u16 lck_div;
>> 				u16 pck_div;
>> 			} channel[MAX_CHANNELS];
>> 		} dispc;
>>
>> 		...
>>
>> 		struct {
>>
>> 		} dsi;
>>
>> 	} clocks;
>> 	...
>>
>> Or something equivalent to the thing above, like using a pointer to an
>> array.
>
> What would be the benefit of that? A dss device can be connected only to
> one channel. Now we have the dividers and the channel defined, and
> omapdss can use this info to configure the dividers for that channel
> properly.

Okay, I guess channel wasn't the best example to explain my point, and I 
guess its safe for dss device not to touch any other channels (currently 
ignoring complex bridge chips which can merge data of 2 LCD channels 
onto one panel).

But there are some parameters which might get common across dss devices.
Things like dispc clock source, dispc core clock divider will be shared 
across the panels. We had discussed the possibility of declaring this 
common info in omap_dss_board_info or as a separate common_clocks 
structure. Each device could pick this filled up common_clocks struct, 
or fill it up its own way (for the use cases which has only one panel on 
at a time). I was wondering if it would be easy to move to this approach 
with your patch. dispc itself would now have some common clock stuff and 
per panel clock stuff. Is that a very clean approach?

Anyway, I think it would be good to have a channel struct, as there are 
more things to put in dispc clocks, it should look something like:

struct clocks {
		struct {
			struct {
				u16 lck_div;
				u16 pck_div;
				enum clock_source lcd_clk_src;
			} channel;
			...
			...
			u16 core_clk_div;
		} dispc;
		...
		...
};

Archit

^ permalink raw reply

* Re: [PATCH 1/9] OMAP: DSS2: move dss device clock configuration
From: Tomi Valkeinen @ 2011-04-01  8:39 UTC (permalink / raw)
  To: Archit Taneja; +Cc: linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org
In-Reply-To: <4D958A91.90807@ti.com>

On Fri, 2011-04-01 at 13:49 +0530, Archit Taneja wrote:

> But there are some parameters which might get common across dss devices.
> Things like dispc clock source, dispc core clock divider will be shared 
> across the panels. We had discussed the possibility of declaring this 
> common info in omap_dss_board_info or as a separate common_clocks 
> structure. Each device could pick this filled up common_clocks struct, 
> or fill it up its own way (for the use cases which has only one panel on 
> at a time). I was wondering if it would be easy to move to this approach 
> with your patch. dispc itself would now have some common clock stuff and 
> per panel clock stuff. Is that a very clean approach?

I don't know =). I think the simplest solution is to have full divisor
info for each dss_device. And it's up to the board file writer to make
sure the divisors match for all the displays that can be enabled at the
same time.

I don't think that is perfect, but trying to share the data sounds a bit
confusing. Especially as there are just a divisor and a clock source
that are shared. If we have a lot of common data, then a shared struct
would of course be better.

> Anyway, I think it would be good to have a channel struct, as there are 
> more things to put in dispc clocks, it should look something like:
> 
> struct clocks {
> 		struct {
> 			struct {
> 				u16 lck_div;
> 				u16 pck_div;
> 				enum clock_source lcd_clk_src;
> 			} channel;
> 			...
> 			...
> 			u16 core_clk_div;
> 		} dispc;
> 		...
> 		...
> };

In my original patch I had:

        struct {
                struct {
                        u16 fck_div;
                } dss;

                struct {
                        u16 lck_div;
                        u16 pck_div;

                        bool fclk_from_dsi_pll;
                } dispc;

		...
	};

Which I removed due to comments and slight confusion how to handle the
DSS_FCLK divisor and the clock source.

Adding the clock source there needs some more work, moving the enum to
public include file, and implementing the support. If you agree that
this patch in its current form is an improvement, I'd like to go forward
with this and work on the clock source later.

 Tomi



^ permalink raw reply

* Re: [PATCH] unicore32 framebuffer fix: get videomemory by __get_free_pages() and make it floatable
From: Arnd Bergmann @ 2011-04-01  9:07 UTC (permalink / raw)
  To: Guan Xuetao; +Cc: 'Paul Mundt', linux-kernel, linux-fbdev
In-Reply-To: <003d01cbf046$f4947ca0$ddbd75e0$@mprc.pku.edu.cn>

On Friday 01 April 2011, Guan Xuetao wrote:
> 1. get videomemory by __get_free_pages() in fb-puv3.c
> 2. remove resource reservation for old fixed UNIGFX_MMAP & UVC_MMAP space
> 3. remove unused macros: PKUNTIY_UNIGFX_MMAP_BASE, PKUNITY_UNIGFX_MMAP_SIZE,
>         PKUNITY_UVC_MMAP_BASE, PKUNITY_UVC_MMAP_SIZE and KUSER_UNIGFX_BASE
> 4. remove unused header linux/vmalloc.h in fb-puv3.h
> 
> Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>

Acked-by: Arnd Bergmann <arnd@arndb.de>

^ permalink raw reply

* Re: [PATCH 1/9] OMAP: DSS2: move dss device clock configuration
From: Archit Taneja @ 2011-04-01  9:38 UTC (permalink / raw)
  To: Valkeinen, Tomi; +Cc: linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org
In-Reply-To: <1301647184.3393.29.camel@deskari>

On Friday 01 April 2011 02:09 PM, Valkeinen, Tomi wrote:
> On Fri, 2011-04-01 at 13:49 +0530, Archit Taneja wrote:
>
>> But there are some parameters which might get common across dss devices.
>> Things like dispc clock source, dispc core clock divider will be shared
>> across the panels. We had discussed the possibility of declaring this
>> common info in omap_dss_board_info or as a separate common_clocks
>> structure. Each device could pick this filled up common_clocks struct,
>> or fill it up its own way (for the use cases which has only one panel on
>> at a time). I was wondering if it would be easy to move to this approach
>> with your patch. dispc itself would now have some common clock stuff and
>> per panel clock stuff. Is that a very clean approach?
>
> I don't know =). I think the simplest solution is to have full divisor
> info for each dss_device. And it's up to the board file writer to make
> sure the divisors match for all the displays that can be enabled at the
> same time.
>
> I don't think that is perfect, but trying to share the data sounds a bit
> confusing. Especially as there are just a divisor and a clock source
> that are shared. If we have a lot of common data, then a shared struct
> would of course be better.
>
>> Anyway, I think it would be good to have a channel struct, as there are
>> more things to put in dispc clocks, it should look something like:
>>
>> struct clocks {
>> 		struct {
>> 			struct {
>> 				u16 lck_div;
>> 				u16 pck_div;
>> 				enum clock_source lcd_clk_src;
>> 			} channel;
>> 			...
>> 			...
>> 			u16 core_clk_div;
>> 		} dispc;
>> 		...
>> 		...
>> };
>
> In my original patch I had:
>
>          struct {
>                  struct {
>                          u16 fck_div;
>                  } dss;
>
>                  struct {
>                          u16 lck_div;
>                          u16 pck_div;
>
>                          bool fclk_from_dsi_pll;
>                  } dispc;
>
> 		...
> 	};
>
> Which I removed due to comments and slight confusion how to handle the
> DSS_FCLK divisor and the clock source.
>
> Adding the clock source there needs some more work, moving the enum to
> public include file, and implementing the support. If you agree that
> this patch in its current form is an improvement, I'd like to go forward
> with this and work on the clock source later.

Yeah it is, sure.

Archit

^ permalink raw reply

* [PATCH 0/5] OMAP: DSS: add __inits and __exits
From: Tomi Valkeinen @ 2011-04-01 10:00 UTC (permalink / raw)
  To: linux-omap, linux-fbdev; +Cc: Tomi Valkeinen

These patches add __inits and __exits to multiple functions in omapdss and
panel drivers. Also omap_dss_register_driver_probe() is added which allows us
to define panel driver probe functions as __init.

This moved almost 7kB from .text section to .init section on my configuration.

Tomi Valkeinen (5):
  OMAP: DSS2: make omap_dss_(un)register_device static
  OMAP: DSS2: add __inits to omapdss driver
  OMAP: DSS2: use __exit for selected panel drivers
  OMAP: DSS2: Add omap_dss_register_driver_probe()
  OMAP: DSS2: use omap_dss_register_driver_probe() in selected drivers

 arch/arm/plat-omap/include/plat/display.h          |    5 +-
 drivers/video/omap2/displays/panel-generic-dpi.c   |   10 ++--
 .../video/omap2/displays/panel-sharp-ls037v7dw01.c |   10 ++--
 drivers/video/omap2/displays/panel-taal.c          |    9 +--
 drivers/video/omap2/dss/core.c                     |   64 +++++++++++++++++---
 drivers/video/omap2/dss/dispc.c                    |    7 +-
 drivers/video/omap2/dss/dpi.c                      |    2 +-
 drivers/video/omap2/dss/dsi.c                      |    7 +-
 drivers/video/omap2/dss/dss.c                      |    9 +--
 drivers/video/omap2/dss/dss_features.c             |    2 +-
 drivers/video/omap2/dss/hdmi.c                     |    8 +-
 drivers/video/omap2/dss/manager.c                  |    2 +-
 drivers/video/omap2/dss/overlay.c                  |    2 +-
 drivers/video/omap2/dss/rfbi.c                     |    7 +-
 drivers/video/omap2/dss/sdi.c                      |    2 +-
 drivers/video/omap2/dss/venc.c                     |    7 +-
 16 files changed, 96 insertions(+), 57 deletions(-)


^ permalink raw reply

* [PATCH 1/5] OMAP: DSS2: make omap_dss_(un)register_device static
From: Tomi Valkeinen @ 2011-04-01 10:00 UTC (permalink / raw)
  To: linux-omap, linux-fbdev; +Cc: Tomi Valkeinen
In-Reply-To: <1301652030-32223-1-git-send-email-tomi.valkeinen@ti.com>

omap_dss_register_device and omap_dss_unregister_device can only be
called from core.c, so we can make it static.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 arch/arm/plat-omap/include/plat/display.h |    3 ---
 drivers/video/omap2/dss/core.c            |    7 +++++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/display.h b/arch/arm/plat-omap/include/plat/display.h
index 5e04ddc..e239a0d 100644
--- a/arch/arm/plat-omap/include/plat/display.h
+++ b/arch/arm/plat-omap/include/plat/display.h
@@ -519,9 +519,6 @@ struct omap_dss_driver {
 int omap_dss_register_driver(struct omap_dss_driver *);
 void omap_dss_unregister_driver(struct omap_dss_driver *);
 
-int omap_dss_register_device(struct omap_dss_device *);
-void omap_dss_unregister_device(struct omap_dss_device *);
-
 void omap_dss_get_device(struct omap_dss_device *dssdev);
 void omap_dss_put_device(struct omap_dss_device *dssdev);
 #define for_each_dss_dev(d) while ((d = omap_dss_get_next_device(d)) != NULL)
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 1aa2ed1..9bcb0b8 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -54,6 +54,9 @@ unsigned int dss_debug;
 module_param_named(debug, dss_debug, bool, 0644);
 #endif
 
+static int omap_dss_register_device(struct omap_dss_device *);
+static void omap_dss_unregister_device(struct omap_dss_device *);
+
 /* REGULATORS */
 
 struct regulator *dss_get_vdds_dsi(void)
@@ -480,7 +483,7 @@ static void omap_dss_dev_release(struct device *dev)
 	reset_device(dev, 0);
 }
 
-int omap_dss_register_device(struct omap_dss_device *dssdev)
+static int omap_dss_register_device(struct omap_dss_device *dssdev)
 {
 	static int dev_num;
 
@@ -494,7 +497,7 @@ int omap_dss_register_device(struct omap_dss_device *dssdev)
 	return device_register(&dssdev->dev);
 }
 
-void omap_dss_unregister_device(struct omap_dss_device *dssdev)
+static void omap_dss_unregister_device(struct omap_dss_device *dssdev)
 {
 	device_unregister(&dssdev->dev);
 }
-- 
1.7.1


^ permalink raw reply related

* [PATCH 2/5] OMAP: DSS2: add __inits to omapdss driver
From: Tomi Valkeinen @ 2011-04-01 10:00 UTC (permalink / raw)
  To: linux-omap, linux-fbdev; +Cc: Tomi Valkeinen
In-Reply-To: <1301652030-32223-1-git-send-email-tomi.valkeinen@ti.com>

We can use platform_driver_probe() instead of platform_driver_register()
and thus add __init to many functions in omapdss driver.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/video/omap2/dss/core.c         |   15 +++++++--------
 drivers/video/omap2/dss/dispc.c        |    7 +++----
 drivers/video/omap2/dss/dpi.c          |    2 +-
 drivers/video/omap2/dss/dsi.c          |    7 +++----
 drivers/video/omap2/dss/dss.c          |    9 ++++-----
 drivers/video/omap2/dss/dss_features.c |    2 +-
 drivers/video/omap2/dss/hdmi.c         |    8 ++++----
 drivers/video/omap2/dss/manager.c      |    2 +-
 drivers/video/omap2/dss/overlay.c      |    2 +-
 drivers/video/omap2/dss/rfbi.c         |    7 +++----
 drivers/video/omap2/dss/sdi.c          |    2 +-
 drivers/video/omap2/dss/venc.c         |    7 +++----
 12 files changed, 32 insertions(+), 38 deletions(-)

diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 9bcb0b8..3584e3e 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -109,7 +109,7 @@ static const struct file_operations dss_debug_fops = {
 
 static struct dentry *dss_debugfs_dir;
 
-static int dss_initialize_debugfs(void)
+static int __init dss_initialize_debugfs(void)
 {
 	dss_debugfs_dir = debugfs_create_dir("omapdss", NULL);
 	if (IS_ERR(dss_debugfs_dir)) {
@@ -156,7 +156,7 @@ static void dss_uninitialize_debugfs(void)
 		debugfs_remove_recursive(dss_debugfs_dir);
 }
 #else /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */
-static inline int dss_initialize_debugfs(void)
+static inline int __init dss_initialize_debugfs(void)
 {
 	return 0;
 }
@@ -166,7 +166,7 @@ static inline void dss_uninitialize_debugfs(void)
 #endif /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */
 
 /* PLATFORM DEVICE */
-static int omap_dss_probe(struct platform_device *pdev)
+static int __init omap_dss_probe(struct platform_device *pdev)
 {
 	struct omap_dss_board_info *pdata = pdev->dev.platform_data;
 	int r;
@@ -307,7 +307,6 @@ static int omap_dss_resume(struct platform_device *pdev)
 }
 
 static struct platform_driver omap_dss_driver = {
-	.probe          = omap_dss_probe,
 	.remove         = omap_dss_remove,
 	.shutdown	= omap_dss_shutdown,
 	.suspend	= omap_dss_suspend,
@@ -483,7 +482,7 @@ static void omap_dss_dev_release(struct device *dev)
 	reset_device(dev, 0);
 }
 
-static int omap_dss_register_device(struct omap_dss_device *dssdev)
+static int __init omap_dss_register_device(struct omap_dss_device *dssdev)
 {
 	static int dev_num;
 
@@ -503,7 +502,7 @@ static void omap_dss_unregister_device(struct omap_dss_device *dssdev)
 }
 
 /* BUS */
-static int omap_dss_bus_register(void)
+static int __init omap_dss_bus_register(void)
 {
 	int r;
 
@@ -542,7 +541,7 @@ static int __init omap_dss_init(void)
 	if (r)
 		return r;
 
-	r = platform_driver_register(&omap_dss_driver);
+	r = platform_driver_probe(&omap_dss_driver, omap_dss_probe);
 	if (r) {
 		omap_dss_bus_unregister();
 		return r;
@@ -578,7 +577,7 @@ static int __init omap_dss_init(void)
 
 static int __init omap_dss_init2(void)
 {
-	return platform_driver_register(&omap_dss_driver);
+	return platform_driver_probe(&omap_dss_driver, omap_dss_probe);
 }
 
 core_initcall(omap_dss_init);
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 7804779..8cfc9f0 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -3419,7 +3419,7 @@ int dispc_setup_plane(enum omap_plane plane,
 }
 
 /* DISPC HW IP initialisation */
-static int omap_dispchw_probe(struct platform_device *pdev)
+static int __init omap_dispchw_probe(struct platform_device *pdev)
 {
 	u32 rev;
 	int r = 0;
@@ -3491,7 +3491,6 @@ static int omap_dispchw_remove(struct platform_device *pdev)
 }
 
 static struct platform_driver omap_dispchw_driver = {
-	.probe          = omap_dispchw_probe,
 	.remove         = omap_dispchw_remove,
 	.driver         = {
 		.name   = "omapdss_dispc",
@@ -3499,9 +3498,9 @@ static struct platform_driver omap_dispchw_driver = {
 	},
 };
 
-int dispc_init_platform_driver(void)
+int __init dispc_init_platform_driver(void)
 {
-	return platform_driver_register(&omap_dispchw_driver);
+	return platform_driver_probe(&omap_dispchw_driver, omap_dispchw_probe);
 }
 
 void dispc_uninit_platform_driver(void)
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index 2d3ca4c..4e8ea50 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -319,7 +319,7 @@ int dpi_init_display(struct omap_dss_device *dssdev)
 	return 0;
 }
 
-int dpi_init(void)
+int __init dpi_init(void)
 {
 	return 0;
 }
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 23d9bbe..102bd70 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -3819,7 +3819,7 @@ static void dsi_exit(void)
 }
 
 /* DSI1 HW IP initialisation */
-static int omap_dsi1hw_probe(struct platform_device *pdev)
+static int __init omap_dsi1hw_probe(struct platform_device *pdev)
 {
 	int r;
 	dsi.pdev = pdev;
@@ -3839,7 +3839,6 @@ static int omap_dsi1hw_remove(struct platform_device *pdev)
 }
 
 static struct platform_driver omap_dsi1hw_driver = {
-	.probe          = omap_dsi1hw_probe,
 	.remove         = omap_dsi1hw_remove,
 	.driver         = {
 		.name   = "omapdss_dsi1",
@@ -3847,9 +3846,9 @@ static struct platform_driver omap_dsi1hw_driver = {
 	},
 };
 
-int dsi_init_platform_driver(void)
+int __init dsi_init_platform_driver(void)
 {
-	return platform_driver_register(&omap_dsi1hw_driver);
+	return platform_driver_probe(&omap_dsi1hw_driver, omap_dsi1hw_probe);
 }
 
 void dsi_uninit_platform_driver(void)
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index 9a73af6..428cc8f 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -635,7 +635,7 @@ void dss_select_hdmi_venc_clk_source(enum dss_hdmi_venc_clk_source_select hdmi)
 	REG_FLD_MOD(DSS_CONTROL, hdmi, 15, 15);	/* VENC_HDMI_SWITCH */
 }
 
-static int dss_init(void)
+static int __init dss_init(void)
 {
 	int r;
 	u32 rev;
@@ -1088,7 +1088,7 @@ void dss_debug_dump_clocks(struct seq_file *s)
 
 
 /* DSS HW IP initialisation */
-static int omap_dsshw_probe(struct platform_device *pdev)
+static int __init omap_dsshw_probe(struct platform_device *pdev)
 {
 	int r;
 
@@ -1152,7 +1152,6 @@ static int omap_dsshw_remove(struct platform_device *pdev)
 }
 
 static struct platform_driver omap_dsshw_driver = {
-	.probe          = omap_dsshw_probe,
 	.remove         = omap_dsshw_remove,
 	.driver         = {
 		.name   = "omapdss_dss",
@@ -1160,9 +1159,9 @@ static struct platform_driver omap_dsshw_driver = {
 	},
 };
 
-int dss_init_platform_driver(void)
+int __init dss_init_platform_driver(void)
 {
-	return platform_driver_register(&omap_dsshw_driver);
+	return platform_driver_probe(&omap_dsshw_driver, omap_dsshw_probe);
 }
 
 void dss_uninit_platform_driver(void)
diff --git a/drivers/video/omap2/dss/dss_features.c b/drivers/video/omap2/dss/dss_features.c
index 179a7a4..f30b917 100644
--- a/drivers/video/omap2/dss/dss_features.c
+++ b/drivers/video/omap2/dss/dss_features.c
@@ -360,7 +360,7 @@ void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end)
 	*end = omap_current_dss_features->reg_fields[id].end;
 }
 
-void dss_features_init(void)
+void __init dss_features_init(void)
 {
 	if (cpu_is_omap24xx())
 		omap_current_dss_features = &omap2_dss_features;
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 0d44f07..ce07539 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -1276,7 +1276,7 @@ void omapdss_hdmi_display_disable(struct omap_dss_device *dssdev)
 }
 
 /* HDMI HW IP initialisation */
-static int omapdss_hdmihw_probe(struct platform_device *pdev)
+static int __init omapdss_hdmihw_probe(struct platform_device *pdev)
 {
 	struct resource *hdmi_mem;
 
@@ -1313,7 +1313,6 @@ static int omapdss_hdmihw_remove(struct platform_device *pdev)
 }
 
 static struct platform_driver omapdss_hdmihw_driver = {
-	.probe          = omapdss_hdmihw_probe,
 	.remove         = omapdss_hdmihw_remove,
 	.driver         = {
 		.name   = "omapdss_hdmi",
@@ -1321,9 +1320,10 @@ static struct platform_driver omapdss_hdmihw_driver = {
 	},
 };
 
-int hdmi_init_platform_driver(void)
+int __init hdmi_init_platform_driver(void)
 {
-	return platform_driver_register(&omapdss_hdmihw_driver);
+	return platform_driver_probe(&omapdss_hdmihw_driver,
+			omapdss_hdmihw_probe);
 }
 
 void hdmi_uninit_platform_driver(void)
diff --git a/drivers/video/omap2/dss/manager.c b/drivers/video/omap2/dss/manager.c
index bcd37ec..08152a7 100644
--- a/drivers/video/omap2/dss/manager.c
+++ b/drivers/video/omap2/dss/manager.c
@@ -1475,7 +1475,7 @@ static void omap_dss_add_overlay_manager(struct omap_overlay_manager *manager)
 	list_add_tail(&manager->list, &manager_list);
 }
 
-int dss_init_overlay_managers(struct platform_device *pdev)
+int __init dss_init_overlay_managers(struct platform_device *pdev)
 {
 	int i, r;
 
diff --git a/drivers/video/omap2/dss/overlay.c b/drivers/video/omap2/dss/overlay.c
index f1aca6d..96f304a 100644
--- a/drivers/video/omap2/dss/overlay.c
+++ b/drivers/video/omap2/dss/overlay.c
@@ -570,7 +570,7 @@ void dss_overlay_setup_l4_manager(struct omap_overlay_manager *mgr)
 }
 #endif
 
-void dss_init_overlays(struct platform_device *pdev)
+void __init dss_init_overlays(struct platform_device *pdev)
 {
 	int i, r;
 
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c
index 5ea17f4..8bbe83e 100644
--- a/drivers/video/omap2/dss/rfbi.c
+++ b/drivers/video/omap2/dss/rfbi.c
@@ -1013,7 +1013,7 @@ int rfbi_init_display(struct omap_dss_device *dssdev)
 }
 
 /* RFBI HW IP initialisation */
-static int omap_rfbihw_probe(struct platform_device *pdev)
+static int __init omap_rfbihw_probe(struct platform_device *pdev)
 {
 	u32 rev;
 	u32 l;
@@ -1065,7 +1065,6 @@ static int omap_rfbihw_remove(struct platform_device *pdev)
 }
 
 static struct platform_driver omap_rfbihw_driver = {
-	.probe          = omap_rfbihw_probe,
 	.remove         = omap_rfbihw_remove,
 	.driver         = {
 		.name   = "omapdss_rfbi",
@@ -1073,9 +1072,9 @@ static struct platform_driver omap_rfbihw_driver = {
 	},
 };
 
-int rfbi_init_platform_driver(void)
+int __init rfbi_init_platform_driver(void)
 {
-	return platform_driver_register(&omap_rfbihw_driver);
+	return platform_driver_probe(&omap_rfbihw_driver, omap_rfbihw_probe);
 }
 
 void rfbi_uninit_platform_driver(void)
diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c
index 54a53e6..87d5a7e 100644
--- a/drivers/video/omap2/dss/sdi.c
+++ b/drivers/video/omap2/dss/sdi.c
@@ -160,7 +160,7 @@ int sdi_init_display(struct omap_dss_device *dssdev)
 	return 0;
 }
 
-int sdi_init(void)
+int __init sdi_init(void)
 {
 	return 0;
 }
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c
index 8e35a5b..c56c16b 100644
--- a/drivers/video/omap2/dss/venc.c
+++ b/drivers/video/omap2/dss/venc.c
@@ -714,7 +714,7 @@ void venc_dump_regs(struct seq_file *s)
 }
 
 /* VENC HW IP initialisation */
-static int omap_venchw_probe(struct platform_device *pdev)
+static int __init omap_venchw_probe(struct platform_device *pdev)
 {
 	u8 rev_id;
 	struct resource *venc_mem;
@@ -759,7 +759,6 @@ static int omap_venchw_remove(struct platform_device *pdev)
 }
 
 static struct platform_driver omap_venchw_driver = {
-	.probe          = omap_venchw_probe,
 	.remove         = omap_venchw_remove,
 	.driver         = {
 		.name   = "omapdss_venc",
@@ -767,12 +766,12 @@ static struct platform_driver omap_venchw_driver = {
 	},
 };
 
-int venc_init_platform_driver(void)
+int __init venc_init_platform_driver(void)
 {
 	if (cpu_is_omap44xx())
 		return 0;
 
-	return platform_driver_register(&omap_venchw_driver);
+	return platform_driver_probe(&omap_venchw_driver, omap_venchw_probe);
 }
 
 void venc_uninit_platform_driver(void)
-- 
1.7.1


^ permalink raw reply related

* [PATCH 3/5] OMAP: DSS2: use __exit for selected panel drivers
From: Tomi Valkeinen @ 2011-04-01 10:00 UTC (permalink / raw)
  To: linux-omap, linux-fbdev; +Cc: Tomi Valkeinen
In-Reply-To: <1301652030-32223-1-git-send-email-tomi.valkeinen@ti.com>

We can use __exit for the driver remove function in plain dss panels
(ie. those that do not need i2c or spi).

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/video/omap2/displays/panel-generic-dpi.c   |    4 ++--
 .../video/omap2/displays/panel-sharp-ls037v7dw01.c |    4 ++--
 drivers/video/omap2/displays/panel-taal.c          |    4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/video/omap2/displays/panel-generic-dpi.c b/drivers/video/omap2/displays/panel-generic-dpi.c
index 4a9b9ff..e359f93 100644
--- a/drivers/video/omap2/displays/panel-generic-dpi.c
+++ b/drivers/video/omap2/displays/panel-generic-dpi.c
@@ -285,7 +285,7 @@ static int generic_dpi_panel_probe(struct omap_dss_device *dssdev)
 	return 0;
 }
 
-static void generic_dpi_panel_remove(struct omap_dss_device *dssdev)
+static void __exit generic_dpi_panel_remove(struct omap_dss_device *dssdev)
 {
 	struct panel_drv_data *drv_data = dev_get_drvdata(&dssdev->dev);
 
@@ -358,7 +358,7 @@ static int generic_dpi_panel_check_timings(struct omap_dss_device *dssdev,
 
 static struct omap_dss_driver dpi_driver = {
 	.probe		= generic_dpi_panel_probe,
-	.remove		= generic_dpi_panel_remove,
+	.remove		= __exit_p(generic_dpi_panel_remove),
 
 	.enable		= generic_dpi_panel_enable,
 	.disable	= generic_dpi_panel_disable,
diff --git a/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c b/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c
index d2b35d2..c772747 100644
--- a/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c
+++ b/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c
@@ -120,7 +120,7 @@ static int sharp_ls_panel_probe(struct omap_dss_device *dssdev)
 	return 0;
 }
 
-static void sharp_ls_panel_remove(struct omap_dss_device *dssdev)
+static void __exit sharp_ls_panel_remove(struct omap_dss_device *dssdev)
 {
 	struct sharp_data *sd = dev_get_drvdata(&dssdev->dev);
 	struct backlight_device *bl = sd->bl;
@@ -205,7 +205,7 @@ static int sharp_ls_panel_resume(struct omap_dss_device *dssdev)
 
 static struct omap_dss_driver sharp_ls_driver = {
 	.probe		= sharp_ls_panel_probe,
-	.remove		= sharp_ls_panel_remove,
+	.remove		= __exit_p(sharp_ls_panel_remove),
 
 	.enable		= sharp_ls_panel_enable,
 	.disable	= sharp_ls_panel_disable,
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
index adc9900..490998f 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -819,7 +819,7 @@ err:
 	return r;
 }
 
-static void taal_remove(struct omap_dss_device *dssdev)
+static void __exit taal_remove(struct omap_dss_device *dssdev)
 {
 	struct taal_data *td = dev_get_drvdata(&dssdev->dev);
 	struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev);
@@ -1557,7 +1557,7 @@ static enum omap_dss_update_mode taal_get_update_mode(
 
 static struct omap_dss_driver taal_driver = {
 	.probe		= taal_probe,
-	.remove		= taal_remove,
+	.remove		= __exit_p(taal_remove),
 
 	.enable		= taal_enable,
 	.disable	= taal_disable,
-- 
1.7.1


^ permalink raw reply related

* [PATCH 4/5] OMAP: DSS2: Add omap_dss_register_driver_probe()
From: Tomi Valkeinen @ 2011-04-01 10:00 UTC (permalink / raw)
  To: linux-omap, linux-fbdev; +Cc: Tomi Valkeinen
In-Reply-To: <1301652030-32223-1-git-send-email-tomi.valkeinen@ti.com>

Implement omap_dss_register_driver_probe() function, which is similar to
platform_driver_probe(). omap_dss_register_driver_probe will add the
driver and probe devices in one go, thus enabling us to use __init for
panel probe functions.

Also, if no devices are found in omap_dss_register_driver_probe(), the
function will return -ENODEV, which causes the panel driver module to be
unloaded.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 arch/arm/plat-omap/include/plat/display.h |    2 +
 drivers/video/omap2/dss/core.c            |   44 +++++++++++++++++++++++++++++
 2 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/display.h b/arch/arm/plat-omap/include/plat/display.h
index e239a0d..226a78f 100644
--- a/arch/arm/plat-omap/include/plat/display.h
+++ b/arch/arm/plat-omap/include/plat/display.h
@@ -517,6 +517,8 @@ struct omap_dss_driver {
 };
 
 int omap_dss_register_driver(struct omap_dss_driver *);
+int omap_dss_register_driver_probe(struct omap_dss_driver *,
+		int (*probe)(struct omap_dss_device *));
 void omap_dss_unregister_driver(struct omap_dss_driver *);
 
 void omap_dss_get_device(struct omap_dss_device *dssdev);
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 3584e3e..b3eba14 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -447,6 +447,50 @@ void omap_dss_unregister_driver(struct omap_dss_driver *dssdriver)
 }
 EXPORT_SYMBOL(omap_dss_unregister_driver);
 
+static int omap_dss_driver_probe_fail(struct device *dev)
+{
+	return -ENXIO;
+}
+
+static int find_any_dev(struct device *dev, void *data)
+{
+	struct omap_dss_driver *dssdrv = data;
+	return dev->driver = &dssdrv->driver;
+}
+
+int omap_dss_register_driver_probe(struct omap_dss_driver *dssdriver,
+		int (*probe)(struct omap_dss_device *))
+{
+	int r;
+
+	/* make sure driver won't have bind/unbind attributes */
+	dssdriver->driver.suppress_bind_attrs = true;
+
+	/* temporary section violation during probe() */
+	dssdriver->probe = probe;
+	r = omap_dss_register_driver(dssdriver);
+
+	/* fixup that section violation */
+
+	dssdriver->probe = NULL;
+	dssdriver->driver.probe = omap_dss_driver_probe_fail;
+
+	if (r)
+		return r;
+
+	/* find any device using this driver */
+	r = bus_for_each_dev(&dss_bus_type, NULL, dssdriver, find_any_dev);
+
+	if (r = 0) {
+		/* no devices for this driver */
+		omap_dss_unregister_driver(dssdriver);
+		return -ENODEV;
+	}
+
+	return 0;
+}
+EXPORT_SYMBOL(omap_dss_register_driver_probe);
+
 /* DEVICE */
 static void reset_device(struct device *dev, int check)
 {
-- 
1.7.1


^ permalink raw reply related

* [PATCH 5/5] OMAP: DSS2: use omap_dss_register_driver_probe() in selected drivers
From: Tomi Valkeinen @ 2011-04-01 10:00 UTC (permalink / raw)
  To: linux-omap, linux-fbdev; +Cc: Tomi Valkeinen
In-Reply-To: <1301652030-32223-1-git-send-email-tomi.valkeinen@ti.com>

Use omap_dss_register_driver_probe() in plain dss panel drivers, which
allows us to use __init for the driver probe functions.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/video/omap2/displays/panel-generic-dpi.c   |    6 +++---
 .../video/omap2/displays/panel-sharp-ls037v7dw01.c |    6 +++---
 drivers/video/omap2/displays/panel-taal.c          |    5 ++---
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/video/omap2/displays/panel-generic-dpi.c b/drivers/video/omap2/displays/panel-generic-dpi.c
index e359f93..010ea4e 100644
--- a/drivers/video/omap2/displays/panel-generic-dpi.c
+++ b/drivers/video/omap2/displays/panel-generic-dpi.c
@@ -246,7 +246,7 @@ static void generic_dpi_panel_power_off(struct omap_dss_device *dssdev)
 	omapdss_dpi_display_disable(dssdev);
 }
 
-static int generic_dpi_panel_probe(struct omap_dss_device *dssdev)
+static int __init generic_dpi_panel_probe(struct omap_dss_device *dssdev)
 {
 	struct panel_generic_dpi_data *panel_data = get_panel_data(dssdev);
 	struct panel_config *panel_config = NULL;
@@ -357,7 +357,6 @@ static int generic_dpi_panel_check_timings(struct omap_dss_device *dssdev,
 }
 
 static struct omap_dss_driver dpi_driver = {
-	.probe		= generic_dpi_panel_probe,
 	.remove		= __exit_p(generic_dpi_panel_remove),
 
 	.enable		= generic_dpi_panel_enable,
@@ -377,7 +376,8 @@ static struct omap_dss_driver dpi_driver = {
 
 static int __init generic_dpi_panel_drv_init(void)
 {
-	return omap_dss_register_driver(&dpi_driver);
+	return omap_dss_register_driver_probe(&dpi_driver,
+			generic_dpi_panel_probe);
 }
 
 static void __exit generic_dpi_panel_drv_exit(void)
diff --git a/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c b/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c
index c772747..2cf3c9f 100644
--- a/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c
+++ b/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c
@@ -79,7 +79,7 @@ static const struct backlight_ops sharp_ls_bl_ops = {
 
 
 
-static int sharp_ls_panel_probe(struct omap_dss_device *dssdev)
+static int __init sharp_ls_panel_probe(struct omap_dss_device *dssdev)
 {
 	struct backlight_properties props;
 	struct backlight_device *bl;
@@ -204,7 +204,6 @@ static int sharp_ls_panel_resume(struct omap_dss_device *dssdev)
 }
 
 static struct omap_dss_driver sharp_ls_driver = {
-	.probe		= sharp_ls_panel_probe,
 	.remove		= __exit_p(sharp_ls_panel_remove),
 
 	.enable		= sharp_ls_panel_enable,
@@ -220,7 +219,8 @@ static struct omap_dss_driver sharp_ls_driver = {
 
 static int __init sharp_ls_panel_drv_init(void)
 {
-	return omap_dss_register_driver(&sharp_ls_driver);
+	return omap_dss_register_driver_probe(&sharp_ls_driver,
+			sharp_ls_panel_probe);
 }
 
 static void __exit sharp_ls_panel_drv_exit(void)
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
index 490998f..d62821e 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -661,7 +661,7 @@ static void taal_hw_reset(struct omap_dss_device *dssdev)
 		msleep(td->panel_config->sleep.hw_reset);
 }
 
-static int taal_probe(struct omap_dss_device *dssdev)
+static int __init taal_probe(struct omap_dss_device *dssdev)
 {
 	struct backlight_properties props;
 	struct taal_data *td;
@@ -1556,7 +1556,6 @@ static enum omap_dss_update_mode taal_get_update_mode(
 }
 
 static struct omap_dss_driver taal_driver = {
-	.probe		= taal_probe,
 	.remove		= __exit_p(taal_remove),
 
 	.enable		= taal_enable,
@@ -1593,7 +1592,7 @@ static struct omap_dss_driver taal_driver = {
 
 static int __init taal_init(void)
 {
-	omap_dss_register_driver(&taal_driver);
+	omap_dss_register_driver_probe(&taal_driver, taal_probe);
 
 	return 0;
 }
-- 
1.7.1


^ permalink raw reply related

* [PATCH 6/6] drivers/video/bfin-lq035q1-fb.c: introduce missing kfree
From: Julia Lawall @ 2011-04-01 14:23 UTC (permalink / raw)
  To: Paul Mundt; +Cc: kernel-janitors, linux-fbdev, linux-kernel

Error handling code following a kmalloc should free the allocated data.

The semantic match that finds the problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@r exists@
local idexpression x;
statement S;
expression E;
identifier f,f1,l;
position p1,p2;
expression *ptr != NULL;
@@

x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(...);
...
if (x = NULL) S
<... when != x
     when != if (...) { <+...x...+> }
(
x->f1 = E
|
 (x->f1 = NULL || ...)
|
 f(...,x->f1,...)
)
...>
(
 return \(0\|<+...x...+>\|ptr\);
|
 return@p2 ...;
)

@script:python@
p1 << r.p1;
p2 << r.p2;
@@

print "* file: %s kmalloc %s return %s" % (p1[0].file,p1[0].line,p2[0].line)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 drivers/video/bfin-lq035q1-fb.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/video/bfin-lq035q1-fb.c b/drivers/video/bfin-lq035q1-fb.c
index c8e1f04..23b6c4b 100644
--- a/drivers/video/bfin-lq035q1-fb.c
+++ b/drivers/video/bfin-lq035q1-fb.c
@@ -154,8 +154,10 @@ static int __devinit lq035q1_spidev_probe(struct spi_device *spi)
 
 	ret = lq035q1_control(spi, LQ035_SHUT_CTL, LQ035_ON);
 	ret |= lq035q1_control(spi, LQ035_DRIVER_OUTPUT_CTL, ctl->mode);
-	if (ret)
+	if (ret) {
+		kfree(ctl);
 		return ret;
+	}
 
 	spi_set_drvdata(spi, ctl);
 


^ permalink raw reply related

* udlfb.c dlfb_ops_ioctl - missing copy_from_user's ?
From: Dr. David Alan Gilbert @ 2011-04-01 19:47 UTC (permalink / raw)
  To: linux-fbdev

Hi,
 I was running sparse() over the kernel and it noticed
a few casts in dlfb_ops_ioctl that got me looking.

In the DLFB_IOCTL_RETURN_EDID case copy_to_user is used to write to
the data pointed to by arg, but in the DLFB_IOCTL_REPORT_DAMAGE
case the data is accessed directly:

        /* TODO: Help propose a standard fb.h ioctl to report mmap damage */
        if (cmd = DLFB_IOCTL_REPORT_DAMAGE) {

                /*
                 * If we have a damage-aware client, turn fb_defio "off"
                 * To avoid perf imact of unecessary page fault handling.
                 * Done by resetting the delay for this fb_info to a very
                 * long period. Pages will become writable and stay that way.
                 * Reset to normal value when all clients have closed this fb.
                 */
                if (info->fbdefio)
                        info->fbdefio->delay = DL_DEFIO_WRITE_DISABLE;

                area = (struct dloarea *)arg;

                if (area->x < 0)
                        area->x = 0;

It looks to me like making area a local variable and then copy_from_user'ing
it from arg is needed.   I don't think there is anything further up in the
call chain that is doing the copy is there?

(On a more minor note, in dlfb_ops_open the line:

         if ((user = 0) & (!console))

looks like it should really be && - not that I think it makes any
difference.)

Dave (please cc, not subscribed to linux-fbdev)
-- 
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\ gro.gilbert @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/

^ permalink raw reply


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