Skip to contentSkip to conversation

hwmon: (lm75) Add MAX31725/6 support

PATCH Guenter Roeck 2 participants 2 messages Sep 11, 2018 Hardware monitoring

lore
Share & tools
lore

Guenter Roeck

author maintainer Applied
#0 lore raw
Quoted 9 lines · Kun Yi

MAX31725/MAX31726 are local temperature sensors with +/- 0.5 degree Celsius accuracy and 16-bit (0.00390625 degrees Celsius) resolution. They have a register mapping and encoding compatible with the lm75 series drivers. Address scan and extended temperature range are not supported by this patch.

Tested on real hardware and verified temperature readings are correct.

Applied to hwmon-next.

Thanks,
Guenter

Quoted 96 lines
---
 Documentation/hwmon/lm75 |  6 +++---
 drivers/hwmon/lm75.c     | 18 ++++++++++++++++--
 2 files changed, 19 insertions(+), 5 deletions(-)
Documentation/hwmon/lm75 +3 -3
index ac95edfcd907..2f1120f88c16 100644
@@ -17,8 +17,8 @@ Supported chips:
     Addresses scanned: none
     Datasheet: Publicly available at the Maxim website
                http://www.maximintegrated.com/
-  * Maxim MAX6625, MAX6626
-    Prefixes: 'max6625', 'max6626'
+  * Maxim MAX6625, MAX6626, MAX31725, MAX31726
+    Prefixes: 'max6625', 'max6626', 'max31725', 'max31726'
     Addresses scanned: none
     Datasheet: Publicly available at the Maxim website
                http://www.maxim-ic.com/
@@ -86,7 +86,7 @@ The LM75 is essentially an industry standard; there may be other
 LM75 clones not listed here, with or without various enhancements,
 that are supported. The clones are not detected by the driver, unless
 they reproduce the exact register tricks of the original LM75, and must
-therefore be instantiated explicitly. Higher resolution up to 12-bit
+therefore be instantiated explicitly. Higher resolution up to 16-bit
 is supported by this driver, other specific enhancements are not.
 
 The LM77 is not supported, contrary to what we pretended for a long time.
drivers/hwmon/lm75.c +16 -2
index 49f4b33a5685..e6e5a1080f09 100644
@@ -47,6 +47,7 @@ enum lm75_type {		/* keep sorted in alphabetical order */
 	lm75b,
 	max6625,
 	max6626,
+	max31725,
 	mcp980x,
 	stds75,
 	tcn75,
@@ -64,7 +65,6 @@ enum lm75_type {		/* keep sorted in alphabetical order */
 static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, 0x4c,
 					0x4d, 0x4e, 0x4f, I2C_CLIENT_END };
 
-
 /* The LM75 registers */
 #define LM75_REG_TEMP		0x00
 #define LM75_REG_CONF		0x01
@@ -76,7 +76,7 @@ struct lm75_data {
 	struct i2c_client	*client;
 	struct regmap		*regmap;
 	u8			orig_conf;
-	u8			resolution;	/* In bits, between 9 and 12 */
+	u8			resolution;	/* In bits, between 9 and 16 */
 	u8			resolution_limits;
 	unsigned int		sample_time;	/* In ms */
 };
@@ -339,6 +339,10 @@ lm75_probe(struct i2c_client *client, const struct i2c_device_id *id)
 		data->resolution_limits = 9;
 		data->sample_time = MSEC_PER_SEC / 4;
 		break;
+	case max31725:
+		data->resolution = 16;
+		data->sample_time = MSEC_PER_SEC / 8;
+		break;
 	case tcn75:
 		data->resolution = 9;
 		data->sample_time = MSEC_PER_SEC / 8;
@@ -415,6 +419,8 @@ static const struct i2c_device_id lm75_ids[] = {
 	{ "lm75b", lm75b, },
 	{ "max6625", max6625, },
 	{ "max6626", max6626, },
+	{ "max31725", max31725, },
+	{ "max31726", max31725, },
 	{ "mcp980x", mcp980x, },
 	{ "stds75", stds75, },
 	{ "tcn75", tcn75, },
@@ -471,6 +477,14 @@ static const struct of_device_id lm75_of_match[] = {
 		.compatible = "maxim,max6626",
 		.data = (void *)max6626
 	},
+	{
+		.compatible = "maxim,max31725",
+		.data = (void *)max31725
+	},
+	{
+		.compatible = "maxim,max31726",
+		.data = (void *)max31725
+	},
 	{
 		.compatible = "maxim,mcp980x",
 		.data = (void *)mcp980x
Signature · 1 line
2.19.0.rc2.392.g5ba43deb5a-goog
#1 lore raw

Great, thanks!

Quoted 121 lines · Guenter Roeck
Quoted 9 lines · Kun Yi

MAX31725/MAX31726 are local temperature sensors with +/- 0.5 degree Celsius accuracy and 16-bit (0.00390625 degrees Celsius) resolution. They have a register mapping and encoding compatible with the lm75 series drivers. Address scan and extended temperature range are not supported by this patch.

Tested on real hardware and verified temperature readings are correct.

Applied to hwmon-next.

Thanks,
Guenter

Documentation/hwmon/lm75 The LM75 is essentially an industry standard; there

Quoted 21 lines
---
 Documentation/hwmon/lm75 |  6 +++---
 drivers/hwmon/lm75.c     | 18 ++++++++++++++++--
 2 files changed, 19 insertions(+), 5 deletions(-)
Documentation/hwmon/lm75 +2 -2
index ac95edfcd907..2f1120f88c16 100644
@@ -17,8 +17,8 @@ Supported chips:
     Addresses scanned: none
     Datasheet: Publicly available at the Maxim website
                http://www.maximintegrated.com/
-  * Maxim MAX6625, MAX6626
-    Prefixes: 'max6625', 'max6626'
+  * Maxim MAX6625, MAX6626, MAX31725, MAX31726
+    Prefixes: 'max6625', 'max6626', 'max31725', 'max31726'
     Addresses scanned: none
     Datasheet: Publicly available at the Maxim website
                http://www.maxim-ic.com/
@@ -86,7 +86,7 @@ The LM75 is essentially an industry standard; there

may be other

Documentation/hwmon/lm75 The LM75 is essentially an industry standard; there · line 92

Quoted 8 lines
Documentation/hwmon/lm75 +1 -1
 LM75 clones not listed here, with or without various enhancements,
 that are supported. The clones are not detected by the driver, unless
 they reproduce the exact register tricks of the original LM75, and must
-therefore be instantiated explicitly. Higher resolution up to 12-bit
+therefore be instantiated explicitly. Higher resolution up to 16-bit
 is supported by this driver, other specific enhancements are not.
 
 The LM77 is not supported, contrary to what we pretended for a long

time.

drivers/hwmon/lm75.c enum lm75_type { /* keep sorted in

Quoted 5 lines
drivers/hwmon/lm75.c +0 -0
index 49f4b33a5685..e6e5a1080f09 100644
@@ -47,6 +47,7 @@ enum lm75_type {            /* keep sorted in

alphabetical order */

drivers/hwmon/lm75.c enum lm75_type { /* keep sorted in

Quoted 8 lines
drivers/hwmon/lm75.c +1 -0
      lm75b,
      max6625,
      max6626,
+     max31725,
      mcp980x,
      stds75,
      tcn75,
@@ -64,7 +65,6 @@ enum lm75_type {            /* keep sorted in

alphabetical order */

drivers/hwmon/lm75.c enum lm75_type { /* keep sorted in · line 65

Quoted 1 line
drivers/hwmon/lm75.c +0 -0
 static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b,

0x4c,

drivers/hwmon/lm75.c struct lm75_data { · line 79

Quoted 11 lines
drivers/hwmon/lm75.c +0 -2
                                      0x4d, 0x4e, 0x4f, I2C_CLIENT_END };
 
-
 /* The LM75 registers */
 #define LM75_REG_TEMP                0x00
 #define LM75_REG_CONF                0x01
@@ -76,7 +76,7 @@ struct lm75_data {
      struct i2c_client       *client;
      struct regmap           *regmap;
      u8                      orig_conf;
-     u8                      resolution;     /* In bits, between 9 and

12 */

drivers/hwmon/lm75.c struct lm75_data { · line 79

Quoted 1 line
drivers/hwmon/lm75.c +1 -0
+     u8                      resolution;     /* In bits, between 9 and

16 */

drivers/hwmon/lm75.c lm75_probe(struct i2c_client *client, const struct

Quoted 4 lines
drivers/hwmon/lm75.c +0 -0
      u8                      resolution_limits;
      unsigned int            sample_time;    /* In ms */
 };
@@ -339,6 +339,10 @@ lm75_probe(struct i2c_client *client, const struct

i2c_device_id *id)

Quoted 37 lines
drivers/hwmon/lm75.c +14 -1
              data->resolution_limits = 9;
              data->sample_time = MSEC_PER_SEC / 4;
              break;
+     case max31725:
+             data->resolution = 16;
+             data->sample_time = MSEC_PER_SEC / 8;
+             break;
      case tcn75:
              data->resolution = 9;
              data->sample_time = MSEC_PER_SEC / 8;
@@ -415,6 +419,8 @@ static const struct i2c_device_id lm75_ids[] = {
      { "lm75b", lm75b, },
      { "max6625", max6625, },
      { "max6626", max6626, },
+     { "max31725", max31725, },
+     { "max31726", max31725, },
      { "mcp980x", mcp980x, },
      { "stds75", stds75, },
      { "tcn75", tcn75, },
@@ -471,6 +477,14 @@ static const struct of_device_id lm75_of_match[] = {
              .compatible = "maxim,max6626",
              .data = (void *)max6626
      },
+     {
+             .compatible = "maxim,max31725",
+             .data = (void *)max31725
+     },
+     {
+             .compatible = "maxim,max31726",
+             .data = (void *)max31725
+     },
      {
              .compatible = "maxim,mcp980x",
              .data = (void *)mcp980x
--

2.19.0.rc2.392.g5ba43deb5a-goog

Signature · 2 lines
Regards,
Kun