diff --git a/Documentation/devicetree/bindings/hwmon/lm75.yaml b/Documentation/devicetree/bindings/hwmon/lm75.yaml index 0b69897f0c63fc..abc50d4e0ad768 100644 --- a/Documentation/devicetree/bindings/hwmon/lm75.yaml +++ b/Documentation/devicetree/bindings/hwmon/lm75.yaml @@ -14,6 +14,7 @@ properties: compatible: enum: - adi,adt75 + - adi,max31875 - atmel,at30ts74 - dallas,ds1775 - dallas,ds75 diff --git a/Documentation/hwmon/lm75.rst b/Documentation/hwmon/lm75.rst index 8d0ab4ad5fb525..ed3a1444c28c4a 100644 --- a/Documentation/hwmon/lm75.rst +++ b/Documentation/hwmon/lm75.rst @@ -63,9 +63,9 @@ Supported chips: http://www.microchip.com/ - * Analog Devices ADT75 + * Analog Devices ADT75, MAX31875 - Prefix: 'adt75' + Prefix: 'adt75', 'max31875' Addresses scanned: none @@ -73,6 +73,8 @@ Supported chips: https://www.analog.com/adt75 + https://www.analog.com/max31875 + * ST Microelectronics STDS75 Prefix: 'stds75' diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index b7fa01e9dd892e..332313f39090ee 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig @@ -1338,7 +1338,7 @@ config SENSORS_LM75 If you say yes here you get support for one common type of temperature sensor chip, with models including: - - Analog Devices ADT75 + - Analog Devices ADT75, MAX31875 - Atmel (now Microchip) AT30TS74 - Dallas Semiconductor DS75, DS1775 and DS7505 - Global Mixed-mode Technology (GMT) G751 diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c index 5b2ea05c951e33..7acf61d863c494 100644 --- a/drivers/hwmon/lm75.c +++ b/drivers/hwmon/lm75.c @@ -36,6 +36,7 @@ enum lm75_type { /* keep sorted in alphabetical order */ max6625, max6626, max31725, + max31875, mcp980x, pct2075, stds75, @@ -204,6 +205,13 @@ static const struct lm75_params device_params[] = { .default_resolution = 16, .default_sample_time = MSEC_PER_SEC / 20, }, + [max31875] = { + .default_resolution = 10, + .resolutions = (u8 []) {8, 9, 10, 12 }, + .default_sample_time = 4000, + .num_sample_times = 4, + .sample_times = (unsigned int []){ 125, 250, 1000, 4000 }, + }, [tcn75] = { .default_resolution = 9, .default_sample_time = MSEC_PER_SEC / 18, @@ -446,6 +454,13 @@ static int lm75_update_interval(struct device *dev, long val) return err; data->sample_time = data->params->sample_times[index]; break; + case max31875: + err = regmap_update_bits(data->regmap, LM75_REG_CONF, + 0x0600, (3 - index) << 9); + if (err < 0) + return err; + data->sample_time = data->params->sample_times[index]; + break; case pct2075: err = i2c_smbus_write_byte_data(data->client, PCT2075_REG_IDLE, index + 1); @@ -665,6 +680,7 @@ static const struct i2c_device_id lm75_ids[] = { { "max6626", max6626, }, { "max31725", max31725, }, { "max31726", max31725, }, + { "max31875", max31875, }, { "mcp980x", mcp980x, }, { "pct2075", pct2075, }, { "stds75", stds75, }, @@ -689,6 +705,10 @@ static const struct of_device_id __maybe_unused lm75_of_match[] = { .compatible = "adi,adt75", .data = (void *)adt75 }, + { + .compatible = "adi,max31875", + .data = (void *)max31875 + }, { .compatible = "atmel,at30ts74", .data = (void *)at30ts74