hwmon: (pmbus) add support for IR35215
Subsystems (2)
PATCH 3/4 hwmon: (pmbus) add support for IR35215
Provide support for Infineon Dual Output Digital Multi-Phase Buck Controllers IR35215 and IR3570B.
Signed-off-by Ruslan Babayev <[email protected]>
--- Documentation/hwmon/ir35215 | 98 +++++++++++++++++++++++++++++++++++ drivers/hwmon/pmbus/Kconfig | 10 ++++ drivers/hwmon/pmbus/Makefile | 1 + drivers/hwmon/pmbus/ir35215.c | 91 ++++++++++++++++++++++++++++++++ 4 files changed, 200 insertions(+) create mode 100644 Documentation/hwmon/ir35215 create mode 100644 drivers/hwmon/pmbus/ir35215.c
Documentation/hwmon/ir35215 new file +98 -0
@@ -0,0 +1,98 @@ +Kernel driver ir35215 +===================== + +Supported chips: + * Infinion IR35215 + Prefix: 'ir35215' + Addresses scanned: - + Datasheet: Datasheet is not publicly available. + * Infinion IR3570B + Prefix: 'ir3570b' + Addresses scanned: - + Datasheet: Datasheet is not publicly available. + +Author: Ruslan Babayev <[email protected]> + + +Description +----------- + +IR35215 is a Dual Output Digital Multi-Phase Controller + + +Usage Notes +----------- + +This driver does not probe for PMBus devices. You will have to instantiate +devices explicitly. + +Example: the following commands will load the driver for an IR35215 +at address 0x40 on I2C bus #4: + +# modprobe ir35215 +# echo ir35215 0x40 > /sys/bus/i2c/devices/i2c-4/new_device + + +Sysfs attributes +---------------- + +curr[1-2]_label "iin[1-2]" +curr[1-2]_input Measured input current +curr[1-2]_max Maximum current for +curr[1-2]_max_alarm Current high alarm + +curr[3-4]_label "iout[3-4]" +curr[3-4]_input Measured output current +curr[3-4]_crit Critical maximum current +curr[3-4]_crit_alarm Current critical high alarm +curr[3-4]_highest Highest output current +curr[3-4]_lowest Lowest output current +curr[3-4]_max Maximum current +curr[3-4]_max_alarm Current high alarm + +in[1-2]_label "vin[1-2]" +in[1-2]_input Measured input voltage +in[1-2]_crit Critical maximum input voltage +in[1-2]_crit_alarm Input voltage critical high alarm +in[1-2]_highest Highest input voltage +in[1-2]_lowest Lowest input voltage +in[1-2]_min Minimum input voltage +in[1-2]_min_alarm Input voltage low alarm + +in[3-4]_label "vout[3-4]" +in[3-4]_input Measured output voltage +in[3-4]_lcrit Critical minimum output voltage +in[3-4]_lcrit_alarm Output voltage critical low alarm +in[3-4]_crit Critical maximum output voltage +in[3-4]_crit_alarm Output voltage critical high alarm +in[3-4]_highest Highest output voltage +in[3-4]_lowest Lowest output voltage +in[3-4]_max Maximum output voltage +in[3-4]_max_alarm Output voltage high alarm +in[3-4]_min Minimum output voltage +in[3-4]_min_alarm Output voltage low alarm + +out[1-2]_command Commanded output voltage +out[1-2]_margin_high Output voltage when operation is set to "high" +out[1-2]_margin_low Output voltage when operation is set to "low" +out[1-2]_max Maximum output voltage +out[1-2]_max_alarm Output voltage high alarm +out[1-2]_operation Set the output voltage to "on", "off", "high" or "low" + +power1_label "pin" +power1_input Measured input power +power1_alarm Input power high alarm +power1_max Input power limit + +power[2-3]_label "pout[1-2]" +power[2-3]_input Measured output power +power[2-3]_max Output power limit +power[2-3]_max_alarm Output power high alarm + +temp[1-2]_input Measured temperature +temp[1-2]_crit Critical high temperature +temp[1-2]_crit_alarm Chip temperature critical high alarm +temp[1-2]_highest Highest temperature +temp[1-2]_lowest Lowest temperature +temp[1-2]_max Maximum temperature +temp[1-2]_max_alarm Chip temperature high alarm
drivers/hwmon/pmbus/Kconfig +10 -0
@@ -45,6 +45,16 @@ config SENSORS_IBM_CFFPS This driver can also be built as a module. If so, the module will be called ibm-cffps. +config SENSORS_IR35215 + tristate "Infineon IR35215" + default n + 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
@@ -7,6 +7,7 @@ obj-$(CONFIG_PMBUS) += pmbus_core.o obj-$(CONFIG_SENSORS_PMBUS) += pmbus.o obj-$(CONFIG_SENSORS_ADM1275) += adm1275.o obj-$(CONFIG_SENSORS_IBM_CFFPS) += ibm-cffps.o +obj-$(CONFIG_SENSORS_IR35215) += ir35215.o obj-$(CONFIG_SENSORS_IR35221) += ir35221.o obj-$(CONFIG_SENSORS_LM25066) += lm25066.o obj-$(CONFIG_SENSORS_LTC2978) += ltc2978.o
drivers/hwmon/pmbus/ir35215.c new file +91 -0
91 lines not on this page · raw message
Signature · 1 line
2.17.1
Guenter Roeck
maintainerQuoted 168 lines · Ruslan Babayev
Provide support for Infineon Dual Output Digital Multi-Phase Buck Controllers IR35215 and IR3570B.
Signed-off-by Ruslan Babayev <[email protected]>--- Documentation/hwmon/ir35215 | 98 +++++++++++++++++++++++++++++++++++ drivers/hwmon/pmbus/Kconfig | 10 ++++ drivers/hwmon/pmbus/Makefile | 1 + drivers/hwmon/pmbus/ir35215.c | 91 ++++++++++++++++++++++++++++++++ 4 files changed, 200 insertions(+) create mode 100644 Documentation/hwmon/ir35215 create mode 100644 drivers/hwmon/pmbus/ir35215.cDocumentation/hwmon/ir35215 new file +98
-0@@ -0,0 +1,98 @@ +Kernel driver ir35215 +===================== + +Supported chips: + * Infinion IR35215 + Prefix: 'ir35215' + Addresses scanned: - + Datasheet: Datasheet is not publicly available. + * Infinion IR3570B + Prefix: 'ir3570b' + Addresses scanned: - + Datasheet: Datasheet is not publicly available. + +Author: Ruslan Babayev <[email protected]> + + +Description +----------- + +IR35215 is a Dual Output Digital Multi-Phase Controller + + +Usage Notes +----------- + +This driver does not probe for PMBus devices. You will have to instantiate +devices explicitly. + +Example: the following commands will load the driver for an IR35215 +at address 0x40 on I2C bus #4: + +# modprobe ir35215 +# echo ir35215 0x40 > /sys/bus/i2c/devices/i2c-4/new_device + + +Sysfs attributes +---------------- + +curr[1-2]_label "iin[1-2]" +curr[1-2]_input Measured input current +curr[1-2]_max Maximum current for +curr[1-2]_max_alarm Current high alarm + +curr[3-4]_label "iout[3-4]" +curr[3-4]_input Measured output current +curr[3-4]_crit Critical maximum current +curr[3-4]_crit_alarm Current critical high alarm +curr[3-4]_highest Highest output current +curr[3-4]_lowest Lowest output current +curr[3-4]_max Maximum current +curr[3-4]_max_alarm Current high alarm + +in[1-2]_label "vin[1-2]" +in[1-2]_input Measured input voltage +in[1-2]_crit Critical maximum input voltage +in[1-2]_crit_alarm Input voltage critical high alarm +in[1-2]_highest Highest input voltage +in[1-2]_lowest Lowest input voltage +in[1-2]_min Minimum input voltage +in[1-2]_min_alarm Input voltage low alarm + +in[3-4]_label "vout[3-4]" +in[3-4]_input Measured output voltage +in[3-4]_lcrit Critical minimum output voltage +in[3-4]_lcrit_alarm Output voltage critical low alarm +in[3-4]_crit Critical maximum output voltage +in[3-4]_crit_alarm Output voltage critical high alarm +in[3-4]_highest Highest output voltage +in[3-4]_lowest Lowest output voltage +in[3-4]_max Maximum output voltage +in[3-4]_max_alarm Output voltage high alarm +in[3-4]_min Minimum output voltage +in[3-4]_min_alarm Output voltage low alarm + +out[1-2]_command Commanded output voltage +out[1-2]_margin_high Output voltage when operation is set to "high" +out[1-2]_margin_low Output voltage when operation is set to "low" +out[1-2]_max Maximum output voltage +out[1-2]_max_alarm Output voltage high alarm +out[1-2]_operation Set the output voltage to "on", "off", "high" or "low" + +power1_label "pin" +power1_input Measured input power +power1_alarm Input power high alarm +power1_max Input power limit + +power[2-3]_label "pout[1-2]" +power[2-3]_input Measured output power +power[2-3]_max Output power limit +power[2-3]_max_alarm Output power high alarm + +temp[1-2]_input Measured temperature +temp[1-2]_crit Critical high temperature +temp[1-2]_crit_alarm Chip temperature critical high alarm +temp[1-2]_highest Highest temperature +temp[1-2]_lowest Lowest temperature +temp[1-2]_max Maximum temperature +temp[1-2]_max_alarm Chip temperature high alarmdrivers/hwmon/pmbus/Kconfig +10
-0@@ -45,6 +45,16 @@ config SENSORS_IBM_CFFPS This driver can also be built as a module. If so, the module will be called ibm-cffps. +config SENSORS_IR35215 + tristate "Infineon IR35215" + default n + 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@@ -7,6 +7,7 @@ obj-$(CONFIG_PMBUS) += pmbus_core.o obj-$(CONFIG_SENSORS_PMBUS) += pmbus.o obj-$(CONFIG_SENSORS_ADM1275) += adm1275.o obj-$(CONFIG_SENSORS_IBM_CFFPS) += ibm-cffps.o +obj-$(CONFIG_SENSORS_IR35215) += ir35215.o obj-$(CONFIG_SENSORS_IR35221) += ir35221.o obj-$(CONFIG_SENSORS_LM25066) += lm25066.o obj-$(CONFIG_SENSORS_LTC2978) += ltc2978.odrivers/hwmon/pmbus/ir35215.c new file +11
-0@@ -0,0 +1,91 @@ +/* +* Hardware monitoring driver for Infineon IR35215 +* +* Copyright (c) 2019 Cisco Systems. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful,
drivers/hwmon/pmbus/ir35215.c line 21
Quoted 10 lines
drivers/hwmon/pmbus/ir35215.c new file +10
-0+* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/init.h> +#include <linux/err.h> +#include <linux/i2c.h>
Alphabetic include file order please.
Quoted 22 lines
drivers/hwmon/pmbus/ir35215.c new file +22
-0+#include "pmbus.h" + +#define COMMON_FUNCS (PMBUS_HAVE_VIN | PMBUS_HAVE_VOUT \ + | PMBUS_HAVE_IIN | PMBUS_HAVE_IOUT \ + | PMBUS_HAVE_PIN | PMBUS_HAVE_POUT \ + | PMBUS_HAVE_TEMP \ + | PMBUS_HAVE_STATUS_VOUT \ + | PMBUS_HAVE_STATUS_IOUT \ + | PMBUS_HAVE_STATUS_INPUT \ + | PMBUS_HAVE_STATUS_TEMP \ + | PMBUS_HAVE_VOUT_MARGIN_HIGH \ + | PMBUS_HAVE_VOUT_MARGIN_LOW \ + ) + + +#define IR35215_FUNCS (COMMON_FUNCS | PMBUS_HAVE_VOUT_COMMAND) +#define IR3570B_FUNCS (COMMON_FUNCS | PMBUS_HAVE_TEMP2) + +static struct pmbus_driver_info ir35215_info = { + .pages =2 , + .format[PSC_VOLTAGE_IN ] = linear, + .format[PSC_VOLTAGE_OUT ] = linear,
drivers/hwmon/pmbus/ir35215.c line 53
Quoted 10 lines
drivers/hwmon/pmbus/ir35215.c new file +10
-0+ .format[PSC_CURRENT_IN] = linear, + .format[PSC_CURRENT_OUT] = linear, + .format[PSC_POWER] = linear, + .format[PSC_TEMPERATURE] = linear, + .func[0] = IR35215_FUNCS, + .func[1] = IR35215_FUNCS, +}; + +static struct pmbus_driver_info ir3570b_info = { + .pages =1 ,
Either this ...
drivers/hwmon/pmbus/ir35215.c line 61
Quoted 8 lines
drivers/hwmon/pmbus/ir35215.c new file +8
-0+ .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] = IR3570B_FUNCS, + .func[1] = IR3570B_FUNCS,
... or this is wrong.
Quoted 33 lines
drivers/hwmon/pmbus/ir35215.c new file +30
-0+}; + +static int ir35215_probe (struct i2c_client *client, +const struct i2c_device_id *id) +{ +return pmbus_do_probe (client, id, (void *)id->driver_data); +} + +static const struct i2c_device_id ir35215_id[] = { + {"ir35215" , (kernel_ulong_t)&ir35215_info}, + {"ir3570b" , (kernel_ulong_t)&ir3570b_info}, + {} +}; + +MODULE_DEVICE_TABLE (i2c, ir35215_id); + +static struct i2c_driver ir35215_driver = { + .driver = { + .name ="ir35215" , + }, + .probe = ir35215_probe, + .remove = pmbus_do_remove, + .id_table = ir35215_id, +}; + +module_i2c_driver (ir35215_driver); + +MODULE_AUTHOR ("Ruslan Babayev <[email protected]>" ); +MODULE_DESCRIPTION ("PMBus driver for IR35215" ); +MODULE_LICENSE ("GPL" );Signature · 1 line
2.17.1
Quoted 8 lines · Guenter Roeck
drivers/hwmon/pmbus/ir35215.c line 21
Quoted 6 lines
drivers/hwmon/pmbus/ir35215.c new file +6
-0+ +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/init.h> +#include <linux/err.h> +#include <linux/i2c.h> Alphabetic include file order please.
Sure
Quoted 6 lines
drivers/hwmon/pmbus/ir35215.c line 53
Quoted 3 lines
drivers/hwmon/pmbus/ir35215.c new file +3
-0+ +static struct pmbus_driver_info ir3570b_info = { + .pages =1 ,Either this ...
Quoted 10 lines
drivers/hwmon/pmbus/ir35215.c line 61
Quoted 8 lines
drivers/hwmon/pmbus/ir35215.c new file +8
-0+ .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] = IR3570B_FUNCS, + .func[1] = IR3570B_FUNCS,... or this is wrong.
The latter is wrong. Thanks for catching it.