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