[PATCH 4/5] GEODE: Add powerup / powerdown hooks to the GX driver

Jordan Crouse jordan.crouse at amd.com
Wed Apr 25 20:31:37 EDT 2007


From: Jordan Crouse <jordan.crouse at amd.com>

Support the new fb_powerup() and fb_powerdown() bits in the GX driver.
Also modify the DCON driver to use the generic calls.  All GX/LX calls
should be out of DCON now.

Signed-off-by: Jordan Crouse <jordan.crouse at amd.com>
---

 drivers/video/geode/gxfb_core.c |    2 ++
 drivers/video/geode/video_gx.c  |   18 ++++-------------
 drivers/video/geode/video_gx.h  |    3 +++
 drivers/video/olpc_dcon.c       |   42 +++++----------------------------------
 4 files changed, 14 insertions(+), 51 deletions(-)

diff --git a/drivers/video/geode/gxfb_core.c b/drivers/video/geode/gxfb_core.c
index 0813877..0418273 100644
--- a/drivers/video/geode/gxfb_core.c
+++ b/drivers/video/geode/gxfb_core.c
@@ -339,6 +339,8 @@ static struct fb_ops gxfb_ops = {
 	.fb_fillrect	= cfb_fillrect,
 	.fb_copyarea	= cfb_copyarea,
 	.fb_imageblit	= cfb_imageblit,
+	.fb_powerdown   = gxfb_powerdown,
+	.fb_powerup     = gxfb_powerup,
 };
 
 static struct fb_info * __init gxfb_init_fbinfo(struct device *dev)
diff --git a/drivers/video/geode/video_gx.c b/drivers/video/geode/video_gx.c
index 3043439..b0e4303 100644
--- a/drivers/video/geode/video_gx.c
+++ b/drivers/video/geode/video_gx.c
@@ -390,9 +390,8 @@ int gxfb_powerdown(struct fb_info *info) {
 	return 0;
 }
 
-int gxfb_pre_powerup(struct fb_info *info)
+int gxfb_powerup(struct fb_info *info)
 {
-
 	struct geodefb_par *par = info->par;
 
 	if (gxfb_powered_down == 0)
@@ -403,16 +402,12 @@ int gxfb_pre_powerup(struct fb_info *info)
 	writel(gx_pm_regs[VC_FP_PM], par->vid_regs + GX_FP_PM);
 
 	msleep(64);
-	return 0;
-}
-
-int gxfb_powerup(struct fb_info *info)
-{
-	struct geodefb_par *par = info->par;
 
 	writel(gx_pm_regs[DC_DCFG], par->dc_regs + DC_DISPLAY_CFG);
 
-	/* Do this one last because it will turn on the FIFO which will start the line count */
+	/* Do this one last because it will turn on the FIFO which will
+	   start the line count */
+
 	writel(gx_pm_regs[DC_GCFG], par->dc_regs + DC_GENERAL_CFG);
 
 	writel(0x0, par->dc_regs + DC_UNLOCK);
@@ -480,9 +475,4 @@ struct geode_vid_ops gx_vid_ops = {
 	.blank_display	   = gx_blank_display,
 };
 
-/* We define these as special hooks for the DCON driver to hook into */
-
-EXPORT_SYMBOL(gxfb_powerdown);
-EXPORT_SYMBOL(gxfb_pre_powerup);
-EXPORT_SYMBOL(gxfb_powerup);
 
diff --git a/drivers/video/geode/video_gx.h b/drivers/video/geode/video_gx.h
index 65952a2..3f373dd 100644
--- a/drivers/video/geode/video_gx.h
+++ b/drivers/video/geode/video_gx.h
@@ -79,4 +79,7 @@ extern struct geode_vid_ops gx_vid_ops;
 #  define MSR_GLCP_DOTPLL_BYPASS		(0x0000000000008000ull)
 #  define MSR_GLCP_DOTPLL_LOCK			(0x0000000002000000ull)
 
+int gxfb_powerdown(struct fb_info *info);
+int gxfb_powerup(struct fb_info *info);
+
 #endif /* !__VIDEO_GX_H__ */
diff --git a/drivers/video/olpc_dcon.c b/drivers/video/olpc_dcon.c
index 778c24b..4e0b3c8 100644
--- a/drivers/video/olpc_dcon.c
+++ b/drivers/video/olpc_dcon.c
@@ -55,7 +55,6 @@ static struct backlight_device *dcon_bl_dev;
 /* Base address of the GPIO registers */
 static unsigned long gpio_base;
 
-/* fbinfo from the GX framebuffer driver */
 static struct fb_info *fbinfo;
 
 /* Current source */
@@ -75,12 +74,6 @@ static int dcon_switched;
 
 static DECLARE_WAIT_QUEUE_HEAD(dcon_wait_queue);
 
-#ifdef CONFIG_FB_GEODE_GX
-extern int gxfb_powerdown(struct fb_info *info);
-extern int gxfb_pre_powerup(struct fb_info *info);
-extern int gxfb_powerup(struct fb_info *info);
-#endif
-
 static unsigned short normal_i2c[] = { 0x0D, I2C_CLIENT_END };
 I2C_CLIENT_INSMOD;
 
@@ -187,9 +180,7 @@ static int dcon_set_source(int arg)
 		/* FIXME:  Set the task uninterruptable for this bit? */
 		/* Prepare to turn on the graphics engine */
 
-#ifdef CONFIG_FB_GEODE_GX
-		gxfb_pre_powerup(fbinfo);
-#endif
+		fb_powerup(fbinfo);
 
 		/* Enable the scanline interrupt bit */
 		dcon_write(DCON_REG_MODE, dcon_disp_mode | MODE_SCAN_INT);
@@ -205,10 +196,6 @@ static int dcon_set_source(int arg)
 			return -1;
 		}
 
-		/* Turn on the graphics engine */
-#ifdef CONFIG_FB_GEODE_GX
-		gxfb_powerup(fbinfo);
-#endif
 		outl(1<<11, gpio_base + GPIOx_OUT_VAL);
 
 		printk(KERN_INFO "olpc-dcon: The CPU has control\n");
@@ -238,9 +225,8 @@ static int dcon_set_source(int arg)
 		}
 
 		/* Turn off the graphics engine completely */
-#ifdef CONFIG_FB_GEODE_GX
-		gxfb_powerdown(fbinfo);
-#endif
+		fb_powerdown(fbinfo);
+
 		printk(KERN_INFO "olpc-dcon: The DCON has control\n");
 		break;
 	}
@@ -474,7 +460,6 @@ static int dcon_request_irq(void)
 static int dcon_probe(struct i2c_adapter *adap, int addr, int kind)
 {
 	struct i2c_client *client;
-	struct pci_dev *dev;
 	uint16_t ver;
 	int rc, i;
 
@@ -483,25 +468,8 @@ static int dcon_probe(struct i2c_adapter *adap, int addr, int kind)
 		return -ENODEV;
 	}
 
-#ifdef CONFIG_FB_GEODE_GX
-	dev = pci_get_device(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_GX_VIDEO, NULL);
-	if (dev)
-		fbinfo = pci_get_drvdata(dev);
-#endif
-
-#ifdef CONFIG_FB_GEODE_LX
-	if (!fbinfo) {
-		dev = pci_get_device(PCI_VENDOR_ID_AMD,
-					PCI_DEVICE_ID_AMD_LX_VIDEO, NULL);
-		if (dev)
-			fbinfo = pci_get_drvdata(dev);
-	}
-#endif
-
-	if (!fbinfo) {
-		printk(KERN_ERR "dcon:  Couldn't find a Geode GPU device\n");
-		return -ENXIO;
-	}
+	if (num_registered_fb >= 1)
+		fbinfo = registered_fb[0];
 
 	if (adap->id != I2C_HW_SMBUS_SCX200) {
 		printk(KERN_ERR "olpc-dcon: Invalid I2C bus (%d not %d)\n",





More information about the Devel mailing list