linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] 2/3 Add I2C/DDC support to radeonfb
@ 2003-08-22 16:25 Kronos
  0 siblings, 0 replies; only message in thread
From: Kronos @ 2003-08-22 16:25 UTC (permalink / raw)
  To: linux-fbdev-devel; +Cc: Benjamin Herrenschmidt, James Simmons

Register i2c bus. Parse EDID block.

--- linux-2.6.vanilla/drivers/video/radeonfb.c	Fri Aug 22 17:33:45 2003
+++ linux-2.6/drivers/video/radeonfb.c	Fri Aug 22 17:36:29 2003
@@ -418,6 +418,10 @@
 #ifdef CONFIG_FB_RADEON_I2C
 	u32 DDCReg;
 #endif
+	/* ModeDB from EDID */
+	struct fb_videomode *modedb;
+	int dbsize;
+	
 	struct radeonfb_info *next;
 };
 
@@ -1597,7 +1601,7 @@
 #ifndef MODULE
         if (mode_option)
                 fb_find_mode (var, &rinfo->info, mode_option,
-                              NULL, 0, NULL, 8);
+                              rinfo->modedb, rinfo->dbsize, NULL, 8);
         else
 #endif
 	if (rinfo->use_default_var)
@@ -3248,7 +3252,33 @@
 	}
 #endif
 
+	/* Register I2C bus */
+	if (!radeonfb_i2c_bus_reg(rinfo))
+		i2c_ready = 1;
+
 	radeon_get_EDID(rinfo);
+	if (rinfo->EDID) {
+		struct fb_var_screeninfo var;
+		struct fb_videomode *db;
+		int i;
+
+		if (parse_edid(rinfo->EDID, &var)) {
+			kfree(rinfo->EDID);
+			rinfo->EDID = NULL;
+		} else {
+			/* Update default with EDID info */
+			radeonfb_default_var = var;
+			rinfo->use_default_var = 1;
+
+			/* Create a modedb */
+			if ((db = fb_create_modedb(rinfo->EDID, &i))) {
+				rinfo->modedb = db;
+				rinfo->dbsize = i;
+			}
+		}
+
+		show_edid(rinfo->EDID);
+	}
 
 	if ((rinfo->dviDisp_type == MT_DFP) || (rinfo->dviDisp_type == MT_LCD) ||
 	    (rinfo->crtDisp_type == MT_DFP)) {
@@ -3258,6 +3288,10 @@
 					    pci_resource_len(pdev, 2));
 			release_mem_region (rinfo->fb_base_phys,
 					    pci_resource_len(pdev, 0));
+			if (rinfo->EDID)
+				kfree(rinfo->EDID);
+			fb_destroy_modedb(rinfo->modedb);
+			radeonfb_i2c_bus_del();
 			kfree (rinfo);
 			return -ENODEV;
 		}
@@ -3271,6 +3305,10 @@
 				    pci_resource_len(pdev, 2));
 		release_mem_region (rinfo->fb_base_phys,
 				    pci_resource_len(pdev, 0));
+		if (rinfo->EDID)
+			kfree(rinfo->EDID);
+		fb_destroy_modedb(rinfo->modedb);
+		radeonfb_i2c_bus_del();
 		kfree (rinfo);
 		return -ENODEV;
 	}
@@ -3329,6 +3367,10 @@
 				    pci_resource_len(pdev, 2));
 		release_mem_region (rinfo->fb_base_phys,
 				    pci_resource_len(pdev, 0));
+		if (rinfo->EDID)
+			kfree(rinfo->EDID);
+		fb_destroy_modedb(rinfo->modedb);
+		radeonfb_i2c_bus_del();
 		kfree (rinfo);
 		return -ENODEV;
 	}
@@ -3400,6 +3442,12 @@
 			    pci_resource_len(pdev, 2));
 	release_mem_region (rinfo->fb_base_phys,
 			    pci_resource_len(pdev, 0));
+
+	if (rinfo->EDID)
+		kfree(rinfo->EDID);
+
+	fb_destroy_modedb(rinfo->modedb);
+	radeonfb_i2c_bus_del();
         
         kfree (rinfo);
 }


-- 
Reply-To: kronos@kronoz.cjb.net
Home: http://kronoz.cjb.net
Non capisco tutta questa eccitazione per il Multitasking: 
io sono anni che leggo in bagno.


-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines
at the same time. Free trial click here:http://www.vmware.com/wl/offer/358/0

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-08-22 16:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-22 16:25 [PATCH] 2/3 Add I2C/DDC support to radeonfb Kronos

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