diff options
Diffstat (limited to 'drivers/i2c/chips/lm63.c')
-rw-r--r-- | drivers/i2c/chips/lm63.c | 262 |
1 files changed, 139 insertions, 123 deletions
diff --git a/drivers/i2c/chips/lm63.c b/drivers/i2c/chips/lm63.c index 14cc5af03739..7c6f9ea5a254 100644 --- a/drivers/i2c/chips/lm63.c +++ b/drivers/i2c/chips/lm63.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * lm63.c - driver for the National Semiconductor LM63 temperature sensor | 2 | * lm63.c - driver for the National Semiconductor LM63 temperature sensor |
3 | * with integrated fan control | 3 | * with integrated fan control |
4 | * Copyright (C) 2004 Jean Delvare <khali@linux-fr.org> | 4 | * Copyright (C) 2004-2005 Jean Delvare <khali@linux-fr.org> |
5 | * Based on the lm90 driver. | 5 | * Based on the lm90 driver. |
6 | * | 6 | * |
7 | * The LM63 is a sensor chip made by National Semiconductor. It measures | 7 | * The LM63 is a sensor chip made by National Semiconductor. It measures |
@@ -37,13 +37,13 @@ | |||
37 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 37 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
38 | */ | 38 | */ |
39 | 39 | ||
40 | #include <linux/config.h> | ||
41 | #include <linux/module.h> | 40 | #include <linux/module.h> |
42 | #include <linux/init.h> | 41 | #include <linux/init.h> |
43 | #include <linux/slab.h> | 42 | #include <linux/slab.h> |
44 | #include <linux/jiffies.h> | 43 | #include <linux/jiffies.h> |
45 | #include <linux/i2c.h> | 44 | #include <linux/i2c.h> |
46 | #include <linux/i2c-sensor.h> | 45 | #include <linux/i2c-sensor.h> |
46 | #include <linux/hwmon-sysfs.h> | ||
47 | 47 | ||
48 | /* | 48 | /* |
49 | * Addresses to scan | 49 | * Addresses to scan |
@@ -99,9 +99,9 @@ SENSORS_INSMOD_1(lm63); | |||
99 | * Conversions and various macros | 99 | * Conversions and various macros |
100 | * For tachometer counts, the LM63 uses 16-bit values. | 100 | * For tachometer counts, the LM63 uses 16-bit values. |
101 | * For local temperature and high limit, remote critical limit and hysteresis | 101 | * For local temperature and high limit, remote critical limit and hysteresis |
102 | * value, it uses signed 8-bit values with LSB = 1 degree Celcius. | 102 | * value, it uses signed 8-bit values with LSB = 1 degree Celsius. |
103 | * For remote temperature, low and high limits, it uses signed 11-bit values | 103 | * For remote temperature, low and high limits, it uses signed 11-bit values |
104 | * with LSB = 0.125 degree Celcius, left-justified in 16-bit registers. | 104 | * with LSB = 0.125 degree Celsius, left-justified in 16-bit registers. |
105 | */ | 105 | */ |
106 | 106 | ||
107 | #define FAN_FROM_REG(reg) ((reg) == 0xFFFC || (reg) == 0 ? 0 : \ | 107 | #define FAN_FROM_REG(reg) ((reg) == 0xFFFC || (reg) == 0 ? 0 : \ |
@@ -158,16 +158,16 @@ struct lm63_data { | |||
158 | 158 | ||
159 | /* registers values */ | 159 | /* registers values */ |
160 | u8 config, config_fan; | 160 | u8 config, config_fan; |
161 | u16 fan1_input; | 161 | u16 fan[2]; /* 0: input |
162 | u16 fan1_low; | 162 | 1: low limit */ |
163 | u8 pwm1_freq; | 163 | u8 pwm1_freq; |
164 | u8 pwm1_value; | 164 | u8 pwm1_value; |
165 | s8 temp1_input; | 165 | s8 temp8[3]; /* 0: local input |
166 | s8 temp1_high; | 166 | 1: local high limit |
167 | s16 temp2_input; | 167 | 2: remote critical limit */ |
168 | s16 temp2_high; | 168 | s16 temp11[3]; /* 0: remote input |
169 | s16 temp2_low; | 169 | 1: remote low limit |
170 | s8 temp2_crit; | 170 | 2: remote high limit */ |
171 | u8 temp2_crit_hyst; | 171 | u8 temp2_crit_hyst; |
172 | u8 alarms; | 172 | u8 alarms; |
173 | }; | 173 | }; |
@@ -176,33 +176,33 @@ struct lm63_data { | |||
176 | * Sysfs callback functions and files | 176 | * Sysfs callback functions and files |
177 | */ | 177 | */ |
178 | 178 | ||
179 | #define show_fan(value) \ | 179 | static ssize_t show_fan(struct device *dev, struct device_attribute *devattr, |
180 | static ssize_t show_##value(struct device *dev, char *buf) \ | 180 | char *buf) |
181 | { \ | 181 | { |
182 | struct lm63_data *data = lm63_update_device(dev); \ | 182 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
183 | return sprintf(buf, "%d\n", FAN_FROM_REG(data->value)); \ | 183 | struct lm63_data *data = lm63_update_device(dev); |
184 | return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan[attr->index])); | ||
184 | } | 185 | } |
185 | show_fan(fan1_input); | ||
186 | show_fan(fan1_low); | ||
187 | 186 | ||
188 | static ssize_t set_fan1_low(struct device *dev, const char *buf, | 187 | static ssize_t set_fan(struct device *dev, struct device_attribute *dummy, |
189 | size_t count) | 188 | const char *buf, size_t count) |
190 | { | 189 | { |
191 | struct i2c_client *client = to_i2c_client(dev); | 190 | struct i2c_client *client = to_i2c_client(dev); |
192 | struct lm63_data *data = i2c_get_clientdata(client); | 191 | struct lm63_data *data = i2c_get_clientdata(client); |
193 | unsigned long val = simple_strtoul(buf, NULL, 10); | 192 | unsigned long val = simple_strtoul(buf, NULL, 10); |
194 | 193 | ||
195 | down(&data->update_lock); | 194 | down(&data->update_lock); |
196 | data->fan1_low = FAN_TO_REG(val); | 195 | data->fan[1] = FAN_TO_REG(val); |
197 | i2c_smbus_write_byte_data(client, LM63_REG_TACH_LIMIT_LSB, | 196 | i2c_smbus_write_byte_data(client, LM63_REG_TACH_LIMIT_LSB, |
198 | data->fan1_low & 0xFF); | 197 | data->fan[1] & 0xFF); |
199 | i2c_smbus_write_byte_data(client, LM63_REG_TACH_LIMIT_MSB, | 198 | i2c_smbus_write_byte_data(client, LM63_REG_TACH_LIMIT_MSB, |
200 | data->fan1_low >> 8); | 199 | data->fan[1] >> 8); |
201 | up(&data->update_lock); | 200 | up(&data->update_lock); |
202 | return count; | 201 | return count; |
203 | } | 202 | } |
204 | 203 | ||
205 | static ssize_t show_pwm1(struct device *dev, char *buf) | 204 | static ssize_t show_pwm1(struct device *dev, struct device_attribute *dummy, |
205 | char *buf) | ||
206 | { | 206 | { |
207 | struct lm63_data *data = lm63_update_device(dev); | 207 | struct lm63_data *data = lm63_update_device(dev); |
208 | return sprintf(buf, "%d\n", data->pwm1_value >= 2 * data->pwm1_freq ? | 208 | return sprintf(buf, "%d\n", data->pwm1_value >= 2 * data->pwm1_freq ? |
@@ -210,7 +210,8 @@ static ssize_t show_pwm1(struct device *dev, char *buf) | |||
210 | (2 * data->pwm1_freq)); | 210 | (2 * data->pwm1_freq)); |
211 | } | 211 | } |
212 | 212 | ||
213 | static ssize_t set_pwm1(struct device *dev, const char *buf, size_t count) | 213 | static ssize_t set_pwm1(struct device *dev, struct device_attribute *dummy, |
214 | const char *buf, size_t count) | ||
214 | { | 215 | { |
215 | struct i2c_client *client = to_i2c_client(dev); | 216 | struct i2c_client *client = to_i2c_client(dev); |
216 | struct lm63_data *data = i2c_get_clientdata(client); | 217 | struct lm63_data *data = i2c_get_clientdata(client); |
@@ -229,77 +230,83 @@ static ssize_t set_pwm1(struct device *dev, const char *buf, size_t count) | |||
229 | return count; | 230 | return count; |
230 | } | 231 | } |
231 | 232 | ||
232 | static ssize_t show_pwm1_enable(struct device *dev, char *buf) | 233 | static ssize_t show_pwm1_enable(struct device *dev, struct device_attribute *dummy, |
234 | char *buf) | ||
233 | { | 235 | { |
234 | struct lm63_data *data = lm63_update_device(dev); | 236 | struct lm63_data *data = lm63_update_device(dev); |
235 | return sprintf(buf, "%d\n", data->config_fan & 0x20 ? 1 : 2); | 237 | return sprintf(buf, "%d\n", data->config_fan & 0x20 ? 1 : 2); |
236 | } | 238 | } |
237 | 239 | ||
238 | #define show_temp8(value) \ | 240 | static ssize_t show_temp8(struct device *dev, struct device_attribute *devattr, |
239 | static ssize_t show_##value(struct device *dev, char *buf) \ | 241 | char *buf) |
240 | { \ | 242 | { |
241 | struct lm63_data *data = lm63_update_device(dev); \ | 243 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
242 | return sprintf(buf, "%d\n", TEMP8_FROM_REG(data->value)); \ | 244 | struct lm63_data *data = lm63_update_device(dev); |
245 | return sprintf(buf, "%d\n", TEMP8_FROM_REG(data->temp8[attr->index])); | ||
243 | } | 246 | } |
244 | #define show_temp11(value) \ | 247 | |
245 | static ssize_t show_##value(struct device *dev, char *buf) \ | 248 | static ssize_t set_temp8(struct device *dev, struct device_attribute *dummy, |
246 | { \ | 249 | const char *buf, size_t count) |
247 | struct lm63_data *data = lm63_update_device(dev); \ | 250 | { |
248 | return sprintf(buf, "%d\n", TEMP11_FROM_REG(data->value)); \ | 251 | struct i2c_client *client = to_i2c_client(dev); |
252 | struct lm63_data *data = i2c_get_clientdata(client); | ||
253 | long val = simple_strtol(buf, NULL, 10); | ||
254 | |||
255 | down(&data->update_lock); | ||
256 | data->temp8[1] = TEMP8_TO_REG(val); | ||
257 | i2c_smbus_write_byte_data(client, LM63_REG_LOCAL_HIGH, data->temp8[1]); | ||
258 | up(&data->update_lock); | ||
259 | return count; | ||
249 | } | 260 | } |
250 | show_temp8(temp1_input); | 261 | |
251 | show_temp8(temp1_high); | 262 | static ssize_t show_temp11(struct device *dev, struct device_attribute *devattr, |
252 | show_temp11(temp2_input); | 263 | char *buf) |
253 | show_temp11(temp2_high); | 264 | { |
254 | show_temp11(temp2_low); | 265 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
255 | show_temp8(temp2_crit); | 266 | struct lm63_data *data = lm63_update_device(dev); |
256 | 267 | return sprintf(buf, "%d\n", TEMP11_FROM_REG(data->temp11[attr->index])); | |
257 | #define set_temp8(value, reg) \ | ||
258 | static ssize_t set_##value(struct device *dev, const char *buf, \ | ||
259 | size_t count) \ | ||
260 | { \ | ||
261 | struct i2c_client *client = to_i2c_client(dev); \ | ||
262 | struct lm63_data *data = i2c_get_clientdata(client); \ | ||
263 | long val = simple_strtol(buf, NULL, 10); \ | ||
264 | \ | ||
265 | down(&data->update_lock); \ | ||
266 | data->value = TEMP8_TO_REG(val); \ | ||
267 | i2c_smbus_write_byte_data(client, reg, data->value); \ | ||
268 | up(&data->update_lock); \ | ||
269 | return count; \ | ||
270 | } | 268 | } |
271 | #define set_temp11(value, reg_msb, reg_lsb) \ | 269 | |
272 | static ssize_t set_##value(struct device *dev, const char *buf, \ | 270 | static ssize_t set_temp11(struct device *dev, struct device_attribute *devattr, |
273 | size_t count) \ | 271 | const char *buf, size_t count) |
274 | { \ | 272 | { |
275 | struct i2c_client *client = to_i2c_client(dev); \ | 273 | static const u8 reg[4] = { |
276 | struct lm63_data *data = i2c_get_clientdata(client); \ | 274 | LM63_REG_REMOTE_LOW_MSB, |
277 | long val = simple_strtol(buf, NULL, 10); \ | 275 | LM63_REG_REMOTE_LOW_LSB, |
278 | \ | 276 | LM63_REG_REMOTE_HIGH_MSB, |
279 | down(&data->update_lock); \ | 277 | LM63_REG_REMOTE_HIGH_LSB, |
280 | data->value = TEMP11_TO_REG(val); \ | 278 | }; |
281 | i2c_smbus_write_byte_data(client, reg_msb, data->value >> 8); \ | 279 | |
282 | i2c_smbus_write_byte_data(client, reg_lsb, data->value & 0xff); \ | 280 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
283 | up(&data->update_lock); \ | 281 | struct i2c_client *client = to_i2c_client(dev); |
284 | return count; \ | 282 | struct lm63_data *data = i2c_get_clientdata(client); |
283 | long val = simple_strtol(buf, NULL, 10); | ||
284 | int nr = attr->index; | ||
285 | |||
286 | down(&data->update_lock); | ||
287 | data->temp11[nr] = TEMP11_TO_REG(val); | ||
288 | i2c_smbus_write_byte_data(client, reg[(nr - 1) * 2], | ||
289 | data->temp11[nr] >> 8); | ||
290 | i2c_smbus_write_byte_data(client, reg[(nr - 1) * 2 + 1], | ||
291 | data->temp11[nr] & 0xff); | ||
292 | up(&data->update_lock); | ||
293 | return count; | ||
285 | } | 294 | } |
286 | set_temp8(temp1_high, LM63_REG_LOCAL_HIGH); | ||
287 | set_temp11(temp2_high, LM63_REG_REMOTE_HIGH_MSB, LM63_REG_REMOTE_HIGH_LSB); | ||
288 | set_temp11(temp2_low, LM63_REG_REMOTE_LOW_MSB, LM63_REG_REMOTE_LOW_LSB); | ||
289 | 295 | ||
290 | /* Hysteresis register holds a relative value, while we want to present | 296 | /* Hysteresis register holds a relative value, while we want to present |
291 | an absolute to user-space */ | 297 | an absolute to user-space */ |
292 | static ssize_t show_temp2_crit_hyst(struct device *dev, char *buf) | 298 | static ssize_t show_temp2_crit_hyst(struct device *dev, struct device_attribute *dummy, |
299 | char *buf) | ||
293 | { | 300 | { |
294 | struct lm63_data *data = lm63_update_device(dev); | 301 | struct lm63_data *data = lm63_update_device(dev); |
295 | return sprintf(buf, "%d\n", TEMP8_FROM_REG(data->temp2_crit) | 302 | return sprintf(buf, "%d\n", TEMP8_FROM_REG(data->temp8[2]) |
296 | - TEMP8_FROM_REG(data->temp2_crit_hyst)); | 303 | - TEMP8_FROM_REG(data->temp2_crit_hyst)); |
297 | } | 304 | } |
298 | 305 | ||
299 | /* And now the other way around, user-space provides an absolute | 306 | /* And now the other way around, user-space provides an absolute |
300 | hysteresis value and we have to store a relative one */ | 307 | hysteresis value and we have to store a relative one */ |
301 | static ssize_t set_temp2_crit_hyst(struct device *dev, const char *buf, | 308 | static ssize_t set_temp2_crit_hyst(struct device *dev, struct device_attribute *dummy, |
302 | size_t count) | 309 | const char *buf, size_t count) |
303 | { | 310 | { |
304 | struct i2c_client *client = to_i2c_client(dev); | 311 | struct i2c_client *client = to_i2c_client(dev); |
305 | struct lm63_data *data = i2c_get_clientdata(client); | 312 | struct lm63_data *data = i2c_get_clientdata(client); |
@@ -307,36 +314,37 @@ static ssize_t set_temp2_crit_hyst(struct device *dev, const char *buf, | |||
307 | long hyst; | 314 | long hyst; |
308 | 315 | ||
309 | down(&data->update_lock); | 316 | down(&data->update_lock); |
310 | hyst = TEMP8_FROM_REG(data->temp2_crit) - val; | 317 | hyst = TEMP8_FROM_REG(data->temp8[2]) - val; |
311 | i2c_smbus_write_byte_data(client, LM63_REG_REMOTE_TCRIT_HYST, | 318 | i2c_smbus_write_byte_data(client, LM63_REG_REMOTE_TCRIT_HYST, |
312 | HYST_TO_REG(hyst)); | 319 | HYST_TO_REG(hyst)); |
313 | up(&data->update_lock); | 320 | up(&data->update_lock); |
314 | return count; | 321 | return count; |
315 | } | 322 | } |
316 | 323 | ||
317 | static ssize_t show_alarms(struct device *dev, char *buf) | 324 | static ssize_t show_alarms(struct device *dev, struct device_attribute *dummy, |
325 | char *buf) | ||
318 | { | 326 | { |
319 | struct lm63_data *data = lm63_update_device(dev); | 327 | struct lm63_data *data = lm63_update_device(dev); |
320 | return sprintf(buf, "%u\n", data->alarms); | 328 | return sprintf(buf, "%u\n", data->alarms); |
321 | } | 329 | } |
322 | 330 | ||
323 | static DEVICE_ATTR(fan1_input, S_IRUGO, show_fan1_input, NULL); | 331 | static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_fan, NULL, 0); |
324 | static DEVICE_ATTR(fan1_min, S_IWUSR | S_IRUGO, show_fan1_low, | 332 | static SENSOR_DEVICE_ATTR(fan1_min, S_IWUSR | S_IRUGO, show_fan, |
325 | set_fan1_low); | 333 | set_fan, 1); |
326 | 334 | ||
327 | static DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm1, set_pwm1); | 335 | static DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm1, set_pwm1); |
328 | static DEVICE_ATTR(pwm1_enable, S_IRUGO, show_pwm1_enable, NULL); | 336 | static DEVICE_ATTR(pwm1_enable, S_IRUGO, show_pwm1_enable, NULL); |
329 | 337 | ||
330 | static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp1_input, NULL); | 338 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp8, NULL, 0); |
331 | static DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp1_high, | 339 | static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp8, |
332 | set_temp1_high); | 340 | set_temp8, 1); |
333 | 341 | ||
334 | static DEVICE_ATTR(temp2_input, S_IRUGO, show_temp2_input, NULL); | 342 | static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp11, NULL, 0); |
335 | static DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO, show_temp2_low, | 343 | static SENSOR_DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO, show_temp11, |
336 | set_temp2_low); | 344 | set_temp11, 1); |
337 | static DEVICE_ATTR(temp2_max, S_IWUSR | S_IRUGO, show_temp2_high, | 345 | static SENSOR_DEVICE_ATTR(temp2_max, S_IWUSR | S_IRUGO, show_temp11, |
338 | set_temp2_high); | 346 | set_temp11, 2); |
339 | static DEVICE_ATTR(temp2_crit, S_IRUGO, show_temp2_crit, NULL); | 347 | static SENSOR_DEVICE_ATTR(temp2_crit, S_IRUGO, show_temp8, NULL, 2); |
340 | static DEVICE_ATTR(temp2_crit_hyst, S_IWUSR | S_IRUGO, show_temp2_crit_hyst, | 348 | static DEVICE_ATTR(temp2_crit_hyst, S_IWUSR | S_IRUGO, show_temp2_crit_hyst, |
341 | set_temp2_crit_hyst); | 349 | set_temp2_crit_hyst); |
342 | 350 | ||
@@ -430,17 +438,25 @@ static int lm63_detect(struct i2c_adapter *adapter, int address, int kind) | |||
430 | 438 | ||
431 | /* Register sysfs hooks */ | 439 | /* Register sysfs hooks */ |
432 | if (data->config & 0x04) { /* tachometer enabled */ | 440 | if (data->config & 0x04) { /* tachometer enabled */ |
433 | device_create_file(&new_client->dev, &dev_attr_fan1_input); | 441 | device_create_file(&new_client->dev, |
434 | device_create_file(&new_client->dev, &dev_attr_fan1_min); | 442 | &sensor_dev_attr_fan1_input.dev_attr); |
443 | device_create_file(&new_client->dev, | ||
444 | &sensor_dev_attr_fan1_min.dev_attr); | ||
435 | } | 445 | } |
436 | device_create_file(&new_client->dev, &dev_attr_pwm1); | 446 | device_create_file(&new_client->dev, &dev_attr_pwm1); |
437 | device_create_file(&new_client->dev, &dev_attr_pwm1_enable); | 447 | device_create_file(&new_client->dev, &dev_attr_pwm1_enable); |
438 | device_create_file(&new_client->dev, &dev_attr_temp1_input); | 448 | device_create_file(&new_client->dev, |
439 | device_create_file(&new_client->dev, &dev_attr_temp2_input); | 449 | &sensor_dev_attr_temp1_input.dev_attr); |
440 | device_create_file(&new_client->dev, &dev_attr_temp2_min); | 450 | device_create_file(&new_client->dev, |
441 | device_create_file(&new_client->dev, &dev_attr_temp1_max); | 451 | &sensor_dev_attr_temp2_input.dev_attr); |
442 | device_create_file(&new_client->dev, &dev_attr_temp2_max); | 452 | device_create_file(&new_client->dev, |
443 | device_create_file(&new_client->dev, &dev_attr_temp2_crit); | 453 | &sensor_dev_attr_temp2_min.dev_attr); |
454 | device_create_file(&new_client->dev, | ||
455 | &sensor_dev_attr_temp1_max.dev_attr); | ||
456 | device_create_file(&new_client->dev, | ||
457 | &sensor_dev_attr_temp2_max.dev_attr); | ||
458 | device_create_file(&new_client->dev, | ||
459 | &sensor_dev_attr_temp2_crit.dev_attr); | ||
444 | device_create_file(&new_client->dev, &dev_attr_temp2_crit_hyst); | 460 | device_create_file(&new_client->dev, &dev_attr_temp2_crit_hyst); |
445 | device_create_file(&new_client->dev, &dev_attr_alarms); | 461 | device_create_file(&new_client->dev, &dev_attr_alarms); |
446 | 462 | ||
@@ -511,14 +527,14 @@ static struct lm63_data *lm63_update_device(struct device *dev) | |||
511 | if (time_after(jiffies, data->last_updated + HZ) || !data->valid) { | 527 | if (time_after(jiffies, data->last_updated + HZ) || !data->valid) { |
512 | if (data->config & 0x04) { /* tachometer enabled */ | 528 | if (data->config & 0x04) { /* tachometer enabled */ |
513 | /* order matters for fan1_input */ | 529 | /* order matters for fan1_input */ |
514 | data->fan1_input = i2c_smbus_read_byte_data(client, | 530 | data->fan[0] = i2c_smbus_read_byte_data(client, |
515 | LM63_REG_TACH_COUNT_LSB) & 0xFC; | 531 | LM63_REG_TACH_COUNT_LSB) & 0xFC; |
516 | data->fan1_input |= i2c_smbus_read_byte_data(client, | 532 | data->fan[0] |= i2c_smbus_read_byte_data(client, |
517 | LM63_REG_TACH_COUNT_MSB) << 8; | 533 | LM63_REG_TACH_COUNT_MSB) << 8; |
518 | data->fan1_low = (i2c_smbus_read_byte_data(client, | 534 | data->fan[1] = (i2c_smbus_read_byte_data(client, |
519 | LM63_REG_TACH_LIMIT_LSB) & 0xFC) | 535 | LM63_REG_TACH_LIMIT_LSB) & 0xFC) |
520 | | (i2c_smbus_read_byte_data(client, | 536 | | (i2c_smbus_read_byte_data(client, |
521 | LM63_REG_TACH_LIMIT_MSB) << 8); | 537 | LM63_REG_TACH_LIMIT_MSB) << 8); |
522 | } | 538 | } |
523 | 539 | ||
524 | data->pwm1_freq = i2c_smbus_read_byte_data(client, | 540 | data->pwm1_freq = i2c_smbus_read_byte_data(client, |
@@ -528,26 +544,26 @@ static struct lm63_data *lm63_update_device(struct device *dev) | |||
528 | data->pwm1_value = i2c_smbus_read_byte_data(client, | 544 | data->pwm1_value = i2c_smbus_read_byte_data(client, |
529 | LM63_REG_PWM_VALUE); | 545 | LM63_REG_PWM_VALUE); |
530 | 546 | ||
531 | data->temp1_input = i2c_smbus_read_byte_data(client, | 547 | data->temp8[0] = i2c_smbus_read_byte_data(client, |
532 | LM63_REG_LOCAL_TEMP); | 548 | LM63_REG_LOCAL_TEMP); |
533 | data->temp1_high = i2c_smbus_read_byte_data(client, | 549 | data->temp8[1] = i2c_smbus_read_byte_data(client, |
534 | LM63_REG_LOCAL_HIGH); | 550 | LM63_REG_LOCAL_HIGH); |
535 | 551 | ||
536 | /* order matters for temp2_input */ | 552 | /* order matters for temp2_input */ |
537 | data->temp2_input = i2c_smbus_read_byte_data(client, | 553 | data->temp11[0] = i2c_smbus_read_byte_data(client, |
538 | LM63_REG_REMOTE_TEMP_MSB) << 8; | 554 | LM63_REG_REMOTE_TEMP_MSB) << 8; |
539 | data->temp2_input |= i2c_smbus_read_byte_data(client, | 555 | data->temp11[0] |= i2c_smbus_read_byte_data(client, |
540 | LM63_REG_REMOTE_TEMP_LSB); | 556 | LM63_REG_REMOTE_TEMP_LSB); |
541 | data->temp2_high = (i2c_smbus_read_byte_data(client, | 557 | data->temp11[1] = (i2c_smbus_read_byte_data(client, |
542 | LM63_REG_REMOTE_HIGH_MSB) << 8) | ||
543 | | i2c_smbus_read_byte_data(client, | ||
544 | LM63_REG_REMOTE_HIGH_LSB); | ||
545 | data->temp2_low = (i2c_smbus_read_byte_data(client, | ||
546 | LM63_REG_REMOTE_LOW_MSB) << 8) | 558 | LM63_REG_REMOTE_LOW_MSB) << 8) |
547 | | i2c_smbus_read_byte_data(client, | 559 | | i2c_smbus_read_byte_data(client, |
548 | LM63_REG_REMOTE_LOW_LSB); | 560 | LM63_REG_REMOTE_LOW_LSB); |
549 | data->temp2_crit = i2c_smbus_read_byte_data(client, | 561 | data->temp11[2] = (i2c_smbus_read_byte_data(client, |
550 | LM63_REG_REMOTE_TCRIT); | 562 | LM63_REG_REMOTE_HIGH_MSB) << 8) |
563 | | i2c_smbus_read_byte_data(client, | ||
564 | LM63_REG_REMOTE_HIGH_LSB); | ||
565 | data->temp8[2] = i2c_smbus_read_byte_data(client, | ||
566 | LM63_REG_REMOTE_TCRIT); | ||
551 | data->temp2_crit_hyst = i2c_smbus_read_byte_data(client, | 567 | data->temp2_crit_hyst = i2c_smbus_read_byte_data(client, |
552 | LM63_REG_REMOTE_TCRIT_HYST); | 568 | LM63_REG_REMOTE_TCRIT_HYST); |
553 | 569 | ||