Re: [PATCH] dt-bindings: hwmon: Add nct7802 bindings

From: Guenter Roeck
Date: Fri Sep 10 2021 - 17:28:22 EST


On 9/10/21 1:44 PM, Oskar Senft wrote:
Hi Guenter

Thanks for the quick feedback!

+ nuvoton,rtd-modes:
+ description: |
+ Select modes for the three RTDs.
+
At the very least, "RTD" should be defined. The datasheet doesn't say explicitly,
but I suspect it means "Remote Temperature Diode".
Ha, good point. As I understand, RTD means "Resistance Temperature
Detector". But TBH, I'm not sure how that squares with Nuvoton's use
of "LTD" for the local sensor ... sigh.

+ Valid values for RTD1 and RTD2 are:
+ "closed",
+ "current",
+ "thermistor",
+ "voltage"
I am not sure what "closed" means (the datasheet doesn't say), but I suspect it means
that the sensor is disabled (?). For the other modes, the translation to the standard
ABI is:
Thanks for that pointer, I now found that in
Documentation/hwmon/sysfs-interface. Given that there's no definition
for "disabled", I guess I'll just leave that out of the device tree
binding for now? That way we'll stay consistent with the sysfs ABI.


Sure there is. A possible set of bindings - in that case for tmp421 -
is suggested with the series at
https://lore.kernel.org/linux-hwmon/cover.1631021349.git.krzysztof.adamski@xxxxxxxxx/

That specifically includes the ability to enable or disable channels
using the standard 'status' property. While that series is primarily
for the n-factor property supported by the tmp421, the same approach
can be used for [temperature] sensor properties on other chips as well.

I put [temperature] in [] because we'd need to find a means to express
if the sub-nodes are for temperature, voltage, or something else, but
I think the basic principle is sound.

Guenter

That gives us the following mapping for sysfs / device tree -> nct7802 HW:
2 (3904 transistor) -> 3 (voltage)
3 (thermal diode) -> 1 (current)
4 (thermistor) -> 2 (thermistor)

I'll update the device tree binding to be an array then. I also update
the temp_type functions to support all 3 values.

Oskar.