Skip to content

Commit ca32f70

Browse files
committed
hwmon: pmbus : adp1051 and adp1055: Add driver support
ADP1051: 6 PWM for I/O Voltage, I/O Current, Temperature ADP1055: 6 PWM for I/O Voltage, I/O Current, Power, Temperature Signed-off-by: Alexis Torreno <[email protected]>
1 parent 9f4b738 commit ca32f70

File tree

2 files changed

+105
-14
lines changed

2 files changed

+105
-14
lines changed

Documentation/hwmon/adp1050.rst

+49-5
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,33 @@ Supported chips:
1313

1414
Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ADP1050.pdf
1515

16+
* Analog Devices ADP1051
17+
18+
Prefix: 'adp1051'
19+
20+
Addresses scanned: I2C 0x70 - 0x77
21+
22+
Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ADP1051.pdf
23+
24+
* Analog Devices ADP1055
25+
26+
Prefix: 'adp1055'
27+
28+
Addresses scanned: I2C 0x4B - 0x77
29+
30+
Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ADP1055.pdf
31+
1632
Authors:
1733

1834
- Radu Sabau <[email protected]>
1935

20-
2136
Description
2237
-----------
2338

24-
This driver supprts hardware monitoring for Analog Devices ADP1050 Digital
25-
Controller for Isolated Power Supply with PMBus interface.
39+
This driver supports hardware monitoring for Analog Devices ADP1050, ADP1051, and
40+
ADP1055 Digital Controller for Isolated Power Supply with PMBus interface.
2641

27-
The ADP1050 is an advanced digital controller with a PMBus™
42+
The ADP105X is an advanced digital controller with a PMBus™
2843
interface targeting high density, high efficiency dc-to-dc power
2944
conversion used to monitor system temperatures, voltages and currents.
3045
Through the PMBus interface, the device can monitor input/output voltages,
@@ -49,16 +64,45 @@ Sysfs Attributes
4964
in1_label "vin"
5065
in1_input Measured input voltage
5166
in1_alarm Input voltage alarm
67+
in1_crit Critical maximum input voltage
68+
in1_crit_alarm Input voltage high alarm
69+
in1_lcrit Critical minimum input voltage
70+
in1_lcrit_alarm Input voltage critical low alarm
5271
in2_label "vout1"
5372
in2_input Measured output voltage
5473
in2_crit Critical maximum output voltage
5574
in2_crit_alarm Output voltage high alarm
5675
in2_lcrit Critical minimum output voltage
5776
in2_lcrit_alarm Output voltage critical low alarm
77+
in2_max Critical maximum output voltage
78+
in2_max_alarm Output voltage critical max alarm
79+
in2_min Critical minimum output voltage
80+
in2_min_alarm Output voltage critical min alarm
5881
curr1_label "iin"
59-
curr1_input Measured input current.
82+
curr1_input Measured input current
6083
curr1_alarm Input current alarm
84+
curr1_crit Critical maximum input current
85+
curr1_crit_alarm Input current high alarm
86+
curr2_label "iout1"
87+
curr2_input Measured output current
88+
curr2_crit Critical maximum output current
89+
curr2_crit_alarm Output current high alarm
90+
curr2_lcrit Critical minimum output current
91+
curr2_lcrit_alarm Output current critical low alarm
92+
curr2_max Critical maximum output current
93+
curr2_max_alarm Output current critical max alarm
94+
power1_label "pout1"
95+
power1_input Measured output power
96+
power1_crit Critical maximum output power
97+
power1_crit_alarm Output power high alarm
6198
temp1_input Measured temperature
6299
temp1_crit Critical high temperature
63100
temp1_crit_alarm Chip temperature critical high alarm
101+
temp1_max Critical maximum temperature
102+
temp1_max_alarm Temperature critical max alarm
103+
temp2_input Measured temperature
104+
temp2_crit Critical high temperature
105+
temp2_crit_alarm Chip temperature critical high alarm
106+
temp2_max Critical maximum temperature
107+
temp2_max_alarm Temperature critical max alarm
64108
================= ========================================

drivers/hwmon/pmbus/adp1050.c

+56-9
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,80 @@
1111

1212
#include "pmbus.h"
1313

14+
enum ADP1050_type {
15+
ADP1050,
16+
ADP1051,
17+
ADP1055,
18+
};
19+
1420
static struct pmbus_driver_info adp1050_info = {
1521
.pages = 1,
1622
.format[PSC_VOLTAGE_IN] = linear,
1723
.format[PSC_VOLTAGE_OUT] = linear,
1824
.format[PSC_CURRENT_IN] = linear,
1925
.format[PSC_TEMPERATURE] = linear,
2026
.func[0] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
21-
| PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT
22-
| PMBUS_HAVE_IIN | PMBUS_HAVE_TEMP
23-
| PMBUS_HAVE_STATUS_TEMP,
27+
| PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT
28+
| PMBUS_HAVE_IIN | PMBUS_HAVE_TEMP
29+
| PMBUS_HAVE_STATUS_TEMP,
30+
};
31+
32+
static struct pmbus_driver_info adp1051_info = {
33+
.pages = 1,
34+
.format[PSC_VOLTAGE_IN] = linear,
35+
.format[PSC_VOLTAGE_OUT] = linear,
36+
.format[PSC_CURRENT_IN] = linear,
37+
.format[PSC_TEMPERATURE] = linear,
38+
.func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_IIN | PMBUS_HAVE_VOUT
39+
| PMBUS_HAVE_IOUT | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_VOUT
40+
| PMBUS_HAVE_STATUS_IOUT | PMBUS_HAVE_STATUS_INPUT
41+
| PMBUS_HAVE_STATUS_TEMP,
2442
};
2543

26-
/* 6.1 probe() function still uses the second struct i2c_device_id argument */
27-
static int adp1050_probe(struct i2c_client *client,
28-
const struct i2c_device_id *id)
44+
static struct pmbus_driver_info adp1055_info = {
45+
.pages = 1,
46+
.format[PSC_VOLTAGE_IN] = linear,
47+
.format[PSC_VOLTAGE_OUT] = linear,
48+
.format[PSC_CURRENT_IN] = linear,
49+
.format[PSC_TEMPERATURE] = linear,
50+
.func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_IIN | PMBUS_HAVE_VOUT
51+
| PMBUS_HAVE_IOUT | PMBUS_HAVE_TEMP2 | PMBUS_HAVE_TEMP3
52+
| PMBUS_HAVE_POUT | PMBUS_HAVE_STATUS_VOUT
53+
| PMBUS_HAVE_STATUS_IOUT | PMBUS_HAVE_STATUS_INPUT
54+
| PMBUS_HAVE_STATUS_TEMP,
55+
};
56+
57+
static int adp1050_probe(struct i2c_client *client)
2958
{
30-
return pmbus_do_probe(client, &adp1050_info);
59+
enum ADP1050_type type;
60+
61+
type = (enum ADP1050_type)(uintptr_t)device_get_match_data(&client->dev);
62+
63+
switch (type) {
64+
case ADP1050:
65+
return pmbus_do_probe(client, &adp1050_info);
66+
case ADP1051:
67+
return pmbus_do_probe(client, &adp1051_info);
68+
case ADP1055:
69+
return pmbus_do_probe(client, &adp1055_info);
70+
default:
71+
return -EINVAL;
72+
}
3173
}
3274

3375
static const struct i2c_device_id adp1050_id[] = {
34-
{"adp1050", 0},
76+
{"adp1050", ADP1050},
77+
{"adp1051", ADP1051},
78+
{"adp1055", ADP1055},
3579
{}
3680
};
81+
3782
MODULE_DEVICE_TABLE(i2c, adp1050_id);
3883

3984
static const struct of_device_id adp1050_of_match[] = {
40-
{ .compatible = "adi,adp1050"},
85+
{ .compatible = "adi,adp1050", .data = (void *)ADP1050},
86+
{ .compatible = "adi,adp1051", .data = (void *)ADP1051},
87+
{ .compatible = "adi,adp1055", .data = (void *)ADP1055},
4188
{}
4289
};
4390
MODULE_DEVICE_TABLE(of, adp1050_of_match);

0 commit comments

Comments
 (0)