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