diff options
author | Patrick Rudolph <patrick.rudolph@9elements.com> | 2023-07-14 16:51:15 +0300 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2023-08-21 16:04:30 +0300 |
commit | 88fc1efcd45c3f681740659a1483978e7553ade7 (patch) | |
tree | 9a9f07597803af4d60b94719eed9a2b4e128d007 /drivers/hwmon/pmbus/mp2975.c | |
parent | 5239277ef41086cf4173c62de2fe3dda2cd9c777 (diff) | |
download | linux-88fc1efcd45c3f681740659a1483978e7553ade7.tar.xz |
hwmon: (pmbus/mp2975) Add regulator support
Add support to expose the PMBUS regulator.
Tested on MP2973 and MP2971.
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Signed-off-by: Naresh Solanki <Naresh.Solanki@9elements.com>
Link: https://lore.kernel.org/r/20230714135124.2645339-7-Naresh.Solanki@9elements.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/pmbus/mp2975.c')
-rw-r--r-- | drivers/hwmon/pmbus/mp2975.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/hwmon/pmbus/mp2975.c b/drivers/hwmon/pmbus/mp2975.c index 634369ebec43..5fb21b9f4ab3 100644 --- a/drivers/hwmon/pmbus/mp2975.c +++ b/drivers/hwmon/pmbus/mp2975.c @@ -115,6 +115,11 @@ static const struct i2c_device_id mp2975_id[] = { MODULE_DEVICE_TABLE(i2c, mp2975_id); +static const struct regulator_desc __maybe_unused mp2975_reg_desc[] = { + PMBUS_REGULATOR("vout", 0), + PMBUS_REGULATOR("vout", 1), +}; + #define to_mp2975_data(x) container_of(x, struct mp2975_data, info) static int @@ -806,6 +811,10 @@ static struct pmbus_driver_info mp2975_info = { PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP | PMBUS_HAVE_POUT | PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT | PMBUS_PHASE_VIRTUAL, .read_word_data = mp2975_read_word_data, +#if IS_ENABLED(CONFIG_SENSORS_MP2975_REGULATOR) + .num_regulators = 1, + .reg_desc = mp2975_reg_desc, +#endif }; static struct pmbus_driver_info mp2973_info = { @@ -823,6 +832,10 @@ static struct pmbus_driver_info mp2973_info = { PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP | PMBUS_HAVE_POUT | PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT, .read_word_data = mp2973_read_word_data, +#if IS_ENABLED(CONFIG_SENSORS_MP2975_REGULATOR) + .num_regulators = 1, + .reg_desc = mp2975_reg_desc, +#endif }; static int mp2975_probe(struct i2c_client *client) @@ -861,6 +874,8 @@ static int mp2975_probe(struct i2c_client *client) data->info.pages = MP2975_PAGE_NUM; data->info.phases[1] = ret; data->info.func[1] = MP2975_RAIL2_FUNC; + if (IS_ENABLED(CONFIG_SENSORS_MP2975_REGULATOR)) + data->info.num_regulators = MP2975_PAGE_NUM; } if (data->chip_id == mp2975) { |