diff options
-rw-r--r-- | Documentation/hwmon/lm75 | 7 | ||||
-rw-r--r-- | drivers/hwmon/lm75.c | 42 |
2 files changed, 40 insertions, 9 deletions
diff --git a/Documentation/hwmon/lm75 b/Documentation/hwmon/lm75 index 69af1c7db6b7..5e45d0795986 100644 --- a/Documentation/hwmon/lm75 +++ b/Documentation/hwmon/lm75 | |||
@@ -67,7 +67,8 @@ the temperature falls below the Hysteresis value. | |||
67 | All temperatures are in degrees Celsius, and are guaranteed within a | 67 | All temperatures are in degrees Celsius, and are guaranteed within a |
68 | range of -55 to +125 degrees. | 68 | range of -55 to +125 degrees. |
69 | 69 | ||
70 | The LM75 only updates its values each 1.5 seconds; reading it more often | 70 | The driver caches the values for a period varying between 1 second for the |
71 | slowest chips and 125 ms for the fastest chips; reading it more often | ||
71 | will do no harm, but will return 'old' values. | 72 | will do no harm, but will return 'old' values. |
72 | 73 | ||
73 | The original LM75 was typically used in combination with LM78-like chips | 74 | The original LM75 was typically used in combination with LM78-like chips |
@@ -78,8 +79,8 @@ The LM75 is essentially an industry standard; there may be other | |||
78 | LM75 clones not listed here, with or without various enhancements, | 79 | LM75 clones not listed here, with or without various enhancements, |
79 | that are supported. The clones are not detected by the driver, unless | 80 | that are supported. The clones are not detected by the driver, unless |
80 | they reproduce the exact register tricks of the original LM75, and must | 81 | they reproduce the exact register tricks of the original LM75, and must |
81 | therefore be instantiated explicitly. The specific enhancements (such as | 82 | therefore be instantiated explicitly. Higher resolution up to 12-bit |
82 | higher resolution) are not currently supported by the driver. | 83 | is supported by this driver, other specific enhancements are not. |
83 | 84 | ||
84 | The LM77 is not supported, contrary to what we pretended for a long time. | 85 | The LM77 is not supported, contrary to what we pretended for a long time. |
85 | Both chips are simply not compatible, value encoding differs. | 86 | Both chips are simply not compatible, value encoding differs. |
diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c index 559e675db3c8..928341115793 100644 --- a/drivers/hwmon/lm75.c +++ b/drivers/hwmon/lm75.c | |||
@@ -169,6 +169,7 @@ lm75_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
169 | int status; | 169 | int status; |
170 | u8 set_mask, clr_mask; | 170 | u8 set_mask, clr_mask; |
171 | int new; | 171 | int new; |
172 | enum lm75_type kind = id->driver_data; | ||
172 | 173 | ||
173 | if (!i2c_check_functionality(client->adapter, | 174 | if (!i2c_check_functionality(client->adapter, |
174 | I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) | 175 | I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) |
@@ -187,30 +188,59 @@ lm75_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
187 | set_mask = 0; | 188 | set_mask = 0; |
188 | clr_mask = LM75_SHUTDOWN; /* continuous conversions */ | 189 | clr_mask = LM75_SHUTDOWN; /* continuous conversions */ |
189 | 190 | ||
190 | switch (id->driver_data) { | 191 | switch (kind) { |
191 | case adt75: | 192 | case adt75: |
192 | clr_mask |= 1 << 5; /* not one-shot mode */ | 193 | clr_mask |= 1 << 5; /* not one-shot mode */ |
194 | data->resolution = 12; | ||
195 | data->sample_time = HZ / 8; | ||
193 | break; | 196 | break; |
194 | case ds1775: | 197 | case ds1775: |
195 | case ds75: | 198 | case ds75: |
196 | case stds75: | 199 | case stds75: |
197 | clr_mask |= 3 << 5; /* 9-bit mode */ | 200 | clr_mask |= 3 << 5; |
201 | set_mask |= 2 << 5; /* 11-bit mode */ | ||
202 | data->resolution = 11; | ||
203 | data->sample_time = HZ; | ||
204 | break; | ||
205 | case lm75: | ||
206 | case lm75a: | ||
207 | data->resolution = 9; | ||
208 | data->sample_time = HZ / 2; | ||
209 | break; | ||
210 | case max6625: | ||
211 | data->resolution = 9; | ||
212 | data->sample_time = HZ / 4; | ||
213 | break; | ||
214 | case max6626: | ||
215 | data->resolution = 12; | ||
216 | data->resolution_limits = 9; | ||
217 | data->sample_time = HZ / 4; | ||
218 | break; | ||
219 | case tcn75: | ||
220 | data->resolution = 9; | ||
221 | data->sample_time = HZ / 8; | ||
198 | break; | 222 | break; |
199 | case mcp980x: | 223 | case mcp980x: |
224 | data->resolution_limits = 9; | ||
225 | /* fall through */ | ||
200 | case tmp100: | 226 | case tmp100: |
201 | case tmp101: | 227 | case tmp101: |
228 | set_mask |= 3 << 5; /* 12-bit mode */ | ||
229 | data->resolution = 12; | ||
230 | data->sample_time = HZ; | ||
231 | clr_mask |= 1 << 7; /* not one-shot mode */ | ||
232 | break; | ||
202 | case tmp105: | 233 | case tmp105: |
203 | case tmp175: | 234 | case tmp175: |
204 | case tmp275: | 235 | case tmp275: |
205 | case tmp75: | 236 | case tmp75: |
206 | clr_mask |= 3 << 5; /* 9-bit mode */ | 237 | set_mask |= 3 << 5; /* 12-bit mode */ |
207 | clr_mask |= 1 << 7; /* not one-shot mode */ | 238 | clr_mask |= 1 << 7; /* not one-shot mode */ |
239 | data->resolution = 12; | ||
240 | data->sample_time = HZ / 2; | ||
208 | break; | 241 | break; |
209 | } | 242 | } |
210 | 243 | ||
211 | data->resolution = 9; | ||
212 | data->sample_time = HZ + HZ / 2; | ||
213 | |||
214 | /* configure as specified */ | 244 | /* configure as specified */ |
215 | status = lm75_read_value(client, LM75_REG_CONF); | 245 | status = lm75_read_value(client, LM75_REG_CONF); |
216 | if (status < 0) { | 246 | if (status < 0) { |