X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fi2c%2Fchips%2Flm78.c;h=640aa01cd7903d1673aa63e06b9dadf6534b8d77;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=40385ffd8b91857fc32e2331a387db2bdc6b36ba;hpb=9bf4aaab3e101692164d49b7ca357651eb691cb6;p=linux-2.6.git diff --git a/drivers/i2c/chips/lm78.c b/drivers/i2c/chips/lm78.c index 40385ffd8..640aa01cd 100644 --- a/drivers/i2c/chips/lm78.c +++ b/drivers/i2c/chips/lm78.c @@ -27,10 +27,11 @@ #include /* Addresses to scan */ -static unsigned short normal_i2c[] = { I2C_CLIENT_END }; -static unsigned short normal_i2c_range[] = { 0x20, 0x2f, I2C_CLIENT_END }; +static unsigned short normal_i2c[] = { 0x20, 0x21, 0x22, 0x23, 0x24, + 0x25, 0x26, 0x27, 0x28, 0x29, + 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, + 0x2f, I2C_CLIENT_END }; static unsigned int normal_isa[] = { 0x0290, I2C_CLIENT_ISA_END }; -static unsigned int normal_isa_range[] = { I2C_CLIENT_ISA_END }; /* Insmod parameters */ SENSORS_INSMOD_3(lm78, lm78j, lm79); @@ -229,29 +230,29 @@ static ssize_t set_in_max(struct device *dev, const char *buf, static ssize_t \ show_in##offset (struct device *dev, char *buf) \ { \ - return show_in(dev, buf, 0x##offset); \ + return show_in(dev, buf, offset); \ } \ static DEVICE_ATTR(in##offset##_input, S_IRUGO, \ show_in##offset, NULL); \ static ssize_t \ show_in##offset##_min (struct device *dev, char *buf) \ { \ - return show_in_min(dev, buf, 0x##offset); \ + return show_in_min(dev, buf, offset); \ } \ static ssize_t \ show_in##offset##_max (struct device *dev, char *buf) \ { \ - return show_in_max(dev, buf, 0x##offset); \ + return show_in_max(dev, buf, offset); \ } \ static ssize_t set_in##offset##_min (struct device *dev, \ const char *buf, size_t count) \ { \ - return set_in_min(dev, buf, count, 0x##offset); \ + return set_in_min(dev, buf, count, offset); \ } \ static ssize_t set_in##offset##_max (struct device *dev, \ const char *buf, size_t count) \ { \ - return set_in_max(dev, buf, count, 0x##offset); \ + return set_in_max(dev, buf, count, offset); \ } \ static DEVICE_ATTR(in##offset##_min, S_IRUGO | S_IWUSR, \ show_in##offset##_min, set_in##offset##_min); \ @@ -375,20 +376,20 @@ static ssize_t set_fan_div(struct device *dev, const char *buf, #define show_fan_offset(offset) \ static ssize_t show_fan_##offset (struct device *dev, char *buf) \ { \ - return show_fan(dev, buf, 0x##offset - 1); \ + return show_fan(dev, buf, offset - 1); \ } \ static ssize_t show_fan_##offset##_min (struct device *dev, char *buf) \ { \ - return show_fan_min(dev, buf, 0x##offset - 1); \ + return show_fan_min(dev, buf, offset - 1); \ } \ static ssize_t show_fan_##offset##_div (struct device *dev, char *buf) \ { \ - return show_fan_div(dev, buf, 0x##offset - 1); \ + return show_fan_div(dev, buf, offset - 1); \ } \ static ssize_t set_fan_##offset##_min (struct device *dev, \ const char *buf, size_t count) \ { \ - return set_fan_min(dev, buf, count, 0x##offset - 1); \ + return set_fan_min(dev, buf, count, offset - 1); \ } \ static DEVICE_ATTR(fan##offset##_input, S_IRUGO, show_fan_##offset, NULL);\ static DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \ @@ -423,7 +424,7 @@ static ssize_t show_vid(struct device *dev, char *buf) struct lm78_data *data = lm78_update_device(dev); return sprintf(buf, "%d\n", VID_FROM_REG(data->vid)); } -static DEVICE_ATTR(in0_ref, S_IRUGO, show_vid, NULL); +static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); /* Alarms */ static ssize_t show_alarms(struct device *dev, char *buf) @@ -461,7 +462,7 @@ int lm78_detect(struct i2c_adapter *adapter, int address, int kind) /* Reserve the ISA region */ if (is_isa) - if (!request_region(address, LM78_EXTENT, "lm78")) { + if (!request_region(address, LM78_EXTENT, lm78_driver.name)) { err = -EBUSY; goto ERROR0; } @@ -615,7 +616,7 @@ int lm78_detect(struct i2c_adapter *adapter, int address, int kind) device_create_file(&new_client->dev, &dev_attr_fan3_min); device_create_file(&new_client->dev, &dev_attr_fan3_div); device_create_file(&new_client->dev, &dev_attr_alarms); - device_create_file(&new_client->dev, &dev_attr_in0_ref); + device_create_file(&new_client->dev, &dev_attr_cpu0_vid); return 0; @@ -692,26 +693,12 @@ static int lm78_write_value(struct i2c_client *client, u8 reg, u8 value) /* Called when we have found a new LM78. It should set limits, etc. */ static void lm78_init_client(struct i2c_client *client) { - struct lm78_data *data = i2c_get_clientdata(client); - int vid; - - /* Reset all except Watchdog values and last conversion values - This sets fan-divs to 2, among others */ - lm78_write_value(client, LM78_REG_CONFIG, 0x80); - - vid = lm78_read_value(client, LM78_REG_VID_FANDIV) & 0x0f; - if (data->type == lm79) - vid |= - (lm78_read_value(client, LM78_REG_CHIPID) & 0x01) << 4; - else - vid |= 0x10; - vid = VID_FROM_REG(vid); + u8 config = lm78_read_value(client, LM78_REG_CONFIG); /* Start monitoring */ - lm78_write_value(client, LM78_REG_CONFIG, - (lm78_read_value(client, LM78_REG_CONFIG) & 0xf7) - | 0x01); - + if (!(config & 0x01)) + lm78_write_value(client, LM78_REG_CONFIG, + (config & 0xf7) | 0x01); } static struct lm78_data *lm78_update_device(struct device *dev)