aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorRainer Birkenmaier <rainer.birkenmaier@siemens.com>2007-06-09 10:11:16 -0400
committerMark M. Hoffman <mhoffman@lightlink.com>2007-07-19 14:22:12 -0400
commit32c82a934759b2c9939c9e25865c2d7d1204b9e8 (patch)
tree2e635ddcb4f84e24f271efad193881334bd78dcd /drivers/hwmon
parent2df6d811574f46bea0d38bf91aa54df4c05488cd (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>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/Kconfig4
-rw-r--r--drivers/hwmon/lm90.c72
2 files changed, 58 insertions, 18 deletions
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
94static unsigned short normal_i2c[] = { 0x4c, 0x4d, I2C_CLIENT_END }; 103static 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
100I2C_CLIENT_INSMOD_6(lm90, adm1032, lm99, lm86, max6657, adt7461); 112I2C_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 &reg_convrate) < 0) 537 &reg_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
647static void lm90_init_client(struct i2c_client *client) 675static 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
665static int lm90_detach_client(struct i2c_client *client) 705static int lm90_detach_client(struct i2c_client *client)