Message ID | 20250219082817.56339-2-clamor95@gmail.com (mailing list archive) |
---|---|
State | New |
Delegated to: | Daniel Lezcano |
Headers | show |
Series | thermal: thermal-generic-adc: add temp sensor function | expand |
On Wed, Feb 19, 2025 at 10:28:16AM +0200, Svyatoslav Ryhel wrote: > Since device is a thermal sensor it needs '#io-channel-cells' to allow > exposure of thermal data via IIO means. This looks odd. The consumer is also a producer? What in DT would be the 2nd consumer. If you don't have a consumer in the DT, then you don't need '#io-channel-cells'. I would like to see Jonathan's buy in on this. > > Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> > --- > .../devicetree/bindings/thermal/generic-adc-thermal.yaml | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/Documentation/devicetree/bindings/thermal/generic-adc-thermal.yaml b/Documentation/devicetree/bindings/thermal/generic-adc-thermal.yaml > index 12e6418dc24d..4bc2cff0593c 100644 > --- a/Documentation/devicetree/bindings/thermal/generic-adc-thermal.yaml > +++ b/Documentation/devicetree/bindings/thermal/generic-adc-thermal.yaml > @@ -30,6 +30,9 @@ properties: > io-channel-names: > const: sensor-channel > > + '#io-channel-cells': > + const: 1 You have to document what is in the cells. > + > temperature-lookup-table: > description: | > Lookup table to map the relation between ADC value and temperature. > @@ -60,6 +63,7 @@ examples: > #thermal-sensor-cells = <0>; > io-channels = <&ads1015 1>; > io-channel-names = "sensor-channel"; > + #io-channel-cells = <1>; > temperature-lookup-table = < > (-40000) 2578 > (-39000) 2577 > -- > 2.43.0 >
пт, 21 лют. 2025 р. о 23:13 Rob Herring <robh@kernel.org> пише: > > On Wed, Feb 19, 2025 at 10:28:16AM +0200, Svyatoslav Ryhel wrote: > > Since device is a thermal sensor it needs '#io-channel-cells' to allow > > exposure of thermal data via IIO means. > > This looks odd. The consumer is also a producer? What in DT would be the > 2nd consumer. If you don't have a consumer in the DT, then you don't > need '#io-channel-cells'. > No, this binding in general describes converting of iio adc data into thermal data, using device specific conversion table. Resulting thermal data is exposed as thermal sensor cell for thermal zone binding. What I did is that I just exposed thermal data as temp iio channel (processed). Real use case: I own an embedded device which has a dedicated sensor for battery temperature control, but to indicate the temperature is used adc channel of that sensor and adc data is converted using a device specific table into temperature. Basically this fits existing generic-adc-thermal setup to create a thermal zone, but along with all that, the fuel gauge which monitors battery can accept iio temp channel to expose battery temperature. This is what I am adding here. adc sensor > generic-adc-thermal > temp channel > battery gauge > I would like to see Jonathan's buy in on this. > > > > > Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> > > --- > > .../devicetree/bindings/thermal/generic-adc-thermal.yaml | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/Documentation/devicetree/bindings/thermal/generic-adc-thermal.yaml b/Documentation/devicetree/bindings/thermal/generic-adc-thermal.yaml > > index 12e6418dc24d..4bc2cff0593c 100644 > > --- a/Documentation/devicetree/bindings/thermal/generic-adc-thermal.yaml > > +++ b/Documentation/devicetree/bindings/thermal/generic-adc-thermal.yaml > > @@ -30,6 +30,9 @@ properties: > > io-channel-names: > > const: sensor-channel > > > > + '#io-channel-cells': > > + const: 1 > > You have to document what is in the cells. > > > + > > temperature-lookup-table: > > description: | > > Lookup table to map the relation between ADC value and temperature. > > @@ -60,6 +63,7 @@ examples: > > #thermal-sensor-cells = <0>; > > io-channels = <&ads1015 1>; > > io-channel-names = "sensor-channel"; > > + #io-channel-cells = <1>; > > temperature-lookup-table = < > > (-40000) 2578 > > (-39000) 2577 > > -- > > 2.43.0 > >
diff --git a/Documentation/devicetree/bindings/thermal/generic-adc-thermal.yaml b/Documentation/devicetree/bindings/thermal/generic-adc-thermal.yaml index 12e6418dc24d..4bc2cff0593c 100644 --- a/Documentation/devicetree/bindings/thermal/generic-adc-thermal.yaml +++ b/Documentation/devicetree/bindings/thermal/generic-adc-thermal.yaml @@ -30,6 +30,9 @@ properties: io-channel-names: const: sensor-channel + '#io-channel-cells': + const: 1 + temperature-lookup-table: description: | Lookup table to map the relation between ADC value and temperature. @@ -60,6 +63,7 @@ examples: #thermal-sensor-cells = <0>; io-channels = <&ads1015 1>; io-channel-names = "sensor-channel"; + #io-channel-cells = <1>; temperature-lookup-table = < (-40000) 2578 (-39000) 2577
Since device is a thermal sensor it needs '#io-channel-cells' to allow exposure of thermal data via IIO means. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> --- .../devicetree/bindings/thermal/generic-adc-thermal.yaml | 4 ++++ 1 file changed, 4 insertions(+)