From: Naresh Solanki <naresh.solanki@9elements.com>
To: devicetree@vger.kernel.org, Guenter Roeck <linux@roeck-us.net>,
Jean Delvare <jdelvare@suse.com>
Cc: linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org,
Patrick Rudolph <patrick.rudolph@9elements.com>,
Naresh Solanki <Naresh.Solanki@9elements.com>
Subject: [PATCH 7/8] hwmon: (pmbus/mp2975) Add regulator support
Date: Wed, 12 Jul 2023 13:47:48 +0200 [thread overview]
Message-ID: <20230712114754.500477-7-Naresh.Solanki@9elements.com> (raw)
In-Reply-To: <20230712114754.500477-1-Naresh.Solanki@9elements.com>
From: Patrick Rudolph <patrick.rudolph@9elements.com>
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>
---
drivers/hwmon/pmbus/Kconfig | 7 +++++++
drivers/hwmon/pmbus/mp2975.c | 15 +++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig
index 270b6336b76d..b4e93bd5835e 100644
--- a/drivers/hwmon/pmbus/Kconfig
+++ b/drivers/hwmon/pmbus/Kconfig
@@ -317,6 +317,13 @@ config SENSORS_MP2975
This driver can also be built as a module. If so, the module will
be called mp2975.
+config SENSORS_MP2975_REGULATOR
+ depends on SENSORS_MP2975 && REGULATOR
+ bool "Regulator support for MPS MP2975"
+ help
+ If you say yes here you get regulator support for MPS MP2975
+ Dual Loop Digital Multi-Phase Controller.
+
config SENSORS_MP5023
tristate "MPS MP5023"
help
diff --git a/drivers/hwmon/pmbus/mp2975.c b/drivers/hwmon/pmbus/mp2975.c
index 83242595ccbe..27a9724aed68 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
@@ -807,6 +812,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 = {
@@ -824,6 +833,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)
@@ -862,6 +875,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 (CONFIG_SENSORS_MP2975_REGULATOR)
+ data->info.num_regulators = MP2975_PAGE_NUM;
}
if (data->chip_id == mp2975) {
--
2.41.0
next prev parent reply other threads:[~2023-07-12 11:49 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-12 11:47 [PATCH 1/8] hwmon: (pmbus/mp2975) Fix whitespace error Naresh Solanki
2023-07-12 11:47 ` [PATCH 2/8] dt-bindings: trivial-devices: Add MPS MP2971 and MP2973 Naresh Solanki
2023-07-12 11:51 ` Krzysztof Kozlowski
2023-07-12 11:47 ` [PATCH 3/8] hwmon: (pmbus/mp2975) Prepare for MP2973 and MP2971 Naresh Solanki
2023-07-12 11:47 ` [PATCH 4/8] hwmon: (pmbus/mp2975) Simplify VOUT code Naresh Solanki
2023-07-12 15:49 ` Guenter Roeck
2023-07-14 11:23 ` Naresh Solanki
2023-07-12 11:47 ` [PATCH 5/8] hwmon: (pmbus/mp2975) Make phase count variable Naresh Solanki
2023-07-12 11:47 ` [PATCH 6/8] hwmon: (pmbus/mp2975) Add support for MP2971 and MP2973 Naresh Solanki
2023-07-12 17:58 ` Guenter Roeck
2023-07-14 12:25 ` Naresh Solanki
2023-07-12 11:47 ` Naresh Solanki [this message]
2023-07-12 11:47 ` [PATCH 8/8] hwmon: (pmbus/mp2975) Add OCP limit Naresh Solanki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230712114754.500477-7-Naresh.Solanki@9elements.com \
--to=naresh.solanki@9elements.com \
--cc=devicetree@vger.kernel.org \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=patrick.rudolph@9elements.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox