sysfs-interface 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. Naming and data format standards for sysfs files
  2. ------------------------------------------------
  3. The libsensors library offers an interface to the raw sensors data
  4. through the sysfs interface. See libsensors documentation and source for
  5. more further information. As of writing this document, libsensors
  6. (from lm_sensors 2.8.3) is heavily chip-dependant. Adding or updating
  7. support for any given chip requires modifying the library's code.
  8. This is because libsensors was written for the procfs interface
  9. older kernel modules were using, which wasn't standardized enough.
  10. Recent versions of libsensors (from lm_sensors 2.8.2 and later) have
  11. support for the sysfs interface, though.
  12. The new sysfs interface was designed to be as chip-independant as
  13. possible.
  14. Note that motherboards vary widely in the connections to sensor chips.
  15. There is no standard that ensures, for example, that the second
  16. temperature sensor is connected to the CPU, or that the second fan is on
  17. the CPU. Also, some values reported by the chips need some computation
  18. before they make full sense. For example, most chips can only measure
  19. voltages between 0 and +4V. Other voltages are scaled back into that
  20. range using external resistors. Since the values of these resistors
  21. can change from motherboard to motherboard, the conversions cannot be
  22. hard coded into the driver and have to be done in user space.
  23. For this reason, even if we aim at a chip-independant libsensors, it will
  24. still require a configuration file (e.g. /etc/sensors.conf) for proper
  25. values conversion, labeling of inputs and hiding of unused inputs.
  26. An alternative method that some programs use is to access the sysfs
  27. files directly. This document briefly describes the standards that the
  28. drivers follow, so that an application program can scan for entries and
  29. access this data in a simple and consistent way. That said, such programs
  30. will have to implement conversion, labeling and hiding of inputs. For
  31. this reason, it is still not recommended to bypass the library.
  32. If you are developing a userspace application please send us feedback on
  33. this standard.
  34. Note that this standard isn't completely established yet, so it is subject
  35. to changes, even important ones. One more reason to use the library instead
  36. of accessing sysfs files directly.
  37. Each chip gets its own directory in the sysfs /sys/devices tree. To
  38. find all sensor chips, it is easier to follow the symlinks from
  39. /sys/i2c/devices/
  40. All sysfs values are fixed point numbers. To get the true value of some
  41. of the values, you should divide by the specified value.
  42. There is only one value per file, unlike the older /proc specification.
  43. The common scheme for files naming is: <type><number>_<item>. Usual
  44. types for sensor chips are "in" (voltage), "temp" (temperature) and
  45. "fan" (fan). Usual items are "input" (measured value), "max" (high
  46. threshold, "min" (low threshold). Numbering usually starts from 1,
  47. except for voltages which start from 0 (because most data sheets use
  48. this). A number is always used for elements that can be present more
  49. than once, even if there is a single element of the given type on the
  50. specific chip. Other files do not refer to a specific element, so
  51. they have a simple name, and no number.
  52. Alarms are direct indications read from the chips. The drivers do NOT
  53. make comparisons of readings to thresholds. This allows violations
  54. between readings to be caught and alarmed. The exact definition of an
  55. alarm (for example, whether a threshold must be met or must be exceeded
  56. to cause an alarm) is chip-dependent.
  57. -------------------------------------------------------------------------
  58. [0-*] denotes any positive number starting from 0
  59. [1-*] denotes any positive number starting from 1
  60. RO read only value
  61. RW read/write value
  62. Read/write values may be read-only for some chips, depending on the
  63. hardware implementation.
  64. ************
  65. * Voltages *
  66. ************
  67. in[0-*]_min Voltage min value.
  68. Unit: millivolt
  69. RW
  70. in[0-*]_max Voltage max value.
  71. Unit: millivolt
  72. RW
  73. in[0-*]_input Voltage input value.
  74. Unit: millivolt
  75. RO
  76. Voltage measured on the chip pin.
  77. Actual voltage depends on the scaling resistors on the
  78. motherboard, as recommended in the chip datasheet.
  79. This varies by chip and by motherboard.
  80. Because of this variation, values are generally NOT scaled
  81. by the chip driver, and must be done by the application.
  82. However, some drivers (notably lm87 and via686a)
  83. do scale, because of internal resistors built into a chip.
  84. These drivers will output the actual voltage.
  85. Typical usage:
  86. in0_* CPU #1 voltage (not scaled)
  87. in1_* CPU #2 voltage (not scaled)
  88. in2_* 3.3V nominal (not scaled)
  89. in3_* 5.0V nominal (scaled)
  90. in4_* 12.0V nominal (scaled)
  91. in5_* -12.0V nominal (scaled)
  92. in6_* -5.0V nominal (scaled)
  93. in7_* varies
  94. in8_* varies
  95. cpu[0-*]_vid CPU core reference voltage.
  96. Unit: millivolt
  97. RO
  98. Not always correct.
  99. vrm Voltage Regulator Module version number.
  100. RW (but changing it should no more be necessary)
  101. Originally the VRM standard version multiplied by 10, but now
  102. an arbitrary number, as not all standards have a version
  103. number.
  104. Affects the way the driver calculates the CPU core reference
  105. voltage from the vid pins.
  106. Also see the Alarms section for status flags associated with voltages.
  107. ********
  108. * Fans *
  109. ********
  110. fan[1-*]_min Fan minimum value
  111. Unit: revolution/min (RPM)
  112. RW
  113. fan[1-*]_input Fan input value.
  114. Unit: revolution/min (RPM)
  115. RO
  116. fan[1-*]_div Fan divisor.
  117. Integer value in powers of two (1, 2, 4, 8, 16, 32, 64, 128).
  118. RW
  119. Some chips only support values 1, 2, 4 and 8.
  120. Note that this is actually an internal clock divisor, which
  121. affects the measurable speed range, not the read value.
  122. Also see the Alarms section for status flags associated with fans.
  123. *******
  124. * PWM *
  125. *******
  126. pwm[1-*] Pulse width modulation fan control.
  127. Integer value in the range 0 to 255
  128. RW
  129. 255 is max or 100%.
  130. pwm[1-*]_enable
  131. Switch PWM on and off.
  132. Not always present even if fan*_pwm is.
  133. 0: turn off
  134. 1: turn on in manual mode
  135. 2+: turn on in automatic mode
  136. Check individual chip documentation files for automatic mode details.
  137. RW
  138. pwm[1-*]_mode
  139. 0: DC mode
  140. 1: PWM mode
  141. RW
  142. pwm[1-*]_auto_channels_temp
  143. Select which temperature channels affect this PWM output in
  144. auto mode. Bitfield, 1 is temp1, 2 is temp2, 4 is temp3 etc...
  145. Which values are possible depend on the chip used.
  146. RW
  147. pwm[1-*]_auto_point[1-*]_pwm
  148. pwm[1-*]_auto_point[1-*]_temp
  149. pwm[1-*]_auto_point[1-*]_temp_hyst
  150. Define the PWM vs temperature curve. Number of trip points is
  151. chip-dependent. Use this for chips which associate trip points
  152. to PWM output channels.
  153. RW
  154. OR
  155. temp[1-*]_auto_point[1-*]_pwm
  156. temp[1-*]_auto_point[1-*]_temp
  157. temp[1-*]_auto_point[1-*]_temp_hyst
  158. Define the PWM vs temperature curve. Number of trip points is
  159. chip-dependent. Use this for chips which associate trip points
  160. to temperature channels.
  161. RW
  162. ****************
  163. * Temperatures *
  164. ****************
  165. temp[1-*]_type Sensor type selection.
  166. Integers 1 to 4 or thermistor Beta value (typically 3435)
  167. RW
  168. 1: PII/Celeron Diode
  169. 2: 3904 transistor
  170. 3: thermal diode
  171. 4: thermistor (default/unknown Beta)
  172. Not all types are supported by all chips
  173. temp[1-*]_max Temperature max value.
  174. Unit: millidegree Celcius
  175. RW
  176. temp[1-*]_min Temperature min value.
  177. Unit: millidegree Celcius
  178. RW
  179. temp[1-*]_max_hyst
  180. Temperature hysteresis value for max limit.
  181. Unit: millidegree Celcius
  182. Must be reported as an absolute temperature, NOT a delta
  183. from the max value.
  184. RW
  185. temp[1-*]_input Temperature input value.
  186. Unit: millidegree Celcius
  187. RO
  188. temp[1-*]_crit Temperature critical value, typically greater than
  189. corresponding temp_max values.
  190. Unit: millidegree Celcius
  191. RW
  192. temp[1-*]_crit_hyst
  193. Temperature hysteresis value for critical limit.
  194. Unit: millidegree Celcius
  195. Must be reported as an absolute temperature, NOT a delta
  196. from the critical value.
  197. RW
  198. temp[1-4]_offset
  199. Temperature offset which is added to the temperature reading
  200. by the chip.
  201. Unit: millidegree Celsius
  202. Read/Write value.
  203. If there are multiple temperature sensors, temp1_* is
  204. generally the sensor inside the chip itself,
  205. reported as "motherboard temperature". temp2_* to
  206. temp4_* are generally sensors external to the chip
  207. itself, for example the thermal diode inside the CPU or
  208. a thermistor nearby.
  209. Also see the Alarms section for status flags associated with temperatures.
  210. ************
  211. * Currents *
  212. ************
  213. Note that no known chip provides current measurements as of writing,
  214. so this part is theoretical, so to say.
  215. curr[1-*]_max Current max value
  216. Unit: milliampere
  217. RW
  218. curr[1-*]_min Current min value.
  219. Unit: milliampere
  220. RW
  221. curr[1-*]_input Current input value
  222. Unit: milliampere
  223. RO
  224. **********
  225. * Alarms *
  226. **********
  227. Each channel or limit may have an associated alarm file, containing a
  228. boolean value. 1 means than an alarm condition exists, 0 means no alarm.
  229. Usually a given chip will either use channel-related alarms, or
  230. limit-related alarms, not both. The driver should just reflect the hardware
  231. implementation.
  232. in[0-*]_alarm
  233. fan[1-*]_alarm
  234. temp[1-*]_alarm
  235. Channel alarm
  236. 0: no alarm
  237. 1: alarm
  238. RO
  239. OR
  240. in[0-*]_min_alarm
  241. in[0-*]_max_alarm
  242. fan[1-*]_min_alarm
  243. temp[1-*]_min_alarm
  244. temp[1-*]_max_alarm
  245. temp[1-*]_crit_alarm
  246. Limit alarm
  247. 0: no alarm
  248. 1: alarm
  249. RO
  250. Each input channel may have an associated fault file. This can be used
  251. to notify open diodes, unconnected fans etc. where the hardware
  252. supports it. When this boolean has value 1, the measurement for that
  253. channel should not be trusted.
  254. in[0-*]_input_fault
  255. fan[1-*]_input_fault
  256. temp[1-*]_input_fault
  257. Input fault condition
  258. 0: no fault occured
  259. 1: fault condition
  260. RO
  261. Some chips also offer the possibility to get beeped when an alarm occurs:
  262. beep_enable Master beep enable
  263. 0: no beeps
  264. 1: beeps
  265. RW
  266. in[0-*]_beep
  267. fan[1-*]_beep
  268. temp[1-*]_beep
  269. Channel beep
  270. 0: disable
  271. 1: enable
  272. RW
  273. In theory, a chip could provide per-limit beep masking, but no such chip
  274. was seen so far.
  275. Old drivers provided a different, non-standard interface to alarms and
  276. beeps. These interface files are deprecated, but will be kept around
  277. for compatibility reasons:
  278. alarms Alarm bitmask.
  279. RO
  280. Integer representation of one to four bytes.
  281. A '1' bit means an alarm.
  282. Chips should be programmed for 'comparator' mode so that
  283. the alarm will 'come back' after you read the register
  284. if it is still valid.
  285. Generally a direct representation of a chip's internal
  286. alarm registers; there is no standard for the position
  287. of individual bits. For this reason, the use of this
  288. interface file for new drivers is discouraged. Use
  289. individual *_alarm and *_fault files instead.
  290. Bits are defined in kernel/include/sensors.h.
  291. beep_mask Bitmask for beep.
  292. Same format as 'alarms' with the same bit locations,
  293. use discouraged for the same reason. Use individual
  294. *_beep files instead.
  295. RW
  296. *********
  297. * Other *
  298. *********
  299. eeprom Raw EEPROM data in binary form.
  300. RO
  301. pec Enable or disable PEC (SMBus only)
  302. 0: disable
  303. 1: enable
  304. RW