From: Guenter Roeck <linux@roeck-us.net>
To: Pawel Dembicki <paweldembicki@gmail.com>, linux-hwmon@vger.kernel.org
Cc: Jean Delvare <jdelvare@suse.com>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Jonathan Corbet <corbet@lwn.net>,
Noah Wang <noahwang.wang@outlook.com>,
Fabio Estevam <festevam@gmail.com>,
Naresh Solanki <naresh.solanki@9elements.com>,
Michal Simek <michal.simek@amd.com>,
Grant Peltier <grantpeltier93@gmail.com>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Peter Zijlstra <peterz@infradead.org>,
Shen Lichuan <shenlichuan@vivo.com>,
Greg KH <gregkh@linuxfoundation.org>,
Charles Hsu <ythsu0511@gmail.com>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-doc@vger.kernel.org
Subject: Re: [PATCH v2 2/5] hwmon: pmbus: mpq8785: Add support for MPM82504
Date: Fri, 9 May 2025 06:54:55 -0700 [thread overview]
Message-ID: <45d1a08c-8a7f-4b6e-8068-4ab0e63abbf3@roeck-us.net> (raw)
In-Reply-To: <20250509065237.2392692-3-paweldembicki@gmail.com>
On 5/8/25 23:51, Pawel Dembicki wrote:
> Add support for the Monolithic Power Systems MPM82504 digital voltage
> regulator. MPM82504 uses PMBus direct format for voltage output.
>
> Tested with device tree based matching.
>
> Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
>
> ---
> v2:
> - fixed signedess for temperatures < 0 deg C
> - remove empty lines
> ---
> Documentation/hwmon/mpq8785.rst | 20 +++++++++++++++-----
> drivers/hwmon/pmbus/mpq8785.c | 30 +++++++++++++++++++++++++++++-
> 2 files changed, 44 insertions(+), 6 deletions(-)
>
> diff --git a/Documentation/hwmon/mpq8785.rst b/Documentation/hwmon/mpq8785.rst
> index bf8176b87086..be228ee58ce2 100644
> --- a/Documentation/hwmon/mpq8785.rst
> +++ b/Documentation/hwmon/mpq8785.rst
> @@ -6,6 +6,7 @@ Kernel driver mpq8785
> Supported chips:
>
> * MPS MPQ8785
> + * MPS MPM82504
>
> Prefix: 'mpq8785'
>
> @@ -20,21 +21,30 @@ buck converter. The MPQ8785 offers a very compact solution that achieves up to
> wide input supply range. The MPQ8785 operates at high efficiency over a wide
> output current load range.
>
> +The MPM82504 is a quad 25A, scalable, fully integrated power module with a PMBus
> +interface. The device offers a complete power solution that achieves up to 25A
> +per output channel. The MPM82504 has four output channels that can be paralleled
> +to provide 50A, 75A, or 100A of output current for flexible configurations.
> +The device can also operate in parallel with the MPM3695-100 and additional
> +MPM82504 devices to provide a higher output current. The MPM82504 operates
> +at high efficiency across a wide load range.
> +
> The PMBus interface provides converter configurations and key parameters
> monitoring.
>
> -The MPQ8785 adopts MPS's proprietary multi-phase digital constant-on-time (MCOT)
> +The devices adopts MPS's proprietary multi-phase digital constant-on-time (MCOT)
> control, which provides fast transient response and eases loop stabilization.
> -The MCOT scheme also allows multiple MPQ8785 devices to be connected in parallel
> -with excellent current sharing and phase interleaving for high-current
> +The MCOT scheme also allows multiple devices or chennels to be connected in
channels
> +parallel with excellent current sharing and phase interleaving for high-current
> applications.
>
> Fully integrated protection features include over-current protection (OCP),
> over-voltage protection (OVP), under-voltage protection (UVP), and
> over-temperature protection (OTP).
>
> -The MPQ8785 requires a minimal number of readily available, standard external
> -components, and is available in a TLGA (5mmx6mm) package.
> +All supported modules require a minimal number of readily available, standard
> +external components. The MPQ8785 is available in a TLGA (5mmx6mm) package
> +and the MPM82504 is available in a BGA (15mmx30mmx5.18mm) package.
>
> Device compliant with:
>
> diff --git a/drivers/hwmon/pmbus/mpq8785.c b/drivers/hwmon/pmbus/mpq8785.c
> index 00ec21b081cb..9a4a211b2aeb 100644
> --- a/drivers/hwmon/pmbus/mpq8785.c
> +++ b/drivers/hwmon/pmbus/mpq8785.c
> @@ -8,7 +8,9 @@
> #include <linux/of_device.h>
> #include "pmbus.h"
>
> -enum chips { mpq8785 };
> +#define PMBUS_READ_TEMPERATURE_1_SIGN BIT(9)
s/PMBUS/MPM82504/
because this is not a standard bit. Needs to include linux/bits.h
or better linux/bitops.h (see below).
> +
> +enum chips { mpq8785, mpm82504 };
Please keep those in alphabetic order.
>
> static int mpq8785_identify(struct i2c_client *client,
> struct pmbus_driver_info *info)
> @@ -36,6 +38,23 @@ static int mpq8785_identify(struct i2c_client *client,
> return 0;
> };
>
> +static int mpm82504_read_word_data(struct i2c_client *client, int page,
> + int phase, int reg)
> +{
> + int ret;
> +
> + ret = pmbus_read_word_data(client, page, phase, reg);
> +
> + if (ret < 0 || reg != PMBUS_READ_TEMPERATURE_1)
> + return ret;
> +
> + /* Fix PMBUS_READ_TEMPERATURE_1 signedness */
> + if (ret & PMBUS_READ_TEMPERATURE_1_SIGN)
> + ret |= GENMASK(15, 10);
Better use sign_extend32(ret, PMBUS_READ_TEMPERATURE_1_SIGN) & 0xffff.
The mask is a bit odd but there is no sign_extend16(), but this makes it
more obvious what is done here.
Also, this needs to include linux/bitops.h.
> +
> + return ret;
> +}
> +
> static struct pmbus_driver_info mpq8785_info = {
> .pages = 1,
> .format[PSC_VOLTAGE_IN] = direct,
> @@ -59,12 +78,14 @@ static struct pmbus_driver_info mpq8785_info = {
>
> static const struct i2c_device_id mpq8785_id[] = {
> { "mpq8785", mpq8785 },
> + { "mpm82504", mpm82504 },
> { },
> };
> MODULE_DEVICE_TABLE(i2c, mpq8785_id);
>
> static const struct of_device_id __maybe_unused mpq8785_of_match[] = {
> { .compatible = "mps,mpq8785", .data = (void *)mpq8785 },
> + { .compatible = "mps,mpm82504", .data = (void *)mpm82504 },
Alphabetic order.
> {}
> };
> MODULE_DEVICE_TABLE(of, mpq8785_of_match);
> @@ -88,6 +109,13 @@ static int mpq8785_probe(struct i2c_client *client)
> case mpq8785:
> info->identify = mpq8785_identify;
> break;
> + case mpm82504:
> + info->format[PSC_VOLTAGE_OUT] = direct;
> + info->m[PSC_VOLTAGE_OUT] = 8;
> + info->b[PSC_VOLTAGE_OUT] = 0;
> + info->R[PSC_VOLTAGE_OUT] = 2;
> + info->read_word_data = mpm82504_read_word_data;
> + break;
Same here, with case statements. Sorry, I should have noticed in v1.
Thanks,
Guenter
> default:
> return -ENODEV;
> }
next prev parent reply other threads:[~2025-05-09 13:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-09 6:51 [PATCH v2 0/5] hwmon: pmbus: Add support for MPM82504 and MPM3695 family Pawel Dembicki
2025-05-09 6:51 ` [PATCH v2 1/5] hwmon: pmbus: mpq8785: Prepare driver for multiple device support Pawel Dembicki
2025-05-09 7:03 ` Krzysztof Kozlowski
2025-05-09 7:41 ` Paweł Dembicki
2025-05-09 9:22 ` Krzysztof Kozlowski
2025-05-09 14:15 ` Guenter Roeck
2025-05-09 6:51 ` [PATCH v2 2/5] hwmon: pmbus: mpq8785: Add support for MPM82504 Pawel Dembicki
2025-05-09 13:54 ` Guenter Roeck [this message]
2025-05-09 6:51 ` [PATCH v2 3/5] hwmon: pmbus: mpq8785: Add support for MPM3695 family Pawel Dembicki
2025-05-09 7:06 ` Krzysztof Kozlowski
2025-05-09 6:51 ` [PATCH v2 4/5] hwmon: pmbus: mpq8785: Implement VOUT feedback resistor divider ratio configuration Pawel Dembicki
2025-05-09 7:07 ` Krzysztof Kozlowski
2025-05-09 13:26 ` Guenter Roeck
2025-05-09 6:51 ` [PATCH v2 5/5] dt-bindings: hwmon: Add bindings for mpq8785 driver Pawel Dembicki
2025-05-09 7:00 ` Krzysztof Kozlowski
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=45d1a08c-8a7f-4b6e-8068-4ab0e63abbf3@roeck-us.net \
--to=linux@roeck-us.net \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=festevam@gmail.com \
--cc=grantpeltier93@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jdelvare@suse.com \
--cc=krzk+dt@kernel.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.simek@amd.com \
--cc=naresh.solanki@9elements.com \
--cc=noahwang.wang@outlook.com \
--cc=paweldembicki@gmail.com \
--cc=peterz@infradead.org \
--cc=robh@kernel.org \
--cc=shenlichuan@vivo.com \
--cc=ythsu0511@gmail.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
all inboxes | Powered by JetHome®