Skip to content

Commit 04f1759

Browse files
RaduSabau1groeck
authored andcommitted
hwmon: (pmbus) Add driver for ADP1050
Add support for ADP1050 Digital Controller for Isolated Power Supplies with PMBus interface Voltage, Current and Temperature Monitor. The ADP1050 implements several features to enable a robust system of parallel and redundant operation for customers who require high availability. The device can measure voltage, current and temperature that can be used in different techniques to identify and safely shut down an erroneous power supply in parallel operation mode. Signed-off-by: Radu Sabau <radu.sabau@analog.com> Link: https://lore.kernel.org/r/20240321142201.10330-2-radu.sabau@analog.com [groeck: Fixed corrupted link in documentation] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
1 parent 3bf88a2 commit 04f1759

File tree

5 files changed

+134
-0
lines changed

5 files changed

+134
-0
lines changed

Documentation/hwmon/adp1050.rst

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
.. SPDX-License-Identifier: GPL-2.0
2+
3+
Kernel driver adp1050
4+
=====================
5+
6+
Supported chips:
7+
8+
* Analog Devices ADP1050
9+
10+
Prefix: 'adp1050'
11+
12+
Addresses scanned: I2C 0x70 - 0x77
13+
14+
Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ADP1050.pdf
15+
16+
Authors:
17+
18+
- Radu Sabau <radu.sabau@analog.com>
19+
20+
21+
Description
22+
-----------
23+
24+
This driver supprts hardware monitoring for Analog Devices ADP1050 Digital
25+
Controller for Isolated Power Supply with PMBus interface.
26+
27+
The ADP1050 is an advanced digital controller with a PMBus™
28+
interface targeting high density, high efficiency dc-to-dc power
29+
conversion used to monitor system temperatures, voltages and currents.
30+
Through the PMBus interface, the device can monitor input/output voltages,
31+
input current and temperature.
32+
33+
Usage Notes
34+
-----------
35+
36+
This driver does not auto-detect devices. You will have to instantiate
37+
the devices explicitly.
38+
Please see Documentation/i2c/instantiating-devices.rst for details.
39+
40+
Platform data support
41+
---------------------
42+
43+
The driver supports standard PMBus driver platform data.
44+
45+
Sysfs Attributes
46+
----------------
47+
48+
================= ========================================
49+
in1_label "vin"
50+
in1_input Measured input voltage
51+
in1_alarm Input voltage alarm
52+
in2_label "vout1"
53+
in2_input Measured output voltage
54+
in2_crit Critical maximum output voltage
55+
in2_crit_alarm Output voltage high alarm
56+
in2_lcrit Critical minimum output voltage
57+
in2_lcrit_alarm Output voltage critical low alarm
58+
curr1_label "iin"
59+
curr1_input Measured input current.
60+
curr1_alarm Input current alarm
61+
temp1_input Measured temperature
62+
temp1_crit Critical high temperature
63+
temp1_crit_alarm Chip temperature critical high alarm
64+
================= ========================================

Documentation/hwmon/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Hardware Monitoring Kernel Drivers
3333
adm1266
3434
adm1275
3535
adm9240
36+
adp1050
3637
ads7828
3738
adt7410
3839
adt7411

drivers/hwmon/pmbus/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@ config SENSORS_ADM1275
5757
This driver can also be built as a module. If so, the module will
5858
be called adm1275.
5959

60+
config SENSORS_ADP1050
61+
tristate "Analog Devices ADP1050 digital controller for Power Supplies"
62+
help
63+
If you say yes here you get hardware monitoring support for Analog
64+
Devices ADP1050 digital controller for isolated power supply with
65+
PMBus interface.
66+
67+
This driver can also be built as a module. If so, the module will
68+
be called adp1050.
69+
6070
config SENSORS_BEL_PFE
6171
tristate "Bel PFE Compatible Power Supplies"
6272
help

drivers/hwmon/pmbus/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ obj-$(CONFIG_SENSORS_PMBUS) += pmbus.o
88
obj-$(CONFIG_SENSORS_ACBEL_FSG032) += acbel-fsg032.o
99
obj-$(CONFIG_SENSORS_ADM1266) += adm1266.o
1010
obj-$(CONFIG_SENSORS_ADM1275) += adm1275.o
11+
obj-$(CONFIG_SENSORS_ADP1050) += adp1050.o
1112
obj-$(CONFIG_SENSORS_BEL_PFE) += bel-pfe.o
1213
obj-$(CONFIG_SENSORS_BPA_RS600) += bpa-rs600.o
1314
obj-$(CONFIG_SENSORS_DELTA_AHE50DC_FAN) += delta-ahe50dc-fan.o

drivers/hwmon/pmbus/adp1050.c

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
/*
3+
* Hardware monitoring driver for Analog Devices ADP1050
4+
*
5+
* Copyright (C) 2024 Analog Devices, Inc.
6+
*/
7+
#include <linux/bits.h>
8+
#include <linux/err.h>
9+
#include <linux/i2c.h>
10+
#include <linux/init.h>
11+
#include <linux/kernel.h>
12+
#include <linux/module.h>
13+
#include <linux/of.h>
14+
#include "pmbus.h"
15+
16+
static struct pmbus_driver_info adp1050_info = {
17+
.pages = 1,
18+
.format[PSC_VOLTAGE_IN] = linear,
19+
.format[PSC_VOLTAGE_OUT] = linear,
20+
.format[PSC_CURRENT_IN] = linear,
21+
.format[PSC_TEMPERATURE] = linear,
22+
.func[0] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
23+
| PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT
24+
| PMBUS_HAVE_IIN | PMBUS_HAVE_TEMP
25+
| PMBUS_HAVE_STATUS_TEMP,
26+
};
27+
28+
static int adp1050_probe(struct i2c_client *client)
29+
{
30+
return pmbus_do_probe(client, &adp1050_info);
31+
}
32+
33+
static const struct i2c_device_id adp1050_id[] = {
34+
{"adp1050", 0},
35+
{}
36+
};
37+
MODULE_DEVICE_TABLE(i2c, adp1050_id);
38+
39+
static const struct of_device_id adp1050_of_match[] = {
40+
{ .compatible = "adi,adp1050"},
41+
{}
42+
};
43+
MODULE_DEVICE_TABLE(of, adp1050_of_match);
44+
45+
static struct i2c_driver adp1050_driver = {
46+
.driver = {
47+
.name = "adp1050",
48+
.of_match_table = adp1050_of_match,
49+
},
50+
.probe = adp1050_probe,
51+
.id_table = adp1050_id,
52+
};
53+
module_i2c_driver(adp1050_driver);
54+
55+
MODULE_AUTHOR("Radu Sabau <radu.sabau@analog.com>");
56+
MODULE_DESCRIPTION("Analog Devices ADP1050 HWMON PMBus Driver");
57+
MODULE_LICENSE("GPL");
58+
MODULE_IMPORT_NS(PMBUS);

0 commit comments

Comments
 (0)