Back to home page

OSCL-LXR

 
 

    


0001 General Purpose Analog To Digital Converter (ADC) based thermal sensor.
0002 
0003 On some of platforms, thermal sensor like thermistors are connected to
0004 one of ADC channel and sensor resistance is read via voltage across the
0005 sensor resistor. The voltage read across the sensor is mapped to
0006 temperature using voltage-temperature lookup table.
0007 
0008 Required properties:
0009 ===================
0010 - compatible:                Must be "generic-adc-thermal".
0011 - #thermal-sensor-cells:     Should be 1. See Documentation/devicetree/bindings/thermal/thermal-sensor.yaml for a description
0012                              of this property.
0013 Optional properties:
0014 ===================
0015 - temperature-lookup-table:  Two dimensional array of Integer; lookup table
0016                              to map the relation between ADC value and
0017                              temperature. When ADC is read, the value is
0018                              looked up on the table to get the equivalent
0019                              temperature.
0020 
0021                              The first value of the each row of array is the
0022                              temperature in milliCelsius and second value of
0023                              the each row of array is the ADC read value.
0024 
0025                              If not specified, driver assumes the ADC channel
0026                              gives milliCelsius directly.
0027 
0028 Example :
0029 #include <dt-bindings/thermal/thermal.h>
0030 
0031 i2c@7000c400 {
0032         ads1015: ads1015@4a {
0033                 reg = <0x4a>;
0034                 compatible = "ads1015";
0035                 sampling-frequency = <3300>;
0036                 #io-channel-cells = <1>;
0037         };
0038 };
0039 
0040 tboard_thermistor: thermal-sensor {
0041         compatible = "generic-adc-thermal";
0042         #thermal-sensor-cells = <0>;
0043         io-channels = <&ads1015 1>;
0044         io-channel-names = "sensor-channel";
0045         temperature-lookup-table = <    (-40000) 2578
0046                                         (-39000) 2577
0047                                         (-38000) 2576
0048                                         (-37000) 2575
0049                                         (-36000) 2574
0050                                         (-35000) 2573
0051                                         (-34000) 2572
0052                                         (-33000) 2571
0053                                         (-32000) 2569
0054                                         (-31000) 2568
0055                                         (-30000) 2567
0056                                         ::::::::::
0057                                         118000 254
0058                                         119000 247
0059                                         120000 240
0060                                         121000 233
0061                                         122000 226
0062                                         123000 220
0063                                         124000 214
0064                                         125000 208>;
0065 };
0066 
0067 dummy_cool_dev: dummy-cool-dev {
0068         compatible = "dummy-cooling-dev";
0069         #cooling-cells = <2>; /* min followed by max */
0070 };
0071 
0072 thermal-zones {
0073         Tboard {
0074                 polling-delay = <15000>; /* milliseconds */
0075                 polling-delay-passive = <0>; /* milliseconds */
0076                 thermal-sensors = <&tboard_thermistor>;
0077 
0078                 trips {
0079                         therm_est_trip: therm_est_trip {
0080                                 temperature = <40000>;
0081                                 type = "active";
0082                                 hysteresis = <1000>;
0083                         };
0084                 };
0085 
0086                 cooling-maps {
0087                         map0 {
0088                                 trip = <&therm_est_trip>;
0089                                 cooling-device = <&dummy_cool_dev THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
0090                                 contribution = <100>;
0091                         };
0092 
0093                 };
0094         };
0095 };