Skip to content

Commit c3062cc

Browse files
committed
hwmon: (pmbus/max17616): add driver for max17616
Add support for the Analog Devices MAX17616/MAX17616A Current-Limiter with Overvoltage/Surge, Undervoltage, Reverse Polarity, Loss of Ground Protection with PMBus Interface. The PMBus interface allows monitoring of input/output voltages, output current and temperature. Signed-off-by: Kim Seer Paller <kimseer.paller@analog.com>
1 parent aeeb94e commit c3062cc

File tree

6 files changed

+162
-0
lines changed

6 files changed

+162
-0
lines changed

Documentation/hwmon/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ Hardware Monitoring Kernel Drivers
143143
max1619
144144
max16601
145145
max1668
146+
max17616
146147
max197
147148
max20730
148149
max20751

Documentation/hwmon/max17616.rst

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
.. SPDX-License-Identifier: GPL-2.0
2+
3+
Kernel driver max17616
4+
====================
5+
6+
Supported chips:
7+
8+
* Analog Devices MAX17616/MAX17616A
9+
10+
Prefix: 'max17616'
11+
12+
Addresses scanned: -
13+
14+
Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/max17616-max17616a.pdf
15+
16+
Authors: Kim Seer Paller <kimseer.paller@analog.com>
17+
18+
19+
Description
20+
-----------
21+
22+
This driver supports hardware monitoring for Analog Devices MAX17616/MAX17616A
23+
Current-Limiter with OV/Surge, UV, Reverse Polarity, Loss of Ground Protection
24+
with PMBus Interface.
25+
26+
The MAX17616/MAX17616A is a 3V to 80V, 7A current-limiter with overvoltage,
27+
surge, undervoltage, reverse polarity, and loss of ground protection. Through
28+
the PMBus interface, the device can monitor input/output voltages, output current
29+
and temperature.
30+
31+
The driver is a client driver to the core PMBus driver. Please see
32+
Documentation/hwmon/pmbus.rst for details on PMBus client drivers.
33+
34+
Usage Notes
35+
-----------
36+
37+
This driver does not auto-detect devices. You will have to instantiate
38+
the devices explicitly. Please see Documentation/i2c/instantiating-devices.rst
39+
for details.
40+
41+
Platform data support
42+
---------------------
43+
44+
The driver supports standard PMBus driver platform data.
45+
46+
Sysfs entries
47+
-------------
48+
49+
================= ========================================
50+
in1_label "vin"
51+
in1_input Measured input voltage
52+
in1_alarm Input voltage alarm
53+
in2_label "vout1"
54+
in2_input Measured output voltage
55+
curr1_label "iout1"
56+
curr1_input Measured output current.
57+
curr1_alarm Output current alarm
58+
temp1_input Measured temperature
59+
temp1_alarm Chip temperature alarm
60+
================= ========================================

MAINTAINERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14032,6 +14032,8 @@ L: linux-hwmon@vger.kernel.org
1403214032
S: Supported
1403314033
W: https://ez.analog.com/linux-software-drivers
1403414034
F: Documentation/devicetree/bindings/hwmon/pmbus/adi,max17616.yaml
14035+
F: Documentation/hwmon/max17616.rst
14036+
F: drivers/hwmon/pmbus/max17616.c
1403514037

1403614038
MAX2175 SDR TUNER DRIVER
1403714039
M: Ramesh Shanmugasundaram <rashanmu@gmail.com>

drivers/hwmon/pmbus/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,15 @@ config SENSORS_MAX16601
292292
This driver can also be built as a module. If so, the module will
293293
be called max16601.
294294

295+
config SENSORS_MAX17616
296+
tristate "Analog Devices MAX17616/MAX17616A"
297+
help
298+
If you say yes here you get hardware monitoring support for Analog
299+
Devices MAX17616/MAX17616A.
300+
301+
This driver can also be built as a module. If so, the module will
302+
be called max17616.
303+
295304
config SENSORS_MAX20730
296305
tristate "Maxim MAX20710, MAX20730, MAX20734, MAX20743"
297306
help

drivers/hwmon/pmbus/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ obj-$(CONFIG_SENSORS_LTC4286) += ltc4286.o
3030
obj-$(CONFIG_SENSORS_MAX15301) += max15301.o
3131
obj-$(CONFIG_SENSORS_MAX16064) += max16064.o
3232
obj-$(CONFIG_SENSORS_MAX16601) += max16601.o
33+
obj-$(CONFIG_SENSORS_MAX17616) += max17616.o
3334
obj-$(CONFIG_SENSORS_MAX20730) += max20730.o
3435
obj-$(CONFIG_SENSORS_MAX20751) += max20751.o
3536
obj-$(CONFIG_SENSORS_MAX31785) += max31785.o

drivers/hwmon/pmbus/max17616.c

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
/*
3+
* Hardware monitoring driver for Analog Devices MAX17616/MAX17616A
4+
*
5+
* Copyright (C) 2025 Analog Devices, Inc.
6+
*/
7+
8+
#include <linux/err.h>
9+
#include <linux/i2c.h>
10+
#include <linux/mod_devicetable.h>
11+
#include <linux/module.h>
12+
13+
#include "pmbus.h"
14+
15+
static struct pmbus_driver_info max17616_info = {
16+
.pages = 1,
17+
.format[PSC_VOLTAGE_IN] = direct,
18+
.m[PSC_VOLTAGE_IN] = 512,
19+
.b[PSC_VOLTAGE_IN] = -18,
20+
.R[PSC_VOLTAGE_IN] = -1,
21+
22+
.format[PSC_VOLTAGE_OUT] = direct,
23+
.m[PSC_VOLTAGE_OUT] = 512,
24+
.b[PSC_VOLTAGE_OUT] = -18,
25+
.R[PSC_VOLTAGE_OUT] = -1,
26+
27+
.format[PSC_CURRENT_OUT] = direct,
28+
.m[PSC_CURRENT_OUT] = 5845,
29+
.b[PSC_CURRENT_OUT] = 80,
30+
.R[PSC_CURRENT_OUT] = -1,
31+
32+
.format[PSC_TEMPERATURE] = direct,
33+
.m[PSC_TEMPERATURE] = 71,
34+
.b[PSC_TEMPERATURE] = 19653,
35+
.R[PSC_TEMPERATURE] = -1,
36+
37+
.func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_VOUT | PMBUS_HAVE_IOUT |
38+
PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_VOUT |
39+
PMBUS_HAVE_STATUS_IOUT | PMBUS_HAVE_STATUS_INPUT |
40+
PMBUS_HAVE_STATUS_TEMP,
41+
};
42+
43+
static int max17616_probe(struct i2c_client *client)
44+
{
45+
struct device *dev = &client->dev;
46+
u8 buf[I2C_SMBUS_BLOCK_MAX];
47+
int ret;
48+
49+
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_I2C_BLOCK))
50+
return -ENODEV;
51+
52+
ret = i2c_smbus_read_i2c_block_data(client, PMBUS_MFR_MODEL, sizeof(buf), buf);
53+
if (ret < 0)
54+
return dev_err_probe(dev, ret, "Failed to read MFR_MODEL\n");
55+
56+
if ((strncmp(buf + 1, "MAX17616", 8) && strncmp(buf + 1, "MAX17616A", 9)))
57+
return dev_err_probe(dev, -ENODEV, "Unsupported device\n");
58+
59+
return pmbus_do_probe(client, &max17616_info);
60+
}
61+
62+
static const struct i2c_device_id max17616_id[] = {
63+
{ "max17616" },
64+
{ "max17616a" },
65+
{ }
66+
};
67+
MODULE_DEVICE_TABLE(i2c, max17616_id);
68+
69+
static const struct of_device_id __maybe_unused max17616_of_match[] = {
70+
{ .compatible = "adi,max17616" },
71+
{ .compatible = "adi,max17616a" },
72+
{ }
73+
};
74+
MODULE_DEVICE_TABLE(of, max17616_of_match);
75+
76+
static struct i2c_driver max17616_driver = {
77+
.driver = {
78+
.name = "max17616",
79+
.of_match_table = of_match_ptr(max17616_of_match),
80+
},
81+
.probe = max17616_probe,
82+
.id_table = max17616_id,
83+
};
84+
module_i2c_driver(max17616_driver);
85+
86+
MODULE_AUTHOR("Kim Seer Paller <kim.seer.paller@analog.com>");
87+
MODULE_DESCRIPTION("PMBus driver for Analog Devices MAX17616/MAX17616A");
88+
MODULE_LICENSE("GPL");
89+
MODULE_IMPORT_NS(PMBUS);

0 commit comments

Comments
 (0)