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