aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/hwmon/pmbus
blob: f2d42e8bdf48b93a5b6dba12261dafdaf2179e33 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
Kernel driver pmbus
====================

Supported chips:
  * Ericsson BMR45X series
    DC/DC Converter
    Prefixes: 'bmr450', 'bmr451', 'bmr453', 'bmr454'
    Addresses scanned: -
    Datasheet:
 http://archive.ericsson.net/service/internet/picov/get?DocNo=28701-EN/LZT146395
  * Linear Technology LTC2978
    Octal PMBus Power Supply Monitor and Controller
    Prefix: 'ltc2978'
    Addresses scanned: -
    Datasheet: http://cds.linear.com/docs/Datasheet/2978fa.pdf
  * Maxim MAX16064
    Quad Power-Supply Controller
    Prefix: 'max16064'
    Addresses scanned: -
    Datasheet: http://datasheets.maxim-ic.com/en/ds/MAX16064.pdf
  * Maxim MAX34440
    PMBus 6-Channel Power-Supply Manager
    Prefixes: 'max34440'
    Addresses scanned: -
    Datasheet: http://datasheets.maxim-ic.com/en/ds/MAX34440.pdf
  * Maxim MAX34441
    PMBus 5-Channel Power-Supply Manager and Intelligent Fan Controller
    Prefixes: 'max34441'
    Addresses scanned: -
    Datasheet: http://datasheets.maxim-ic.com/en/ds/MAX34441.pdf
  * Maxim MAX8688
    Digital Power-Supply Controller/Monitor
    Prefix: 'max8688'
    Addresses scanned: -
    Datasheet: http://datasheets.maxim-ic.com/en/ds/MAX8688.pdf
  * Generic PMBus devices
    Prefix: 'pmbus'
    Addresses scanned: -
    Datasheet: n.a.

Author: Guenter Roeck <guenter.roeck@ericsson.com>


Description
-----------

This driver supports hardware montoring for various PMBus compliant devices.
It supports voltage, current, power, and temperature sensors as supported
by the device.

Each monitored channel has its own high and low limits, plus a critical
limit.

Fan support will be added in a later version of this driver.


Usage Notes
-----------

This driver does not probe for PMBus devices, since there is no register
which can be safely used to identify the chip (The MFG_ID register is not
supported by all chips), and since there is no well defined address range for
PMBus devices. You will have to instantiate the devices explicitly.

Example: the following will load the driver for an LTC2978 at address 0x60
on I2C bus #1:
$ modprobe pmbus
$ echo ltc2978 0x60 > /sys/bus/i2c/devices/i2c-1/new_device


Platform data support
---------------------

Support for additional PMBus chips can be added by defining chip parameters in
a new chip specific driver file. For example, (untested) code to add support for
Emerson DS1200 power modules might look as follows.

static struct pmbus_driver_info ds1200_info = {
	.pages = 1,
	/* Note: All other sensors are in linear mode */
	.direct[PSC_VOLTAGE_OUT] = true,
	.direct[PSC_TEMPERATURE] = true,
	.direct[PSC_CURRENT_OUT] = true,
	.m[PSC_VOLTAGE_IN] = 1,
	.b[PSC_VOLTAGE_IN] = 0,
	.R[PSC_VOLTAGE_IN] = 3,
	.m[PSC_VOLTAGE_OUT] = 1,
	.b[PSC_VOLTAGE_OUT] = 0,
	.R[PSC_VOLTAGE_OUT] = 3,
	.m[PSC_TEMPERATURE] = 1,
	.b[PSC_TEMPERATURE] = 0,
	.R[PSC_TEMPERATURE] = 3,
	.func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_IIN | PMBUS_HAVE_STATUS_INPUT
		   | PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
		   | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT
		   | PMBUS_HAVE_PIN | PMBUS_HAVE_POUT
		   | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP
		   | PMBUS_HAVE_FAN12 | PMBUS_HAVE_STATUS_FAN12,
};

static int ds1200_probe(struct i2c_client *client,
			const struct i2c_device_id *id)
{
	return pmbus_do_probe(client, id, &ds1200_info);
}

static int ds1200_remove(struct i2c_client *client)
{
	return pmbus_do_remove(client);
}

static const struct i2c_device_id ds1200_id[] = {
	{"ds1200", 0},
	{}
};

MODULE_DEVICE_TABLE(i2c, ds1200_id);

/* This is the driver that will be inserted */
static struct i2c_driver ds1200_driver = {
	.driver = {
		   .name = "ds1200",
		   },
	.probe = ds1200_probe,
	.remove = ds1200_remove,
	.id_table = ds1200_id,
};

static int __init ds1200_init(void)
{
	return i2c_add_driver(&ds1200_driver);
}

static void __exit ds1200_exit(void)
{
	i2c_del_driver(&ds1200_driver);
}


Sysfs entries
-------------

When probing the chip, the driver identifies which PMBus registers are
supported, and determines available sensors from this information.
Attribute files only exist if respective sensors are suported by the chip.
Labels are provided to inform the user about the sensor associated with
a given sysfs entry.

The following attributes are supported. Limits are read-write; all other
attributes are read-only.

inX_input		Measured voltage. From READ_VIN or READ_VOUT register.
inX_min			Minumum Voltage.
			From VIN_UV_WARN_LIMIT or VOUT_UV_WARN_LIMIT register.
inX_max			Maximum voltage.
			From VIN_OV_WARN_LIMIT or VOUT_OV_WARN_LIMIT register.
inX_lcrit		Critical minumum Voltage.
			From VIN_UV_FAULT_LIMIT or VOUT_UV_FAULT_LIMIT register.
inX_crit		Critical maximum voltage.
			From VIN_OV_FAULT_LIMIT or VOUT_OV_FAULT_LIMIT register.
inX_min_alarm		Voltage low alarm. From VOLTAGE_UV_WARNING status.
inX_max_alarm		Voltage high alarm. From VOLTAGE_OV_WARNING status.
inX_lcrit_alarm		Voltage critical low alarm.
			From VOLTAGE_UV_FAULT status.
inX_crit_alarm		Voltage critical high alarm.
			From VOLTAGE_OV_FAULT status.
inX_label		"vin", "vcap", or "voutY"

currX_input		Measured current. From READ_IIN or READ_IOUT register.
currX_max		Maximum current.
			From IIN_OC_WARN_LIMIT or IOUT_OC_WARN_LIMIT register.
currX_lcrit		Critical minumum output current.
			From IOUT_UC_FAULT_LIMIT register.
currX_crit		Critical maximum current.
			From IIN_OC_FAULT_LIMIT or IOUT_OC_FAULT_LIMIT register.
currX_alarm		Current high alarm.
			From IIN_OC_WARNING or IOUT_OC_WARNING status.
currX_lcrit_alarm	Output current critical low alarm.
			From IOUT_UC_FAULT status.
currX_crit_alarm	Current critical high alarm.
			From IIN_OC_FAULT or IOUT_OC_FAULT status.
currX_label		"iin" or "vinY"

powerX_input		Measured power. From READ_PIN or READ_POUT register.
powerX_cap		Output power cap. From POUT_MAX register.
powerX_max		Power limit. From PIN_OP_WARN_LIMIT or
			POUT_OP_WARN_LIMIT register.
powerX_crit		Critical output power limit.
			From POUT_OP_FAULT_LIMIT register.
powerX_alarm		Power high alarm.
			From PIN_OP_WARNING or POUT_OP_WARNING status.
powerX_crit_alarm	Output power critical high alarm.
			From POUT_OP_FAULT status.
powerX_label		"pin" or "poutY"

tempX_input		Measured tempererature.
			From READ_TEMPERATURE_X register.
tempX_min		Mimimum tempererature. From UT_WARN_LIMIT register.
tempX_max		Maximum tempererature. From OT_WARN_LIMIT register.
tempX_lcrit		Critical low tempererature.
			From UT_FAULT_LIMIT register.
tempX_crit		Critical high tempererature.
			From OT_FAULT_LIMIT register.
tempX_min_alarm		Chip temperature low alarm. Set by comparing
			READ_TEMPERATURE_X with UT_WARN_LIMIT if
			TEMP_UT_WARNING status is set.
tempX_max_alarm		Chip temperature high alarm. Set by comparing
			READ_TEMPERATURE_X with OT_WARN_LIMIT if
			TEMP_OT_WARNING status is set.
tempX_lcrit_alarm	Chip temperature critical low alarm. Set by comparing
			READ_TEMPERATURE_X with UT_FAULT_LIMIT if
			TEMP_UT_FAULT status is set.
tempX_crit_alarm	Chip temperature critical high alarm. Set by comparing
			READ_TEMPERATURE_X with OT_FAULT_LIMIT if
			TEMP_OT_FAULT status is set.