1*4882a593Smuzhiyun.. SPDX-License-Identifier: GPL-2.0 2*4882a593Smuzhiyun 3*4882a593SmuzhiyunKernel driver tmp513 4*4882a593Smuzhiyun==================== 5*4882a593Smuzhiyun 6*4882a593SmuzhiyunSupported chips: 7*4882a593Smuzhiyun 8*4882a593Smuzhiyun * Texas Instruments TMP512 9*4882a593Smuzhiyun 10*4882a593Smuzhiyun Prefix: 'tmp512' 11*4882a593Smuzhiyun 12*4882a593Smuzhiyun Datasheet: https://www.ti.com/lit/ds/symlink/tmp512.pdf 13*4882a593Smuzhiyun 14*4882a593Smuzhiyun * Texas Instruments TMP513 15*4882a593Smuzhiyun 16*4882a593Smuzhiyun Prefix: 'tmp513' 17*4882a593Smuzhiyun 18*4882a593Smuzhiyun Datasheet: https://www.ti.com/lit/ds/symlink/tmp513.pdf 19*4882a593Smuzhiyun 20*4882a593SmuzhiyunAuthors: 21*4882a593Smuzhiyun 22*4882a593Smuzhiyun Eric Tremblay <etremblay@distech-controls.com> 23*4882a593Smuzhiyun 24*4882a593SmuzhiyunDescription 25*4882a593Smuzhiyun----------- 26*4882a593Smuzhiyun 27*4882a593SmuzhiyunThis driver implements support for Texas Instruments TMP512, and TMP513. 28*4882a593SmuzhiyunThe TMP512 (dual-channel) and TMP513 (triple-channel) are system monitors 29*4882a593Smuzhiyunthat include remote sensors, a local temperature sensor, and a high-side current 30*4882a593Smuzhiyunshunt monitor. These system monitors have the capability of measuring remote 31*4882a593Smuzhiyuntemperatures, on-chip temperatures, and system voltage/power/current 32*4882a593Smuzhiyunconsumption. 33*4882a593Smuzhiyun 34*4882a593SmuzhiyunThe temperatures are measured in degrees Celsius with a range of 35*4882a593Smuzhiyun-40 to + 125 degrees with a resolution of 0.0625 degree C. 36*4882a593Smuzhiyun 37*4882a593SmuzhiyunFor hysteresis value, only the first channel is writable. Writing to it 38*4882a593Smuzhiyunwill affect all other values since each channels are sharing the same 39*4882a593Smuzhiyunhysteresis value. The hysteresis is in degrees Celsius with a range of 40*4882a593Smuzhiyun0 to 127.5 degrees with a resolution of 0.5 degree. 41*4882a593Smuzhiyun 42*4882a593SmuzhiyunThe driver exports the temperature values via the following sysfs files: 43*4882a593Smuzhiyun 44*4882a593Smuzhiyun**temp[1-4]_input** 45*4882a593Smuzhiyun 46*4882a593Smuzhiyun**temp[1-4]_crit** 47*4882a593Smuzhiyun 48*4882a593Smuzhiyun**temp[1-4]_crit_alarm** 49*4882a593Smuzhiyun 50*4882a593Smuzhiyun**temp[1-4]_crit_hyst** 51*4882a593Smuzhiyun 52*4882a593SmuzhiyunThe driver read the shunt voltage from the chip and convert it to current. 53*4882a593SmuzhiyunThe readable range depends on the "ti,pga-gain" property (default to 8) and the 54*4882a593Smuzhiyunshunt resistor value. The value resolution will be equal to 10uV/Rshunt. 55*4882a593Smuzhiyun 56*4882a593SmuzhiyunThe driver exports the shunt currents values via the following sysFs files: 57*4882a593Smuzhiyun 58*4882a593Smuzhiyun**curr1_input** 59*4882a593Smuzhiyun 60*4882a593Smuzhiyun**curr1_lcrit** 61*4882a593Smuzhiyun 62*4882a593Smuzhiyun**curr1_lcrit_alarm** 63*4882a593Smuzhiyun 64*4882a593Smuzhiyun**curr1_crit** 65*4882a593Smuzhiyun 66*4882a593Smuzhiyun**curr1_crit_alarm** 67*4882a593Smuzhiyun 68*4882a593SmuzhiyunThe bus voltage range is read from the chip with a resolution of 4mV. The chip 69*4882a593Smuzhiyuncan be configurable in two different range (32V or 16V) using the 70*4882a593Smuzhiyunti,bus-range-microvolt property in the devicetree. 71*4882a593Smuzhiyun 72*4882a593SmuzhiyunThe driver exports the bus voltage values via the following sysFs files: 73*4882a593Smuzhiyun 74*4882a593Smuzhiyun**in0_input** 75*4882a593Smuzhiyun 76*4882a593Smuzhiyun**in0_lcrit** 77*4882a593Smuzhiyun 78*4882a593Smuzhiyun**in0_lcrit_alarm** 79*4882a593Smuzhiyun 80*4882a593Smuzhiyun**in0_crit** 81*4882a593Smuzhiyun 82*4882a593Smuzhiyun**in0_crit_alarm** 83*4882a593Smuzhiyun 84*4882a593SmuzhiyunThe bus power and bus currents range and resolution depends on the calibration 85*4882a593Smuzhiyunregister value. Those values are calculate by the hardware using those 86*4882a593Smuzhiyunformulas: 87*4882a593Smuzhiyun 88*4882a593SmuzhiyunCurrent = (ShuntVoltage * CalibrationRegister) / 4096 89*4882a593SmuzhiyunPower = (Current * BusVoltage) / 5000 90*4882a593Smuzhiyun 91*4882a593SmuzhiyunThe driver exports the bus current and bus power values via the following 92*4882a593SmuzhiyunsysFs files: 93*4882a593Smuzhiyun 94*4882a593Smuzhiyun**curr2_input** 95*4882a593Smuzhiyun 96*4882a593Smuzhiyun**power1_input** 97*4882a593Smuzhiyun 98*4882a593Smuzhiyun**power1_crit** 99*4882a593Smuzhiyun 100*4882a593Smuzhiyun**power1_crit_alarm** 101*4882a593Smuzhiyun 102*4882a593SmuzhiyunThe calibration process follow the procedure of the datasheet (without overflow) 103*4882a593Smuzhiyunand depend on the shunt resistor value and the pga_gain value. 104