1*54b15c59SMarius Cristea.. SPDX-License-Identifier: GPL-2.0-or-later 2*54b15c59SMarius Cristea 3*54b15c59SMarius CristeaKernel driver emc1812 4*54b15c59SMarius Cristea===================== 5*54b15c59SMarius Cristea 6*54b15c59SMarius CristeaSupported chips: 7*54b15c59SMarius Cristea 8*54b15c59SMarius Cristea * Microchip EMC1812, EMC1813, EMC1814, EMC1815, EMC1833 9*54b15c59SMarius Cristea 10*54b15c59SMarius Cristea Prefix: 'emc1812' 11*54b15c59SMarius Cristea 12*54b15c59SMarius Cristea Datasheets: 13*54b15c59SMarius Cristea 14*54b15c59SMarius Cristea - https://ww1.microchip.com/downloads/aemDocuments/documents/MSLD/ProductDocuments/DataSheets/EMC1812-3-4-5-33-Data-Sheet-DS20005751.pdf 15*54b15c59SMarius Cristea 16*54b15c59SMarius CristeaAuthor: 17*54b15c59SMarius Cristea Marius Cristea <marius.cristea@microchip.com> 18*54b15c59SMarius Cristea 19*54b15c59SMarius Cristea 20*54b15c59SMarius CristeaDescription 21*54b15c59SMarius Cristea----------- 22*54b15c59SMarius Cristea 23*54b15c59SMarius CristeaThe Microchip EMC181x/33 chips contain up to 4 remote temperature sensors 24*54b15c59SMarius Cristeaand one internal. 25*54b15c59SMarius Cristea- The EMC1812 is a single channel remote temperature sensor. 26*54b15c59SMarius Cristea- The EMC1813 and EMC1833 are dual channel remote temperature sensor. The 27*54b15c59SMarius Cristearemote channels for this selection of devices can support substrate diodes, 28*54b15c59SMarius Cristeadiscrete diode-connected transistors or CPU/GPU thermal diodes. 29*54b15c59SMarius Cristea- The EMC1814 is a three channel remote temperature sensor that supports 30*54b15c59SMarius CristeaAnti-Parallel Diode (APD) only on one channel. For the channel that does not 31*54b15c59SMarius Cristeasupport APD functionality, substrate diodes, discrete diode-connected 32*54b15c59SMarius Cristeatransistors or CPU/GPU thermal diodes are supported. For the channel that 33*54b15c59SMarius Cristeasupports APD, only discrete diode-connected transistors may be implemented. 34*54b15c59SMarius CristeaHowever, if APD is disabled on the EMC1814, then the channel that supports 35*54b15c59SMarius CristeaAPD will be functional with substrate diodes, discrete diode-connected 36*54b15c59SMarius Cristeatransistors and CPU/GPU thermal diodes. 37*54b15c59SMarius Cristea- The EMC1815 is a four channel remote temperature sensor. 38*54b15c59SMarius Cristea 39*54b15c59SMarius CristeaThe EMC1815 and EMC1833 support APD on all channels. When APD is enabled, 40*54b15c59SMarius Cristeathe channels support only diode-connected transistors. If APD is disabled, 41*54b15c59SMarius Cristeathen the channels will support substrate transistors, discrete diode-connected 42*54b15c59SMarius Cristeatransistors and CPU/GPU thermal diodes. 43*54b15c59SMarius Cristea 44*54b15c59SMarius CristeaNote: Disabling APD functionality to implement substrate diodes on devices 45*54b15c59SMarius Cristeathat support APD eliminates the benefit of APD (two diodes on one channel). 46*54b15c59SMarius Cristea 47*54b15c59SMarius CristeaThe chips implement three limits for each sensor: low (tempX_min), high 48*54b15c59SMarius Cristea(tempX_max) and critical (tempX_crit). The chips also implement an 49*54b15c59SMarius Cristeahysteresis mechanism which applies to all limits. The relative difference 50*54b15c59SMarius Cristeais stored in a single register on the chip, which means that the relative 51*54b15c59SMarius Cristeadifference between the limit and its hysteresis is always the same for 52*54b15c59SMarius Cristeaall three limits. 53*54b15c59SMarius Cristea 54*54b15c59SMarius CristeaThis implementation detail implies the following: 55*54b15c59SMarius Cristea 56*54b15c59SMarius Cristea* When setting a limit, its hysteresis will automatically follow, the 57*54b15c59SMarius Cristea difference staying unchanged. For example, if the old critical limit was 58*54b15c59SMarius Cristea 80 degrees C, and the hysteresis was 75 degrees C, and you change the 59*54b15c59SMarius Cristea critical limit to 90 degrees C, then the hysteresis will automatically 60*54b15c59SMarius Cristea change to 85 degrees C. 61*54b15c59SMarius Cristea* The hysteresis values can't be set independently. We decided to make 62*54b15c59SMarius Cristea only tempX_crit_hyst writable, while all other hysteresis attributes 63*54b15c59SMarius Cristea are read-only. Setting tempX_crit_hyst writes the difference between 64*54b15c59SMarius Cristea tempX_crit_hyst and tempX_crit into the chip, and the same relative 65*54b15c59SMarius Cristea hysteresis applies automatically to all other limits. 66*54b15c59SMarius Cristea* The limits should be set before the hysteresis. At power up the device 67*54b15c59SMarius Cristea starts with 10 degree hysteresis. 68