1Naming and data format standards for sysfs files
2================================================
3
4The libsensors library offers an interface to the raw sensors data
5through the sysfs interface. Since lm-sensors 3.0.0, libsensors is
6completely chip-independent. It assumes that all the kernel drivers
7implement the standard sysfs interface described in this document.
8This makes adding or updating support for any given chip very easy, as
9libsensors, and applications using it, do not need to be modified.
10This is a major improvement compared to lm-sensors 2.
11
12Note that motherboards vary widely in the connections to sensor chips.
13There is no standard that ensures, for example, that the second
14temperature sensor is connected to the CPU, or that the second fan is on
15the CPU. Also, some values reported by the chips need some computation
16before they make full sense. For example, most chips can only measure
17voltages between 0 and +4V. Other voltages are scaled back into that
18range using external resistors. Since the values of these resistors
19can change from motherboard to motherboard, the conversions cannot be
20hard coded into the driver and have to be done in user space.
21
22For this reason, even if we aim at a chip-independent libsensors, it will
23still require a configuration file (e.g. /etc/sensors.conf) for proper
24values conversion, labeling of inputs and hiding of unused inputs.
25
26An alternative method that some programs use is to access the sysfs
27files directly. This document briefly describes the standards that the
28drivers follow, so that an application program can scan for entries and
29access this data in a simple and consistent way. That said, such programs
30will have to implement conversion, labeling and hiding of inputs. For
31this reason, it is still not recommended to bypass the library.
32
33Each chip gets its own directory in the sysfs /sys/devices tree.  To
34find all sensor chips, it is easier to follow the device symlinks from
35`/sys/class/hwmon/hwmon*`.
36
37Up to lm-sensors 3.0.0, libsensors looks for hardware monitoring attributes
38in the "physical" device directory. Since lm-sensors 3.0.1, attributes found
39in the hwmon "class" device directory are also supported. Complex drivers
40(e.g. drivers for multifunction chips) may want to use this possibility to
41avoid namespace pollution. The only drawback will be that older versions of
42libsensors won't support the driver in question.
43
44All sysfs values are fixed point numbers.
45
46There is only one value per file, unlike the older /proc specification.
47The common scheme for files naming is: <type><number>_<item>. Usual
48types for sensor chips are "in" (voltage), "temp" (temperature) and
49"fan" (fan). Usual items are "input" (measured value), "max" (high
50threshold, "min" (low threshold). Numbering usually starts from 1,
51except for voltages which start from 0 (because most data sheets use
52this). A number is always used for elements that can be present more
53than once, even if there is a single element of the given type on the
54specific chip. Other files do not refer to a specific element, so
55they have a simple name, and no number.
56
57Alarms are direct indications read from the chips. The drivers do NOT
58make comparisons of readings to thresholds. This allows violations
59between readings to be caught and alarmed. The exact definition of an
60alarm (for example, whether a threshold must be met or must be exceeded
61to cause an alarm) is chip-dependent.
62
63When setting values of hwmon sysfs attributes, the string representation of
64the desired value must be written, note that strings which are not a number
65are interpreted as 0! For more on how written strings are interpreted see the
66"sysfs attribute writes interpretation" section at the end of this file.
67
68Attribute access
69----------------
70
71Hardware monitoring sysfs attributes are displayed by unrestricted userspace
72applications. For this reason, all standard ABI attributes shall be world
73readable. Writeable standard ABI attributes shall be writeable only for
74privileged users.
75
76-------------------------------------------------------------------------
77
78======= ===========================================
79`[0-*]`	denotes any positive number starting from 0
80`[1-*]`	denotes any positive number starting from 1
81RO	read only value
82WO	write only value
83RW	read/write value
84======= ===========================================
85
86Read/write values may be read-only for some chips, depending on the
87hardware implementation.
88
89All entries (except name) are optional, and should only be created in a
90given driver if the chip has the feature.
91
92
93*****************
94Global attributes
95*****************
96
97`name`
98		The chip name.
99		This should be a short, lowercase string, not containing
100		whitespace, dashes, or the wildcard character '*'.
101		This attribute represents the chip name. It is the only
102		mandatory attribute.
103		I2C devices get this attribute created automatically.
104
105		RO
106
107`update_interval`
108		The interval at which the chip will update readings.
109		Unit: millisecond
110
111		RW
112
113		Some devices have a variable update rate or interval.
114		This attribute can be used to change it to the desired value.
115
116
117********
118Voltages
119********
120
121`in[0-*]_min`
122		Voltage min value.
123
124		Unit: millivolt
125
126		RW
127
128`in[0-*]_lcrit`
129		Voltage critical min value.
130
131		Unit: millivolt
132
133		RW
134
135		If voltage drops to or below this limit, the system may
136		take drastic action such as power down or reset. At the very
137		least, it should report a fault.
138
139`in[0-*]_max`
140		Voltage max value.
141
142		Unit: millivolt
143
144		RW
145
146`in[0-*]_crit`
147		Voltage critical max value.
148
149		Unit: millivolt
150
151		RW
152
153		If voltage reaches or exceeds this limit, the system may
154		take drastic action such as power down or reset. At the very
155		least, it should report a fault.
156
157`in[0-*]_input`
158		Voltage input value.
159
160		Unit: millivolt
161
162		RO
163
164		Voltage measured on the chip pin.
165
166		Actual voltage depends on the scaling resistors on the
167		motherboard, as recommended in the chip datasheet.
168
169		This varies by chip and by motherboard.
170		Because of this variation, values are generally NOT scaled
171		by the chip driver, and must be done by the application.
172		However, some drivers (notably lm87 and via686a)
173		do scale, because of internal resistors built into a chip.
174		These drivers will output the actual voltage. Rule of
175		thumb: drivers should report the voltage values at the
176		"pins" of the chip.
177
178`in[0-*]_average`
179		Average voltage
180
181		Unit: millivolt
182
183		RO
184
185`in[0-*]_lowest`
186		Historical minimum voltage
187
188		Unit: millivolt
189
190		RO
191
192`in[0-*]_highest`
193		Historical maximum voltage
194
195		Unit: millivolt
196
197		RO
198
199`in[0-*]_reset_history`
200		Reset inX_lowest and inX_highest
201
202		WO
203
204`in_reset_history`
205		Reset inX_lowest and inX_highest for all sensors
206
207		WO
208
209`in[0-*]_label`
210		Suggested voltage channel label.
211
212		Text string
213
214		Should only be created if the driver has hints about what
215		this voltage channel is being used for, and user-space
216		doesn't. In all other cases, the label is provided by
217		user-space.
218
219		RO
220
221`in[0-*]_enable`
222		Enable or disable the sensors.
223
224		When disabled the sensor read will return -ENODATA.
225
226		- 1: Enable
227		- 0: Disable
228
229		RW
230
231`cpu[0-*]_vid`
232		CPU core reference voltage.
233
234		Unit: millivolt
235
236		RO
237
238		Not always correct.
239
240`vrm`
241		Voltage Regulator Module version number.
242
243		RW (but changing it should no more be necessary)
244
245		Originally the VRM standard version multiplied by 10, but now
246		an arbitrary number, as not all standards have a version
247		number.
248
249		Affects the way the driver calculates the CPU core reference
250		voltage from the vid pins.
251
252`in[0-*]_rated_min`
253		Minimum rated voltage.
254
255		Unit: millivolt
256
257		RO
258
259`in[0-*]_rated_max`
260		Maximum rated voltage.
261
262		Unit: millivolt
263
264		RO
265
266Also see the Alarms section for status flags associated with voltages.
267
268
269****
270Fans
271****
272
273`fan[1-*]_min`
274		Fan minimum value
275
276		Unit: revolution/min (RPM)
277
278		RW
279
280`fan[1-*]_max`
281		Fan maximum value
282
283		Unit: revolution/min (RPM)
284
285		Only rarely supported by the hardware.
286		RW
287
288`fan[1-*]_input`
289		Fan input value.
290
291		Unit: revolution/min (RPM)
292
293		RO
294
295`fan[1-*]_div`
296		Fan divisor.
297
298		Integer value in powers of two (1, 2, 4, 8, 16, 32, 64, 128).
299
300		RW
301
302		Some chips only support values 1, 2, 4 and 8.
303		Note that this is actually an internal clock divisor, which
304		affects the measurable speed range, not the read value.
305
306`fan[1-*]_pulses`
307		Number of tachometer pulses per fan revolution.
308
309		Integer value, typically between 1 and 4.
310
311		RW
312
313		This value is a characteristic of the fan connected to the
314		device's input, so it has to be set in accordance with the fan
315		model.
316
317		Should only be created if the chip has a register to configure
318		the number of pulses. In the absence of such a register (and
319		thus attribute) the value assumed by all devices is 2 pulses
320		per fan revolution.
321
322`fan[1-*]_target`
323		Desired fan speed
324
325		Unit: revolution/min (RPM)
326
327		RW
328
329		Only makes sense if the chip supports closed-loop fan speed
330		control based on the measured fan speed.
331
332`fan[1-*]_label`
333		Suggested fan channel label.
334
335		Text string
336
337		Should only be created if the driver has hints about what
338		this fan channel is being used for, and user-space doesn't.
339		In all other cases, the label is provided by user-space.
340
341		RO
342
343`fan[1-*]_enable`
344		Enable or disable the sensors.
345
346		When disabled the sensor read will return -ENODATA.
347
348		- 1: Enable
349		- 0: Disable
350
351		RW
352
353Also see the Alarms section for status flags associated with fans.
354
355
356***
357PWM
358***
359
360`pwm[1-*]`
361		Pulse width modulation fan control.
362
363		Integer value in the range 0 to 255
364
365		RW
366
367		255 is max or 100%.
368
369`pwm[1-*]_enable`
370		Fan speed control method:
371
372		- 0: no fan speed control (i.e. fan at full speed)
373		- 1: manual fan speed control enabled (using `pwm[1-*]`)
374		- 2+: automatic fan speed control enabled
375
376		Check individual chip documentation files for automatic mode
377		details.
378
379		RW
380
381`pwm[1-*]_mode`
382		- 0: DC mode (direct current)
383		- 1: PWM mode (pulse-width modulation)
384
385		RW
386
387`pwm[1-*]_freq`
388		Base PWM frequency in Hz.
389
390		Only possibly available when pwmN_mode is PWM, but not always
391		present even then.
392
393		RW
394
395`pwm[1-*]_auto_channels_temp`
396		Select which temperature channels affect this PWM output in
397		auto mode.
398
399		Bitfield, 1 is temp1, 2 is temp2, 4 is temp3 etc...
400		Which values are possible depend on the chip used.
401
402		RW
403
404`pwm[1-*]_auto_point[1-*]_pwm` / `pwm[1-*]_auto_point[1-*]_temp` / `pwm[1-*]_auto_point[1-*]_temp_hyst`
405		Define the PWM vs temperature curve.
406
407		Number of trip points is chip-dependent. Use this for chips
408		which associate trip points to PWM output channels.
409
410		RW
411
412`temp[1-*]_auto_point[1-*]_pwm` / `temp[1-*]_auto_point[1-*]_temp` / `temp[1-*]_auto_point[1-*]_temp_hyst`
413		Define the PWM vs temperature curve.
414
415		Number of trip points is chip-dependent. Use this for chips
416		which associate trip points to temperature channels.
417
418		RW
419
420There is a third case where trip points are associated to both PWM output
421channels and temperature channels: the PWM values are associated to PWM
422output channels while the temperature values are associated to temperature
423channels. In that case, the result is determined by the mapping between
424temperature inputs and PWM outputs. When several temperature inputs are
425mapped to a given PWM output, this leads to several candidate PWM values.
426The actual result is up to the chip, but in general the highest candidate
427value (fastest fan speed) wins.
428
429
430************
431Temperatures
432************
433
434`temp[1-*]_type`
435		Sensor type selection.
436
437		Integers 1 to 6
438
439		RW
440
441		- 1: CPU embedded diode
442		- 2: 3904 transistor
443		- 3: thermal diode
444		- 4: thermistor
445		- 5: AMD AMDSI
446		- 6: Intel PECI
447
448		Not all types are supported by all chips
449
450`temp[1-*]_max`
451		Temperature max value.
452
453		Unit: millidegree Celsius (or millivolt, see below)
454
455		RW
456
457`temp[1-*]_min`
458		Temperature min value.
459
460		Unit: millidegree Celsius
461
462		RW
463
464`temp[1-*]_max_hyst`
465		Temperature hysteresis value for max limit.
466
467		Unit: millidegree Celsius
468
469		Must be reported as an absolute temperature, NOT a delta
470		from the max value.
471
472		RW
473
474`temp[1-*]_min_hyst`
475		Temperature hysteresis value for min limit.
476		Unit: millidegree Celsius
477
478		Must be reported as an absolute temperature, NOT a delta
479		from the min value.
480
481		RW
482
483`temp[1-*]_input`
484	 Temperature input value.
485
486		Unit: millidegree Celsius
487
488		RO
489
490`temp[1-*]_crit`
491		Temperature critical max value, typically greater than
492		corresponding temp_max values.
493
494		Unit: millidegree Celsius
495
496		RW
497
498`temp[1-*]_crit_hyst`
499		Temperature hysteresis value for critical limit.
500
501		Unit: millidegree Celsius
502
503		Must be reported as an absolute temperature, NOT a delta
504		from the critical value.
505
506		RW
507
508`temp[1-*]_emergency`
509		Temperature emergency max value, for chips supporting more than
510		two upper temperature limits. Must be equal or greater than
511		corresponding temp_crit values.
512
513		Unit: millidegree Celsius
514
515		RW
516
517`temp[1-*]_emergency_hyst`
518		Temperature hysteresis value for emergency limit.
519
520		Unit: millidegree Celsius
521
522		Must be reported as an absolute temperature, NOT a delta
523		from the emergency value.
524
525		RW
526
527`temp[1-*]_lcrit`
528		Temperature critical min value, typically lower than
529		corresponding temp_min values.
530
531		Unit: millidegree Celsius
532
533		RW
534
535`temp[1-*]_lcrit_hyst`
536		Temperature hysteresis value for critical min limit.
537
538		Unit: millidegree Celsius
539
540		Must be reported as an absolute temperature, NOT a delta
541		from the critical min value.
542
543		RW
544
545`temp[1-*]_offset`
546		Temperature offset which is added to the temperature reading
547		by the chip.
548
549		Unit: millidegree Celsius
550
551		Read/Write value.
552
553`temp[1-*]_label`
554		Suggested temperature channel label.
555
556		Text string
557
558		Should only be created if the driver has hints about what
559		this temperature channel is being used for, and user-space
560		doesn't. In all other cases, the label is provided by
561		user-space.
562
563		RO
564
565`temp[1-*]_lowest`
566		Historical minimum temperature
567
568		Unit: millidegree Celsius
569
570		RO
571
572`temp[1-*]_highest`
573		Historical maximum temperature
574
575		Unit: millidegree Celsius
576
577		RO
578
579`temp[1-*]_reset_history`
580		Reset temp_lowest and temp_highest
581
582		WO
583
584`temp_reset_history`
585		Reset temp_lowest and temp_highest for all sensors
586
587		WO
588
589`temp[1-*]_enable`
590		Enable or disable the sensors.
591
592		When disabled the sensor read will return -ENODATA.
593
594		- 1: Enable
595		- 0: Disable
596
597		RW
598
599`temp[1-*]_rated_min`
600		Minimum rated temperature.
601
602		Unit: millidegree Celsius
603
604		RO
605
606`temp[1-*]_rated_max`
607		Maximum rated temperature.
608
609		Unit: millidegree Celsius
610
611		RO
612
613Some chips measure temperature using external thermistors and an ADC, and
614report the temperature measurement as a voltage. Converting this voltage
615back to a temperature (or the other way around for limits) requires
616mathematical functions not available in the kernel, so the conversion
617must occur in user space. For these chips, all temp* files described
618above should contain values expressed in millivolt instead of millidegree
619Celsius. In other words, such temperature channels are handled as voltage
620channels by the driver.
621
622Also see the Alarms section for status flags associated with temperatures.
623
624
625********
626Currents
627********
628
629`curr[1-*]_max`
630		Current max value
631
632		Unit: milliampere
633
634		RW
635
636`curr[1-*]_min`
637		Current min value.
638
639		Unit: milliampere
640
641		RW
642
643`curr[1-*]_lcrit`
644		Current critical low value
645
646		Unit: milliampere
647
648		RW
649
650`curr[1-*]_crit`
651		Current critical high value.
652
653		Unit: milliampere
654
655		RW
656
657`curr[1-*]_input`
658		Current input value
659
660		Unit: milliampere
661
662		RO
663
664`curr[1-*]_average`
665		Average current use
666
667		Unit: milliampere
668
669		RO
670
671`curr[1-*]_lowest`
672		Historical minimum current
673
674		Unit: milliampere
675
676		RO
677
678`curr[1-*]_highest`
679		Historical maximum current
680		Unit: milliampere
681		RO
682
683`curr[1-*]_reset_history`
684		Reset currX_lowest and currX_highest
685
686		WO
687
688`curr_reset_history`
689		Reset currX_lowest and currX_highest for all sensors
690
691		WO
692
693`curr[1-*]_enable`
694		Enable or disable the sensors.
695
696		When disabled the sensor read will return -ENODATA.
697
698		- 1: Enable
699		- 0: Disable
700
701		RW
702
703`curr[1-*]_rated_min`
704		Minimum rated current.
705
706		Unit: milliampere
707
708		RO
709
710`curr[1-*]_rated_max`
711		Maximum rated current.
712
713		Unit: milliampere
714
715		RO
716
717Also see the Alarms section for status flags associated with currents.
718
719*****
720Power
721*****
722
723`power[1-*]_average`
724				Average power use
725
726				Unit: microWatt
727
728				RO
729
730`power[1-*]_average_interval`
731				Power use averaging interval.  A poll
732				notification is sent to this file if the
733				hardware changes the averaging interval.
734
735				Unit: milliseconds
736
737				RW
738
739`power[1-*]_average_interval_max`
740				Maximum power use averaging interval
741
742				Unit: milliseconds
743
744				RO
745
746`power[1-*]_average_interval_min`
747				Minimum power use averaging interval
748
749				Unit: milliseconds
750
751				RO
752
753`power[1-*]_average_highest`
754				Historical average maximum power use
755
756				Unit: microWatt
757
758				RO
759
760`power[1-*]_average_lowest`
761				Historical average minimum power use
762
763				Unit: microWatt
764
765				RO
766
767`power[1-*]_average_max`
768				A poll notification is sent to
769				`power[1-*]_average` when power use
770				rises above this value.
771
772				Unit: microWatt
773
774				RW
775
776`power[1-*]_average_min`
777				A poll notification is sent to
778				`power[1-*]_average` when power use
779				sinks below this value.
780
781				Unit: microWatt
782
783				RW
784
785`power[1-*]_input`
786				Instantaneous power use
787
788				Unit: microWatt
789
790				RO
791
792`power[1-*]_input_highest`
793				Historical maximum power use
794
795				Unit: microWatt
796
797				RO
798
799`power[1-*]_input_lowest`
800				Historical minimum power use
801
802				Unit: microWatt
803
804				RO
805
806`power[1-*]_reset_history`
807				Reset input_highest, input_lowest,
808				average_highest and average_lowest.
809
810				WO
811
812`power[1-*]_accuracy`
813				Accuracy of the power meter.
814
815				Unit: Percent
816
817				RO
818
819`power[1-*]_cap`
820				If power use rises above this limit, the
821				system should take action to reduce power use.
822				A poll notification is sent to this file if the
823				cap is changed by the hardware.  The `*_cap`
824				files only appear if the cap is known to be
825				enforced by hardware.
826
827				Unit: microWatt
828
829				RW
830
831`power[1-*]_cap_hyst`
832				Margin of hysteresis built around capping and
833				notification.
834
835				Unit: microWatt
836
837				RW
838
839`power[1-*]_cap_max`
840				Maximum cap that can be set.
841
842				Unit: microWatt
843
844				RO
845
846`power[1-*]_cap_min`
847				Minimum cap that can be set.
848
849				Unit: microWatt
850
851				RO
852
853`power[1-*]_max`
854				Maximum power.
855
856				Unit: microWatt
857
858				RW
859
860`power[1-*]_crit`
861				Critical maximum power.
862
863				If power rises to or above this limit, the
864				system is expected take drastic action to reduce
865				power consumption, such as a system shutdown or
866				a forced powerdown of some devices.
867
868				Unit: microWatt
869
870				RW
871
872`power[1-*]_enable`
873				Enable or disable the sensors.
874
875				When disabled the sensor read will return
876				-ENODATA.
877
878				- 1: Enable
879				- 0: Disable
880
881				RW
882
883`power[1-*]_rated_min`
884				Minimum rated power.
885
886				Unit: microWatt
887
888				RO
889
890`power[1-*]_rated_max`
891				Maximum rated power.
892
893				Unit: microWatt
894
895				RO
896
897Also see the Alarms section for status flags associated with power readings.
898
899******
900Energy
901******
902
903`energy[1-*]_input`
904				Cumulative energy use
905
906				Unit: microJoule
907
908				RO
909
910`energy[1-*]_enable`
911				Enable or disable the sensors.
912
913				When disabled the sensor read will return
914				-ENODATA.
915
916				- 1: Enable
917				- 0: Disable
918
919				RW
920
921********
922Humidity
923********
924
925`humidity[1-*]_input`
926				Humidity
927
928				Unit: milli-percent (per cent mille, pcm)
929
930				RO
931
932
933`humidity[1-*]_enable`
934				Enable or disable the sensors
935
936				When disabled the sensor read will return
937				-ENODATA.
938
939				- 1: Enable
940				- 0: Disable
941
942				RW
943
944`humidity[1-*]_rated_min`
945				Minimum rated humidity.
946
947				Unit: milli-percent (per cent mille, pcm)
948
949				RO
950
951`humidity[1-*]_rated_max`
952				Maximum rated humidity.
953
954				Unit: milli-percent (per cent mille, pcm)
955
956				RO
957
958******
959Alarms
960******
961
962Each channel or limit may have an associated alarm file, containing a
963boolean value. 1 means than an alarm condition exists, 0 means no alarm.
964
965Usually a given chip will either use channel-related alarms, or
966limit-related alarms, not both. The driver should just reflect the hardware
967implementation.
968
969+-------------------------------+-----------------------+
970| **`in[0-*]_alarm`,		| Channel alarm		|
971| `curr[1-*]_alarm`,		|			|
972| `power[1-*]_alarm`,		|   - 0: no alarm	|
973| `fan[1-*]_alarm`,		|   - 1: alarm		|
974| `temp[1-*]_alarm`**		|			|
975|				|   RO			|
976+-------------------------------+-----------------------+
977
978**OR**
979
980+-------------------------------+-----------------------+
981| **`in[0-*]_min_alarm`,	| Limit alarm		|
982| `in[0-*]_max_alarm`,		|			|
983| `in[0-*]_lcrit_alarm`,	|   - 0: no alarm	|
984| `in[0-*]_crit_alarm`,		|   - 1: alarm		|
985| `curr[1-*]_min_alarm`,	|			|
986| `curr[1-*]_max_alarm`,	| RO			|
987| `curr[1-*]_lcrit_alarm`,	|			|
988| `curr[1-*]_crit_alarm`,	|			|
989| `power[1-*]_cap_alarm`,	|			|
990| `power[1-*]_max_alarm`,	|			|
991| `power[1-*]_crit_alarm`,	|			|
992| `fan[1-*]_min_alarm`,		|			|
993| `fan[1-*]_max_alarm`,		|			|
994| `temp[1-*]_min_alarm`,	|			|
995| `temp[1-*]_max_alarm`,	|			|
996| `temp[1-*]_lcrit_alarm`,	|			|
997| `temp[1-*]_crit_alarm`,	|			|
998| `temp[1-*]_emergency_alarm`**	|			|
999+-------------------------------+-----------------------+
1000
1001Each input channel may have an associated fault file. This can be used
1002to notify open diodes, unconnected fans etc. where the hardware
1003supports it. When this boolean has value 1, the measurement for that
1004channel should not be trusted.
1005
1006`fan[1-*]_fault` / `temp[1-*]_fault`
1007		Input fault condition
1008
1009		- 0: no fault occurred
1010		- 1: fault condition
1011
1012		RO
1013
1014Some chips also offer the possibility to get beeped when an alarm occurs:
1015
1016`beep_enable`
1017		Master beep enable
1018
1019		- 0: no beeps
1020		- 1: beeps
1021
1022		RW
1023
1024`in[0-*]_beep`, `curr[1-*]_beep`, `fan[1-*]_beep`, `temp[1-*]_beep`,
1025		Channel beep
1026
1027		- 0: disable
1028		- 1: enable
1029
1030		RW
1031
1032In theory, a chip could provide per-limit beep masking, but no such chip
1033was seen so far.
1034
1035Old drivers provided a different, non-standard interface to alarms and
1036beeps. These interface files are deprecated, but will be kept around
1037for compatibility reasons:
1038
1039`alarms`
1040		Alarm bitmask.
1041
1042		RO
1043
1044		Integer representation of one to four bytes.
1045
1046		A '1' bit means an alarm.
1047
1048		Chips should be programmed for 'comparator' mode so that
1049		the alarm will 'come back' after you read the register
1050		if it is still valid.
1051
1052		Generally a direct representation of a chip's internal
1053		alarm registers; there is no standard for the position
1054		of individual bits. For this reason, the use of this
1055		interface file for new drivers is discouraged. Use
1056		`individual *_alarm` and `*_fault` files instead.
1057		Bits are defined in kernel/include/sensors.h.
1058
1059`beep_mask`
1060		Bitmask for beep.
1061		Same format as 'alarms' with the same bit locations,
1062		use discouraged for the same reason. Use individual
1063		`*_beep` files instead.
1064		RW
1065
1066
1067*******************
1068Intrusion detection
1069*******************
1070
1071`intrusion[0-*]_alarm`
1072		Chassis intrusion detection
1073
1074		- 0: OK
1075		- 1: intrusion detected
1076
1077		RW
1078
1079		Contrary to regular alarm flags which clear themselves
1080		automatically when read, this one sticks until cleared by
1081		the user. This is done by writing 0 to the file. Writing
1082		other values is unsupported.
1083
1084`intrusion[0-*]_beep`
1085		Chassis intrusion beep
1086
1087		0: disable
1088		1: enable
1089
1090		RW
1091
1092****************************
1093Average sample configuration
1094****************************
1095
1096Devices allowing for reading {in,power,curr,temp}_average values may export
1097attributes for controlling number of samples used to compute average.
1098
1099+--------------+---------------------------------------------------------------+
1100| samples      | Sets number of average samples for all types of measurements. |
1101|	       |							       |
1102|	       | RW							       |
1103+--------------+---------------------------------------------------------------+
1104| in_samples   | Sets number of average samples for specific type of	       |
1105| power_samples| measurements.						       |
1106| curr_samples |							       |
1107| temp_samples | Note that on some devices it won't be possible to set all of  |
1108|	       | them to different values so changing one might also change    |
1109|	       | some others.						       |
1110|	       |							       |
1111|	       | RW							       |
1112+--------------+---------------------------------------------------------------+
1113
1114sysfs attribute writes interpretation
1115-------------------------------------
1116
1117hwmon sysfs attributes always contain numbers, so the first thing to do is to
1118convert the input to a number, there are 2 ways todo this depending whether
1119the number can be negative or not::
1120
1121	unsigned long u = simple_strtoul(buf, NULL, 10);
1122	long s = simple_strtol(buf, NULL, 10);
1123
1124With buf being the buffer with the user input being passed by the kernel.
1125Notice that we do not use the second argument of strto[u]l, and thus cannot
1126tell when 0 is returned, if this was really 0 or is caused by invalid input.
1127This is done deliberately as checking this everywhere would add a lot of
1128code to the kernel.
1129
1130Notice that it is important to always store the converted value in an
1131unsigned long or long, so that no wrap around can happen before any further
1132checking.
1133
1134After the input string is converted to an (unsigned) long, the value should be
1135checked if its acceptable. Be careful with further conversions on the value
1136before checking it for validity, as these conversions could still cause a wrap
1137around before the check. For example do not multiply the result, and only
1138add/subtract if it has been divided before the add/subtract.
1139
1140What to do if a value is found to be invalid, depends on the type of the
1141sysfs attribute that is being set. If it is a continuous setting like a
1142tempX_max or inX_max attribute, then the value should be clamped to its
1143limits using clamp_val(value, min_limit, max_limit). If it is not continuous
1144like for example a tempX_type, then when an invalid value is written,
1145-EINVAL should be returned.
1146
1147Example1, temp1_max, register is a signed 8 bit value (-128 - 127 degrees)::
1148
1149	long v = simple_strtol(buf, NULL, 10) / 1000;
1150	v = clamp_val(v, -128, 127);
1151	/* write v to register */
1152
1153Example2, fan divider setting, valid values 2, 4 and 8::
1154
1155	unsigned long v = simple_strtoul(buf, NULL, 10);
1156
1157	switch (v) {
1158	case 2: v = 1; break;
1159	case 4: v = 2; break;
1160	case 8: v = 3; break;
1161	default:
1162		return -EINVAL;
1163	}
1164	/* write v to register */
1165