[i2c] [PATCH 2/2] i2c/eeprom: Recognize VGN as a valid Sony Vaio name prefix

Jean Delvare khali at linux-fr.org
Mon Nov 12 19:30:38 CET 2007


Recent (i.e. 2005 and later) Sony Vaio laptops have names beginning
with VGN rather than PCG. Update the eeprom driver so that it
recognizes these.

Signed-off-by: Jean Delvare <khali at linux.org>
---
 drivers/i2c/chips/eeprom.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

--- linux-2.6.24-rc2.orig/drivers/i2c/chips/eeprom.c	2007-11-12 18:38:42.000000000 +0100
+++ linux-2.6.24-rc2/drivers/i2c/chips/eeprom.c	2007-11-12 18:48:06.000000000 +0100
@@ -204,12 +204,16 @@ static int eeprom_detect(struct i2c_adap
 		goto exit_kfree;
 
 	/* Detect the Vaio nature of EEPROMs.
-	   We use the "PCG-" prefix as the signature. */
+	   We use the "PCG-" or "VGN-" prefix as the signature. */
 	if (address == 0x57) {
-		if (i2c_smbus_read_byte_data(new_client, 0x80) == 'P'
-		 && i2c_smbus_read_byte(new_client) == 'C'
-		 && i2c_smbus_read_byte(new_client) == 'G'
-		 && i2c_smbus_read_byte(new_client) == '-') {
+		char name[4];
+
+		name[0] = i2c_smbus_read_byte_data(new_client, 0x80);
+		name[1] = i2c_smbus_read_byte(new_client);
+		name[2] = i2c_smbus_read_byte(new_client);
+		name[3] = i2c_smbus_read_byte(new_client);
+
+		if (!memcmp(name, "PCG-", 4) || !memcmp(name, "VGN-", 4)) {
 			dev_info(&new_client->dev, "Vaio EEPROM detected, "
 				"enabling privacy protection\n");
 			data->nature = VAIO;


-- 
Jean Delvare



More information about the i2c mailing list