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