xref: /openbmc/linux/Documentation/hwmon/bt1-pvt.rst (revision 4b4193256c8d3bc3a5397b5cd9494c2ad386317d)
1*87976ce2SSerge Semin.. SPDX-License-Identifier: GPL-2.0-only
2*87976ce2SSerge Semin
3*87976ce2SSerge SeminKernel driver bt1-pvt
4*87976ce2SSerge Semin=====================
5*87976ce2SSerge Semin
6*87976ce2SSerge SeminSupported chips:
7*87976ce2SSerge Semin
8*87976ce2SSerge Semin  * Baikal-T1 PVT sensor (in SoC)
9*87976ce2SSerge Semin
10*87976ce2SSerge Semin    Prefix: 'bt1-pvt'
11*87976ce2SSerge Semin
12*87976ce2SSerge Semin    Addresses scanned: -
13*87976ce2SSerge Semin
14*87976ce2SSerge Semin    Datasheet: Provided by BAIKAL ELECTRONICS upon request and under NDA
15*87976ce2SSerge Semin
16*87976ce2SSerge SeminAuthors:
17*87976ce2SSerge Semin    Maxim Kaurkin <maxim.kaurkin@baikalelectronics.ru>
18*87976ce2SSerge Semin    Serge Semin <Sergey.Semin@baikalelectronics.ru>
19*87976ce2SSerge Semin
20*87976ce2SSerge SeminDescription
21*87976ce2SSerge Semin-----------
22*87976ce2SSerge Semin
23*87976ce2SSerge SeminThis driver implements support for the hardware monitoring capabilities of the
24*87976ce2SSerge Seminembedded into Baikal-T1 process, voltage and temperature sensors. PVT IP-core
25*87976ce2SSerge Seminconsists of one temperature and four voltage sensors, which can be used to
26*87976ce2SSerge Seminmonitor the chip internal environment like heating, supply voltage and
27*87976ce2SSerge Semintransistors performance. The driver can optionally provide the hwmon alarms
28*87976ce2SSerge Seminfor each sensor the PVT controller supports. The alarms functionality is made
29*87976ce2SSerge Semincompile-time configurable due to the hardware interface implementation
30*87976ce2SSerge Seminpeculiarity, which is connected with an ability to convert data from only one
31*87976ce2SSerge Seminsensor at a time. Additional limitation is that the controller performs the
32*87976ce2SSerge Seminthresholds checking synchronously with the data conversion procedure. Due to
33*87976ce2SSerge Seminthese in order to have the hwmon alarms automatically detected the driver code
34*87976ce2SSerge Seminmust switch from one sensor to another, read converted data and manually check
35*87976ce2SSerge Seminthe threshold status bits. Depending on the measurements timeout settings
36*87976ce2SSerge Semin(update_interval sysfs node value) this design may cause additional burden on
37*87976ce2SSerge Seminthe system performance. So in case if alarms are unnecessary in your system
38*87976ce2SSerge Semindesign it's recommended to have them disabled to prevent the PVT IRQs being
39*87976ce2SSerge Seminperiodically raised to get the data cache/alarms status up to date. By default
40*87976ce2SSerge Seminin alarm-less configuration the data conversion is performed by the driver
41*87976ce2SSerge Seminon demand when read operation is requested via corresponding _input-file.
42*87976ce2SSerge Semin
43*87976ce2SSerge SeminTemperature Monitoring
44*87976ce2SSerge Semin----------------------
45*87976ce2SSerge Semin
46*87976ce2SSerge SeminTemperature is measured with 10-bit resolution and reported in millidegree
47*87976ce2SSerge SeminCelsius. The driver performs all the scaling by itself therefore reports true
48*87976ce2SSerge Semintemperatures that don't need any user-space adjustments. While the data
49*87976ce2SSerge Semintranslation formulae isn't linear, which gives us non-linear discreteness,
50*87976ce2SSerge Seminit's close to one, but giving a bit better accuracy for higher temperatures.
51*87976ce2SSerge SeminThe temperature input is mapped as follows (the last column indicates the input
52*87976ce2SSerge Seminranges)::
53*87976ce2SSerge Semin
54*87976ce2SSerge Semin	temp1: CPU embedded diode	-48.38C - +147.438C
55*87976ce2SSerge Semin
56*87976ce2SSerge SeminIn case if the alarms kernel config is enabled in the driver the temperature input
57*87976ce2SSerge Seminhas associated min and max limits which trigger an alarm when crossed.
58*87976ce2SSerge Semin
59*87976ce2SSerge SeminVoltage Monitoring
60*87976ce2SSerge Semin------------------
61*87976ce2SSerge Semin
62*87976ce2SSerge SeminThe voltage inputs are also sampled with 10-bit resolution and reported in
63*87976ce2SSerge Seminmillivolts. But in this case the data translation formulae is linear, which
64*87976ce2SSerge Seminprovides a constant measurements discreteness. The data scaling is also
65*87976ce2SSerge Seminperformed by the driver, so returning true millivolts. The voltage inputs are
66*87976ce2SSerge Seminmapped as follows (the last column indicates the input ranges)::
67*87976ce2SSerge Semin
68*87976ce2SSerge Semin	in0: VDD		(processor core)		0.62V - 1.168V
69*87976ce2SSerge Semin	in1: Low-Vt		(low voltage threshold)		0.62V - 1.168V
70*87976ce2SSerge Semin	in2: High-Vt		(high voltage threshold)	0.62V - 1.168V
71*87976ce2SSerge Semin	in3: Standard-Vt	(standard voltage threshold)	0.62V - 1.168V
72*87976ce2SSerge Semin
73*87976ce2SSerge SeminIn case if the alarms config is enabled in the driver the voltage inputs
74*87976ce2SSerge Seminhave associated min and max limits which trigger an alarm when crossed.
75*87976ce2SSerge Semin
76*87976ce2SSerge SeminSysfs Attributes
77*87976ce2SSerge Semin----------------
78*87976ce2SSerge Semin
79*87976ce2SSerge SeminFollowing is a list of all sysfs attributes that the driver provides, their
80*87976ce2SSerge Seminpermissions and a short description:
81*87976ce2SSerge Semin
82*87976ce2SSerge Semin=============================== ======= =======================================
83*87976ce2SSerge SeminName				Perm	Description
84*87976ce2SSerge Semin=============================== ======= =======================================
85*87976ce2SSerge Seminupdate_interval			RW	Measurements update interval per
86*87976ce2SSerge Semin					sensor.
87*87976ce2SSerge Semintemp1_type			RO	Sensor type (always 1 as CPU embedded
88*87976ce2SSerge Semin					diode).
89*87976ce2SSerge Semintemp1_label			RO	CPU Core Temperature sensor.
90*87976ce2SSerge Semintemp1_input			RO	Measured temperature in millidegree
91*87976ce2SSerge Semin					Celsius.
92*87976ce2SSerge Semintemp1_min			RW	Low limit for temp input.
93*87976ce2SSerge Semintemp1_max			RW	High limit for temp input.
94*87976ce2SSerge Semintemp1_min_alarm			RO	Temperature input alarm. Returns 1 if
95*87976ce2SSerge Semin					temperature input went below min limit,
96*87976ce2SSerge Semin					0 otherwise.
97*87976ce2SSerge Semintemp1_max_alarm			RO	Temperature input alarm. Returns 1 if
98*87976ce2SSerge Semin					temperature input went above max limit,
99*87976ce2SSerge Semin					0 otherwise.
100*87976ce2SSerge Semintemp1_offset			RW	Temperature offset in millidegree
101*87976ce2SSerge Semin					Celsius which is added to the
102*87976ce2SSerge Semin					temperature reading by the chip. It can
103*87976ce2SSerge Semin					be used to manually adjust the
104*87976ce2SSerge Semin					temperature measurements within 7.130
105*87976ce2SSerge Semin					degrees Celsius.
106*87976ce2SSerge Seminin[0-3]_label			RO	CPU Voltage sensor (either core or
107*87976ce2SSerge Semin					low/high/standard thresholds).
108*87976ce2SSerge Seminin[0-3]_input			RO	Measured voltage in millivolts.
109*87976ce2SSerge Seminin[0-3]_min			RW	Low limit for voltage input.
110*87976ce2SSerge Seminin[0-3]_max			RW	High limit for voltage input.
111*87976ce2SSerge Seminin[0-3]_min_alarm		RO	Voltage input alarm. Returns 1 if
112*87976ce2SSerge Semin					voltage input went below min limit,
113*87976ce2SSerge Semin					0 otherwise.
114*87976ce2SSerge Seminin[0-3]_max_alarm		RO	Voltage input alarm. Returns 1 if
115*87976ce2SSerge Semin					voltage input went above max limit,
116*87976ce2SSerge Semin					0 otherwise.
117*87976ce2SSerge Semin=============================== ======= =======================================
118