use i2c block reads if that functionality is available.

git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@1686 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Mark D. Studebaker committed 2003-01-05 01:33:34 +00:00
1 parent 1286132218
commit 454e70e79a
3 files changed
+29 -12

No files matched your search

+1
View File
@@ -23,6 +23,7 @@ ask CVS about it:
Library: Add support for exponents and logarithms for vt1211/vt8235 temps
Makefile: Generate warnings if new library won't be found by ld.so
Module adm1021: Ignore failed reads and report old value
Modules ddcmon, eeprom: Use i2c block reads if possible
Module i2c-i810.c: Fix for some chips
Modules mtp008, smsc47m1, vt1211, vt8231, w83781d: Standardize and improve
pwm and pwm enable support; update docs
+14 -6
View File
@@ -279,15 +279,23 @@ void ddcmon_update_client(struct i2c_client *client)
if ((jiffies - data->last_updated > 300 * HZ) ||
(jiffies < data->last_updated) || !data->valid) {
if (i2c_smbus_write_byte(client, 0)) {
if (i2c_check_functionality(client->adapter,
I2C_FUNC_SMBUS_READ_BLOCK_DATA))
{
for (i=0; i<DDCMON_SIZE; i+=I2C_SMBUS_I2C_BLOCK_MAX)
if(i2c_smbus_read_i2c_block_data(client,
i, data->data + i)
!= I2C_SMBUS_I2C_BLOCK_MAX)
break;
} else {
if (i2c_smbus_write_byte(client, 0)) {
#ifdef DEBUG
printk("ddcmon read start has failed!\n");
printk("ddcmon read start has failed!\n");
#endif
}
for (i = 0; i < DDCMON_SIZE; i++)
data->data[i] = (u8) i2c_smbus_read_byte(client);
}
for (i = 0; i < DDCMON_SIZE; i++) {
data->data[i] = (u8) i2c_smbus_read_byte(client);
}
data->last_updated = jiffies;
data->valid = 1;
}
+14 -6
View File
@@ -345,15 +345,23 @@ void eeprom_update_client(struct i2c_client *client)
printk("Starting eeprom update\n");
#endif
if (i2c_smbus_write_byte(client, 0)) {
if (i2c_check_functionality(client->adapter,
I2C_FUNC_SMBUS_READ_BLOCK_DATA))
{
for (i=0; i<EEPROM_SIZE; i+=I2C_SMBUS_I2C_BLOCK_MAX)
if(i2c_smbus_read_i2c_block_data(client,
i, data->data + i)
!= I2C_SMBUS_I2C_BLOCK_MAX)
break;
} else {
if (i2c_smbus_write_byte(client, 0)) {
#ifdef DEBUG
printk("eeprom read start has failed!\n");
printk("eeprom read start has failed!\n");
#endif
}
for (i = 0; i < EEPROM_SIZE; i++)
data->data[i] = (u8) i2c_smbus_read_byte(client);
}
for (i = 0; i < EEPROM_SIZE; i++) {
data->data[i] = (u8) i2c_smbus_read_byte(client);
}
data->last_updated = jiffies;
data->valid = 1;
}