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