diff options
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/Kconfig | 5 | ||||
-rw-r--r-- | drivers/hwmon/f75375s.c | 89 | ||||
-rw-r--r-- | drivers/hwmon/jc42.c | 30 | ||||
-rw-r--r-- | drivers/hwmon/pmbus/pmbus_core.c | 3 | ||||
-rw-r--r-- | drivers/hwmon/pmbus/zl6100.c | 10 |
5 files changed, 114 insertions, 23 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/f75375s.c b/drivers/hwmon/f75375s.c index 6bab2001ef3b..6aa5a9fad879 100644 --- a/drivers/hwmon/f75375s.c +++ b/drivers/hwmon/f75375s.c | |||
@@ -178,6 +178,16 @@ static inline void f75375_write16(struct i2c_client *client, u8 reg, | |||
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 | ||
181 | static 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 | |||
181 | static struct f75375_data *f75375_update_device(struct device *dev) | 191 | static 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); |
@@ -254,6 +264,36 @@ static inline u16 rpm_to_reg(int rpm) | |||
254 | return 1500000 / rpm; | 264 | return 1500000 / rpm; |
255 | } | 265 | } |
256 | 266 | ||
267 | static 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 | |||
282 | static 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 | |||
257 | static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr, | 297 | static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr, |
258 | const char *buf, size_t count) | 298 | const char *buf, size_t count) |
259 | { | 299 | { |
@@ -287,6 +327,11 @@ static ssize_t set_fan_target(struct device *dev, struct device_attribute *attr, | |||
287 | if (err < 0) | 327 | if (err < 0) |
288 | return err; | 328 | return err; |
289 | 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 | |||
290 | mutex_lock(&data->update_lock); | 335 | mutex_lock(&data->update_lock); |
291 | data->fan_target[nr] = rpm_to_reg(val); | 336 | data->fan_target[nr] = rpm_to_reg(val); |
292 | 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]); |
@@ -307,9 +352,13 @@ static ssize_t set_pwm(struct device *dev, struct device_attribute *attr, | |||
307 | if (err < 0) | 352 | if (err < 0) |
308 | return err; | 353 | return err; |
309 | 354 | ||
355 | if (auto_mode_enabled(data->pwm_enable[nr]) || | ||
356 | !duty_mode_enabled(data->pwm_enable[nr])) | ||
357 | return -EINVAL; | ||
358 | |||
310 | mutex_lock(&data->update_lock); | 359 | mutex_lock(&data->update_lock); |
311 | data->pwm[nr] = SENSORS_LIMIT(val, 0, 255); | 360 | data->pwm[nr] = SENSORS_LIMIT(val, 0, 255); |
312 | f75375_write8(client, F75375_REG_FAN_PWM_DUTY(nr), data->pwm[nr]); | 361 | f75375_write_pwm(client, nr); |
313 | mutex_unlock(&data->update_lock); | 362 | mutex_unlock(&data->update_lock); |
314 | return count; | 363 | return count; |
315 | } | 364 | } |
@@ -327,11 +376,15 @@ static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val) | |||
327 | struct f75375_data *data = i2c_get_clientdata(client); | 376 | struct f75375_data *data = i2c_get_clientdata(client); |
328 | u8 fanmode; | 377 | u8 fanmode; |
329 | 378 | ||
330 | if (val < 0 || val > 3) | 379 | if (val < 0 || val > 4) |
331 | return -EINVAL; | 380 | return -EINVAL; |
332 | 381 | ||
333 | fanmode = f75375_read8(client, F75375_REG_FAN_TIMER); | 382 | fanmode = f75375_read8(client, F75375_REG_FAN_TIMER); |
334 | 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; | ||
335 | /* clear each fanX_mode bit before setting them properly */ | 388 | /* clear each fanX_mode bit before setting them properly */ |
336 | fanmode &= ~(1 << F75387_FAN_DUTY_MODE(nr)); | 389 | fanmode &= ~(1 << F75387_FAN_DUTY_MODE(nr)); |
337 | fanmode &= ~(1 << F75387_FAN_MANU_MODE(nr)); | 390 | fanmode &= ~(1 << F75387_FAN_MANU_MODE(nr)); |
@@ -345,12 +398,14 @@ static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val) | |||
345 | fanmode |= (1 << F75387_FAN_MANU_MODE(nr)); | 398 | fanmode |= (1 << F75387_FAN_MANU_MODE(nr)); |
346 | fanmode |= (1 << F75387_FAN_DUTY_MODE(nr)); | 399 | fanmode |= (1 << F75387_FAN_DUTY_MODE(nr)); |
347 | break; | 400 | break; |
348 | case 2: /* AUTOMATIC*/ | 401 | case 2: /* Automatic, speed mode */ |
349 | fanmode |= (1 << F75387_FAN_DUTY_MODE(nr)); | ||
350 | break; | 402 | break; |
351 | case 3: /* fan speed */ | 403 | case 3: /* fan speed */ |
352 | fanmode |= (1 << F75387_FAN_MANU_MODE(nr)); | 404 | fanmode |= (1 << F75387_FAN_MANU_MODE(nr)); |
353 | break; | 405 | break; |
406 | case 4: /* Automatic, pwm */ | ||
407 | fanmode |= (1 << F75387_FAN_DUTY_MODE(nr)); | ||
408 | break; | ||
354 | } | 409 | } |
355 | } else { | 410 | } else { |
356 | /* clear each fanX_mode bit before setting them properly */ | 411 | /* clear each fanX_mode bit before setting them properly */ |
@@ -368,14 +423,15 @@ static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val) | |||
368 | break; | 423 | break; |
369 | case 3: /* fan speed */ | 424 | case 3: /* fan speed */ |
370 | break; | 425 | break; |
426 | case 4: /* Automatic pwm */ | ||
427 | return -EINVAL; | ||
371 | } | 428 | } |
372 | } | 429 | } |
373 | 430 | ||
374 | f75375_write8(client, F75375_REG_FAN_TIMER, fanmode); | 431 | f75375_write8(client, F75375_REG_FAN_TIMER, fanmode); |
375 | data->pwm_enable[nr] = val; | 432 | data->pwm_enable[nr] = val; |
376 | if (val == 0) | 433 | if (val == 0) |
377 | f75375_write8(client, F75375_REG_FAN_PWM_DUTY(nr), | 434 | f75375_write_pwm(client, nr); |
378 | data->pwm[nr]); | ||
379 | return 0; | 435 | return 0; |
380 | } | 436 | } |
381 | 437 | ||
@@ -726,14 +782,17 @@ static void f75375_init(struct i2c_client *client, struct f75375_data *data, | |||
726 | 782 | ||
727 | manu = ((mode >> F75387_FAN_MANU_MODE(nr)) & 1); | 783 | manu = ((mode >> F75387_FAN_MANU_MODE(nr)) & 1); |
728 | duty = ((mode >> F75387_FAN_DUTY_MODE(nr)) & 1); | 784 | duty = ((mode >> F75387_FAN_DUTY_MODE(nr)) & 1); |
729 | if (manu && duty) | 785 | if (!manu && duty) |
730 | /* speed */ | 786 | /* auto, pwm */ |
787 | data->pwm_enable[nr] = 4; | ||
788 | else if (manu && !duty) | ||
789 | /* manual, speed */ | ||
731 | data->pwm_enable[nr] = 3; | 790 | data->pwm_enable[nr] = 3; |
732 | else if (!manu && duty) | 791 | else if (!manu && !duty) |
733 | /* automatic */ | 792 | /* automatic, speed */ |
734 | data->pwm_enable[nr] = 2; | 793 | data->pwm_enable[nr] = 2; |
735 | else | 794 | else |
736 | /* manual */ | 795 | /* manual, pwm */ |
737 | data->pwm_enable[nr] = 1; | 796 | data->pwm_enable[nr] = 1; |
738 | } else { | 797 | } else { |
739 | if (!(conf & (1 << F75375_FAN_CTRL_LINEAR(nr)))) | 798 | if (!(conf & (1 << F75375_FAN_CTRL_LINEAR(nr)))) |
@@ -758,9 +817,11 @@ static void f75375_init(struct i2c_client *client, struct f75375_data *data, | |||
758 | set_pwm_enable_direct(client, 0, f75375s_pdata->pwm_enable[0]); | 817 | set_pwm_enable_direct(client, 0, f75375s_pdata->pwm_enable[0]); |
759 | set_pwm_enable_direct(client, 1, f75375s_pdata->pwm_enable[1]); | 818 | set_pwm_enable_direct(client, 1, f75375s_pdata->pwm_enable[1]); |
760 | 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; | ||
761 | data->pwm[nr] = SENSORS_LIMIT(f75375s_pdata->pwm[nr], 0, 255); | 823 | data->pwm[nr] = SENSORS_LIMIT(f75375s_pdata->pwm[nr], 0, 255); |
762 | f75375_write8(client, F75375_REG_FAN_PWM_DUTY(nr), | 824 | f75375_write_pwm(client, nr); |
763 | data->pwm[nr]); | ||
764 | } | 825 | } |
765 | 826 | ||
766 | } | 827 | } |
@@ -787,7 +848,7 @@ static int f75375_probe(struct i2c_client *client, | |||
787 | if (err) | 848 | if (err) |
788 | goto exit_free; | 849 | goto exit_free; |
789 | 850 | ||
790 | if (data->kind == f75375) { | 851 | if (data->kind != f75373) { |
791 | err = sysfs_chmod_file(&client->dev.kobj, | 852 | err = sysfs_chmod_file(&client->dev.kobj, |
792 | &sensor_dev_attr_pwm1_mode.dev_attr.attr, | 853 | &sensor_dev_attr_pwm1_mode.dev_attr.attr, |
793 | 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 | |||
116 | static u16 jc42_hysteresis[] = { 0, 1500, 3000, 6000 }; | 133 | static u16 jc42_hysteresis[] = { 0, 1500, 3000, 6000 }; |
117 | 134 | ||
118 | struct jc42_chips { | 135 | struct jc42_chips { |
@@ -123,8 +140,11 @@ struct jc42_chips { | |||
123 | 140 | ||
124 | static struct jc42_chips jc42_chips[] = { | 141 | static 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 | ||
160 | static const struct i2c_device_id jc42_id[] = { | 182 | static 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 | }; |
178 | MODULE_DEVICE_TABLE(i2c, jc42_id); | 204 | MODULE_DEVICE_TABLE(i2c, jc42_id); |
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 }; | |||
33 | struct zl6100_data { | 33 | struct 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 */ |
53 | static inline void zl6100_wait(const struct zl6100_data *data) | 54 | static 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 |