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