Linux I2C development
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Cedric Encarnacion <cedricjustine.encarnacion@analog.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-i2c@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-hwmon@vger.kernel.org
Cc: Jean Delvare <jdelvare@suse.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Delphine CC Chiu <Delphine_CC_Chiu@Wiwynn.com>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Peter Yin <peteryin.openbmc@gmail.com>,
	Noah Wang <noahwang.wang@outlook.com>,
	Marek Vasut <marex@denx.de>, Lukas Wunner <lukas@wunner.de>
Subject: Re: [PATCH v2 2/2] hwmon: pmbus: add driver for ltp8800-1a, ltp8800-4a, and ltp8800-2
Date: Tue, 5 Nov 2024 20:31:46 -0800	[thread overview]
Message-ID: <d016c2e5-2ebe-45cb-a62e-25f8b8d3a1b9@roeck-us.net> (raw)
In-Reply-To: <20241106030918.24849-3-cedricjustine.encarnacion@analog.com>

On 11/5/24 19:09, Cedric Encarnacion wrote:
> LTP8800-1A 54V, 150A DC/DC µModule Regulator with PMBus Interface
> LTP8800-4A 54V, 200A DC/DC µModule Regulator with PMBus Interface
> LTP8800-2 54V, 135A DC/DC μModule Regulator with PMBus Interface
> 
> The LTP8800 is a family of step-down μModule regulators that provides
> microprocessor core voltage from 54V power distribution architecture. It
> features telemetry monitoring of input/output voltage, input current,
> output power, and temperature over PMBus.
> 
> Signed-off-by: Cedric Encarnacion <cedricjustine.encarnacion@analog.com>
> ---
>   Documentation/hwmon/index.rst   |  1 +
>   Documentation/hwmon/ltp8800.rst | 91 +++++++++++++++++++++++++++++++++
>   MAINTAINERS                     |  2 +
>   drivers/hwmon/pmbus/Kconfig     | 18 +++++++
>   drivers/hwmon/pmbus/Makefile    |  1 +
>   drivers/hwmon/pmbus/ltp8800.c   | 63 +++++++++++++++++++++++
>   6 files changed, 176 insertions(+)
>   create mode 100644 Documentation/hwmon/ltp8800.rst
>   create mode 100644 drivers/hwmon/pmbus/ltp8800.c
> 
> diff --git a/Documentation/hwmon/index.rst b/Documentation/hwmon/index.rst
> index 55f1111594b2..8e6799824859 100644
> --- a/Documentation/hwmon/index.rst
> +++ b/Documentation/hwmon/index.rst
> @@ -136,6 +136,7 @@ Hardware Monitoring Kernel Drivers
>      ltc4261
>      ltc4282
>      ltc4286
> +   ltp8800
>      max127
>      max15301
>      max16064
> diff --git a/Documentation/hwmon/ltp8800.rst b/Documentation/hwmon/ltp8800.rst
> new file mode 100644
> index 000000000000..bbe1b4a7c827
> --- /dev/null
> +++ b/Documentation/hwmon/ltp8800.rst
> @@ -0,0 +1,91 @@
> +.. SPDX-License-Identifier: GPL-2.0
> +
> +Kernel driver ltp8800
> +=====================
> +
> +Supported chips:
> +
> +  * Analog Devices LTP8800-1A, LTP8800-2, LTP8800-4A
> +
> +    Prefix: 'ltp8800'
> +
> +    Addresses scanned: -
> +
> +    Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ltp8800-1a.pdf
> +
> +         https://www.analog.com/media/en/technical-documentation/data-sheets/ltp8800-2.pdf
> +
> +         https://www.analog.com/media/en/technical-documentation/data-sheets/ltp8800-4a.pdf
> +
> +Authors:
> +    - Cedric Encarnacion <cedricjustine.encarnacion@analog.com>
> +
> +
> +Description
> +-----------
> +
> +The LTP8800 is a family of step-down μModule regulators that provides
> +microprocessor core voltage from 54V power distribution architecture. LTP8800
> +features telemetry monitoring of input/output voltage, input current, output
> +power, and temperature over PMBus.
> +
> +The driver is a client driver to the core PMBus driver. Please see
> +Documentation/hwmon/pmbus.rst for details on PMBus client drivers.
> +
> +Usage Notes
> +-----------
> +
> +This driver does not auto-detect devices. You will have to instantiate the
> +devices explicitly. Please see Documentation/i2c/instantiating-devices.rst for
> +details.
> +
> +Platform data support
> +---------------------
> +
> +The driver supports standard PMBus driver platform data. Please see
> +Documentation/hwmon/pmbus.rst for details.
> +
> +Sysfs Attributes
> +----------------
> +
> +======================= ===========================
> +curr1_label		"iin"
> +curr1_input		Measured input current
> +curr1_crit		Critical maximum current
> +curr1_crit_alarm	Current critical high alarm
> +
> +curr2_label		"iout1"
> +curr2_input		Measured output current
> +curr2_lcrit		Critical minimum current
> +curr2_crit		Critical maximum current
> +curr2_max		Maximum output current
> +curr2_alarm		Current alarm
> +
> +in1_label		"vin"
> +in1_input		Measured input voltage
> +in1_lcrit		Critical minimum input voltage
> +in1_lcrit_alarm		Input voltage critical low alarm
> +in1_crit		Critical maximum input voltage
> +in1_crit_alarm		Input voltage critical high alarm
> +
> +in2_label		"vout1"
> +in2_input		Measured output voltage
> +in2_lcrit		Critical minimum output voltage
> +in2_lcrit_alarm		Output voltage critical low alarm
> +in2_crit		Critical maximum output voltage
> +in2_crit_alarm		Output voltage critical high alarm
> +in2_max			Maximum output voltage
> +in2_max_alarm		Output voltage high alarm
> +in2_min			Minimum output voltage
> +in2_min_alarm		Output voltage low alarm
> +
> +power1_label		"pout1"
> +power1_input		Measured output power
> +power1_crit		Critical maximum output power
> +
> +temp1_input		Measured temperature
> +temp1_lcrit		Critical low temperature
> +temp1_lcrit_alarm		Chip temperature critical low alarm
> +temp1_crit		Critical high temperature
> +temp1_crit_alarm		Chip temperature critical high alarm
> +======================= ===========================
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 6ca691500fb7..a5d1bd61fc2c 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -13559,6 +13559,8 @@ LTP8800 HARDWARE MONITOR DRIVER
>   M:	Cedric Encarnacion <cedricjustine.encarnacion@analog.com>
>   L:	linux-hwmon@vger.kernel.org
>   S:	Supported
> +F:	Documentation/hwmon/ltp8800.rst
> +F:	drivers/hwmon/pmbus/ltp8800.c
>   
>   LYNX 28G SERDES PHY DRIVER
>   M:	Ioana Ciornei <ioana.ciornei@nxp.com>
> diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig
> index f6d352841953..264c73275d86 100644
> --- a/drivers/hwmon/pmbus/Kconfig
> +++ b/drivers/hwmon/pmbus/Kconfig
> @@ -247,6 +247,24 @@ config SENSORS_LTC4286
>   	  If you say yes here you get hardware monitoring support for Analog
>   	  Devices LTC4286.
>   
> +config SENSORS_LTP8800
> +	tristate "Analog Devices LTP8800 and compatibles"
> +	help
> +	  If you say yes here you get hardware monitoring support for Analog
> +	  Devices LTP8800-1A, LTP8800-4A, and LTP8800-2.
> +
> +	  This driver can also be built as a module. If so, the module will
> +	  be called ltp8800.
> +
> +config SENSORS_LTP8800_REGULATOR
> +	bool "Regulator support for LTP8800 and compatibles"
> +	depends on SENSORS_LTP8800 && REGULATOR
> +	help
> +	  If you say yes here you get regulator support for Analog Devices
> +	  LTP8800-1A, LTP8800-4A, and LTP8800-2. LTP8800 is a family of DC/DC
> +	  µModule regulators that can provide microprocessor power from 54V
> +	  power distribution architecture.
> +
>   config SENSORS_MAX15301
>   	tristate "Maxim MAX15301"
>   	help
> diff --git a/drivers/hwmon/pmbus/Makefile b/drivers/hwmon/pmbus/Makefile
> index d00bcc758b97..aa5bbdb4a806 100644
> --- a/drivers/hwmon/pmbus/Makefile
> +++ b/drivers/hwmon/pmbus/Makefile
> @@ -26,6 +26,7 @@ obj-$(CONFIG_SENSORS_LT7182S)	+= lt7182s.o
>   obj-$(CONFIG_SENSORS_LTC2978)	+= ltc2978.o
>   obj-$(CONFIG_SENSORS_LTC3815)	+= ltc3815.o
>   obj-$(CONFIG_SENSORS_LTC4286)	+= ltc4286.o
> +obj-$(CONFIG_SENSORS_LTP8800)	+= ltp8800.o
>   obj-$(CONFIG_SENSORS_MAX15301)	+= max15301.o
>   obj-$(CONFIG_SENSORS_MAX16064)	+= max16064.o
>   obj-$(CONFIG_SENSORS_MAX16601)	+= max16601.o
> diff --git a/drivers/hwmon/pmbus/ltp8800.c b/drivers/hwmon/pmbus/ltp8800.c
> new file mode 100644
> index 000000000000..d57f8c058a89
> --- /dev/null
> +++ b/drivers/hwmon/pmbus/ltp8800.c
> @@ -0,0 +1,63 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Hardware monitoring driver for Analog Devices LTP8800
> + *
> + * Copyright (C) 2024 Analog Devices, Inc.
> + */
> +#include <linux/i2c.h>
> +#include <linux/module.h>
> +#include <linux/mod_devicetable.h>
> +#include "pmbus.h"
> +
> +static const struct regulator_desc ltp8800_reg_desc[] = {
> +	PMBUS_REGULATOR("vout", 0),

Ah, sorry, I didn't realize this earlier. This needs to use "PMBUS_REGULATOR_ONE("vout")"
since there is only a single regulator (which needs to be named "vout" and not "vout0").

Thanks,
Guenter

> +};
> +
> +static struct pmbus_driver_info ltp8800_info = {
> +	.pages = 1,
> +	.format[PSC_VOLTAGE_IN] = linear,
> +	.format[PSC_VOLTAGE_OUT] = linear,
> +	.format[PSC_CURRENT_IN] = linear,
> +	.format[PSC_TEMPERATURE] = linear,
> +	.func[0] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT |
> +		   PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT |
> +		   PMBUS_HAVE_IIN | PMBUS_HAVE_IOUT |
> +		   PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP |
> +		   PMBUS_HAVE_POUT,
> +#if IS_ENABLED(CONFIG_SENSORS_LTP8800_REGULATOR)
> +	.num_regulators = 1,
> +	.reg_desc = ltp8800_reg_desc,
> +#endif
> +};
> +
> +static int ltp8800_probe(struct i2c_client *client)
> +{
> +	return pmbus_do_probe(client, &ltp8800_info);
> +}
> +
> +static const struct i2c_device_id ltp8800_id[] = {
> +	{"ltp8800", 0},
> +	{}
> +};
> +MODULE_DEVICE_TABLE(i2c, ltp8800_id);
> +
> +static const struct of_device_id ltp8800_of_match[] = {
> +	{ .compatible = "adi,ltp8800"},
> +	{}
> +};
> +MODULE_DEVICE_TABLE(of, ltp8800_of_match);
> +
> +static struct i2c_driver ltp8800_driver = {
> +	.driver = {
> +		.name = "ltp8800",
> +		.of_match_table = ltp8800_of_match,
> +	},
> +	.probe = ltp8800_probe,
> +	.id_table = ltp8800_id,
> +};
> +module_i2c_driver(ltp8800_driver);
> +
> +MODULE_AUTHOR("Cedric Encarnacion <cedricjustine.encarnacion@analog.com>");
> +MODULE_DESCRIPTION("Analog Devices LTP8800 HWMON PMBus Driver");
> +MODULE_LICENSE("GPL");
> +MODULE_IMPORT_NS(PMBUS);


  reply	other threads:[~2024-11-06  4:31 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-06  3:09 [PATCH v2 0/2] Add driver for LTP8800-1A, LTP8800-2 and LTP8800-4A Cedric Encarnacion
2024-11-06  3:09 ` [PATCH v2 1/2] dt-bindings: trivial-devices: add ltp8800 Cedric Encarnacion
2024-11-06  4:34   ` Guenter Roeck
2024-11-06 16:06     ` Conor Dooley
2024-11-06 16:11       ` Conor Dooley
2024-11-06 16:43         ` Guenter Roeck
2024-11-06 16:54           ` Conor Dooley
2024-11-06 18:19             ` Guenter Roeck
2024-11-06 18:38               ` Conor Dooley
2024-11-06 16:35       ` Guenter Roeck
2024-11-06 16:46         ` Conor Dooley
2024-11-06 18:23           ` Guenter Roeck
2024-11-06  3:09 ` [PATCH v2 2/2] hwmon: pmbus: add driver for ltp8800-1a, ltp8800-4a, and ltp8800-2 Cedric Encarnacion
2024-11-06  4:31   ` Guenter Roeck [this message]
2024-11-06 18:45   ` kernel test robot
2024-11-06 19:17   ` kernel test robot
2024-11-07  1:45   ` Guenter Roeck
2024-11-08  7:44     ` Encarnacion, Cedric justine
2024-11-08 14:31       ` Guenter Roeck
2024-11-13  5:45         ` Encarnacion, Cedric justine

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=d016c2e5-2ebe-45cb-a62e-25f8b8d3a1b9@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=Delphine_CC_Chiu@Wiwynn.com \
    --cc=cedricjustine.encarnacion@analog.com \
    --cc=conor+dt@kernel.org \
    --cc=corbet@lwn.net \
    --cc=devicetree@vger.kernel.org \
    --cc=jdelvare@suse.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=marex@denx.de \
    --cc=noahwang.wang@outlook.com \
    --cc=peteryin.openbmc@gmail.com \
    --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