aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/Kconfig5
-rw-r--r--drivers/hwmon/ads1015.c3
-rw-r--r--drivers/hwmon/f75375s.c103
-rw-r--r--drivers/hwmon/jc42.c30
-rw-r--r--drivers/hwmon/max6639.c22
-rw-r--r--drivers/hwmon/pmbus/max34440.c2
-rw-r--r--drivers/hwmon/pmbus/pmbus_core.c3
-rw-r--r--drivers/hwmon/pmbus/zl6100.c10
-rw-r--r--drivers/hwmon/w83627ehf.c28
9 files changed, 154 insertions, 52 deletions
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 02260406b9e4..dad895fec62a 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -497,8 +497,9 @@ config SENSORS_JC42
497 If you say yes here, you get support for JEDEC JC42.4 compliant 497 If you say yes here, you get support for JEDEC JC42.4 compliant
498 temperature sensors, which are used on many DDR3 memory modules for 498 temperature sensors, which are used on many DDR3 memory modules for
499 mobile devices and servers. Support will include, but not be limited 499 mobile devices and servers. Support will include, but not be limited
500 to, ADT7408, CAT34TS02, CAT6095, MAX6604, MCP9805, MCP98242, MCP98243, 500 to, ADT7408, AT30TS00, CAT34TS02, CAT6095, MAX6604, MCP9804, MCP9805,
501 MCP9843, SE97, SE98, STTS424(E), TSE2002B3, and TS3000B3. 501 MCP98242, MCP98243, MCP9843, SE97, SE98, STTS424(E), STTS2002,
502 STTS3000, TSE2002B3, TSE2002GB2, TS3000B3, and TS3000GB2.
502 503
503 This driver can also be built as a module. If so, the module 504 This driver can also be built as a module. If so, the module
504 will be called jc42. 505 will be called jc42.
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 eedf574ab539..6aa5a9fad879 100644
--- a/drivers/hwmon/f75375s.c
+++ b/drivers/hwmon/f75375s.c
@@ -172,12 +172,22 @@ static inline void f75375_write8(struct i2c_client *client, u8 reg,
172static inline void f75375_write16(struct i2c_client *client, u8 reg, 172static inline void f75375_write16(struct i2c_client *client, u8 reg,
173 u16 value) 173 u16 value)
174{ 174{
175 int err = i2c_smbus_write_byte_data(client, reg, (value << 8)); 175 int err = i2c_smbus_write_byte_data(client, reg, (value >> 8));
176 if (err) 176 if (err)
177 return; 177 return;
178 i2c_smbus_write_byte_data(client, reg + 1, (value & 0xFF)); 178 i2c_smbus_write_byte_data(client, reg + 1, (value & 0xFF));
179} 179}
180 180
181static void f75375_write_pwm(struct i2c_client *client, int nr)
182{
183 struct f75375_data *data = i2c_get_clientdata(client);
184 if (data->kind == f75387)
185 f75375_write16(client, F75375_REG_FAN_EXP(nr), data->pwm[nr]);
186 else
187 f75375_write8(client, F75375_REG_FAN_PWM_DUTY(nr),
188 data->pwm[nr]);
189}
190
181static struct f75375_data *f75375_update_device(struct device *dev) 191static struct f75375_data *f75375_update_device(struct device *dev)
182{ 192{
183 struct i2c_client *client = to_i2c_client(dev); 193 struct i2c_client *client = to_i2c_client(dev);
@@ -200,9 +210,6 @@ static struct f75375_data *f75375_update_device(struct device *dev)
200 f75375_read16(client, F75375_REG_FAN_MIN(nr)); 210 f75375_read16(client, F75375_REG_FAN_MIN(nr));
201 data->fan_target[nr] = 211 data->fan_target[nr] =
202 f75375_read16(client, F75375_REG_FAN_EXP(nr)); 212 f75375_read16(client, F75375_REG_FAN_EXP(nr));
203 data->pwm[nr] = f75375_read8(client,
204 F75375_REG_FAN_PWM_DUTY(nr));
205
206 } 213 }
207 for (nr = 0; nr < 4; nr++) { 214 for (nr = 0; nr < 4; nr++) {
208 data->in_max[nr] = 215 data->in_max[nr] =
@@ -218,6 +225,8 @@ static struct f75375_data *f75375_update_device(struct device *dev)
218 if (time_after(jiffies, data->last_updated + 2 * HZ) 225 if (time_after(jiffies, data->last_updated + 2 * HZ)
219 || !data->valid) { 226 || !data->valid) {
220 for (nr = 0; nr < 2; nr++) { 227 for (nr = 0; nr < 2; nr++) {
228 data->pwm[nr] = f75375_read8(client,
229 F75375_REG_FAN_PWM_DUTY(nr));
221 /* assign MSB, therefore shift it by 8 bits */ 230 /* assign MSB, therefore shift it by 8 bits */
222 data->temp11[nr] = 231 data->temp11[nr] =
223 f75375_read8(client, F75375_REG_TEMP(nr)) << 8; 232 f75375_read8(client, F75375_REG_TEMP(nr)) << 8;
@@ -255,6 +264,36 @@ static inline u16 rpm_to_reg(int rpm)
255 return 1500000 / rpm; 264 return 1500000 / rpm;
256} 265}
257 266
267static bool duty_mode_enabled(u8 pwm_enable)
268{
269 switch (pwm_enable) {
270 case 0: /* Manual, duty mode (full speed) */
271 case 1: /* Manual, duty mode */
272 case 4: /* Auto, duty mode */
273 return true;
274 case 2: /* Auto, speed mode */
275 case 3: /* Manual, speed mode */
276 return false;
277 default:
278 BUG();
279 }
280}
281
282static bool auto_mode_enabled(u8 pwm_enable)
283{
284 switch (pwm_enable) {
285 case 0: /* Manual, duty mode (full speed) */
286 case 1: /* Manual, duty mode */
287 case 3: /* Manual, speed mode */
288 return false;
289 case 2: /* Auto, speed mode */
290 case 4: /* Auto, duty mode */
291 return true;
292 default:
293 BUG();
294 }
295}
296
258static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr, 297static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr,
259 const char *buf, size_t count) 298 const char *buf, size_t count)
260{ 299{
@@ -288,6 +327,11 @@ static ssize_t set_fan_target(struct device *dev, struct device_attribute *attr,
288 if (err < 0) 327 if (err < 0)
289 return err; 328 return err;
290 329
330 if (auto_mode_enabled(data->pwm_enable[nr]))
331 return -EINVAL;
332 if (data->kind == f75387 && duty_mode_enabled(data->pwm_enable[nr]))
333 return -EINVAL;
334
291 mutex_lock(&data->update_lock); 335 mutex_lock(&data->update_lock);
292 data->fan_target[nr] = rpm_to_reg(val); 336 data->fan_target[nr] = rpm_to_reg(val);
293 f75375_write16(client, F75375_REG_FAN_EXP(nr), data->fan_target[nr]); 337 f75375_write16(client, F75375_REG_FAN_EXP(nr), data->fan_target[nr]);
@@ -308,9 +352,13 @@ static ssize_t set_pwm(struct device *dev, struct device_attribute *attr,
308 if (err < 0) 352 if (err < 0)
309 return err; 353 return err;
310 354
355 if (auto_mode_enabled(data->pwm_enable[nr]) ||
356 !duty_mode_enabled(data->pwm_enable[nr]))
357 return -EINVAL;
358
311 mutex_lock(&data->update_lock); 359 mutex_lock(&data->update_lock);
312 data->pwm[nr] = SENSORS_LIMIT(val, 0, 255); 360 data->pwm[nr] = SENSORS_LIMIT(val, 0, 255);
313 f75375_write8(client, F75375_REG_FAN_PWM_DUTY(nr), data->pwm[nr]); 361 f75375_write_pwm(client, nr);
314 mutex_unlock(&data->update_lock); 362 mutex_unlock(&data->update_lock);
315 return count; 363 return count;
316} 364}
@@ -328,11 +376,15 @@ static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val)
328 struct f75375_data *data = i2c_get_clientdata(client); 376 struct f75375_data *data = i2c_get_clientdata(client);
329 u8 fanmode; 377 u8 fanmode;
330 378
331 if (val < 0 || val > 3) 379 if (val < 0 || val > 4)
332 return -EINVAL; 380 return -EINVAL;
333 381
334 fanmode = f75375_read8(client, F75375_REG_FAN_TIMER); 382 fanmode = f75375_read8(client, F75375_REG_FAN_TIMER);
335 if (data->kind == f75387) { 383 if (data->kind == f75387) {
384 /* For now, deny dangerous toggling of duty mode */
385 if (duty_mode_enabled(data->pwm_enable[nr]) !=
386 duty_mode_enabled(val))
387 return -EOPNOTSUPP;
336 /* clear each fanX_mode bit before setting them properly */ 388 /* clear each fanX_mode bit before setting them properly */
337 fanmode &= ~(1 << F75387_FAN_DUTY_MODE(nr)); 389 fanmode &= ~(1 << F75387_FAN_DUTY_MODE(nr));
338 fanmode &= ~(1 << F75387_FAN_MANU_MODE(nr)); 390 fanmode &= ~(1 << F75387_FAN_MANU_MODE(nr));
@@ -341,19 +393,19 @@ static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val)
341 fanmode |= (1 << F75387_FAN_MANU_MODE(nr)); 393 fanmode |= (1 << F75387_FAN_MANU_MODE(nr));
342 fanmode |= (1 << F75387_FAN_DUTY_MODE(nr)); 394 fanmode |= (1 << F75387_FAN_DUTY_MODE(nr));
343 data->pwm[nr] = 255; 395 data->pwm[nr] = 255;
344 f75375_write8(client, F75375_REG_FAN_PWM_DUTY(nr),
345 data->pwm[nr]);
346 break; 396 break;
347 case 1: /* PWM */ 397 case 1: /* PWM */
348 fanmode |= (1 << F75387_FAN_MANU_MODE(nr)); 398 fanmode |= (1 << F75387_FAN_MANU_MODE(nr));
349 fanmode |= (1 << F75387_FAN_DUTY_MODE(nr)); 399 fanmode |= (1 << F75387_FAN_DUTY_MODE(nr));
350 break; 400 break;
351 case 2: /* AUTOMATIC*/ 401 case 2: /* Automatic, speed mode */
352 fanmode |= (1 << F75387_FAN_DUTY_MODE(nr));
353 break; 402 break;
354 case 3: /* fan speed */ 403 case 3: /* fan speed */
355 fanmode |= (1 << F75387_FAN_MANU_MODE(nr)); 404 fanmode |= (1 << F75387_FAN_MANU_MODE(nr));
356 break; 405 break;
406 case 4: /* Automatic, pwm */
407 fanmode |= (1 << F75387_FAN_DUTY_MODE(nr));
408 break;
357 } 409 }
358 } else { 410 } else {
359 /* clear each fanX_mode bit before setting them properly */ 411 /* clear each fanX_mode bit before setting them properly */
@@ -362,22 +414,24 @@ static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val)
362 case 0: /* full speed */ 414 case 0: /* full speed */
363 fanmode |= (3 << FAN_CTRL_MODE(nr)); 415 fanmode |= (3 << FAN_CTRL_MODE(nr));
364 data->pwm[nr] = 255; 416 data->pwm[nr] = 255;
365 f75375_write8(client, F75375_REG_FAN_PWM_DUTY(nr),
366 data->pwm[nr]);
367 break; 417 break;
368 case 1: /* PWM */ 418 case 1: /* PWM */
369 fanmode |= (3 << FAN_CTRL_MODE(nr)); 419 fanmode |= (3 << FAN_CTRL_MODE(nr));
370 break; 420 break;
371 case 2: /* AUTOMATIC*/ 421 case 2: /* AUTOMATIC*/
372 fanmode |= (2 << FAN_CTRL_MODE(nr)); 422 fanmode |= (1 << FAN_CTRL_MODE(nr));
373 break; 423 break;
374 case 3: /* fan speed */ 424 case 3: /* fan speed */
375 break; 425 break;
426 case 4: /* Automatic pwm */
427 return -EINVAL;
376 } 428 }
377 } 429 }
378 430
379 f75375_write8(client, F75375_REG_FAN_TIMER, fanmode); 431 f75375_write8(client, F75375_REG_FAN_TIMER, fanmode);
380 data->pwm_enable[nr] = val; 432 data->pwm_enable[nr] = val;
433 if (val == 0)
434 f75375_write_pwm(client, nr);
381 return 0; 435 return 0;
382} 436}
383 437
@@ -723,19 +777,22 @@ static void f75375_init(struct i2c_client *client, struct f75375_data *data,
723 if (data->kind == f75387) { 777 if (data->kind == f75387) {
724 bool manu, duty; 778 bool manu, duty;
725 779
726 if (!(conf & (1 << F75387_FAN_CTRL_LINEAR(nr)))) 780 if (!(mode & (1 << F75387_FAN_CTRL_LINEAR(nr))))
727 data->pwm_mode[nr] = 1; 781 data->pwm_mode[nr] = 1;
728 782
729 manu = ((mode >> F75387_FAN_MANU_MODE(nr)) & 1); 783 manu = ((mode >> F75387_FAN_MANU_MODE(nr)) & 1);
730 duty = ((mode >> F75387_FAN_DUTY_MODE(nr)) & 1); 784 duty = ((mode >> F75387_FAN_DUTY_MODE(nr)) & 1);
731 if (manu && duty) 785 if (!manu && duty)
732 /* speed */ 786 /* auto, pwm */
787 data->pwm_enable[nr] = 4;
788 else if (manu && !duty)
789 /* manual, speed */
733 data->pwm_enable[nr] = 3; 790 data->pwm_enable[nr] = 3;
734 else if (!manu && duty) 791 else if (!manu && !duty)
735 /* automatic */ 792 /* automatic, speed */
736 data->pwm_enable[nr] = 2; 793 data->pwm_enable[nr] = 2;
737 else 794 else
738 /* manual */ 795 /* manual, pwm */
739 data->pwm_enable[nr] = 1; 796 data->pwm_enable[nr] = 1;
740 } else { 797 } else {
741 if (!(conf & (1 << F75375_FAN_CTRL_LINEAR(nr)))) 798 if (!(conf & (1 << F75375_FAN_CTRL_LINEAR(nr))))
@@ -760,9 +817,11 @@ static void f75375_init(struct i2c_client *client, struct f75375_data *data,
760 set_pwm_enable_direct(client, 0, f75375s_pdata->pwm_enable[0]); 817 set_pwm_enable_direct(client, 0, f75375s_pdata->pwm_enable[0]);
761 set_pwm_enable_direct(client, 1, f75375s_pdata->pwm_enable[1]); 818 set_pwm_enable_direct(client, 1, f75375s_pdata->pwm_enable[1]);
762 for (nr = 0; nr < 2; nr++) { 819 for (nr = 0; nr < 2; nr++) {
820 if (auto_mode_enabled(f75375s_pdata->pwm_enable[nr]) ||
821 !duty_mode_enabled(f75375s_pdata->pwm_enable[nr]))
822 continue;
763 data->pwm[nr] = SENSORS_LIMIT(f75375s_pdata->pwm[nr], 0, 255); 823 data->pwm[nr] = SENSORS_LIMIT(f75375s_pdata->pwm[nr], 0, 255);
764 f75375_write8(client, F75375_REG_FAN_PWM_DUTY(nr), 824 f75375_write_pwm(client, nr);
765 data->pwm[nr]);
766 } 825 }
767 826
768} 827}
@@ -789,7 +848,7 @@ static int f75375_probe(struct i2c_client *client,
789 if (err) 848 if (err)
790 goto exit_free; 849 goto exit_free;
791 850
792 if (data->kind == f75375) { 851 if (data->kind != f75373) {
793 err = sysfs_chmod_file(&client->dev.kobj, 852 err = sysfs_chmod_file(&client->dev.kobj,
794 &sensor_dev_attr_pwm1_mode.dev_attr.attr, 853 &sensor_dev_attr_pwm1_mode.dev_attr.attr,
795 S_IRUGO | S_IWUSR); 854 S_IRUGO | S_IWUSR);
diff --git a/drivers/hwmon/jc42.c b/drivers/hwmon/jc42.c
index 28c09eead36b..b927ee5ccdd7 100644
--- a/drivers/hwmon/jc42.c
+++ b/drivers/hwmon/jc42.c
@@ -64,6 +64,7 @@ static const unsigned short normal_i2c[] = {
64 64
65/* Manufacturer IDs */ 65/* Manufacturer IDs */
66#define ADT_MANID 0x11d4 /* Analog Devices */ 66#define ADT_MANID 0x11d4 /* Analog Devices */
67#define ATMEL_MANID 0x001f /* Atmel */
67#define MAX_MANID 0x004d /* Maxim */ 68#define MAX_MANID 0x004d /* Maxim */
68#define IDT_MANID 0x00b3 /* IDT */ 69#define IDT_MANID 0x00b3 /* IDT */
69#define MCP_MANID 0x0054 /* Microchip */ 70#define MCP_MANID 0x0054 /* Microchip */
@@ -77,15 +78,25 @@ static const unsigned short normal_i2c[] = {
77#define ADT7408_DEVID 0x0801 78#define ADT7408_DEVID 0x0801
78#define ADT7408_DEVID_MASK 0xffff 79#define ADT7408_DEVID_MASK 0xffff
79 80
81/* Atmel */
82#define AT30TS00_DEVID 0x8201
83#define AT30TS00_DEVID_MASK 0xffff
84
80/* IDT */ 85/* IDT */
81#define TS3000B3_DEVID 0x2903 /* Also matches TSE2002B3 */ 86#define TS3000B3_DEVID 0x2903 /* Also matches TSE2002B3 */
82#define TS3000B3_DEVID_MASK 0xffff 87#define TS3000B3_DEVID_MASK 0xffff
83 88
89#define TS3000GB2_DEVID 0x2912 /* Also matches TSE2002GB2 */
90#define TS3000GB2_DEVID_MASK 0xffff
91
84/* Maxim */ 92/* Maxim */
85#define MAX6604_DEVID 0x3e00 93#define MAX6604_DEVID 0x3e00
86#define MAX6604_DEVID_MASK 0xffff 94#define MAX6604_DEVID_MASK 0xffff
87 95
88/* Microchip */ 96/* Microchip */
97#define MCP9804_DEVID 0x0200
98#define MCP9804_DEVID_MASK 0xfffc
99
89#define MCP98242_DEVID 0x2000 100#define MCP98242_DEVID 0x2000
90#define MCP98242_DEVID_MASK 0xfffc 101#define MCP98242_DEVID_MASK 0xfffc
91 102
@@ -113,6 +124,12 @@ static const unsigned short normal_i2c[] = {
113#define STTS424E_DEVID 0x0000 124#define STTS424E_DEVID 0x0000
114#define STTS424E_DEVID_MASK 0xfffe 125#define STTS424E_DEVID_MASK 0xfffe
115 126
127#define STTS2002_DEVID 0x0300
128#define STTS2002_DEVID_MASK 0xffff
129
130#define STTS3000_DEVID 0x0200
131#define STTS3000_DEVID_MASK 0xffff
132
116static u16 jc42_hysteresis[] = { 0, 1500, 3000, 6000 }; 133static u16 jc42_hysteresis[] = { 0, 1500, 3000, 6000 };
117 134
118struct jc42_chips { 135struct jc42_chips {
@@ -123,8 +140,11 @@ struct jc42_chips {
123 140
124static struct jc42_chips jc42_chips[] = { 141static struct jc42_chips jc42_chips[] = {
125 { ADT_MANID, ADT7408_DEVID, ADT7408_DEVID_MASK }, 142 { ADT_MANID, ADT7408_DEVID, ADT7408_DEVID_MASK },
143 { ATMEL_MANID, AT30TS00_DEVID, AT30TS00_DEVID_MASK },
126 { IDT_MANID, TS3000B3_DEVID, TS3000B3_DEVID_MASK }, 144 { IDT_MANID, TS3000B3_DEVID, TS3000B3_DEVID_MASK },
145 { IDT_MANID, TS3000GB2_DEVID, TS3000GB2_DEVID_MASK },
127 { MAX_MANID, MAX6604_DEVID, MAX6604_DEVID_MASK }, 146 { MAX_MANID, MAX6604_DEVID, MAX6604_DEVID_MASK },
147 { MCP_MANID, MCP9804_DEVID, MCP9804_DEVID_MASK },
128 { MCP_MANID, MCP98242_DEVID, MCP98242_DEVID_MASK }, 148 { MCP_MANID, MCP98242_DEVID, MCP98242_DEVID_MASK },
129 { MCP_MANID, MCP98243_DEVID, MCP98243_DEVID_MASK }, 149 { MCP_MANID, MCP98243_DEVID, MCP98243_DEVID_MASK },
130 { MCP_MANID, MCP9843_DEVID, MCP9843_DEVID_MASK }, 150 { MCP_MANID, MCP9843_DEVID, MCP9843_DEVID_MASK },
@@ -133,6 +153,8 @@ static struct jc42_chips jc42_chips[] = {
133 { NXP_MANID, SE98_DEVID, SE98_DEVID_MASK }, 153 { NXP_MANID, SE98_DEVID, SE98_DEVID_MASK },
134 { STM_MANID, STTS424_DEVID, STTS424_DEVID_MASK }, 154 { STM_MANID, STTS424_DEVID, STTS424_DEVID_MASK },
135 { STM_MANID, STTS424E_DEVID, STTS424E_DEVID_MASK }, 155 { STM_MANID, STTS424E_DEVID, STTS424E_DEVID_MASK },
156 { STM_MANID, STTS2002_DEVID, STTS2002_DEVID_MASK },
157 { STM_MANID, STTS3000_DEVID, STTS3000_DEVID_MASK },
136}; 158};
137 159
138/* Each client has this additional data */ 160/* Each client has this additional data */
@@ -159,10 +181,12 @@ static struct jc42_data *jc42_update_device(struct device *dev);
159 181
160static const struct i2c_device_id jc42_id[] = { 182static const struct i2c_device_id jc42_id[] = {
161 { "adt7408", 0 }, 183 { "adt7408", 0 },
184 { "at30ts00", 0 },
162 { "cat94ts02", 0 }, 185 { "cat94ts02", 0 },
163 { "cat6095", 0 }, 186 { "cat6095", 0 },
164 { "jc42", 0 }, 187 { "jc42", 0 },
165 { "max6604", 0 }, 188 { "max6604", 0 },
189 { "mcp9804", 0 },
166 { "mcp9805", 0 }, 190 { "mcp9805", 0 },
167 { "mcp98242", 0 }, 191 { "mcp98242", 0 },
168 { "mcp98243", 0 }, 192 { "mcp98243", 0 },
@@ -171,8 +195,10 @@ static const struct i2c_device_id jc42_id[] = {
171 { "se97b", 0 }, 195 { "se97b", 0 },
172 { "se98", 0 }, 196 { "se98", 0 },
173 { "stts424", 0 }, 197 { "stts424", 0 },
174 { "tse2002b3", 0 }, 198 { "stts2002", 0 },
175 { "ts3000b3", 0 }, 199 { "stts3000", 0 },
200 { "tse2002", 0 },
201 { "ts3000", 0 },
176 { } 202 { }
177}; 203};
178MODULE_DEVICE_TABLE(i2c, jc42_id); 204MODULE_DEVICE_TABLE(i2c, jc42_id);
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;
diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index 00460d8d8423..d89b33967a85 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -54,7 +54,8 @@
54 lcrit_alarm, crit_alarm */ 54 lcrit_alarm, crit_alarm */
55#define PMBUS_IOUT_BOOLEANS_PER_PAGE 3 /* alarm, lcrit_alarm, 55#define PMBUS_IOUT_BOOLEANS_PER_PAGE 3 /* alarm, lcrit_alarm,
56 crit_alarm */ 56 crit_alarm */
57#define PMBUS_POUT_BOOLEANS_PER_PAGE 2 /* alarm, crit_alarm */ 57#define PMBUS_POUT_BOOLEANS_PER_PAGE 3 /* cap_alarm, alarm, crit_alarm
58 */
58#define PMBUS_MAX_BOOLEANS_PER_FAN 2 /* alarm, fault */ 59#define PMBUS_MAX_BOOLEANS_PER_FAN 2 /* alarm, fault */
59#define PMBUS_MAX_BOOLEANS_PER_TEMP 4 /* min_alarm, max_alarm, 60#define PMBUS_MAX_BOOLEANS_PER_TEMP 4 /* min_alarm, max_alarm,
60 lcrit_alarm, crit_alarm */ 61 lcrit_alarm, crit_alarm */
diff --git a/drivers/hwmon/pmbus/zl6100.c b/drivers/hwmon/pmbus/zl6100.c
index 48c7b4a716ae..880b90cf4d32 100644
--- a/drivers/hwmon/pmbus/zl6100.c
+++ b/drivers/hwmon/pmbus/zl6100.c
@@ -33,6 +33,7 @@ enum chips { zl2004, zl2005, zl2006, zl2008, zl2105, zl2106, zl6100, zl6105 };
33struct zl6100_data { 33struct zl6100_data {
34 int id; 34 int id;
35 ktime_t access; /* chip access time */ 35 ktime_t access; /* chip access time */
36 int delay; /* Delay between chip accesses in uS */
36 struct pmbus_driver_info info; 37 struct pmbus_driver_info info;
37}; 38};
38 39
@@ -52,10 +53,10 @@ MODULE_PARM_DESC(delay, "Delay between chip accesses in uS");
52/* Some chips need a delay between accesses */ 53/* Some chips need a delay between accesses */
53static inline void zl6100_wait(const struct zl6100_data *data) 54static inline void zl6100_wait(const struct zl6100_data *data)
54{ 55{
55 if (delay) { 56 if (data->delay) {
56 s64 delta = ktime_us_delta(ktime_get(), data->access); 57 s64 delta = ktime_us_delta(ktime_get(), data->access);
57 if (delta < delay) 58 if (delta < data->delay)
58 udelay(delay - delta); 59 udelay(data->delay - delta);
59 } 60 }
60} 61}
61 62
@@ -207,8 +208,9 @@ static int zl6100_probe(struct i2c_client *client,
207 * can be cleared later for additional chips if tests show that it 208 * can be cleared later for additional chips if tests show that it
208 * is not needed (in other words, better be safe than sorry). 209 * is not needed (in other words, better be safe than sorry).
209 */ 210 */
211 data->delay = delay;
210 if (data->id == zl2004 || data->id == zl6105) 212 if (data->id == zl2004 || data->id == zl6105)
211 delay = 0; 213 data->delay = 0;
212 214
213 /* 215 /*
214 * Since there was a direct I2C device access above, wait before 216 * Since there was a direct I2C device access above, wait before
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c
index 2dfae7d7cc5b..5276d1933dbc 100644
--- a/drivers/hwmon/w83627ehf.c
+++ b/drivers/hwmon/w83627ehf.c
@@ -1920,9 +1920,26 @@ w83627ehf_check_fan_inputs(const struct w83627ehf_sio_data *sio_data,
1920 fan4min = 0; 1920 fan4min = 0;
1921 fan5pin = 0; 1921 fan5pin = 0;
1922 } else if (sio_data->kind == nct6776) { 1922 } else if (sio_data->kind == nct6776) {
1923 fan3pin = !(superio_inb(sio_data->sioreg, 0x24) & 0x40); 1923 bool gpok = superio_inb(sio_data->sioreg, 0x27) & 0x80;
1924 fan4pin = !!(superio_inb(sio_data->sioreg, 0x1C) & 0x01); 1924
1925 fan5pin = !!(superio_inb(sio_data->sioreg, 0x1C) & 0x02); 1925 superio_select(sio_data->sioreg, W83627EHF_LD_HWM);
1926 regval = superio_inb(sio_data->sioreg, SIO_REG_ENABLE);
1927
1928 if (regval & 0x80)
1929 fan3pin = gpok;
1930 else
1931 fan3pin = !(superio_inb(sio_data->sioreg, 0x24) & 0x40);
1932
1933 if (regval & 0x40)
1934 fan4pin = gpok;
1935 else
1936 fan4pin = !!(superio_inb(sio_data->sioreg, 0x1C) & 0x01);
1937
1938 if (regval & 0x20)
1939 fan5pin = gpok;
1940 else
1941 fan5pin = !!(superio_inb(sio_data->sioreg, 0x1C) & 0x02);
1942
1926 fan4min = fan4pin; 1943 fan4min = fan4pin;
1927 } else if (sio_data->kind == w83667hg || sio_data->kind == w83667hg_b) { 1944 } else if (sio_data->kind == w83667hg || sio_data->kind == w83667hg_b) {
1928 fan3pin = 1; 1945 fan3pin = 1;
@@ -2337,11 +2354,6 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev)
2337 for (i = 0; i < data->pwm_num; i++) 2354 for (i = 0; i < data->pwm_num; i++)
2338 data->pwm_enable_orig[i] = data->pwm_enable[i]; 2355 data->pwm_enable_orig[i] = data->pwm_enable[i];
2339 2356
2340 /* Read pwm data to save original values */
2341 w83627ehf_update_pwm_common(dev, data);
2342 for (i = 0; i < data->pwm_num; i++)
2343 data->pwm_enable_orig[i] = data->pwm_enable[i];
2344
2345 /* Register sysfs hooks */ 2357 /* Register sysfs hooks */
2346 for (i = 0; i < ARRAY_SIZE(sda_sf3_arrays); i++) { 2358 for (i = 0; i < ARRAY_SIZE(sda_sf3_arrays); i++) {
2347 err = device_create_file(dev, &sda_sf3_arrays[i].dev_attr); 2359 err = device_create_file(dev, &sda_sf3_arrays[i].dev_attr);