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

From: Oskar Senft
Date: Tue Sep 14 2021 - 08:41:58 EST


Hi Guenter

> 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.

Good pointer! I should be able to replicate that for the LTD (@0) and
RTDs (1, 2, 3) in a similar way.

> 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.
Following the example from tmp421, this could then be like this:

i2c {
#address-cells = <1>;
#size-cells = <0>;

nct7802@28 {
compatible = "nuvoton,nct7802";
reg = <0x28>;
#address-cells = <1>;
#size-cells = <0>;

/* LTD */
input@0 {
reg = <0x0>;
status = "okay";
/* No "mode" attribute here*/
label = "local temp";
};

/* RTD1 */
input@1 {
reg = <0x1>;
mode = <0x2>; /* 3904 transistor */
label = "voltage mode";
};

input@2 {
reg = <0x2>;
mode = <0x4>; /* thermistor */
label = "thermistor mode";
};

/* RTD3 */
input@3 {
reg = <0x3>;
mode = <0x3>; /* thermal diode */
label = "current mode";
status = "disabled";
};
};
};

I noticed that "nct7802_temp_is_visible" only allows the temperature
sensor to be visible for current and thermistor but not voltage. Is
that right?

Before I go and change the driver further, I'd like to make sure we
agree on the interface.

Also: Is nct7802_temp_is_visible called again after temp_type_store
was called (I didn't try it)?

Thanks
Oskar.