xref: /linux/Documentation/hwmon/pmbus.rst (revision 3a2c4d55e32ad65efebdb6de44eef3bfa08bb49d)
1Kernel driver pmbus
2===================
3
4Supported chips:
5
6  * Flex BMR310, BMR316, BMR321, BMR350, BMR351, BMR453, BMR454,
7    BMR456, BMR457, BMR458, BMR480, BMR490, BMR491, BMR492
8
9    Prefixes: 'bmr310', 'bmr316', 'bmr321', 'bmr350', 'bmr351',
10    'bmr453', 'bmr454', 'bmr456', 'bmr457', 'bmr458', 'bmr480',
11    'bmr490', 'bmr491', 'bmr492'
12
13    Addresses scanned: -
14
15    Datasheets:
16
17	https://flex.com/products/power-modules/product-selector
18
19
20  * ON Semiconductor ADP4000, NCP4200, NCP4208
21
22    Prefixes: 'adp4000', 'ncp4200', 'ncp4208'
23
24    Addresses scanned: -
25
26    Datasheets:
27
28	https://www.onsemi.com/pub_link/Collateral/ADP4000-D.PDF
29
30	https://www.onsemi.com/pub_link/Collateral/NCP4200-D.PDF
31
32	https://www.onsemi.com/pub_link/Collateral/JUNE%202009-%20REV.%200.PDF
33
34  * Lineage Power
35
36    Prefixes: 'mdt040', 'pdt003', 'pdt006', 'pdt012', 'udt020'
37
38    Addresses scanned: -
39
40    Datasheets:
41
42	http://www.lineagepower.com/oem/pdf/PDT003A0X.pdf
43
44	http://www.lineagepower.com/oem/pdf/PDT006A0X.pdf
45
46	http://www.lineagepower.com/oem/pdf/PDT012A0X.pdf
47
48	http://www.lineagepower.com/oem/pdf/UDT020A0X.pdf
49
50	http://www.lineagepower.com/oem/pdf/MDT040A0X.pdf
51
52  * Texas Instruments TPS40400, TPS544B20, TPS544B25, TPS544C20, TPS544C25
53
54    Prefixes: 'tps40400', 'tps544b20', 'tps544b25', 'tps544c20', 'tps544c25'
55
56    Addresses scanned: -
57
58    Datasheets:
59
60	https://www.ti.com/lit/gpn/tps40400
61
62	https://www.ti.com/lit/gpn/tps544b20
63
64	https://www.ti.com/lit/gpn/tps544b25
65
66	https://www.ti.com/lit/gpn/tps544c20
67
68	https://www.ti.com/lit/gpn/tps544c25
69
70  * Maxim MAX20796
71
72    Prefix: 'max20796'
73
74    Addresses scanned: -
75
76    Datasheet:
77
78	https://www.analog.com/media/en/technical-documentation/data-sheets/MAX20796.pdf
79
80  * Generic PMBus devices
81
82    Prefix: 'pmbus'
83
84    Addresses scanned: -
85
86    Datasheet: n.a.
87
88
89Author: Guenter Roeck <linux@roeck-us.net>
90
91
92Description
93-----------
94
95This driver supports hardware monitoring for various PMBus compliant devices.
96It supports voltage, current, power, and temperature sensors as supported
97by the device.
98
99Each monitored channel has its own high and low limits, plus a critical
100limit.
101
102Fan support will be added in a later version of this driver.
103
104
105Usage Notes
106-----------
107
108This driver does not probe for PMBus devices, since there is no register
109which can be safely used to identify the chip (The MFG_ID register is not
110supported by all chips), and since there is no well defined address range for
111PMBus devices. You will have to instantiate the devices explicitly.
112
113Example: the following will load the driver for an LTC2978 at address 0x60
114on I2C bus #1::
115
116	$ modprobe pmbus
117	$ echo ltc2978 0x60 > /sys/bus/i2c/devices/i2c-1/new_device
118
119
120Platform data support
121---------------------
122
123Support for additional PMBus chips can be added by defining chip parameters in
124a new chip specific driver file. For example, (untested) code to add support for
125Emerson DS1200 power modules might look as follows::
126
127  static struct pmbus_driver_info ds1200_info = {
128	.pages = 1,
129	/* Note: All other sensors are in linear mode */
130	.direct[PSC_VOLTAGE_OUT] = true,
131	.direct[PSC_TEMPERATURE] = true,
132	.direct[PSC_CURRENT_OUT] = true,
133	.m[PSC_VOLTAGE_IN] = 1,
134	.b[PSC_VOLTAGE_IN] = 0,
135	.R[PSC_VOLTAGE_IN] = 3,
136	.m[PSC_VOLTAGE_OUT] = 1,
137	.b[PSC_VOLTAGE_OUT] = 0,
138	.R[PSC_VOLTAGE_OUT] = 3,
139	.m[PSC_TEMPERATURE] = 1,
140	.b[PSC_TEMPERATURE] = 0,
141	.R[PSC_TEMPERATURE] = 3,
142	.func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_IIN | PMBUS_HAVE_STATUS_INPUT
143		   | PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
144		   | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT
145		   | PMBUS_HAVE_PIN | PMBUS_HAVE_POUT
146		   | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP
147		   | PMBUS_HAVE_FAN12 | PMBUS_HAVE_STATUS_FAN12,
148  };
149
150  static int ds1200_probe(struct i2c_client *client)
151  {
152	return pmbus_do_probe(client, &ds1200_info);
153  }
154
155  static const struct i2c_device_id ds1200_id[] = {
156	{"ds1200"},
157	{}
158  };
159
160  MODULE_DEVICE_TABLE(i2c, ds1200_id);
161
162  /* This is the driver that will be inserted */
163  static struct i2c_driver ds1200_driver = {
164	.driver = {
165		   .name = "ds1200",
166		   },
167	.probe = ds1200_probe,
168	.id_table = ds1200_id,
169  };
170
171  static int __init ds1200_init(void)
172  {
173	return i2c_add_driver(&ds1200_driver);
174  }
175
176  static void __exit ds1200_exit(void)
177  {
178	i2c_del_driver(&ds1200_driver);
179  }
180
181
182Sysfs entries
183-------------
184
185When probing the chip, the driver identifies which PMBus registers are
186supported, and determines available sensors from this information.
187Attribute files only exist if respective sensors are supported by the chip.
188Labels are provided to inform the user about the sensor associated with
189a given sysfs entry.
190
191The following attributes are supported. Limits are read-write; all other
192attributes are read-only.
193
194======================= ========================================================
195inX_input		Measured voltage. From READ_VIN or READ_VOUT register.
196inX_min			Minimum Voltage.
197			From VIN_UV_WARN_LIMIT or VOUT_UV_WARN_LIMIT register.
198inX_max			Maximum voltage.
199			From VIN_OV_WARN_LIMIT or VOUT_OV_WARN_LIMIT register.
200inX_lcrit		Critical minimum Voltage.
201			From VIN_UV_FAULT_LIMIT or VOUT_UV_FAULT_LIMIT register.
202inX_crit		Critical maximum voltage.
203			From VIN_OV_FAULT_LIMIT or VOUT_OV_FAULT_LIMIT register.
204inX_min_alarm		Voltage low alarm. From VOLTAGE_UV_WARNING status.
205inX_max_alarm		Voltage high alarm. From VOLTAGE_OV_WARNING status.
206inX_lcrit_alarm		Voltage critical low alarm.
207			From VOLTAGE_UV_FAULT status.
208inX_crit_alarm		Voltage critical high alarm.
209			From VOLTAGE_OV_FAULT status.
210inX_label		"vin", "vcap", or "voutY"
211inX_rated_min		Minimum rated voltage.
212			From MFR_VIN_MIN or MFR_VOUT_MIN register.
213inX_rated_max		Maximum rated voltage.
214			From MFR_VIN_MAX or MFR_VOUT_MAX register.
215
216currX_input		Measured current. From READ_IIN or READ_IOUT register.
217currX_max		Maximum current.
218			From IIN_OC_WARN_LIMIT or IOUT_OC_WARN_LIMIT register.
219currX_lcrit		Critical minimum output current.
220			From IOUT_UC_FAULT_LIMIT register.
221currX_crit		Critical maximum current.
222			From IIN_OC_FAULT_LIMIT or IOUT_OC_FAULT_LIMIT register.
223currX_alarm		Current high alarm.
224			From IIN_OC_WARNING or IOUT_OC_WARNING status.
225currX_max_alarm		Current high alarm.
226			From IIN_OC_WARN_LIMIT or IOUT_OC_WARN_LIMIT status.
227currX_lcrit_alarm	Output current critical low alarm.
228			From IOUT_UC_FAULT status.
229currX_crit_alarm	Current critical high alarm.
230			From IIN_OC_FAULT or IOUT_OC_FAULT status.
231currX_label		"iin", "iinY", "iinY.Z", "ioutY", or "ioutY.Z",
232			where Y reflects the page number and Z reflects the
233			phase.
234currX_rated_max		Maximum rated current.
235			From MFR_IIN_MAX or MFR_IOUT_MAX register.
236
237powerX_input		Measured power. From READ_PIN or READ_POUT register.
238powerX_cap		Output power cap. From POUT_MAX register.
239powerX_max		Power limit. From PIN_OP_WARN_LIMIT or
240			POUT_OP_WARN_LIMIT register.
241powerX_crit		Critical output power limit.
242			From POUT_OP_FAULT_LIMIT register.
243powerX_alarm		Power high alarm.
244			From PIN_OP_WARNING or POUT_OP_WARNING status.
245powerX_crit_alarm	Output power critical high alarm.
246			From POUT_OP_FAULT status.
247powerX_label		"pin", "pinY", "pinY.Z", "poutY", or "poutY.Z",
248			where Y reflects the page number and Z reflects the
249			phase.
250powerX_rated_max	Maximum rated power.
251			From MFR_PIN_MAX or MFR_POUT_MAX register.
252
253tempX_input		Measured temperature.
254			From READ_TEMPERATURE_X register.
255tempX_min		Minimum temperature. From UT_WARN_LIMIT register.
256tempX_max		Maximum temperature. From OT_WARN_LIMIT register.
257tempX_lcrit		Critical low temperature.
258			From UT_FAULT_LIMIT register.
259tempX_crit		Critical high temperature.
260			From OT_FAULT_LIMIT register.
261tempX_min_alarm		Chip temperature low alarm. Set by comparing
262			READ_TEMPERATURE_X with UT_WARN_LIMIT if
263			TEMP_UT_WARNING status is set.
264tempX_max_alarm		Chip temperature high alarm. Set by comparing
265			READ_TEMPERATURE_X with OT_WARN_LIMIT if
266			TEMP_OT_WARNING status is set.
267tempX_lcrit_alarm	Chip temperature critical low alarm. Set by comparing
268			READ_TEMPERATURE_X with UT_FAULT_LIMIT if
269			TEMP_UT_FAULT status is set.
270tempX_crit_alarm	Chip temperature critical high alarm. Set by comparing
271			READ_TEMPERATURE_X with OT_FAULT_LIMIT if
272			TEMP_OT_FAULT status is set.
273tempX_rated_min		Minimum rated temperature.
274			From MFR_TAMBIENT_MIN register.
275tempX_rated_max		Maximum rated temperature.
276			From MFR_TAMBIENT_MAX, MFR_MAX_TEMP_1, MFR_MAX_TEMP_2 or
277			MFR_MAX_TEMP_3 register.
278======================= ========================================================
279