| From 1db0aeaca98c0d8bfa2d49d7eae70b3a02d28567 Mon Sep 17 00:00:00 2001 |
| From: Charles Hsu <charles.hsu@quanta.corp-partner.google.com> |
| Date: Wed, 17 Dec 2025 08:48:07 +0000 |
| Subject: [PATCH] add xdp730 driver |
| |
| --- |
| drivers/hwmon/pmbus/Kconfig | 10 ++++++ |
| drivers/hwmon/pmbus/Makefile | 1 + |
| drivers/hwmon/pmbus/xdp730.c | 69 ++++++++++++++++++++++++++++++++++++ |
| 3 files changed, 80 insertions(+) |
| create mode 100644 drivers/hwmon/pmbus/xdp730.c |
| |
| diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig |
| index 632ac3cbeb05..eed47f790645 100644 |
| --- a/drivers/hwmon/pmbus/Kconfig |
| +++ b/drivers/hwmon/pmbus/Kconfig |
| @@ -397,6 +397,16 @@ config SENSORS_UCD9200 |
| This driver can also be built as a module. If so, the module will |
| be called ucd9200. |
| |
| +config SENSORS_XDP730 |
| + tristate "Infineon XDP730 family" |
| + help |
| + If you say yes here you get hardware monitoring support for Infineon |
| + XDP730. |
| + |
| + This driver can also be built as a module. If so, the module will |
| + be called xdp730. |
| + |
| + |
| config SENSORS_XDPE152 |
| tristate "Infineon XDPE152 family" |
| help |
| diff --git a/drivers/hwmon/pmbus/Makefile b/drivers/hwmon/pmbus/Makefile |
| index e0026afd59d1..72bcf1a94557 100644 |
| --- a/drivers/hwmon/pmbus/Makefile |
| +++ b/drivers/hwmon/pmbus/Makefile |
| @@ -43,6 +43,7 @@ obj-$(CONFIG_SENSORS_TPS53679) += tps53679.o |
| obj-$(CONFIG_SENSORS_TPS546D24) += tps546d24.o |
| obj-$(CONFIG_SENSORS_UCD9000) += ucd9000.o |
| obj-$(CONFIG_SENSORS_UCD9200) += ucd9200.o |
| +obj-$(CONFIG_SENSORS_XDP730) += xdp730.o |
| obj-$(CONFIG_SENSORS_XDPE122) += xdpe12284.o |
| obj-$(CONFIG_SENSORS_XDPE152) += xdpe152c4.o |
| obj-$(CONFIG_SENSORS_ZL6100) += zl6100.o |
| diff --git a/drivers/hwmon/pmbus/xdp730.c b/drivers/hwmon/pmbus/xdp730.c |
| new file mode 100644 |
| index 000000000000..4e2b11111de3 |
| --- /dev/null |
| +++ b/drivers/hwmon/pmbus/xdp730.c |
| @@ -0,0 +1,69 @@ |
| +// SPDX-License-Identifier: GPL-2.0-or-later |
| +/* |
| + * Driver for Infineon xdp730 Hot-Swap Controller |
| + */ |
| + |
| +#include <linux/bitops.h> |
| +#include <linux/i2c.h> |
| +#include <linux/module.h> |
| +#include <linux/of_device.h> |
| +#include "pmbus.h" |
| + |
| +static struct pmbus_driver_info xdp730_info = { |
| + .pages = 1, |
| + .format[PSC_VOLTAGE_IN] = direct, |
| + .format[PSC_VOLTAGE_OUT] = direct, |
| + .format[PSC_CURRENT_OUT] = direct, |
| + .format[PSC_POWER] = direct, |
| + .format[PSC_TEMPERATURE] = direct, |
| + .m[PSC_VOLTAGE_IN] = 4653, |
| + .b[PSC_VOLTAGE_IN] = 0, |
| + .R[PSC_VOLTAGE_IN] = -2, |
| + .m[PSC_VOLTAGE_OUT] = 4653, |
| + .b[PSC_VOLTAGE_OUT] = 0, |
| + .R[PSC_VOLTAGE_OUT] = -2, |
| + .m[PSC_CURRENT_OUT] = 24668, |
| + .b[PSC_CURRENT_OUT] = 0, |
| + .R[PSC_CURRENT_OUT] = -4, |
| + .m[PSC_POWER] = 4486, |
| + .b[PSC_POWER] = 0, |
| + .R[PSC_POWER] = -1, |
| + .m[PSC_TEMPERATURE] = 54, |
| + .b[PSC_TEMPERATURE] = 22521, |
| + .R[PSC_TEMPERATURE] = -1, |
| + .func[0] = |
| + PMBUS_HAVE_VIN | PMBUS_HAVE_VOUT | PMBUS_HAVE_PIN | |
| + PMBUS_HAVE_TEMP | PMBUS_HAVE_IOUT | |
| + PMBUS_HAVE_STATUS_INPUT | PMBUS_HAVE_STATUS_TEMP, |
| +}; |
| + |
| +static int xdp730_probe(struct i2c_client *client) |
| +{ |
| + return pmbus_do_probe(client, &xdp730_info); |
| +} |
| + |
| +static const struct of_device_id xdp730_of_match[] = { |
| + { .compatible = "infineon,xdp730" }, |
| + {} |
| +}; |
| + |
| +static const struct i2c_device_id xdp730_id[] = { |
| + {"xdp730"}, |
| + { } |
| +}; |
| +MODULE_DEVICE_TABLE(i2c, xdp730_id); |
| + |
| +static struct i2c_driver xdp730_driver = { |
| + .driver = { |
| + .name = "xdp730", |
| + .of_match_table = xdp730_of_match, |
| + }, |
| + .probe_new = xdp730_probe, |
| + .id_table = xdp730_id, |
| +}; |
| +module_i2c_driver(xdp730_driver); |
| + |
| +MODULE_AUTHOR("Charles Hsu <hsu.yungteng@gmail.com>"); |
| +MODULE_DESCRIPTION("PMBus driver for xdp730 HSC"); |
| +MODULE_LICENSE("GPL"); |
| +MODULE_IMPORT_NS("PMBUS"); |
| -- |
| 2.34.1 |
| |