hwmon: (pmbus) add ir35215 driver
PATCH 1/1 hwmon: (pmbus) add ir35215 driver
IR35215 is a digital multi-phase controller.
--- drivers/hwmon/pmbus/Kconfig | 9 +++++ drivers/hwmon/pmbus/Makefile | 1 + drivers/hwmon/pmbus/ir35215.c | 65 +++++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+) create mode 100644 drivers/hwmon/pmbus/ir35215.c
drivers/hwmon/pmbus/Kconfig +9 -0
@@ -123,6 +123,15 @@ config SENSORS_INSPUR_IPSPS This driver can also be built as a module. If so, the module will be called inspur-ipsps. +config SENSORS_IR35215 + tristate "Infineon IR35215" + help + If you say yes here you get hardware monitoring support for the + Infineon IR35215 controller. + + This driver can also be built as a module. If so, the module will + be called ir35215. + config SENSORS_IR35221 tristate "Infineon IR35221" help
drivers/hwmon/pmbus/Makefile +1 -0
@@ -15,6 +15,7 @@ obj-$(CONFIG_SENSORS_FSP_3Y) += fsp-3y.o obj-$(CONFIG_SENSORS_IBM_CFFPS) += ibm-cffps.o obj-$(CONFIG_SENSORS_DPS920AB) += dps920ab.o obj-$(CONFIG_SENSORS_INSPUR_IPSPS) += inspur-ipsps.o +obj-$(CONFIG_SENSORS_IR35215) += ir35215.o obj-$(CONFIG_SENSORS_IR35221) += ir35221.o obj-$(CONFIG_SENSORS_IR36021) += ir36021.o obj-$(CONFIG_SENSORS_IR38064) += ir38064.o
drivers/hwmon/pmbus/ir35215.c new file +65 -0
65 lines not on this page · raw message
Signature · 1 line
2.34.1
Guenter Roeck
maintainerQuoted 3 lines · Scott Smith
IR35215 is a digital multi-phase controller.
Signed-off-by Scott Smith <[email protected]>
Does this chip really need its own driver ? Please check if it can be added to pmbus.c instead. If not, please provide a rationale explaining why that does not work. Also, if you have access to the datasheet, please make sure that the chip is sufficiently different from IR35221 to warrant a separate driver.
Additional comments inline.
Thanks,
Guenter
Quoted 4 lines
--- drivers/hwmon/pmbus/Kconfig | 9 +++++ drivers/hwmon/pmbus/Makefile | 1 + drivers/hwmon/pmbus/ir35215.c | 65 +++++++++++++++++++++++++++++++++++
Documentation/hwmon/ir35215.rst needed (if this driver is needed).
Quoted 41 lines
3 files changed, 75 insertions(+)create mode 100644
drivers/hwmon/pmbus/ir35215.cdrivers/hwmon/pmbus/Kconfig1 renamed from drivers/hwmon/pmbus/Kconfig +9
-0@@ -123,6 +123,15 @@ config SENSORS_INSPUR_IPSPS This driver can also be built as a module. If so, the module will be called inspur-ipsps. +config SENSORS_IR35215 + tristate "Infineon IR35215" + help + If you say yes here you get hardware monitoring support for the + Infineon IR35215 controller. + + This driver can also be built as a module. If so, the module will + be called ir35215. + config SENSORS_IR35221 tristate "Infineon IR35221" helpdrivers/hwmon/pmbus/Makefile +1
-0@@ -15,6 +15,7 @@ obj-$(CONFIG_SENSORS_FSP_3Y) += fsp-3y.o obj-$(CONFIG_SENSORS_IBM_CFFPS) += ibm-cffps.o obj-$(CONFIG_SENSORS_DPS920AB) += dps920ab.o obj-$(CONFIG_SENSORS_INSPUR_IPSPS) += inspur-ipsps.o +obj-$(CONFIG_SENSORS_IR35215) += ir35215.o obj-$(CONFIG_SENSORS_IR35221) += ir35221.o obj-$(CONFIG_SENSORS_IR36021) += ir36021.o obj-$(CONFIG_SENSORS_IR38064) += ir38064.odrivers/hwmon/pmbus/ir35215.c new file +0
-0
drivers/hwmon/pmbus/ir35215.c line 9
Quoted 9 lines
drivers/hwmon/pmbus/ir35215.c new file +9
-0@@ -0,0 +1,65 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Hardware monitoring driver for Infineon IR35215 +* +* Copyright (c) Meta Platforms, Inc. and affiliates. +*/ + +#include <linux/err.h> +#include <linux/hwmon-sysfs.h>
Not needed.
Quoted 23 lines
drivers/hwmon/pmbus/ir35215.c new file +23
-0+#include <linux/i2c.h> +#include <linux/init.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include "pmbus.h" + +static const u32 functionality =PMBUS_HAVE_TEMP + |PMBUS_HAVE_VIN |PMBUS_HAVE_VOUT + |PMBUS_HAVE_IIN |PMBUS_HAVE_IOUT + |PMBUS_HAVE_PIN |PMBUS_HAVE_POUT + |PMBUS_HAVE_STATUS_VOUT |PMBUS_HAVE_STATUS_IOUT + |PMBUS_HAVE_STATUS_INPUT |PMBUS_HAVE_STATUS_TEMP ; + +static struct pmbus_driver_info ir35215_info = { + .pages =2 , + .format[PSC_VOLTAGE_IN ] = linear, + .format[PSC_VOLTAGE_OUT ] = linear, + .format[PSC_CURRENT_IN ] = linear, + .format[PSC_CURRENT_OUT ] = linear, + .format[PSC_POWER ] = linear, + .format[PSC_TEMPERATURE ] = linear, + .func[0 ] = functionality, + .func[1 ] = functionality,
drivers/hwmon/pmbus/ir35215.c line 42
Quoted 10 lines
drivers/hwmon/pmbus/ir35215.c new file +10
-0+}; + +static int ir35215_probe (struct i2c_client *client) +{ +/* +* IR35215 devices may not stay in page 0 during device +* probe which leads to probe failure (read status word failed). +* So let's set the device to page 0 at the beginning. +*/ +i2c_smbus_write_byte_data (client,PMBUS_PAGE ,0 );
That should probably be added to the pmbus core code since it potentially affects all PMBus chips.
Quoted 23 lines
drivers/hwmon/pmbus/ir35215.c new file +23
-0+return pmbus_do_probe (client, &ir35215_info); +} + +static const struct i2c_device_id ir35215_id[] = { + {"ir35215" ,0 }, + {} +}; +MODULE_DEVICE_TABLE (i2c, ir35215_id); + +static struct i2c_driver ir35215_driver = { + .driver = { + .name ="ir35215" , + }, + .probe_new = ir35215_probe, + .id_table = ir35215_id, +}; + +module_i2c_driver (ir35215_driver); + +MODULE_AUTHOR ("Tao Ren <[email protected]>" ); +MODULE_DESCRIPTION ("PMBus driver for Infineon IR35215" ); +MODULE_LICENSE ("GPL" ); +MODULE_IMPORT_NS (PMBUS );