(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
This commit is contained in:
Philip Edelbrock committed 1998-12-14 00:31:22 +00:00
1 parent 8193486f36
commit 446a74bd6a
4 files changed
+36 -14

No files matched your search

+15 -7
View File
@@ -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;i<EEPROM_SIZE;i++) {
data->data[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; i<EEPROM_SIZE; i++) {
for (i=0; i<16; i++) {
results[i]=data->data[i + base];
}
#ifdef DEBUG
printk("eeprom.o: 0x%X EEPROM Contents (base %d): ",client->addr,base);
for (i=0; i<EEPROM_SIZE; i++) {
for (i=0; i<16; i++) {
printk(" 0x%X",data->data[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");
}
}
+3
View File
@@ -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 */
+15 -7
View File
@@ -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;i<EEPROM_SIZE;i++) {
data->data[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; i<EEPROM_SIZE; i++) {
for (i=0; i<16; i++) {
results[i]=data->data[i + base];
}
#ifdef DEBUG
printk("eeprom.o: 0x%X EEPROM Contents (base %d): ",client->addr,base);
for (i=0; i<EEPROM_SIZE; i++) {
for (i=0; i<16; i++) {
printk(" 0x%X",data->data[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");
}
}
+3
View File
@@ -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 */