Skip to content

Commit 32489f5

Browse files
cencarnanunojsa
authored andcommitted
hwmon: (pmbus/lt3074) add support for lt3074
Add hardware monitoring and regulator support for LT3074. The LT3074 is an ultrafast, ultralow noise 3A, 5.5V dropout linear regulator. The PMBus serial interface allows telemetry for input/output voltage, bias voltage, output current, and die temperature. Signed-off-by: Cedric Encarnacion <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
1 parent b338911 commit 32489f5

File tree

6 files changed

+216
-0
lines changed

6 files changed

+216
-0
lines changed

Documentation/hwmon/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ Hardware Monitoring Kernel Drivers
115115
lm95234
116116
lm95245
117117
lochnagar
118+
lt3074
118119
lt7182s
119120
ltc2992
120121
ltc2945

Documentation/hwmon/lt3074.rst

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
.. SPDX-License-Identifier: GPL-2.0
2+
3+
Kernel driver lt3074
4+
====================
5+
6+
Supported chips:
7+
8+
* Analog Devices LT3074
9+
10+
Prefix: 'lt3074'
11+
12+
Addresses scanned: -
13+
14+
Datasheet: https://www.analog.com/en/products/lt3074.html
15+
16+
Authors: Cedric Encarnacion <[email protected]>
17+
18+
19+
Description
20+
-----------
21+
22+
This driver supports hardware monitoring for Analog Devices LT3074 Linear
23+
Regulator with PMBus interface.
24+
25+
The LT3074 is a low voltage, ultra-low noise and ultra-fast transient
26+
response linear regulator with PMBus serial interface. PMBus telemetry
27+
feature provides information regarding the output voltage and current,
28+
input voltage, bias voltage and die temperature.
29+
30+
The driver is a client driver to the core PMBus driver. Please see
31+
Documentation/hwmon/pmbus.rst for details on PMBus client drivers.
32+
33+
Usage Notes
34+
-----------
35+
36+
This driver does not auto-detect devices. You will have to instantiate
37+
the devices explicitly. Please see Documentation/i2c/instantiating-devices.rst
38+
for details.
39+
40+
Platform data support
41+
---------------------
42+
43+
The driver supports standard PMBus driver platform data.
44+
45+
Sysfs entries
46+
-------------
47+
48+
======================= =======================================================
49+
in1_label "vin"
50+
in1_input Measured input voltage
51+
in1_max Input overvoltage warning limit
52+
in1_max_alarm Input overvoltage warning status
53+
in1_min Input undervoltage warning limit
54+
in1_min_alarm Input undervoltage warning status
55+
in2_label "vmon"
56+
in2_input Measured bias voltage
57+
in2_max Bias overvoltage warning limit
58+
in2_min Bias undervoltage warning limit
59+
in3_label "vout1"
60+
in3_input Measured output voltage
61+
in3_max Output overvoltage warning limit
62+
in3_max_alarm Output overvoltage warning status
63+
in3_min Output undervoltage warning limit
64+
in3_min_alarm Output undervoltage warning status
65+
curr1_label "iout1"
66+
curr1_input Measured output current.
67+
curr1_crit Output overcurrent fault limit
68+
curr1_crit_alarm Output overcurrent fault status
69+
temp1_input Measured temperature
70+
temp1_max Maximum temperature limit
71+
temp1_max_alarm Overtemperature warning status
72+
======================= =======================================================

MAINTAINERS

+2
Original file line numberDiff line numberDiff line change
@@ -12632,6 +12632,8 @@ L: [email protected]
1263212632
S: Supported
1263312633
W: https://ez.analog.com/linux-software-drivers
1263412634
F: Documentation/devicetree/bindings/hwmon/pmbus/adi,lt3074.yaml
12635+
F: Documentation/hwmon/lt3074.rst
12636+
F: drivers/hwmon/pmbus/lt3074.c
1263512637

1263612638
LTC1660 DAC DRIVER
1263712639
M: Marcus Folkesson <[email protected]>

drivers/hwmon/pmbus/Kconfig

+18
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,24 @@ config SENSORS_LM25066_REGULATOR
200200
If you say yes here you get regulator support for National
201201
Semiconductor LM25066, LM5064, and LM5066.
202202

203+
config SENSORS_LT3074
204+
tristate "Analog Devices LT3074"
205+
help
206+
If you say yes here you get hardware monitoring support for Analog
207+
Devices LT3074.
208+
209+
This driver can also be built as a module. If so, the module will
210+
be called lt3074.
211+
212+
config SENSORS_LT3074_REGULATOR
213+
tristate "Regulator support for LT3074"
214+
depends on SENSORS_LT3074 && REGULATOR
215+
help
216+
If you say yes here you get regulator support for Analog Devices
217+
LT3074. The LT3074 is a low voltage, ultralow noise, high PSRR,
218+
dropout linear regulator. The device supplies up to 3A with a
219+
typical dropout voltage of 45mV.
220+
203221
config SENSORS_LT7182S
204222
tristate "Analog Devices LT7182S"
205223
help

drivers/hwmon/pmbus/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ obj-$(CONFIG_SENSORS_IR38064) += ir38064.o
2222
obj-$(CONFIG_SENSORS_IRPS5401) += irps5401.o
2323
obj-$(CONFIG_SENSORS_ISL68137) += isl68137.o
2424
obj-$(CONFIG_SENSORS_LM25066) += lm25066.o
25+
obj-$(CONFIG_SENSORS_LT3074) += lt3074.o
2526
obj-$(CONFIG_SENSORS_LT7182S) += lt7182s.o
2627
obj-$(CONFIG_SENSORS_LTC2978) += ltc2978.o
2728
obj-$(CONFIG_SENSORS_LTC3815) += ltc3815.o

drivers/hwmon/pmbus/lt3074.c

+122
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
/*
3+
* Hardware monitoring driver for Analog Devices LT3074
4+
*
5+
* Copyright (C) 2025 Analog Devices, Inc.
6+
*/
7+
#include <linux/err.h>
8+
#include <linux/i2c.h>
9+
#include <linux/mod_devicetable.h>
10+
#include <linux/module.h>
11+
12+
#include "pmbus.h"
13+
14+
#define LT3074_MFR_READ_VBIAS 0xc6
15+
#define LT3074_MFR_BIAS_OV_WARN_LIMIT 0xc7
16+
#define LT3074_MFR_BIAS_UV_WARN_LIMIT 0xc8
17+
#define LT3074_MFR_SPECIAL_ID 0xe7
18+
19+
#define LT3074_SPECIAL_ID_VALUE 0x1c1d
20+
21+
static const struct regulator_desc __maybe_unused lt3074_reg_desc[] = {
22+
PMBUS_REGULATOR("vout", 0),
23+
};
24+
25+
static int lt3074_read_word_data(struct i2c_client *client, int page,
26+
int phase, int reg)
27+
{
28+
switch (reg) {
29+
case PMBUS_VIRT_READ_VMON:
30+
return pmbus_read_word_data(client, page, phase,
31+
LT3074_MFR_READ_VBIAS);
32+
case PMBUS_VIRT_VMON_UV_WARN_LIMIT:
33+
return pmbus_read_word_data(client, page, phase,
34+
LT3074_MFR_BIAS_UV_WARN_LIMIT);
35+
case PMBUS_VIRT_VMON_OV_WARN_LIMIT:
36+
return pmbus_read_word_data(client, page, phase,
37+
LT3074_MFR_BIAS_OV_WARN_LIMIT);
38+
default:
39+
return -ENODATA;
40+
}
41+
}
42+
43+
static int lt3074_write_word_data(struct i2c_client *client, int page,
44+
int reg, u16 word)
45+
{
46+
switch (reg) {
47+
case PMBUS_VIRT_VMON_UV_WARN_LIMIT:
48+
return pmbus_write_word_data(client, 0,
49+
LT3074_MFR_BIAS_UV_WARN_LIMIT,
50+
word);
51+
case PMBUS_VIRT_VMON_OV_WARN_LIMIT:
52+
return pmbus_write_word_data(client, 0,
53+
LT3074_MFR_BIAS_OV_WARN_LIMIT,
54+
word);
55+
default:
56+
return -ENODATA;
57+
}
58+
}
59+
60+
static struct pmbus_driver_info lt3074_info = {
61+
.pages = 1,
62+
.format[PSC_VOLTAGE_IN] = linear,
63+
.format[PSC_VOLTAGE_OUT] = linear,
64+
.format[PSC_CURRENT_OUT] = linear,
65+
.format[PSC_TEMPERATURE] = linear,
66+
.func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_VOUT | PMBUS_HAVE_IOUT |
67+
PMBUS_HAVE_TEMP | PMBUS_HAVE_VMON |
68+
PMBUS_HAVE_STATUS_VOUT | PMBUS_HAVE_STATUS_IOUT |
69+
PMBUS_HAVE_STATUS_INPUT | PMBUS_HAVE_STATUS_TEMP,
70+
.read_word_data = lt3074_read_word_data,
71+
.write_word_data = lt3074_write_word_data,
72+
#if IS_ENABLED(CONFIG_SENSORS_LT3074_REGULATOR)
73+
.num_regulators = 1,
74+
.reg_desc = lt3074_reg_desc,
75+
#endif
76+
};
77+
78+
static int lt3074_probe(struct i2c_client *client)
79+
{
80+
int ret;
81+
struct device *dev = &client->dev;
82+
83+
if (!i2c_check_functionality(client->adapter,
84+
I2C_FUNC_SMBUS_READ_WORD_DATA))
85+
return -ENODEV;
86+
87+
ret = i2c_smbus_read_word_data(client, LT3074_MFR_SPECIAL_ID);
88+
if (ret < 0)
89+
return dev_err_probe(dev, ret, "Failed to read ID\n");
90+
91+
if (ret != LT3074_SPECIAL_ID_VALUE)
92+
return dev_err_probe(dev, -ENODEV, "ID mismatch\n");
93+
94+
return pmbus_do_probe(client, &lt3074_info);
95+
}
96+
97+
static const struct i2c_device_id lt3074_id[] = {
98+
{ "lt3074", 0 },
99+
{}
100+
};
101+
MODULE_DEVICE_TABLE(i2c, lt3074_id);
102+
103+
static const struct of_device_id __maybe_unused lt3074_of_match[] = {
104+
{ .compatible = "adi,lt3074" },
105+
{}
106+
};
107+
MODULE_DEVICE_TABLE(of, lt3074_of_match);
108+
109+
static struct i2c_driver lt3074_driver = {
110+
.driver = {
111+
.name = "lt3074",
112+
.of_match_table = of_match_ptr(lt3074_of_match),
113+
},
114+
.probe = lt3074_probe,
115+
.id_table = lt3074_id,
116+
};
117+
module_i2c_driver(lt3074_driver);
118+
119+
MODULE_AUTHOR("Cedric Encarnacion <[email protected]>");
120+
MODULE_DESCRIPTION("PMBus driver for Analog Devices LT3074");
121+
MODULE_LICENSE("GPL");
122+
MODULE_IMPORT_NS("PMBUS");

0 commit comments

Comments
 (0)