Skip to content

Dev/lm75 add max31875 #2751

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Documentation/devicetree/bindings/hwmon/lm75.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ properties:
compatible:
enum:
- adi,adt75
- adi,max31875
- atmel,at30ts74
- dallas,ds1775
- dallas,ds75
Expand Down
6 changes: 4 additions & 2 deletions Documentation/hwmon/lm75.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,18 @@ Supported chips:

http://www.microchip.com/

* Analog Devices ADT75
* Analog Devices ADT75, MAX31875

Prefix: 'adt75'
Prefix: 'adt75', 'max31875'

Addresses scanned: none

Datasheet: Publicly available at the Analog Devices website

https://www.analog.com/adt75

https://www.analog.com/max31875

* ST Microelectronics STDS75

Prefix: 'stds75'
Expand Down
2 changes: 1 addition & 1 deletion drivers/hwmon/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions drivers/hwmon/lm75.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ enum lm75_type { /* keep sorted in alphabetical order */
max6625,
max6626,
max31725,
max31875,
mcp980x,
pct2075,
stds75,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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, },
Expand All @@ -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
Expand Down