diff options
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/Kconfig | 2 | ||||
-rw-r--r-- | drivers/hwmon/lm90.c | 40 |
2 files changed, 38 insertions, 4 deletions
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 770fc8195627..1396290a31a4 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
@@ -623,7 +623,7 @@ config SENSORS_LM90 | |||
623 | LM86, LM89 and LM99, Analog Devices ADM1032, ADT7461, and ADT7461A, | 623 | LM86, LM89 and LM99, Analog Devices ADM1032, ADT7461, and ADT7461A, |
624 | Maxim MAX6646, MAX6647, MAX6648, MAX6649, MAX6657, MAX6658, MAX6659, | 624 | Maxim MAX6646, MAX6647, MAX6648, MAX6649, MAX6657, MAX6658, MAX6659, |
625 | MAX6680, MAX6681, MAX6692, MAX6695, MAX6696, ON Semiconductor NCT1008, | 625 | MAX6680, MAX6681, MAX6692, MAX6695, MAX6696, ON Semiconductor NCT1008, |
626 | and Winbond/Nuvoton W83L771W/G/AWG/ASG sensor chips. | 626 | Winbond/Nuvoton W83L771W/G/AWG/ASG and Philips SA56004 sensor chips. |
627 | 627 | ||
628 | This driver can also be built as a module. If so, the module | 628 | This driver can also be built as a module. If so, the module |
629 | will be called lm90. | 629 | will be called lm90. |
diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c index 2f94f9504804..708bf0e7e4ac 100644 --- a/drivers/hwmon/lm90.c +++ b/drivers/hwmon/lm90.c | |||
@@ -54,6 +54,9 @@ | |||
54 | * and extended mode. They are mostly compatible with LM90 except for a data | 54 | * and extended mode. They are mostly compatible with LM90 except for a data |
55 | * format difference for the temperature value registers. | 55 | * format difference for the temperature value registers. |
56 | * | 56 | * |
57 | * This driver also supports the SA56004 from Philips. This device is | ||
58 | * pin-compatible with the LM86, the ED/EDP parts are also address-compatible. | ||
59 | * | ||
57 | * Since the LM90 was the first chipset supported by this driver, most | 60 | * Since the LM90 was the first chipset supported by this driver, most |
58 | * comments will refer to this chipset, but are actually general and | 61 | * comments will refer to this chipset, but are actually general and |
59 | * concern all supported chipsets, unless mentioned otherwise. | 62 | * concern all supported chipsets, unless mentioned otherwise. |
@@ -96,13 +99,15 @@ | |||
96 | * MAX6659 can have address 0x4c, 0x4d or 0x4e. | 99 | * MAX6659 can have address 0x4c, 0x4d or 0x4e. |
97 | * MAX6680 and MAX6681 can have address 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, | 100 | * MAX6680 and MAX6681 can have address 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, |
98 | * 0x4c, 0x4d or 0x4e. | 101 | * 0x4c, 0x4d or 0x4e. |
102 | * SA56004 can have address 0x48 through 0x4F. | ||
99 | */ | 103 | */ |
100 | 104 | ||
101 | static const unsigned short normal_i2c[] = { | 105 | static const unsigned short normal_i2c[] = { |
102 | 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, 0x4c, 0x4d, 0x4e, I2C_CLIENT_END }; | 106 | 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, 0x48, 0x49, 0x4a, 0x4b, 0x4c, |
107 | 0x4d, 0x4e, 0x4f, I2C_CLIENT_END }; | ||
103 | 108 | ||
104 | enum chips { lm90, adm1032, lm99, lm86, max6657, max6659, adt7461, max6680, | 109 | enum chips { lm90, adm1032, lm99, lm86, max6657, max6659, adt7461, max6680, |
105 | max6646, w83l771, max6696 }; | 110 | max6646, w83l771, max6696, sa56004 }; |
106 | 111 | ||
107 | /* | 112 | /* |
108 | * The LM90 registers | 113 | * The LM90 registers |
@@ -152,6 +157,10 @@ enum chips { lm90, adm1032, lm99, lm86, max6657, max6659, adt7461, max6680, | |||
152 | #define MAX6659_REG_R_LOCAL_EMERG 0x17 | 157 | #define MAX6659_REG_R_LOCAL_EMERG 0x17 |
153 | #define MAX6659_REG_W_LOCAL_EMERG 0x17 | 158 | #define MAX6659_REG_W_LOCAL_EMERG 0x17 |
154 | 159 | ||
160 | /* SA56004 registers */ | ||
161 | |||
162 | #define SA56004_REG_R_LOCAL_TEMPL 0x22 | ||
163 | |||
155 | #define LM90_DEF_CONVRATE_RVAL 6 /* Def conversion rate register value */ | 164 | #define LM90_DEF_CONVRATE_RVAL 6 /* Def conversion rate register value */ |
156 | #define LM90_MAX_CONVRATE_MS 16000 /* Maximum conversion rate in ms */ | 165 | #define LM90_MAX_CONVRATE_MS 16000 /* Maximum conversion rate in ms */ |
157 | 166 | ||
@@ -192,6 +201,7 @@ static const struct i2c_device_id lm90_id[] = { | |||
192 | { "max6696", max6696 }, | 201 | { "max6696", max6696 }, |
193 | { "nct1008", adt7461 }, | 202 | { "nct1008", adt7461 }, |
194 | { "w83l771", w83l771 }, | 203 | { "w83l771", w83l771 }, |
204 | { "sa56004", sa56004 }, | ||
195 | { } | 205 | { } |
196 | }; | 206 | }; |
197 | MODULE_DEVICE_TABLE(i2c, lm90_id); | 207 | MODULE_DEVICE_TABLE(i2c, lm90_id); |
@@ -204,6 +214,8 @@ struct lm90_params { | |||
204 | u16 alert_alarms; /* Which alarm bits trigger ALERT# */ | 214 | u16 alert_alarms; /* Which alarm bits trigger ALERT# */ |
205 | /* Upper 8 bits for max6695/96 */ | 215 | /* Upper 8 bits for max6695/96 */ |
206 | u8 max_convrate; /* Maximum conversion rate register value */ | 216 | u8 max_convrate; /* Maximum conversion rate register value */ |
217 | u8 reg_local_ext; /* Local extension register if | ||
218 | LM90_HAVE_LOCAL_EXT is set*/ | ||
207 | }; | 219 | }; |
208 | 220 | ||
209 | static const struct lm90_params lm90_params[] = { | 221 | static const struct lm90_params lm90_params[] = { |
@@ -238,16 +250,19 @@ static const struct lm90_params lm90_params[] = { | |||
238 | .flags = LM90_HAVE_LOCAL_EXT, | 250 | .flags = LM90_HAVE_LOCAL_EXT, |
239 | .alert_alarms = 0x7c, | 251 | .alert_alarms = 0x7c, |
240 | .max_convrate = 6, | 252 | .max_convrate = 6, |
253 | .reg_local_ext = MAX6657_REG_R_LOCAL_TEMPL, | ||
241 | }, | 254 | }, |
242 | [max6657] = { | 255 | [max6657] = { |
243 | .flags = LM90_HAVE_LOCAL_EXT, | 256 | .flags = LM90_HAVE_LOCAL_EXT, |
244 | .alert_alarms = 0x7c, | 257 | .alert_alarms = 0x7c, |
245 | .max_convrate = 8, | 258 | .max_convrate = 8, |
259 | .reg_local_ext = MAX6657_REG_R_LOCAL_TEMPL, | ||
246 | }, | 260 | }, |
247 | [max6659] = { | 261 | [max6659] = { |
248 | .flags = LM90_HAVE_LOCAL_EXT | LM90_HAVE_EMERGENCY, | 262 | .flags = LM90_HAVE_LOCAL_EXT | LM90_HAVE_EMERGENCY, |
249 | .alert_alarms = 0x7c, | 263 | .alert_alarms = 0x7c, |
250 | .max_convrate = 8, | 264 | .max_convrate = 8, |
265 | .reg_local_ext = MAX6657_REG_R_LOCAL_TEMPL, | ||
251 | }, | 266 | }, |
252 | [max6680] = { | 267 | [max6680] = { |
253 | .flags = LM90_HAVE_OFFSET, | 268 | .flags = LM90_HAVE_OFFSET, |
@@ -259,12 +274,20 @@ static const struct lm90_params lm90_params[] = { | |||
259 | | LM90_HAVE_EMERGENCY_ALARM | LM90_HAVE_TEMP3, | 274 | | LM90_HAVE_EMERGENCY_ALARM | LM90_HAVE_TEMP3, |
260 | .alert_alarms = 0x187c, | 275 | .alert_alarms = 0x187c, |
261 | .max_convrate = 6, | 276 | .max_convrate = 6, |
277 | .reg_local_ext = MAX6657_REG_R_LOCAL_TEMPL, | ||
262 | }, | 278 | }, |
263 | [w83l771] = { | 279 | [w83l771] = { |
264 | .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT, | 280 | .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT, |
265 | .alert_alarms = 0x7c, | 281 | .alert_alarms = 0x7c, |
266 | .max_convrate = 8, | 282 | .max_convrate = 8, |
267 | }, | 283 | }, |
284 | [sa56004] = { | ||
285 | .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT | ||
286 | | LM90_HAVE_LOCAL_EXT, | ||
287 | .alert_alarms = 0x7b, | ||
288 | .max_convrate = 9, | ||
289 | .reg_local_ext = SA56004_REG_R_LOCAL_TEMPL, | ||
290 | }, | ||
268 | }; | 291 | }; |
269 | 292 | ||
270 | /* | 293 | /* |
@@ -286,6 +309,7 @@ struct lm90_data { | |||
286 | u16 alert_alarms; /* Which alarm bits trigger ALERT# */ | 309 | u16 alert_alarms; /* Which alarm bits trigger ALERT# */ |
287 | /* Upper 8 bits for max6695/96 */ | 310 | /* Upper 8 bits for max6695/96 */ |
288 | u8 max_convrate; /* Maximum conversion rate */ | 311 | u8 max_convrate; /* Maximum conversion rate */ |
312 | u8 reg_local_ext; /* local extension register offset */ | ||
289 | 313 | ||
290 | /* registers values */ | 314 | /* registers values */ |
291 | s8 temp8[8]; /* 0: local low limit | 315 | s8 temp8[8]; /* 0: local low limit |
@@ -454,7 +478,7 @@ static struct lm90_data *lm90_update_device(struct device *dev) | |||
454 | 478 | ||
455 | if (data->flags & LM90_HAVE_LOCAL_EXT) { | 479 | if (data->flags & LM90_HAVE_LOCAL_EXT) { |
456 | lm90_read16(client, LM90_REG_R_LOCAL_TEMP, | 480 | lm90_read16(client, LM90_REG_R_LOCAL_TEMP, |
457 | MAX6657_REG_R_LOCAL_TEMPL, | 481 | data->reg_local_ext, |
458 | &data->temp11[4]); | 482 | &data->temp11[4]); |
459 | } else { | 483 | } else { |
460 | if (lm90_read_reg(client, LM90_REG_R_LOCAL_TEMP, | 484 | if (lm90_read_reg(client, LM90_REG_R_LOCAL_TEMP, |
@@ -1263,6 +1287,11 @@ static int lm90_detect(struct i2c_client *new_client, | |||
1263 | name = "w83l771"; | 1287 | name = "w83l771"; |
1264 | } | 1288 | } |
1265 | } | 1289 | } |
1290 | } else | ||
1291 | if (man_id == 0xA1) { /* NXP Semiconductor/Philips */ | ||
1292 | if (chip_id == 0x00 && address >= 0x48 && address <= 0x4F) { | ||
1293 | name = "sa56004"; | ||
1294 | } | ||
1266 | } | 1295 | } |
1267 | 1296 | ||
1268 | if (!name) { /* identification failed */ | 1297 | if (!name) { /* identification failed */ |
@@ -1372,6 +1401,11 @@ static int lm90_probe(struct i2c_client *new_client, | |||
1372 | /* Set maximum conversion rate */ | 1401 | /* Set maximum conversion rate */ |
1373 | data->max_convrate = lm90_params[data->kind].max_convrate; | 1402 | data->max_convrate = lm90_params[data->kind].max_convrate; |
1374 | 1403 | ||
1404 | if (data->flags & LM90_HAVE_LOCAL_EXT) { | ||
1405 | data->reg_local_ext = lm90_params[data->kind].reg_local_ext; | ||
1406 | WARN_ON(data->reg_local_ext == 0); | ||
1407 | } | ||
1408 | |||
1375 | /* Initialize the LM90 chip */ | 1409 | /* Initialize the LM90 chip */ |
1376 | lm90_init_client(new_client); | 1410 | lm90_init_client(new_client); |
1377 | 1411 | ||