Skip to content

Conversation

@sdivarci
Copy link

@sdivarci sdivarci commented Sep 26, 2025

PR Description

Add MAX31732 hwmod driver and documentation.

PR Type

  • Bug fix (a change that fixes an issue)
  • New feature (a change that adds new functionality)
  • Breaking change (a change that affects other repos or cause CIs to fail)

PR Checklist

  • I have conducted a self-review of my own code changes
  • I have tested the changes on the relevant hardware
  • I have updated the documentation outside this repo accordingly (if there is the case)

Copy link
Collaborator

@nunojsa nunojsa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Sinan,

Just a first high level review. We first need to have this driver using modern hwmon API and have the userspace interface figured.

Also note that the expectation is for this to be first upstreamed (and accepted) before merging it in our tree


* All temperatures reported via sysfs are in milli-degree Celsius.
* ``stop`` halts conversions but does not power-cycle the part; use ``soft_por``
to restore all the registers to their default values.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this patch can typically be squashed with the one adding the driver

Copy link
Contributor

@machschmitt machschmitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @sdivarci,

A few comments from me.
I'm not very familiar with hwmon so feel safe to disregard any potentially misleading suggestion.

reg:
description: I2C address of the device.
maxItems: 1

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The guideline is to make dt docs as complete as possible. So, we can also describe the voltage supply here.

vcc-supply: true


required:
- compatible
- reg
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless I'm missing something, the device requires a power supply to operate, so

required:
  - compatible
  - reg
  - vcc-supply


sensor@1c {
compatible = "adi,max31732";
reg = <0x1c>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and it also needs to appear in the example. e.g.

            vcc-supply = <&supply_3_3V>;

dev_set_drvdata(dev, data);

if (fwnode_property_read_bool(dev_fwnode(dev), "adi,extended-range"))
ret = regmap_set_bits(data->regmap, MAX31732_REG_CONF1, MAX31732_CONF1_EXTRANGE);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The extended_range bit is only set here (at probe) and never changed after that. Then, there are a few places where it's read, (e.g. on max31732_read(), max31732_write(), max31732_highest_temperature_show(), ...). What about having a field for that in struct max31732_data so we can simplify code in those places where we currently do regmap_test_bits(data->regmap, MAX31732_REG_CONF1, MAX31732_CONF1_EXTRANGE);?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, to me, adi,extended-range doesn't seem very related to how hardware is setup. It's mostly a tweak in data offset. I worry dt maintainers might object to accepting that. Do hwmon offer any interface for changing data offset at runtime?

@balaji-rg-celestica
Copy link

Hi Sinan,

Just a first high level review. We first need to have this driver using modern hwmon API and have the userspace interface figured.

Also note that the expectation is for this to be first upstreamed (and accepted) before merging it in our tree

Hi Sinan, this is Balaji from Celestica. Could you please let me know when this driver will be pushed upstream? It is important for our current project.

Add support for Analog Devices MAX31732, a five-channel temperature
monitor with per-channel alarms, calibration helpers, and optional
IRQ handling.

Signed-off-by: Sinan Divarci <sinan.divarci@analog.com>
Add documentation for the Analog Devices MAX31732 temperature sensor driver
under Documentation/hwmon.

Signed-off-by: Sinan Divarci <sinan.divarci@analog.com>
Add device tree bindings for the Analog Devices MAX31732 temperature sensor
driver under Documentation/devicetree/bindings/hwmon/.

Signed-off-by: Sinan Divarci <sinan.divarci@analog.com>
@sdivarci
Copy link
Author

Hi @nunojsa @machschmitt I've made changes to the driver code and documentation based on your review notes; could you please review them again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants