mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Cheng.JackHY@inventec.com, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Jean Delvare <jdelvare@suse.com>
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-hwmon@vger.kernel.org
Subject: Re: [PATCH 2/2] hwmon: (pmbus/q54sj108a2) Add support for q50sn12072 and q54sn120a1
Date: Wed, 16 Jul 2025 12:12:49 -0700	[thread overview]
Message-ID: <5ffdeb33-2e78-4cdd-9b0e-5e7d78d25d73@roeck-us.net> (raw)
In-Reply-To: <20250701-add-support-for-q50sn12072-and-q54sn120a1-v1-2-c387baf928cb@inventec.com>

On 7/1/25 05:03, Jack Cheng via B4 Relay wrote:
> From: Jack Cheng <cheng.jackhy@inventec.com>
> 
> The Q54SN12072 and Q54SN120A1 are high-efficiency, high-density DC-DC power
> module from Delta Power Modules.
> 
> The Q54SN12072, quarter brick, single output 12V. This product provides up
> to 1200 watts of output power at 38~60V. The Q54SN12072 offers peak
> efficiency up to 98.3%@54Vin.
> 
> The Q54SN120A1, quarter brick, single output 12V. This product provides up
> to 1300 watts of output power at 40~60V. The Q54SN120A1 offers peak
> efficiency up to 98.1%@54Vin.
> 
> Add support for them to q54sj108a2 driver.
> 
> Signed-off-by: Jack Cheng <cheng.jackhy@inventec.com>
> ---
>   drivers/hwmon/pmbus/q54sj108a2.c | 51 ++++++++++++++++++++++++++++++++++++++--
>   1 file changed, 49 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hwmon/pmbus/q54sj108a2.c b/drivers/hwmon/pmbus/q54sj108a2.c
> index 4d7086d83aa3..34233d955c48 100644
> --- a/drivers/hwmon/pmbus/q54sj108a2.c
> +++ b/drivers/hwmon/pmbus/q54sj108a2.c
> @@ -21,11 +21,14 @@
>   #define PMBUS_FLASH_KEY_WRITE		0xEC
>   
>   enum chips {
> -	q54sj108a2
> +	q50sn12072,
> +	q54sj108a2,
> +	q54sn120a1
>   };
>   
>   enum {
> -	Q54SJ108A2_DEBUGFS_OPERATION = 0,
> +	Q50SN12072_DEBUGFS_VOUT_COMMAND = 0,
> +	Q54SJ108A2_DEBUGFS_OPERATION,
>   	Q54SJ108A2_DEBUGFS_CLEARFAULT,
>   	Q54SJ108A2_DEBUGFS_WRITEPROTECT,
>   	Q54SJ108A2_DEBUGFS_STOREDEFAULT,
> @@ -54,6 +57,20 @@ struct q54sj108a2_data {
>   #define to_psu(x, y) container_of((x), struct q54sj108a2_data, debugfs_entries[(y)])
>   
>   static struct pmbus_driver_info q54sj108a2_info[] = {
> +	[q50sn12072] = {
> +		.pages = 1,
> +
> +		/* Source : Delta Q50SN12072 */
> +		.format[PSC_TEMPERATURE] = linear,
> +		.format[PSC_VOLTAGE_IN] = linear,
> +		.format[PSC_CURRENT_OUT] = linear,
> +
> +		.func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_IIN | PMBUS_HAVE_PIN |
> +		PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT |
> +		PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT |
> +		PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP |
> +		PMBUS_HAVE_STATUS_INPUT | PMBUS_HAVE_POUT,
> +	},
>   	[q54sj108a2] = {
>   		.pages = 1,
>   
> @@ -68,6 +85,20 @@ static struct pmbus_driver_info q54sj108a2_info[] = {
>   		PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP |
>   		PMBUS_HAVE_STATUS_INPUT,
>   	},
> +	[q54sn120a1] = {
> +		.pages = 1,
> +
> +		/* Source : Delta Q54SN120A1 */
> +		.format[PSC_TEMPERATURE] = linear,
> +		.format[PSC_VOLTAGE_IN] = linear,
> +		.format[PSC_CURRENT_OUT] = linear,
> +
> +		.func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_IIN | PMBUS_HAVE_PIN |
> +		PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT |
> +		PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT |
> +		PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP |
> +		PMBUS_HAVE_STATUS_INPUT | PMBUS_HAVE_POUT,
> +	},
>   };
>   
>   static ssize_t q54sj108a2_debugfs_read(struct file *file, char __user *buf,
> @@ -177,6 +208,7 @@ static ssize_t q54sj108a2_debugfs_write(struct file *file, const char __user *bu
>   {
>   	u8 flash_key[4];
>   	u8 dst_data;
> +	u16 val;
>   	ssize_t rc;
>   	int *idxp = file->private_data;
>   	int idx = *idxp;
> @@ -187,6 +219,17 @@ static ssize_t q54sj108a2_debugfs_write(struct file *file, const char __user *bu
>   		return rc;
>   
>   	switch (idx) {
> +	case Q50SN12072_DEBUGFS_VOUT_COMMAND:
> +		rc = kstrtou16_from_user(buf, count, 0, &val);
> +		if (rc < 0)
> +			return rc;
> +
> +		rc = pmbus_write_word_data(psu->client, 0x00,
> +					   PMBUS_VOUT_COMMAND, (const u16)val);
> +		if (rc < 0)
> +			return rc;
> +
> +		break;

That change is completely unrelated to the added chip support. On top of that,
it is dangerous, and the output voltage can be manipulated using regulator
support if needed. Given that, I do not see the point of this change.

Guenter


      reply	other threads:[~2025-07-16 19:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-01 12:03 [PATCH 0/2] " Jack Cheng via B4 Relay
2025-07-01 12:03 ` [PATCH 1/2] dt-bindings: trivial: Add q50sn12072 and q54sj108a1 support Jack Cheng via B4 Relay
2025-07-08 16:09   ` Rob Herring (Arm)
2025-07-01 12:03 ` [PATCH 2/2] hwmon: (pmbus/q54sj108a2) Add support for q50sn12072 and q54sn120a1 Jack Cheng via B4 Relay
2025-07-16 19:12   ` Guenter Roeck [this message]

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=5ffdeb33-2e78-4cdd-9b0e-5e7d78d25d73@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=Cheng.JackHY@inventec.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jdelvare@suse.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.org \
    /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®