aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/ads1015.c3
-rw-r--r--drivers/hwmon/f75375s.c7
-rw-r--r--drivers/hwmon/max6639.c22
-rw-r--r--drivers/hwmon/pmbus/max34440.c2
4 files changed, 17 insertions, 17 deletions
diff --git a/drivers/hwmon/ads1015.c b/drivers/hwmon/ads1015.c
index eedca3cf9968..dd87ae96c262 100644
--- a/drivers/hwmon/ads1015.c
+++ b/drivers/hwmon/ads1015.c
@@ -271,7 +271,7 @@ static int ads1015_probe(struct i2c_client *client,
271 continue; 271 continue;
272 err = device_create_file(&client->dev, &ads1015_in[k].dev_attr); 272 err = device_create_file(&client->dev, &ads1015_in[k].dev_attr);
273 if (err) 273 if (err)
274 goto exit_free; 274 goto exit_remove;
275 } 275 }
276 276
277 data->hwmon_dev = hwmon_device_register(&client->dev); 277 data->hwmon_dev = hwmon_device_register(&client->dev);
@@ -285,7 +285,6 @@ static int ads1015_probe(struct i2c_client *client,
285exit_remove: 285exit_remove:
286 for (k = 0; k < ADS1015_CHANNELS; ++k) 286 for (k = 0; k < ADS1015_CHANNELS; ++k)
287 device_remove_file(&client->dev, &ads1015_in[k].dev_attr); 287 device_remove_file(&client->dev, &ads1015_in[k].dev_attr);
288exit_free:
289 kfree(data); 288 kfree(data);
290exit: 289exit:
291 return err; 290 return err;
diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c
index f609b5727ba9..6bab2001ef3b 100644
--- a/drivers/hwmon/f75375s.c
+++ b/drivers/hwmon/f75375s.c
@@ -340,8 +340,6 @@ static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val)
340 fanmode |= (1 << F75387_FAN_MANU_MODE(nr)); 340 fanmode |= (1 << F75387_FAN_MANU_MODE(nr));
341 fanmode |= (1 << F75387_FAN_DUTY_MODE(nr)); 341 fanmode |= (1 << F75387_FAN_DUTY_MODE(nr));
342 data->pwm[nr] = 255; 342 data->pwm[nr] = 255;
343 f75375_write8(client, F75375_REG_FAN_PWM_DUTY(nr),
344 data->pwm[nr]);
345 break; 343 break;
346 case 1: /* PWM */ 344 case 1: /* PWM */
347 fanmode |= (1 << F75387_FAN_MANU_MODE(nr)); 345 fanmode |= (1 << F75387_FAN_MANU_MODE(nr));
@@ -361,8 +359,6 @@ static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val)
361 case 0: /* full speed */ 359 case 0: /* full speed */
362 fanmode |= (3 << FAN_CTRL_MODE(nr)); 360 fanmode |= (3 << FAN_CTRL_MODE(nr));
363 data->pwm[nr] = 255; 361 data->pwm[nr] = 255;
364 f75375_write8(client, F75375_REG_FAN_PWM_DUTY(nr),
365 data->pwm[nr]);
366 break; 362 break;
367 case 1: /* PWM */ 363 case 1: /* PWM */
368 fanmode |= (3 << FAN_CTRL_MODE(nr)); 364 fanmode |= (3 << FAN_CTRL_MODE(nr));
@@ -377,6 +373,9 @@ static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val)
377 373
378 f75375_write8(client, F75375_REG_FAN_TIMER, fanmode); 374 f75375_write8(client, F75375_REG_FAN_TIMER, fanmode);
379 data->pwm_enable[nr] = val; 375 data->pwm_enable[nr] = val;
376 if (val == 0)
377 f75375_write8(client, F75375_REG_FAN_PWM_DUTY(nr),
378 data->pwm[nr]);
380 return 0; 379 return 0;
381} 380}
382 381
diff --git a/drivers/hwmon/max6639.c b/drivers/hwmon/max6639.c
index e10a092c603c..a6760bacd915 100644
--- a/drivers/hwmon/max6639.c
+++ b/drivers/hwmon/max6639.c
@@ -72,8 +72,8 @@ static unsigned short normal_i2c[] = { 0x2c, 0x2e, 0x2f, I2C_CLIENT_END };
72 72
73static const int rpm_ranges[] = { 2000, 4000, 8000, 16000 }; 73static const int rpm_ranges[] = { 2000, 4000, 8000, 16000 };
74 74
75#define FAN_FROM_REG(val, div, rpm_range) ((val) == 0 ? -1 : \ 75#define FAN_FROM_REG(val, rpm_range) ((val) == 0 || (val) == 255 ? \
76 (val) == 255 ? 0 : (rpm_ranges[rpm_range] * 30) / ((div + 1) * (val))) 76 0 : (rpm_ranges[rpm_range] * 30) / (val))
77#define TEMP_LIMIT_TO_REG(val) SENSORS_LIMIT((val) / 1000, 0, 255) 77#define TEMP_LIMIT_TO_REG(val) SENSORS_LIMIT((val) / 1000, 0, 255)
78 78
79/* 79/*
@@ -333,7 +333,7 @@ static ssize_t show_fan_input(struct device *dev,
333 return PTR_ERR(data); 333 return PTR_ERR(data);
334 334
335 return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan[attr->index], 335 return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan[attr->index],
336 data->ppr, data->rpm_range)); 336 data->rpm_range));
337} 337}
338 338
339static ssize_t show_alarm(struct device *dev, 339static ssize_t show_alarm(struct device *dev,
@@ -429,9 +429,9 @@ static int max6639_init_client(struct i2c_client *client)
429 struct max6639_data *data = i2c_get_clientdata(client); 429 struct max6639_data *data = i2c_get_clientdata(client);
430 struct max6639_platform_data *max6639_info = 430 struct max6639_platform_data *max6639_info =
431 client->dev.platform_data; 431 client->dev.platform_data;
432 int i = 0; 432 int i;
433 int rpm_range = 1; /* default: 4000 RPM */ 433 int rpm_range = 1; /* default: 4000 RPM */
434 int err = 0; 434 int err;
435 435
436 /* Reset chip to default values, see below for GCONFIG setup */ 436 /* Reset chip to default values, see below for GCONFIG setup */
437 err = i2c_smbus_write_byte_data(client, MAX6639_REG_GCONFIG, 437 err = i2c_smbus_write_byte_data(client, MAX6639_REG_GCONFIG,
@@ -446,11 +446,6 @@ static int max6639_init_client(struct i2c_client *client)
446 else 446 else
447 data->ppr = 2; 447 data->ppr = 2;
448 data->ppr -= 1; 448 data->ppr -= 1;
449 err = i2c_smbus_write_byte_data(client,
450 MAX6639_REG_FAN_PPR(i),
451 data->ppr << 5);
452 if (err)
453 goto exit;
454 449
455 if (max6639_info) 450 if (max6639_info)
456 rpm_range = rpm_range_to_reg(max6639_info->rpm_range); 451 rpm_range = rpm_range_to_reg(max6639_info->rpm_range);
@@ -458,6 +453,13 @@ static int max6639_init_client(struct i2c_client *client)
458 453
459 for (i = 0; i < 2; i++) { 454 for (i = 0; i < 2; i++) {
460 455
456 /* Set Fan pulse per revolution */
457 err = i2c_smbus_write_byte_data(client,
458 MAX6639_REG_FAN_PPR(i),
459 data->ppr << 6);
460 if (err)
461 goto exit;
462
461 /* Fans config PWM, RPM */ 463 /* Fans config PWM, RPM */
462 err = i2c_smbus_write_byte_data(client, 464 err = i2c_smbus_write_byte_data(client,
463 MAX6639_REG_FAN_CONFIG1(i), 465 MAX6639_REG_FAN_CONFIG1(i),
diff --git a/drivers/hwmon/pmbus/max34440.c b/drivers/hwmon/pmbus/max34440.c
index beaf5a8d9c45..9b97a5b3cf3d 100644
--- a/drivers/hwmon/pmbus/max34440.c
+++ b/drivers/hwmon/pmbus/max34440.c
@@ -82,7 +82,7 @@ static int max34440_write_word_data(struct i2c_client *client, int page,
82 case PMBUS_VIRT_RESET_TEMP_HISTORY: 82 case PMBUS_VIRT_RESET_TEMP_HISTORY:
83 ret = pmbus_write_word_data(client, page, 83 ret = pmbus_write_word_data(client, page,
84 MAX34440_MFR_TEMPERATURE_PEAK, 84 MAX34440_MFR_TEMPERATURE_PEAK,
85 0xffff); 85 0x8000);
86 break; 86 break;
87 default: 87 default:
88 ret = -ENODATA; 88 ret = -ENODATA;