diff options
author | Rainer Birkenmaier <rainer.birkenmaier@siemens.com> | 2007-06-09 10:11:16 -0400 |
---|---|---|
committer | Mark M. Hoffman <mhoffman@lightlink.com> | 2007-07-19 14:22:12 -0400 |
commit | 32c82a934759b2c9939c9e25865c2d7d1204b9e8 (patch) | |
tree | 2e635ddcb4f84e24f271efad193881334bd78dcd | |
parent | 2df6d811574f46bea0d38bf91aa54df4c05488cd (diff) |
hwmon/lm90: Add support for the Maxim MAX6680/MAX6681
Signed-off-by: Rainer Birkenmaier <rainer.birkenmaier@siemens.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
-rw-r--r-- | Documentation/hwmon/lm90 | 34 | ||||
-rw-r--r-- | drivers/hwmon/Kconfig | 4 | ||||
-rw-r--r-- | drivers/hwmon/lm90.c | 72 |
3 files changed, 85 insertions, 25 deletions
diff --git a/Documentation/hwmon/lm90 b/Documentation/hwmon/lm90 index ba3e94b7117b..aa4a0ec20081 100644 --- a/Documentation/hwmon/lm90 +++ b/Documentation/hwmon/lm90 | |||
@@ -48,6 +48,18 @@ Supported chips: | |||
48 | Addresses scanned: I2C 0x4c, 0x4d (unsupported 0x4e) | 48 | Addresses scanned: I2C 0x4c, 0x4d (unsupported 0x4e) |
49 | Datasheet: Publicly available at the Maxim website | 49 | Datasheet: Publicly available at the Maxim website |
50 | http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2578 | 50 | http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2578 |
51 | * Maxim MAX6680 | ||
52 | Prefix: 'max6680' | ||
53 | Addresses scanned: I2C 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, | ||
54 | 0x4c, 0x4d and 0x4e | ||
55 | Datasheet: Publicly available at the Maxim website | ||
56 | http://www.maxim-ic.com/quick_view2.cfm/qv_pk/3370 | ||
57 | * Maxim MAX6681 | ||
58 | Prefix: 'max6680' | ||
59 | Addresses scanned: I2C 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, | ||
60 | 0x4c, 0x4d and 0x4e | ||
61 | Datasheet: Publicly available at the Maxim website | ||
62 | http://www.maxim-ic.com/quick_view2.cfm/qv_pk/3370 | ||
51 | 63 | ||
52 | 64 | ||
53 | Author: Jean Delvare <khali@linux-fr.org> | 65 | Author: Jean Delvare <khali@linux-fr.org> |
@@ -59,11 +71,15 @@ Description | |||
59 | The LM90 is a digital temperature sensor. It senses its own temperature as | 71 | The LM90 is a digital temperature sensor. It senses its own temperature as |
60 | well as the temperature of up to one external diode. It is compatible | 72 | well as the temperature of up to one external diode. It is compatible |
61 | with many other devices such as the LM86, the LM89, the LM99, the ADM1032, | 73 | with many other devices such as the LM86, the LM89, the LM99, the ADM1032, |
62 | the MAX6657, MAX6658 and the MAX6659 all of which are supported by this driver. | 74 | the MAX6657, MAX6658, MAX6659, MAX6680 and the MAX6681 all of which are |
63 | Note that there is no easy way to differentiate between the last three | 75 | supported by this driver. |
64 | variants. The extra address and features of the MAX6659 are not supported by | 76 | |
65 | this driver. Additionally, the ADT7461 is supported if found in ADM1032 | 77 | Note that there is no easy way to differentiate between the MAX6657, |
66 | compatibility mode. | 78 | MAX6658 and MAX6659 variants. The extra address and features of the |
79 | MAX6659 are not supported by this driver. The MAX6680 and MAX6681 only | ||
80 | differ in their pinout, therefore they obviously can't (and don't need to) | ||
81 | be distinguished. Additionally, the ADT7461 is supported if found in | ||
82 | ADM1032 compatibility mode. | ||
67 | 83 | ||
68 | The specificity of this family of chipsets over the ADM1021/LM84 | 84 | The specificity of this family of chipsets over the ADM1021/LM84 |
69 | family is that it features critical limits with hysteresis, and an | 85 | family is that it features critical limits with hysteresis, and an |
@@ -93,18 +109,22 @@ ADM1032: | |||
93 | * ALERT is triggered by open remote sensor. | 109 | * ALERT is triggered by open remote sensor. |
94 | * SMBus PEC support for Write Byte and Receive Byte transactions. | 110 | * SMBus PEC support for Write Byte and Receive Byte transactions. |
95 | 111 | ||
96 | ADT7461 | 112 | ADT7461: |
97 | * Extended temperature range (breaks compatibility) | 113 | * Extended temperature range (breaks compatibility) |
98 | * Lower resolution for remote temperature | 114 | * Lower resolution for remote temperature |
99 | 115 | ||
100 | MAX6657 and MAX6658: | 116 | MAX6657 and MAX6658: |
101 | * Remote sensor type selection | 117 | * Remote sensor type selection |
102 | 118 | ||
103 | MAX6659 | 119 | MAX6659: |
104 | * Selectable address | 120 | * Selectable address |
105 | * Second critical temperature limit | 121 | * Second critical temperature limit |
106 | * Remote sensor type selection | 122 | * Remote sensor type selection |
107 | 123 | ||
124 | MAX6680 and MAX6681: | ||
125 | * Selectable address | ||
126 | * Remote sensor type selection | ||
127 | |||
108 | All temperature values are given in degrees Celsius. Resolution | 128 | All temperature values are given in degrees Celsius. Resolution |
109 | is 1.0 degree for the local temperature, 0.125 degree for the remote | 129 | is 1.0 degree for the local temperature, 0.125 degree for the remote |
110 | temperature. | 130 | temperature. |
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 1d9be07c3c1d..d1c6be9e2bad 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
@@ -365,8 +365,8 @@ config SENSORS_LM90 | |||
365 | depends on I2C | 365 | depends on I2C |
366 | help | 366 | help |
367 | If you say yes here you get support for National Semiconductor LM90, | 367 | If you say yes here you get support for National Semiconductor LM90, |
368 | LM86, LM89 and LM99, Analog Devices ADM1032 and Maxim MAX6657 and | 368 | LM86, LM89 and LM99, Analog Devices ADM1032 and Maxim MAX6657, |
369 | MAX6658 sensor chips. | 369 | MAX6658, MAX6659, MAX6680 and MAX6681 sensor chips. |
370 | 370 | ||
371 | The Analog Devices ADT7461 sensor chip is also supported, but only | 371 | The Analog Devices ADT7461 sensor chip is also supported, but only |
372 | if found in ADM1032 compatibility mode. | 372 | if found in ADM1032 compatibility mode. |
diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c index 24b3b0e97537..5771130f51ff 100644 --- a/drivers/hwmon/lm90.c +++ b/drivers/hwmon/lm90.c | |||
@@ -43,6 +43,13 @@ | |||
43 | * variants. The extra address and features of the MAX6659 are not | 43 | * variants. The extra address and features of the MAX6659 are not |
44 | * supported by this driver. | 44 | * supported by this driver. |
45 | * | 45 | * |
46 | * This driver also supports the MAX6680 and MAX6681, two other sensor | ||
47 | * chips made by Maxim. These are quite similar to the other Maxim | ||
48 | * chips. Complete datasheet can be obtained at: | ||
49 | * http://www.maxim-ic.com/quick_view2.cfm/qv_pk/3370 | ||
50 | * The MAX6680 and MAX6681 only differ in the pinout so they can be | ||
51 | * treated identically. | ||
52 | * | ||
46 | * This driver also supports the ADT7461 chip from Analog Devices but | 53 | * This driver also supports the ADT7461 chip from Analog Devices but |
47 | * only in its "compatability mode". If an ADT7461 chip is found but | 54 | * only in its "compatability mode". If an ADT7461 chip is found but |
48 | * is configured in non-compatible mode (where its temperature | 55 | * is configured in non-compatible mode (where its temperature |
@@ -84,20 +91,25 @@ | |||
84 | /* | 91 | /* |
85 | * Addresses to scan | 92 | * Addresses to scan |
86 | * Address is fully defined internally and cannot be changed except for | 93 | * Address is fully defined internally and cannot be changed except for |
87 | * MAX6659. | 94 | * MAX6659, MAX6680 and MAX6681. |
88 | * LM86, LM89, LM90, LM99, ADM1032, ADM1032-1, ADT7461, MAX6657 and MAX6658 | 95 | * LM86, LM89, LM90, LM99, ADM1032, ADM1032-1, ADT7461, MAX6657 and MAX6658 |
89 | * have address 0x4c. | 96 | * have address 0x4c. |
90 | * ADM1032-2, ADT7461-2, LM89-1, and LM99-1 have address 0x4d. | 97 | * ADM1032-2, ADT7461-2, LM89-1, and LM99-1 have address 0x4d. |
91 | * MAX6659 can have address 0x4c, 0x4d or 0x4e (unsupported). | 98 | * MAX6659 can have address 0x4c, 0x4d or 0x4e (unsupported). |
99 | * MAX6680 and MAX6681 can have address 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, | ||
100 | * 0x4c, 0x4d or 0x4e. | ||
92 | */ | 101 | */ |
93 | 102 | ||
94 | static unsigned short normal_i2c[] = { 0x4c, 0x4d, I2C_CLIENT_END }; | 103 | static unsigned short normal_i2c[] = { 0x18, 0x19, 0x1a, |
104 | 0x29, 0x2a, 0x2b, | ||
105 | 0x4c, 0x4d, 0x4e, | ||
106 | I2C_CLIENT_END }; | ||
95 | 107 | ||
96 | /* | 108 | /* |
97 | * Insmod parameters | 109 | * Insmod parameters |
98 | */ | 110 | */ |
99 | 111 | ||
100 | I2C_CLIENT_INSMOD_6(lm90, adm1032, lm99, lm86, max6657, adt7461); | 112 | I2C_CLIENT_INSMOD_7(lm90, adm1032, lm99, lm86, max6657, adt7461, max6680); |
101 | 113 | ||
102 | /* | 114 | /* |
103 | * The LM90 registers | 115 | * The LM90 registers |
@@ -525,7 +537,8 @@ static int lm90_detect(struct i2c_adapter *adapter, int address, int kind) | |||
525 | ®_convrate) < 0) | 537 | ®_convrate) < 0) |
526 | goto exit_free; | 538 | goto exit_free; |
527 | 539 | ||
528 | if (man_id == 0x01) { /* National Semiconductor */ | 540 | if ((address == 0x4C || address == 0x4D) |
541 | && man_id == 0x01) { /* National Semiconductor */ | ||
529 | u8 reg_config2; | 542 | u8 reg_config2; |
530 | 543 | ||
531 | if (lm90_read_reg(new_client, LM90_REG_R_CONFIG2, | 544 | if (lm90_read_reg(new_client, LM90_REG_R_CONFIG2, |
@@ -548,7 +561,8 @@ static int lm90_detect(struct i2c_adapter *adapter, int address, int kind) | |||
548 | } | 561 | } |
549 | } | 562 | } |
550 | } else | 563 | } else |
551 | if (man_id == 0x41) { /* Analog Devices */ | 564 | if ((address == 0x4C || address == 0x4D) |
565 | && man_id == 0x41) { /* Analog Devices */ | ||
552 | if ((chip_id & 0xF0) == 0x40 /* ADM1032 */ | 566 | if ((chip_id & 0xF0) == 0x40 /* ADM1032 */ |
553 | && (reg_config1 & 0x3F) == 0x00 | 567 | && (reg_config1 & 0x3F) == 0x00 |
554 | && reg_convrate <= 0x0A) { | 568 | && reg_convrate <= 0x0A) { |
@@ -562,18 +576,30 @@ static int lm90_detect(struct i2c_adapter *adapter, int address, int kind) | |||
562 | } else | 576 | } else |
563 | if (man_id == 0x4D) { /* Maxim */ | 577 | if (man_id == 0x4D) { /* Maxim */ |
564 | /* | 578 | /* |
565 | * The Maxim variants do NOT have a chip_id register. | 579 | * The MAX6657, MAX6658 and MAX6659 do NOT have a |
566 | * Reading from that address will return the last read | 580 | * chip_id register. Reading from that address will |
567 | * value, which in our case is those of the man_id | 581 | * return the last read value, which in our case is |
568 | * register. Likewise, the config1 register seems to | 582 | * those of the man_id register. Likewise, the config1 |
569 | * lack a low nibble, so the value will be those of the | 583 | * register seems to lack a low nibble, so the value |
570 | * previous read, so in our case those of the man_id | 584 | * will be those of the previous read, so in our case |
571 | * register. | 585 | * those of the man_id register. |
572 | */ | 586 | */ |
573 | if (chip_id == man_id | 587 | if (chip_id == man_id |
588 | && (address == 0x4F || address == 0x4D) | ||
574 | && (reg_config1 & 0x1F) == (man_id & 0x0F) | 589 | && (reg_config1 & 0x1F) == (man_id & 0x0F) |
575 | && reg_convrate <= 0x09) { | 590 | && reg_convrate <= 0x09) { |
576 | kind = max6657; | 591 | kind = max6657; |
592 | } else | ||
593 | /* The chip_id register of the MAX6680 and MAX6681 | ||
594 | * holds the revision of the chip. | ||
595 | * the lowest bit of the config1 register is unused | ||
596 | * and should return zero when read, so should the | ||
597 | * second to last bit of config1 (software reset) | ||
598 | */ | ||
599 | if (chip_id == 0x01 | ||
600 | && (reg_config1 & 0x03) == 0x00 | ||
601 | && reg_convrate <= 0x07) { | ||
602 | kind = max6680; | ||
577 | } | 603 | } |
578 | } | 604 | } |
579 | 605 | ||
@@ -599,6 +625,8 @@ static int lm90_detect(struct i2c_adapter *adapter, int address, int kind) | |||
599 | name = "lm86"; | 625 | name = "lm86"; |
600 | } else if (kind == max6657) { | 626 | } else if (kind == max6657) { |
601 | name = "max6657"; | 627 | name = "max6657"; |
628 | } else if (kind == max6680) { | ||
629 | name = "max6680"; | ||
602 | } else if (kind == adt7461) { | 630 | } else if (kind == adt7461) { |
603 | name = "adt7461"; | 631 | name = "adt7461"; |
604 | } | 632 | } |
@@ -646,7 +674,8 @@ exit: | |||
646 | 674 | ||
647 | static void lm90_init_client(struct i2c_client *client) | 675 | static void lm90_init_client(struct i2c_client *client) |
648 | { | 676 | { |
649 | u8 config; | 677 | u8 config, config_orig; |
678 | struct lm90_data *data = i2c_get_clientdata(client); | ||
650 | 679 | ||
651 | /* | 680 | /* |
652 | * Start the conversions. | 681 | * Start the conversions. |
@@ -657,9 +686,20 @@ static void lm90_init_client(struct i2c_client *client) | |||
657 | dev_warn(&client->dev, "Initialization failed!\n"); | 686 | dev_warn(&client->dev, "Initialization failed!\n"); |
658 | return; | 687 | return; |
659 | } | 688 | } |
660 | if (config & 0x40) | 689 | config_orig = config; |
661 | i2c_smbus_write_byte_data(client, LM90_REG_W_CONFIG1, | 690 | |
662 | config & 0xBF); /* run */ | 691 | /* |
692 | * Put MAX6680/MAX8881 into extended resolution (bit 0x10, | ||
693 | * 0.125 degree resolution) and range (0x08, extend range | ||
694 | * to -64 degree) mode for the remote temperature sensor. | ||
695 | */ | ||
696 | if (data->kind == max6680) { | ||
697 | config |= 0x18; | ||
698 | } | ||
699 | |||
700 | config &= 0xBF; /* run */ | ||
701 | if (config != config_orig) /* Only write if changed */ | ||
702 | i2c_smbus_write_byte_data(client, LM90_REG_W_CONFIG1, config); | ||
663 | } | 703 | } |
664 | 704 | ||
665 | static int lm90_detach_client(struct i2c_client *client) | 705 | static int lm90_detach_client(struct i2c_client *client) |