Commit 10f2ed31aae11040dfd64cee10c47db79b4b4647
Committed by
Jean Delvare
1 parent
70dd6beac0
Exists in
master
and in
39 other branches
hwmon: (lm63) Add basic support for LM64
The LM64 appears to be an LM63 with added GPIO lines. Add support for the hwmon functionality - GPIO can be added at some later stage if someone has a need for them. Signed-off-by: Matthew Garrett <mjg@redhat.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
Showing 3 changed files with 25 additions and 9 deletions Side-by-side Diff
Documentation/hwmon/lm63
... | ... | @@ -7,6 +7,11 @@ |
7 | 7 | Addresses scanned: I2C 0x4c |
8 | 8 | Datasheet: Publicly available at the National Semiconductor website |
9 | 9 | http://www.national.com/pf/LM/LM63.html |
10 | + * National Semiconductor LM64 | |
11 | + Prefix: 'lm64' | |
12 | + Addresses scanned: I2C 0x18 and 0x4e | |
13 | + Datasheet: Publicly available at the National Semiconductor website | |
14 | + http://www.national.com/pf/LM/LM64.html | |
10 | 15 | |
11 | 16 | Author: Jean Delvare <khali@linux-fr.org> |
12 | 17 | |
... | ... | @@ -54,4 +59,7 @@ |
54 | 59 | The lm63 driver will not update its values more frequently than every |
55 | 60 | second; reading them more often will do no harm, but will return 'old' |
56 | 61 | values. |
62 | + | |
63 | +The LM64 is effectively an LM63 with GPIO lines. The driver does not | |
64 | +support these GPIO lines at present. |
drivers/hwmon/Kconfig
... | ... | @@ -447,13 +447,14 @@ |
447 | 447 | will be called it87. |
448 | 448 | |
449 | 449 | config SENSORS_LM63 |
450 | - tristate "National Semiconductor LM63" | |
450 | + tristate "National Semiconductor LM63 and LM64" | |
451 | 451 | depends on I2C |
452 | 452 | help |
453 | - If you say yes here you get support for the National Semiconductor | |
454 | - LM63 remote diode digital temperature sensor with integrated fan | |
455 | - control. Such chips are found on the Tyan S4882 (Thunder K8QS Pro) | |
456 | - motherboard, among others. | |
453 | + If you say yes here you get support for the National | |
454 | + Semiconductor LM63 and LM64 remote diode digital temperature | |
455 | + sensors with integrated fan control. Such chips are found | |
456 | + on the Tyan S4882 (Thunder K8QS Pro) motherboard, among | |
457 | + others. | |
457 | 458 | |
458 | 459 | This driver can also be built as a module. If so, the module |
459 | 460 | will be called lm63. |
drivers/hwmon/lm63.c
... | ... | @@ -53,7 +53,7 @@ |
53 | 53 | * Address is fully defined internally and cannot be changed. |
54 | 54 | */ |
55 | 55 | |
56 | -static const unsigned short normal_i2c[] = { 0x4c, I2C_CLIENT_END }; | |
56 | +static const unsigned short normal_i2c[] = { 0x18, 0x4c, 0x4e, I2C_CLIENT_END }; | |
57 | 57 | |
58 | 58 | /* |
59 | 59 | * The LM63 registers |
60 | 60 | |
... | ... | @@ -131,12 +131,15 @@ |
131 | 131 | static int lm63_detect(struct i2c_client *client, struct i2c_board_info *info); |
132 | 132 | static void lm63_init_client(struct i2c_client *client); |
133 | 133 | |
134 | +enum chips { lm63, lm64 }; | |
135 | + | |
134 | 136 | /* |
135 | 137 | * Driver data (common to all clients) |
136 | 138 | */ |
137 | 139 | |
138 | 140 | static const struct i2c_device_id lm63_id[] = { |
139 | - { "lm63", 0 }, | |
141 | + { "lm63", lm63 }, | |
142 | + { "lm64", lm64 }, | |
140 | 143 | { } |
141 | 144 | }; |
142 | 145 | MODULE_DEVICE_TABLE(i2c, lm63_id); |
... | ... | @@ -422,6 +425,7 @@ |
422 | 425 | struct i2c_adapter *adapter = new_client->adapter; |
423 | 426 | u8 man_id, chip_id, reg_config1, reg_config2; |
424 | 427 | u8 reg_alert_status, reg_alert_mask; |
428 | + int address = new_client->addr; | |
425 | 429 | |
426 | 430 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
427 | 431 | return -ENODEV; |
... | ... | @@ -439,7 +443,6 @@ |
439 | 443 | LM63_REG_ALERT_MASK); |
440 | 444 | |
441 | 445 | if (man_id != 0x01 /* National Semiconductor */ |
442 | - || chip_id != 0x41 /* LM63 */ | |
443 | 446 | || (reg_config1 & 0x18) != 0x00 |
444 | 447 | || (reg_config2 & 0xF8) != 0x00 |
445 | 448 | || (reg_alert_status & 0x20) != 0x00 |
... | ... | @@ -450,7 +453,12 @@ |
450 | 453 | return -ENODEV; |
451 | 454 | } |
452 | 455 | |
453 | - strlcpy(info->type, "lm63", I2C_NAME_SIZE); | |
456 | + if (chip_id == 0x41 && address == 0x4c) | |
457 | + strlcpy(info->type, "lm63", I2C_NAME_SIZE); | |
458 | + else if (chip_id == 0x51 && (address == 0x18 || address == 0x4e)) | |
459 | + strlcpy(info->type, "lm64", I2C_NAME_SIZE); | |
460 | + else | |
461 | + return -ENODEV; | |
454 | 462 | |
455 | 463 | return 0; |
456 | 464 | } |