Skip to content

Commit 0ee7f62

Browse files
PatrickRudolphgroeck
authored andcommitted
hwmon/pmbus: (ir38064) Expose a regulator
The chip series supported by this driver are voltage regulators, so expose them to the regulator subsystem. Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Link: https://lore.kernel.org/r/20211213142814.264802-4-arthur.heymans@9elements.com [groeck: Added brief patch description] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
1 parent e65de22 commit 0ee7f62

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

drivers/hwmon/pmbus/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@ config SENSORS_IR38064
141141
This driver can also be built as a module. If so, the module will
142142
be called ir38064.
143143

144+
config SENSORS_IR38064_REGULATOR
145+
bool "Regulator support for IR38064 and compatibles"
146+
depends on SENSORS_IR38064 && REGULATOR
147+
help
148+
Uses the IR38064 or compatible as regulator.
149+
144150
config SENSORS_IRPS5401
145151
tristate "Infineon IRPS5401"
146152
help

drivers/hwmon/pmbus/ir38064.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,15 @@
1717
#include <linux/kernel.h>
1818
#include <linux/module.h>
1919
#include <linux/of_device.h>
20+
#include <linux/regulator/driver.h>
2021
#include "pmbus.h"
2122

23+
#if IS_ENABLED(CONFIG_SENSORS_IR38064_REGULATOR)
24+
static const struct regulator_desc ir38064_reg_desc[] = {
25+
PMBUS_REGULATOR("vout", 0),
26+
};
27+
#endif /* CONFIG_SENSORS_IR38064_REGULATOR */
28+
2229
static struct pmbus_driver_info ir38064_info = {
2330
.pages = 1,
2431
.format[PSC_VOLTAGE_IN] = linear,
@@ -34,6 +41,10 @@ static struct pmbus_driver_info ir38064_info = {
3441
| PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
3542
| PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT
3643
| PMBUS_HAVE_POUT,
44+
#if IS_ENABLED(CONFIG_SENSORS_IR38064_REGULATOR)
45+
.num_regulators = 1,
46+
.reg_desc = ir38064_reg_desc,
47+
#endif
3748
};
3849

3950
static int ir38064_probe(struct i2c_client *client)

0 commit comments

Comments
 (0)