diff options
author | Guenter Roeck <linux@roeck-us.net> | 2012-01-19 14:02:15 -0500 |
---|---|---|
committer | Guenter Roeck <guenter.roeck@ericsson.com> | 2012-03-18 21:26:49 -0400 |
commit | 9ed5bc24fa2b4ebe52b5aec3318babe2aa31795a (patch) | |
tree | fb987e9e58e946b9412cf36b5352a63d919d36a8 /drivers | |
parent | 2fff0840c2fa18bd84613c307770e46ddd9db8e2 (diff) |
hwmon: (adt7475) Fix multi-line comments
Cc: Jean Delvare <khali@linux-fr.org>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/hwmon/adt7475.c | 90 |
1 files changed, 58 insertions, 32 deletions
diff --git a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c index 71e9ac4b8494..a3b46924a15d 100644 --- a/drivers/hwmon/adt7475.c +++ b/drivers/hwmon/adt7475.c | |||
@@ -32,9 +32,10 @@ | |||
32 | #define THERM 5 | 32 | #define THERM 5 |
33 | #define HYSTERSIS 6 | 33 | #define HYSTERSIS 6 |
34 | 34 | ||
35 | /* These are unique identifiers for the sysfs functions - unlike the | 35 | /* |
36 | numbers above, these are not also indexes into an array | 36 | * These are unique identifiers for the sysfs functions - unlike the |
37 | */ | 37 | * numbers above, these are not also indexes into an array |
38 | */ | ||
38 | 39 | ||
39 | #define ALARM 9 | 40 | #define ALARM 9 |
40 | #define FAULT 10 | 41 | #define FAULT 10 |
@@ -288,8 +289,10 @@ static void adt7475_write_word(struct i2c_client *client, int reg, u16 val) | |||
288 | i2c_smbus_write_byte_data(client, reg, val & 0xFF); | 289 | i2c_smbus_write_byte_data(client, reg, val & 0xFF); |
289 | } | 290 | } |
290 | 291 | ||
291 | /* Find the nearest value in a table - used for pwm frequency and | 292 | /* |
292 | auto temp range */ | 293 | * Find the nearest value in a table - used for pwm frequency and |
294 | * auto temp range | ||
295 | */ | ||
293 | static int find_nearest(long val, const int *array, int size) | 296 | static int find_nearest(long val, const int *array, int size) |
294 | { | 297 | { |
295 | int i; | 298 | int i; |
@@ -385,16 +388,20 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *attr, | |||
385 | out = (out >> 4) & 0xF; | 388 | out = (out >> 4) & 0xF; |
386 | else | 389 | else |
387 | out = (out & 0xF); | 390 | out = (out & 0xF); |
388 | /* Show the value as an absolute number tied to | 391 | /* |
389 | * THERM */ | 392 | * Show the value as an absolute number tied to |
393 | * THERM | ||
394 | */ | ||
390 | out = reg2temp(data, data->temp[THERM][sattr->index]) - | 395 | out = reg2temp(data, data->temp[THERM][sattr->index]) - |
391 | out * 1000; | 396 | out * 1000; |
392 | mutex_unlock(&data->lock); | 397 | mutex_unlock(&data->lock); |
393 | break; | 398 | break; |
394 | 399 | ||
395 | case OFFSET: | 400 | case OFFSET: |
396 | /* Offset is always 2's complement, regardless of the | 401 | /* |
397 | * setting in CONFIG5 */ | 402 | * Offset is always 2's complement, regardless of the |
403 | * setting in CONFIG5 | ||
404 | */ | ||
398 | mutex_lock(&data->lock); | 405 | mutex_lock(&data->lock); |
399 | out = (s8)data->temp[sattr->nr][sattr->index]; | 406 | out = (s8)data->temp[sattr->nr][sattr->index]; |
400 | if (data->config5 & CONFIG5_TEMPOFFSET) | 407 | if (data->config5 & CONFIG5_TEMPOFFSET) |
@@ -452,8 +459,10 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *attr, | |||
452 | break; | 459 | break; |
453 | 460 | ||
454 | case HYSTERSIS: | 461 | case HYSTERSIS: |
455 | /* The value will be given as an absolute value, turn it | 462 | /* |
456 | into an offset based on THERM */ | 463 | * The value will be given as an absolute value, turn it |
464 | * into an offset based on THERM | ||
465 | */ | ||
457 | 466 | ||
458 | /* Read fresh THERM and HYSTERSIS values from the chip */ | 467 | /* Read fresh THERM and HYSTERSIS values from the chip */ |
459 | data->temp[THERM][sattr->index] = | 468 | data->temp[THERM][sattr->index] = |
@@ -478,8 +487,10 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *attr, | |||
478 | default: | 487 | default: |
479 | data->temp[sattr->nr][sattr->index] = temp2reg(data, val); | 488 | data->temp[sattr->nr][sattr->index] = temp2reg(data, val); |
480 | 489 | ||
481 | /* We maintain an extra 2 digits of precision for simplicity | 490 | /* |
482 | * - shift those back off before writing the value */ | 491 | * We maintain an extra 2 digits of precision for simplicity |
492 | * - shift those back off before writing the value | ||
493 | */ | ||
483 | out = (u8) (data->temp[sattr->nr][sattr->index] >> 2); | 494 | out = (u8) (data->temp[sattr->nr][sattr->index] >> 2); |
484 | } | 495 | } |
485 | 496 | ||
@@ -514,8 +525,10 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *attr, | |||
514 | return count; | 525 | return count; |
515 | } | 526 | } |
516 | 527 | ||
517 | /* Table of autorange values - the user will write the value in millidegrees, | 528 | /* |
518 | and we'll convert it */ | 529 | * Table of autorange values - the user will write the value in millidegrees, |
530 | * and we'll convert it | ||
531 | */ | ||
519 | static const int autorange_table[] = { | 532 | static const int autorange_table[] = { |
520 | 2000, 2500, 3330, 4000, 5000, 6670, 8000, | 533 | 2000, 2500, 3330, 4000, 5000, 6670, 8000, |
521 | 10000, 13330, 16000, 20000, 26670, 32000, 40000, | 534 | 10000, 13330, 16000, 20000, 26670, 32000, 40000, |
@@ -558,8 +571,10 @@ static ssize_t set_point2(struct device *dev, struct device_attribute *attr, | |||
558 | data->range[sattr->index] = | 571 | data->range[sattr->index] = |
559 | adt7475_read(TEMP_TRANGE_REG(sattr->index)); | 572 | adt7475_read(TEMP_TRANGE_REG(sattr->index)); |
560 | 573 | ||
561 | /* The user will write an absolute value, so subtract the start point | 574 | /* |
562 | to figure the range */ | 575 | * The user will write an absolute value, so subtract the start point |
576 | * to figure the range | ||
577 | */ | ||
563 | temp = reg2temp(data, data->temp[AUTOMIN][sattr->index]); | 578 | temp = reg2temp(data, data->temp[AUTOMIN][sattr->index]); |
564 | val = SENSORS_LIMIT(val, temp + autorange_table[0], | 579 | val = SENSORS_LIMIT(val, temp + autorange_table[0], |
565 | temp + autorange_table[ARRAY_SIZE(autorange_table) - 1]); | 580 | temp + autorange_table[ARRAY_SIZE(autorange_table) - 1]); |
@@ -664,8 +679,10 @@ static ssize_t set_pwm(struct device *dev, struct device_attribute *attr, | |||
664 | data->pwm[CONTROL][sattr->index] = | 679 | data->pwm[CONTROL][sattr->index] = |
665 | adt7475_read(PWM_CONFIG_REG(sattr->index)); | 680 | adt7475_read(PWM_CONFIG_REG(sattr->index)); |
666 | 681 | ||
667 | /* If we are not in manual mode, then we shouldn't allow | 682 | /* |
668 | * the user to set the pwm speed */ | 683 | * If we are not in manual mode, then we shouldn't allow |
684 | * the user to set the pwm speed | ||
685 | */ | ||
669 | if (((data->pwm[CONTROL][sattr->index] >> 5) & 7) != 7) { | 686 | if (((data->pwm[CONTROL][sattr->index] >> 5) & 7) != 7) { |
670 | mutex_unlock(&data->lock); | 687 | mutex_unlock(&data->lock); |
671 | return count; | 688 | return count; |
@@ -1280,9 +1297,11 @@ static int adt7475_probe(struct i2c_client *client, | |||
1280 | if ((data->config4 & CONFIG4_PINFUNC) == 0x0) | 1297 | if ((data->config4 & CONFIG4_PINFUNC) == 0x0) |
1281 | data->has_fan4 = 1; | 1298 | data->has_fan4 = 1; |
1282 | 1299 | ||
1283 | /* THERM configuration is more complex on the ADT7476 and ADT7490, | 1300 | /* |
1284 | because 2 different pins (TACH4 and +2.5 Vin) can be used for | 1301 | * THERM configuration is more complex on the ADT7476 and ADT7490, |
1285 | this function */ | 1302 | * because 2 different pins (TACH4 and +2.5 Vin) can be used for |
1303 | * this function | ||
1304 | */ | ||
1286 | if (id->driver_data == adt7490) { | 1305 | if (id->driver_data == adt7490) { |
1287 | if ((data->config4 & CONFIG4_PINFUNC) == 0x1 && | 1306 | if ((data->config4 & CONFIG4_PINFUNC) == 0x1 && |
1288 | !(config3 & CONFIG3_THERM)) | 1307 | !(config3 & CONFIG3_THERM)) |
@@ -1294,8 +1313,10 @@ static int adt7475_probe(struct i2c_client *client, | |||
1294 | data->has_voltage |= (1 << 0); /* in0 */ | 1313 | data->has_voltage |= (1 << 0); /* in0 */ |
1295 | } | 1314 | } |
1296 | 1315 | ||
1297 | /* On the ADT7476, the +12V input pin may instead be used as VID5, | 1316 | /* |
1298 | and VID pins may alternatively be used as GPIO */ | 1317 | * On the ADT7476, the +12V input pin may instead be used as VID5, |
1318 | * and VID pins may alternatively be used as GPIO | ||
1319 | */ | ||
1299 | if (id->driver_data == adt7476) { | 1320 | if (id->driver_data == adt7476) { |
1300 | u8 vid = adt7475_read(REG_VID); | 1321 | u8 vid = adt7475_read(REG_VID); |
1301 | if (!(vid & VID_VIDSEL)) | 1322 | if (!(vid & VID_VIDSEL)) |
@@ -1314,8 +1335,10 @@ static int adt7475_probe(struct i2c_client *client, | |||
1314 | } | 1335 | } |
1315 | data->bypass_attn &= data->has_voltage; | 1336 | data->bypass_attn &= data->has_voltage; |
1316 | 1337 | ||
1317 | /* Call adt7475_read_pwm for all pwm's as this will reprogram any | 1338 | /* |
1318 | pwm's which are disabled to manual mode with 0% duty cycle */ | 1339 | * Call adt7475_read_pwm for all pwm's as this will reprogram any |
1340 | * pwm's which are disabled to manual mode with 0% duty cycle | ||
1341 | */ | ||
1319 | for (i = 0; i < ADT7475_PWM_COUNT; i++) | 1342 | for (i = 0; i < ADT7475_PWM_COUNT; i++) |
1320 | adt7475_read_pwm(client, i); | 1343 | adt7475_read_pwm(client, i); |
1321 | 1344 | ||
@@ -1431,8 +1454,10 @@ static void adt7475_read_pwm(struct i2c_client *client, int index) | |||
1431 | 1454 | ||
1432 | data->pwm[CONTROL][index] = adt7475_read(PWM_CONFIG_REG(index)); | 1455 | data->pwm[CONTROL][index] = adt7475_read(PWM_CONFIG_REG(index)); |
1433 | 1456 | ||
1434 | /* Figure out the internal value for pwmctrl and pwmchan | 1457 | /* |
1435 | based on the current settings */ | 1458 | * Figure out the internal value for pwmctrl and pwmchan |
1459 | * based on the current settings | ||
1460 | */ | ||
1436 | v = (data->pwm[CONTROL][index] >> 5) & 7; | 1461 | v = (data->pwm[CONTROL][index] >> 5) & 7; |
1437 | 1462 | ||
1438 | if (v == 3) | 1463 | if (v == 3) |
@@ -1440,10 +1465,11 @@ static void adt7475_read_pwm(struct i2c_client *client, int index) | |||
1440 | else if (v == 7) | 1465 | else if (v == 7) |
1441 | data->pwmctl[index] = 1; | 1466 | data->pwmctl[index] = 1; |
1442 | else if (v == 4) { | 1467 | else if (v == 4) { |
1443 | /* The fan is disabled - we don't want to | 1468 | /* |
1444 | support that, so change to manual mode and | 1469 | * The fan is disabled - we don't want to |
1445 | set the duty cycle to 0 instead | 1470 | * support that, so change to manual mode and |
1446 | */ | 1471 | * set the duty cycle to 0 instead |
1472 | */ | ||
1447 | data->pwm[INPUT][index] = 0; | 1473 | data->pwm[INPUT][index] = 0; |
1448 | data->pwm[CONTROL][index] &= ~0xE0; | 1474 | data->pwm[CONTROL][index] &= ~0xE0; |
1449 | data->pwm[CONTROL][index] |= (7 << 5); | 1475 | data->pwm[CONTROL][index] |= (7 << 5); |