^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) General Purpose Analog To Digital Converter (ADC) based thermal sensor.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) On some of platforms, thermal sensor like thermistors are connected to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) one of ADC channel and sensor resistance is read via voltage across the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) sensor resistor. The voltage read across the sensor is mapped to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) temperature using voltage-temperature lookup table.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) Required properties:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) ===================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) - compatible: Must be "generic-adc-thermal".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) - #thermal-sensor-cells: Should be 1. See Documentation/devicetree/bindings/thermal/thermal-sensor.yaml for a description
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) of this property.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) Optional properties:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) ===================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) - temperature-lookup-table: Two dimensional array of Integer; lookup table
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) to map the relation between ADC value and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) temperature. When ADC is read, the value is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) looked up on the table to get the equivalent
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) temperature.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) The first value of the each row of array is the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) temperature in milliCelsius and second value of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) the each row of array is the ADC read value.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) If not specified, driver assumes the ADC channel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) gives milliCelsius directly.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) Example :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #include <dt-bindings/thermal/thermal.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) i2c@7000c400 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) ads1015: ads1015@4a {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) reg = <0x4a>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) compatible = "ads1015";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) sampling-frequency = <3300>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #io-channel-cells = <1>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) tboard_thermistor: thermal-sensor {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) compatible = "generic-adc-thermal";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) #thermal-sensor-cells = <0>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) io-channels = <&ads1015 1>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) io-channel-names = "sensor-channel";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) temperature-lookup-table = < (-40000) 2578
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) (-39000) 2577
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) (-38000) 2576
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) (-37000) 2575
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) (-36000) 2574
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) (-35000) 2573
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) (-34000) 2572
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) (-33000) 2571
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) (-32000) 2569
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) (-31000) 2568
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) (-30000) 2567
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) ::::::::::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 118000 254
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 119000 247
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 120000 240
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 121000 233
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 122000 226
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 123000 220
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 124000 214
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 125000 208>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) dummy_cool_dev: dummy-cool-dev {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) compatible = "dummy-cooling-dev";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) #cooling-cells = <2>; /* min followed by max */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) thermal-zones {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) Tboard {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) polling-delay = <15000>; /* milliseconds */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) polling-delay-passive = <0>; /* milliseconds */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) thermal-sensors = <&tboard_thermistor>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) trips {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) therm_est_trip: therm_est_trip {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) temperature = <40000>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) type = "active";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) hysteresis = <1000>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) cooling-maps {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) map0 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) trip = <&therm_est_trip>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) cooling-device = <&dummy_cool_dev THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) contribution = <100>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) };