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