Skip to contentSkip to conversation

matrox maven: Convert to a new-style i2c driver

PATCH New Jean Delvare 1 participant 1 message Jun 17, 2008 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 3/3 matrox maven: Convert to a new-style i2c driver

The legacy i2c model is going away soon, so switch to the new model.

---
This needs testing! I don't have any dual-head Matrox card so I couldn't test it myself.

Petr, do we know in advance which adapters have the Maven chip and which don't? If we did, we could use i2c_new_device() instead of i2c_new_probed_device(), for slightly more simple code.

 drivers/video/matrox/i2c-matroxfb.c   |   12 +++-
 drivers/video/matrox/matroxfb_maven.c |   95 +++++++++++++--------------------
 include/linux/i2c-id.h                |    2 
 3 files changed, 50 insertions(+), 59 deletions(-)
drivers/video/matrox/i2c-matroxfb.c +11 -1
@@ -105,7 +105,6 @@ static int i2c_bus_reg(struct i2c_bit_ad
 	b->mask.data = data;
 	b->mask.clock = clock;
 	b->adapter.owner = THIS_MODULE;
-	b->adapter.id = I2C_HW_B_G400;
 	snprintf(b->adapter.name, sizeof(b->adapter.name), name,
 		minfo->fbcon.node);
 	i2c_set_adapdata(&b->adapter, b);
@@ -172,6 +171,17 @@ static void* i2c_matroxfb_probe(struct m
 		err = i2c_bus_reg(&m2info->maven, minfo, MAT_DATA, MAT_CLK, "MAVEN:fb%u");
 		if (err)
 			printk(KERN_INFO "i2c-matroxfb: Could not register Maven i2c bus. Continuing anyway.\n");
+		else {
+			struct i2c_board_info maven_info = {
+				I2C_BOARD_INFO("maven", 0x1b),
+			};
+			unsigned short const addr_list[2] = {
+				0x1b, I2C_CLIENT_END
+			};
+
+			i2c_new_probed_device(&m2info->maven.adapter,
+					      &maven_info, addr_list);
+		}
 	}
 	return m2info;
 fail_ddc1:;
drivers/video/matrox/matroxfb_maven.c +39 -56

186 lines not on this page · raw message

include/linux/i2c-id.h +0 -2
@@ -39,7 +39,6 @@
 #define I2C_DRIVERID_SAA7111A	 8	/* video input processor	*/
 #define I2C_DRIVERID_SAA7185B	13	/* video encoder		*/
 #define I2C_DRIVERID_SAA7110	22	/* video decoder		*/
-#define I2C_DRIVERID_MGATVO	23	/* Matrox TVOut			*/
 #define I2C_DRIVERID_SAA5249	24	/* SAA5249 and compatibles	*/
 #define I2C_DRIVERID_PCF8583	25	/* real time clock		*/
 #define I2C_DRIVERID_SAB3036	26	/* SAB3036 tuner		*/
@@ -97,7 +96,6 @@
 #define I2C_HW_B_BT848		0x010005 /* BT848 video boards */
 #define I2C_HW_B_VIA		0x010007 /* Via vt82c586b */
 #define I2C_HW_B_HYDRA		0x010008 /* Apple Hydra Mac I/O */
-#define I2C_HW_B_G400		0x010009 /* Matrox G400 */
 #define I2C_HW_B_I810		0x01000a /* Intel I810 */
 #define I2C_HW_B_VOO		0x01000b /* 3dfx Voodoo 3 / Banshee */
 #define I2C_HW_B_SCX200		0x01000e /* Nat'l Semi SCx200 I2C */
Signature · 7 lines
Jean Delvare

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php