aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2005-11-26 14:07:54 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-01-06 01:16:20 -0500
commit9c516ef496c857aa4b1b41dc313010f11d39c496 (patch)
tree94fd2cc493def4ec290705b4d943335558eb304e /drivers
parent07421cabdc62519d0f747149b7c9b425b4d746cd (diff)
[PATCH] hwmon: Support the VRM 10 mode of the ADT7463
Support the VRM 10 mode of the ADT7463. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/hwmon/lm85.c44
1 files changed, 36 insertions, 8 deletions
diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c
index d1070ed2bee6..3f5544a40f3c 100644
--- a/drivers/hwmon/lm85.c
+++ b/drivers/hwmon/lm85.c
@@ -443,7 +443,17 @@ show_fan_offset(4);
443static ssize_t show_vid_reg(struct device *dev, struct device_attribute *attr, char *buf) 443static ssize_t show_vid_reg(struct device *dev, struct device_attribute *attr, char *buf)
444{ 444{
445 struct lm85_data *data = lm85_update_device(dev); 445 struct lm85_data *data = lm85_update_device(dev);
446 return sprintf(buf, "%ld\n", (long) vid_from_reg(data->vid, data->vrm)); 446 int vid;
447
448 if (data->type == adt7463 && (data->vid & 0x80)) {
449 /* 6-pin VID (VRM 10) */
450 vid = vid_from_reg(data->vid & 0x3f, data->vrm);
451 } else {
452 /* 5-pin VID (VRM 9) */
453 vid = vid_from_reg(data->vid & 0x1f, data->vrm);
454 }
455
456 return sprintf(buf, "%d\n", vid);
447} 457}
448 458
449static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid_reg, NULL); 459static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid_reg, NULL);
@@ -1176,17 +1186,14 @@ static int lm85_detect(struct i2c_adapter *adapter, int address,
1176 device_create_file(&new_client->dev, &dev_attr_in1_input); 1186 device_create_file(&new_client->dev, &dev_attr_in1_input);
1177 device_create_file(&new_client->dev, &dev_attr_in2_input); 1187 device_create_file(&new_client->dev, &dev_attr_in2_input);
1178 device_create_file(&new_client->dev, &dev_attr_in3_input); 1188 device_create_file(&new_client->dev, &dev_attr_in3_input);
1179 device_create_file(&new_client->dev, &dev_attr_in4_input);
1180 device_create_file(&new_client->dev, &dev_attr_in0_min); 1189 device_create_file(&new_client->dev, &dev_attr_in0_min);
1181 device_create_file(&new_client->dev, &dev_attr_in1_min); 1190 device_create_file(&new_client->dev, &dev_attr_in1_min);
1182 device_create_file(&new_client->dev, &dev_attr_in2_min); 1191 device_create_file(&new_client->dev, &dev_attr_in2_min);
1183 device_create_file(&new_client->dev, &dev_attr_in3_min); 1192 device_create_file(&new_client->dev, &dev_attr_in3_min);
1184 device_create_file(&new_client->dev, &dev_attr_in4_min);
1185 device_create_file(&new_client->dev, &dev_attr_in0_max); 1193 device_create_file(&new_client->dev, &dev_attr_in0_max);
1186 device_create_file(&new_client->dev, &dev_attr_in1_max); 1194 device_create_file(&new_client->dev, &dev_attr_in1_max);
1187 device_create_file(&new_client->dev, &dev_attr_in2_max); 1195 device_create_file(&new_client->dev, &dev_attr_in2_max);
1188 device_create_file(&new_client->dev, &dev_attr_in3_max); 1196 device_create_file(&new_client->dev, &dev_attr_in3_max);
1189 device_create_file(&new_client->dev, &dev_attr_in4_max);
1190 device_create_file(&new_client->dev, &dev_attr_temp1_input); 1197 device_create_file(&new_client->dev, &dev_attr_temp1_input);
1191 device_create_file(&new_client->dev, &dev_attr_temp2_input); 1198 device_create_file(&new_client->dev, &dev_attr_temp2_input);
1192 device_create_file(&new_client->dev, &dev_attr_temp3_input); 1199 device_create_file(&new_client->dev, &dev_attr_temp3_input);
@@ -1224,6 +1231,15 @@ static int lm85_detect(struct i2c_adapter *adapter, int address,
1224 device_create_file(&new_client->dev, &dev_attr_temp2_auto_temp_crit); 1231 device_create_file(&new_client->dev, &dev_attr_temp2_auto_temp_crit);
1225 device_create_file(&new_client->dev, &dev_attr_temp3_auto_temp_crit); 1232 device_create_file(&new_client->dev, &dev_attr_temp3_auto_temp_crit);
1226 1233
1234 /* The ADT7463 has an optional VRM 10 mode where pin 21 is used
1235 as a sixth digital VID input rather than an analog input. */
1236 data->vid = lm85_read_value(new_client, LM85_REG_VID);
1237 if (!(kind == adt7463 && (data->vid & 0x80))) {
1238 device_create_file(&new_client->dev, &dev_attr_in4_input);
1239 device_create_file(&new_client->dev, &dev_attr_in4_min);
1240 device_create_file(&new_client->dev, &dev_attr_in4_max);
1241 }
1242
1227 return 0; 1243 return 0;
1228 1244
1229 /* Error out and cleanup code */ 1245 /* Error out and cleanup code */
@@ -1382,11 +1398,18 @@ static struct lm85_data *lm85_update_device(struct device *dev)
1382 irrelevant. So it is left in 4*/ 1398 irrelevant. So it is left in 4*/
1383 data->adc_scale = (data->type == emc6d102 ) ? 16 : 4; 1399 data->adc_scale = (data->type == emc6d102 ) ? 16 : 4;
1384 1400
1385 for (i = 0; i <= 4; ++i) { 1401 data->vid = lm85_read_value(client, LM85_REG_VID);
1402
1403 for (i = 0; i <= 3; ++i) {
1386 data->in[i] = 1404 data->in[i] =
1387 lm85_read_value(client, LM85_REG_IN(i)); 1405 lm85_read_value(client, LM85_REG_IN(i));
1388 } 1406 }
1389 1407
1408 if (!(data->type == adt7463 && (data->vid & 0x80))) {
1409 data->in[4] = lm85_read_value(client,
1410 LM85_REG_IN(4));
1411 }
1412
1390 for (i = 0; i <= 3; ++i) { 1413 for (i = 0; i <= 3; ++i) {
1391 data->fan[i] = 1414 data->fan[i] =
1392 lm85_read_value(client, LM85_REG_FAN(i)); 1415 lm85_read_value(client, LM85_REG_FAN(i));
@@ -1450,13 +1473,20 @@ static struct lm85_data *lm85_update_device(struct device *dev)
1450 /* Things that don't change often */ 1473 /* Things that don't change often */
1451 dev_dbg(&client->dev, "Reading config values\n"); 1474 dev_dbg(&client->dev, "Reading config values\n");
1452 1475
1453 for (i = 0; i <= 4; ++i) { 1476 for (i = 0; i <= 3; ++i) {
1454 data->in_min[i] = 1477 data->in_min[i] =
1455 lm85_read_value(client, LM85_REG_IN_MIN(i)); 1478 lm85_read_value(client, LM85_REG_IN_MIN(i));
1456 data->in_max[i] = 1479 data->in_max[i] =
1457 lm85_read_value(client, LM85_REG_IN_MAX(i)); 1480 lm85_read_value(client, LM85_REG_IN_MAX(i));
1458 } 1481 }
1459 1482
1483 if (!(data->type == adt7463 && (data->vid & 0x80))) {
1484 data->in_min[4] = lm85_read_value(client,
1485 LM85_REG_IN_MIN(4));
1486 data->in_max[4] = lm85_read_value(client,
1487 LM85_REG_IN_MAX(4));
1488 }
1489
1460 if ( data->type == emc6d100 ) { 1490 if ( data->type == emc6d100 ) {
1461 for (i = 5; i <= 7; ++i) { 1491 for (i = 5; i <= 7; ++i) {
1462 data->in_min[i] = 1492 data->in_min[i] =
@@ -1478,8 +1508,6 @@ static struct lm85_data *lm85_update_device(struct device *dev)
1478 lm85_read_value(client, LM85_REG_TEMP_MAX(i)); 1508 lm85_read_value(client, LM85_REG_TEMP_MAX(i));
1479 } 1509 }
1480 1510
1481 data->vid = lm85_read_value(client, LM85_REG_VID);
1482
1483 for (i = 0; i <= 2; ++i) { 1511 for (i = 0; i <= 2; ++i) {
1484 int val ; 1512 int val ;
1485 data->autofan[i].config = 1513 data->autofan[i].config =