Re: [PATCH 8/8] dt-bindings: hwmon: allow specifying channels for tmp421
From: Guenter Roeck <linux@roeck-us.net>
Date: 2021-09-25 13:26:35
Also in:
linux-hwmon
On Fri, Sep 24, 2021 at 11:37:00AM -0400, Oskar Senft wrote:
quoted
quoted
In many cases the channels are "shared" - we have 3 voltage, 3 current and 3 power sensors but in fact they are not separate sensors but 3 channels each able to measure 3 different things and they may share some common properties in each channel (so current, voltage and power may be calculated bases on the same shunt resistor or correction factor). An example being adi,ltc2992. In those cases it doesn't make sense to have two levels as how would you describe the shared parent? Call it generic "channels"?So in that case (e.g. for the nct7802, see [1]) do we want just 1-level, maybe like this: nct7802@28 { compatible = "nuvoton,nct7802"; reg = <0x28>; sensor@1 { /* RTD1 */ reg = <0x1>; status = "okay"; mode = "thermistor"; /* Any of "thermistor", "thermal-diode", "voltage" */ }; sensor@2 { /* RTD2 */ reg = <0x2>; status = "okay"; mode = "thermal-diode"; /* Any of "thermistor", "thermal-diode", "voltage" */ }; sensor@3 { /* RTD3 */ reg = <0x3>; status = "okay"; mode = "voltage"; /* Any of "thermistor", "voltage" */ }; sensor@4 { /* LTD */ reg = <0x4>; /* using the same number as in sysfs */
Numbering in sysfs is not relevant here; the index should always start with 0.
status = "okay";
/* No mode configuration for LTD */
};
};
In this example, RTD1, RTD2 and LTD would be temperature sensors and
RTD3 would be a voltage sensor.
Would that make more sense? Is the use of strings acceptable?I don't think so. I am quite sure that rtd3 is still a temperature, and I am not sure if other sensor types on that chip may need dt configuration. I have limited internet acces for the next week or so; I'll look into this further after I am back. Guenter
Thanks Oskar. [1] https://lore.kernel.org/all/20210921004627.2786132-1-osk@google.com/ (local)