From 446a74bd6a27344d3466109669a6d6a432e8f941 Mon Sep 17 00:00:00 2001 From: Philip Edelbrock Date: Mon, 14 Dec 1998 00:31:22 +0000 Subject: [PATCH] (Phil) Fixed some bugs and added read support for 128 bytes. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@76 7894878c-1315-0410-8ee3-d5d059ff63e0 --- kernel/chips/eeprom.c | 22 +++++++++++++++------- kernel/include/sensors.h | 3 +++ src/eeprom.c | 22 +++++++++++++++------- src/sensors.h | 3 +++ 4 files changed, 36 insertions(+), 14 deletions(-) diff --git a/kernel/chips/eeprom.c b/kernel/chips/eeprom.c index df42695e..892e9cb3 100644 --- a/kernel/chips/eeprom.c +++ b/kernel/chips/eeprom.c @@ -36,7 +36,7 @@ /* Conversions */ /* Size of EEPROM in bytes */ -#define EEPROM_SIZE 16 +#define EEPROM_SIZE 128 /* Each client has this additional data */ struct eeprom_data { @@ -102,6 +102,12 @@ static ctl_table eeprom_dir_table_template[] = { &sensors_sysctl_real, NULL, &eeprom_contents }, { EEPROM_SYSCTL4, "data48-63", NULL, 0, 0644, NULL, &sensors_proc_real, &sensors_sysctl_real, NULL, &eeprom_contents }, + { EEPROM_SYSCTL5, "data64-79", NULL, 0, 0644, NULL, &sensors_proc_real, + &sensors_sysctl_real, NULL, &eeprom_contents }, + { EEPROM_SYSCTL6, "data80-95", NULL, 0, 0644, NULL, &sensors_proc_real, + &sensors_sysctl_real, NULL, &eeprom_contents }, + { EEPROM_SYSCTL7, "data96-127", NULL, 0, 0644, NULL, &sensors_proc_real, + &sensors_sysctl_real, NULL, &eeprom_contents }, { 0 } }; @@ -280,7 +286,7 @@ void eeprom_update_client(struct i2c_client *client) #endif } for (i=0;idata[i] = smbus_read_byte(client->adapter,client->addr); + data->data[i] = (u8)smbus_read_byte(client->adapter,client->addr); } data->last_updated = jiffies; @@ -301,27 +307,29 @@ void eeprom_contents(struct i2c_client *client, int operation, int ctl_name, if (ctl_name == EEPROM_SYSCTL2){ base=16; } if (ctl_name == EEPROM_SYSCTL3){ base=32; } if (ctl_name == EEPROM_SYSCTL4){ base=48; } + if (ctl_name == EEPROM_SYSCTL5){ base=64; } + if (ctl_name == EEPROM_SYSCTL6){ base=80; } + if (ctl_name == EEPROM_SYSCTL7){ base=96; } if (operation == SENSORS_PROC_REAL_INFO) *nrels_mag = 0; else if (operation == SENSORS_PROC_REAL_READ) { eeprom_update_client(client); - /* just for testing, we won't do the whole thing */ - for (i=0; idata[i + base]; } #ifdef DEBUG printk("eeprom.o: 0x%X EEPROM Contents (base %d): ",client->addr,base); - for (i=0; idata[i + base]); } printk(" .\n"); #endif - *nrels_mag = EEPROM_SIZE; + *nrels_mag = 16; } else if (operation == SENSORS_PROC_REAL_WRITE) { /* No writes to the EEPROM (yet, anyway) (PAE) */ - + printk("eeprom.o: No writes to EEPROMs supported!\n"); } } diff --git a/kernel/include/sensors.h b/kernel/include/sensors.h index e4ab33fb..c5b2bdce 100644 --- a/kernel/include/sensors.h +++ b/kernel/include/sensors.h @@ -155,5 +155,8 @@ struct sensors_chips_data { #define EEPROM_SYSCTL2 1001 #define EEPROM_SYSCTL3 1002 #define EEPROM_SYSCTL4 1003 +#define EEPROM_SYSCTL5 1004 +#define EEPROM_SYSCTL6 1005 +#define EEPROM_SYSCTL7 1006 #endif /* def SENSORS_SENSORS_H */ diff --git a/src/eeprom.c b/src/eeprom.c index df42695e..892e9cb3 100644 --- a/src/eeprom.c +++ b/src/eeprom.c @@ -36,7 +36,7 @@ /* Conversions */ /* Size of EEPROM in bytes */ -#define EEPROM_SIZE 16 +#define EEPROM_SIZE 128 /* Each client has this additional data */ struct eeprom_data { @@ -102,6 +102,12 @@ static ctl_table eeprom_dir_table_template[] = { &sensors_sysctl_real, NULL, &eeprom_contents }, { EEPROM_SYSCTL4, "data48-63", NULL, 0, 0644, NULL, &sensors_proc_real, &sensors_sysctl_real, NULL, &eeprom_contents }, + { EEPROM_SYSCTL5, "data64-79", NULL, 0, 0644, NULL, &sensors_proc_real, + &sensors_sysctl_real, NULL, &eeprom_contents }, + { EEPROM_SYSCTL6, "data80-95", NULL, 0, 0644, NULL, &sensors_proc_real, + &sensors_sysctl_real, NULL, &eeprom_contents }, + { EEPROM_SYSCTL7, "data96-127", NULL, 0, 0644, NULL, &sensors_proc_real, + &sensors_sysctl_real, NULL, &eeprom_contents }, { 0 } }; @@ -280,7 +286,7 @@ void eeprom_update_client(struct i2c_client *client) #endif } for (i=0;idata[i] = smbus_read_byte(client->adapter,client->addr); + data->data[i] = (u8)smbus_read_byte(client->adapter,client->addr); } data->last_updated = jiffies; @@ -301,27 +307,29 @@ void eeprom_contents(struct i2c_client *client, int operation, int ctl_name, if (ctl_name == EEPROM_SYSCTL2){ base=16; } if (ctl_name == EEPROM_SYSCTL3){ base=32; } if (ctl_name == EEPROM_SYSCTL4){ base=48; } + if (ctl_name == EEPROM_SYSCTL5){ base=64; } + if (ctl_name == EEPROM_SYSCTL6){ base=80; } + if (ctl_name == EEPROM_SYSCTL7){ base=96; } if (operation == SENSORS_PROC_REAL_INFO) *nrels_mag = 0; else if (operation == SENSORS_PROC_REAL_READ) { eeprom_update_client(client); - /* just for testing, we won't do the whole thing */ - for (i=0; idata[i + base]; } #ifdef DEBUG printk("eeprom.o: 0x%X EEPROM Contents (base %d): ",client->addr,base); - for (i=0; idata[i + base]); } printk(" .\n"); #endif - *nrels_mag = EEPROM_SIZE; + *nrels_mag = 16; } else if (operation == SENSORS_PROC_REAL_WRITE) { /* No writes to the EEPROM (yet, anyway) (PAE) */ - + printk("eeprom.o: No writes to EEPROMs supported!\n"); } } diff --git a/src/sensors.h b/src/sensors.h index e4ab33fb..c5b2bdce 100644 --- a/src/sensors.h +++ b/src/sensors.h @@ -155,5 +155,8 @@ struct sensors_chips_data { #define EEPROM_SYSCTL2 1001 #define EEPROM_SYSCTL3 1002 #define EEPROM_SYSCTL4 1003 +#define EEPROM_SYSCTL5 1004 +#define EEPROM_SYSCTL6 1005 +#define EEPROM_SYSCTL7 1006 #endif /* def SENSORS_SENSORS_H */