hwmon: (pmbus) Add driver for STMicroelectronics PM6764 Voltage Regulator
Guenter Roeck
maintainerQuoted 6 lines · Yungteng Hsu
Add the pmbus driver for the STMicroelectronics pm6764 voltage regulator.
the output voltage use the
MFR_READ_VOUT0xD4
vout value returned is linear11Signed-off-by Charles Hsu <[email protected]>
Please use standard Linux kernel code formatting rules. Run checkpatch --strict on the patch and make sure it does not report any problems.
total: 1 errors, 39 warnings, 3 checks, 96 lines checked
is a bit much for a 74-line patch.
Quoted 44 lines
--- drivers/hwmon/pmbus/Kconfig | 8 ++++ drivers/hwmon/pmbus/Makefile | 1 + drivers/hwmon/pmbus/pm6764tr.c | 74 ++++++++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+) create mode 100644 drivers/hwmon/pmbus/pm6764tr.cdrivers/hwmon/pmbus/Kconfig +8
-0@@ -220,6 +220,14 @@ config SENSORS_MP2975 This driver can also be built as a module. If so, the module will be called mp2975. +config SENSORS_PM6764TR + tristate "PM6764TR" + help + If you say yes here you get hardware monitoring support for PM6764TR. + + This driver can also be built as a module. If so, the module will + be called pm6764tr. + config SENSORS_PXE1610 tristate "Infineon PXE1610" helpdrivers/hwmon/pmbus/Makefile +1
-0@@ -25,6 +25,7 @@ obj-$(CONFIG_SENSORS_MAX31785) += max31785.o obj-$(CONFIG_SENSORS_MAX34440) += max34440.o obj-$(CONFIG_SENSORS_MAX8688) += max8688.o obj-$(CONFIG_SENSORS_MP2975) += mp2975.o +obj-$(CONFIG_SENSORS_PM6764TR) += pm6764tr.o obj-$(CONFIG_SENSORS_PXE1610) += pxe1610.o obj-$(CONFIG_SENSORS_TPS40422) += tps40422.o obj-$(CONFIG_SENSORS_TPS53679) += tps53679.odrivers/hwmon/pmbus/pm6764tr.c new file +0
-0
drivers/hwmon/pmbus/pm6764tr.c line 8
Quoted 8 lines
drivers/hwmon/pmbus/pm6764tr.c new file +8
-0@@ -0,0 +1,74 @@ +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/init.h> +#include <linux/err.h> +#include <linux/slab.h> +#include <linux/mutex.h> +#include <linux/i2c.h> +#include <linux/pmbus.h>
Alphabetic include file order, please.
drivers/hwmon/pmbus/pm6764tr.c line 11
Quoted 3 lines
drivers/hwmon/pmbus/pm6764tr.c new file +3
-0+#include "pmbus.h" + +#define PM6764TR_PMBUS_READ_VOUT 0xD4
tab after PM6764TR_PMBUS_READ_VOUT, please.
I see you don't use any tabs in the patch. Please do.
Quoted 3 lines
drivers/hwmon/pmbus/pm6764tr.c new file +2
-0+ +static int pm6764tr_read_word_data(struct i2c_client *client, intpage, int reg)
Corrupted ?
That makes me wonder if the patch was corrupted by your e-mail system, and if that system replaced tabs with spaces. Is that possible ?
drivers/hwmon/pmbus/pm6764tr.c
Quoted 7 lines
drivers/hwmon/pmbus/pm6764tr.c new file +7
-0+{ +int ret; + +switch (reg) { +case PMBUS_VIRT_READ_VMON : + ret =pmbus_read_word_data (client, page, +PM6764TR_PMBUS_READ_VOUT );
That can be one line (line limit is now 100 columns).
Quoted 14 lines
+ break;
+ default:
+ ret =-ENODATA;
+ break;
+ }
+ return ret;drivers/hwmon/pmbus/pm6764tr.c new file +8
-0+} + +static struct pmbus_driver_info pm6764tr_info = { + .pages =1 , + .format[PSC_VOLTAGE_IN ] = linear, + .format[PSC_VOLTAGE_OUT ] = vid, + .format[PSC_TEMPERATURE ] = linear, + .format[PSC_CURRENT_OUT ] = linear,
drivers/hwmon/pmbus/pm6764tr.c
Quoted 10 lines
drivers/hwmon/pmbus/pm6764tr.c new file +10
-0+ .format[PSC_POWER] = linear, + .func[0 ] =PMBUS_HAVE_VIN |PMBUS_HAVE_IIN |PMBUS_HAVE_PIN | +PMBUS_HAVE_IOUT |PMBUS_HAVE_POUT |PMBUS_HAVE_VMON | +PMBUS_HAVE_STATUS_IOUT |PMBUS_HAVE_STATUS_VOUT | + PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, + .read_word_data = pm6764tr_read_word_data, +}; + +static int pm6764tr_probe (struct i2c_client *client, +const struct i2c_device_id *id)
Please use the new style probe function (probe_new).
Quoted 12 lines
drivers/hwmon/pmbus/pm6764tr.c new file +12
-0+{ +return pmbus_do_probe (client, id, &pm6764tr_info); +} + +static const struct i2c_device_id pm6764tr_id[] = { + {"pm6764tr" ,0 }, + {} +}; +MODULE_DEVICE_TABLE (i2c, pm6764tr_id); + +static const struct of_device_id pm6764tr_of_match[] = { + {.compatible ="pm6764tr" },
drivers/hwmon/pmbus/pm6764tr.c
Quoted 10 lines
drivers/hwmon/pmbus/pm6764tr.c new file +10
-0+ {} +}; +/* This is the driver that will be inserted */ +static struct i2c_driver pm6764tr_driver = { + .driver = { + .name ="pm6764tr" , + .of_match_table =of_match_ptr (pm6764tr_of_match), + }, + .probe = pm6764tr_probe, + .remove = pmbus_do_remove,
pmbus_do_remove no longer exists.
Quoted 10 lines
+ .id_table =
pm6764tr_id,drivers/hwmon/pmbus/pm6764tr.c new file +7
-1+}; + +module_i2c_driver (pm6764tr_driver); + +MODULE_AUTHOR ("Charles Hsu" ); +MODULE_DESCRIPTION ("PMBus driver for ST PM6764TR" ); +MODULE_LICENSE ("GPL" ); --2.25.1
Quoted 9 lines · Guenter Roeck
Quoted 6 lines · Yungteng Hsu
Add the pmbus driver for the STMicroelectronics pm6764 voltage regulator.
the output voltage use the
MFR_READ_VOUT0xD4
vout value returned is linear11Signed-off-by Charles Hsu <[email protected]>
Quoted 8 lines
Please use standard Linux kernel code formatting rules. Run checkpatch --strict on the patch and make sure it does not report any problems.
total: 1 errors, 39 warnings, 3 checks, 96 lines checked
is a bit much for a 74-line patch.
Okay, I got it.
Quoted 46 lines
Quoted 46 lines
--- drivers/hwmon/pmbus/Kconfig | 8 ++++ drivers/hwmon/pmbus/Makefile | 1 + drivers/hwmon/pmbus/pm6764tr.c | 74 ++++++++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+) create mode 100644 drivers/hwmon/pmbus/pm6764tr.cdrivers/hwmon/pmbus/Kconfig +8
-0@@ -220,6 +220,14 @@ config SENSORS_MP2975 This driver can also be built as a module. If so, the module will be called mp2975. +config SENSORS_PM6764TR + tristate "PM6764TR" + help + If you say yes here you get hardware monitoring support for PM6764TR. + + This driver can also be built as a module. If so, the module will + be called pm6764tr. + config SENSORS_PXE1610 tristate "Infineon PXE1610" helpdrivers/hwmon/pmbus/Makefile +1
-0@@ -25,6 +25,7 @@ obj-$(CONFIG_SENSORS_MAX31785) += max31785.o obj-$(CONFIG_SENSORS_MAX34440) += max34440.o obj-$(CONFIG_SENSORS_MAX8688) += max8688.o obj-$(CONFIG_SENSORS_MP2975) += mp2975.o +obj-$(CONFIG_SENSORS_PM6764TR) += pm6764tr.o obj-$(CONFIG_SENSORS_PXE1610) += pxe1610.o obj-$(CONFIG_SENSORS_TPS40422) += tps40422.o obj-$(CONFIG_SENSORS_TPS53679) += tps53679.odrivers/hwmon/pmbus/pm6764tr.c new file +2
-0@@ -0,0 +1,74 @@ +#include <linux/kernel.h> +#include <linux/module.h>
Quoted 9 lines
drivers/hwmon/pmbus/pm6764tr.c line 8
Quoted 6 lines
drivers/hwmon/pmbus/pm6764tr.c new file +6
-0+#include <linux/init.h> +#include <linux/err.h> +#include <linux/slab.h> +#include <linux/mutex.h> +#include <linux/i2c.h> +#include <linux/pmbus.h> Alphabetic include file order, please.
update include file order in v2.
Quoted 8 lines
drivers/hwmon/pmbus/pm6764tr.c line 11
Quoted 3 lines
drivers/hwmon/pmbus/pm6764tr.c new file +3
-0+#include "pmbus.h" + +#define PM6764TR_PMBUS_READ_VOUT 0xD4tab after
PM6764TR_PMBUS_READ_VOUT, please.I see you don't use any tabs in the patch. Please do.
Quoted 9 lines
Quoted 3 lines
drivers/hwmon/pmbus/pm6764tr.c new file +2
-0+ +static int pm6764tr_read_word_data(struct i2c_client *client, intpage, int reg)
Corrupted ?
That makes me wonder if the patch was corrupted by your e-mail system, and if that system replaced tabs with spaces. Is that possible ?
This is corrupted by e-mail system,
and tabs are replaced with spaces.
I'll check the e-mail system setting and updated in v2.
Quoted 10 lines
drivers/hwmon/pmbus/pm6764tr.c
Quoted 7 lines
drivers/hwmon/pmbus/pm6764tr.c new file +7
-0+{ +int ret; + +switch (reg) { +case PMBUS_VIRT_READ_VMON : + ret =pmbus_read_word_data (client, page, +PM6764TR_PMBUS_READ_VOUT );That can be one line (line limit is now 100 columns).
fix to one line in v2.
Quoted 18 lines
Quoted 18 lines
+ break;
+ default:
+ ret =-ENODATA;
+ break;
+ }
+ return ret;drivers/hwmon/pmbus/pm6764tr.c new file +12
-0+} + +static struct pmbus_driver_info pm6764tr_info = { + .pages =1 , + .format[PSC_VOLTAGE_IN ] = linear, + .format[PSC_VOLTAGE_OUT ] = vid, + .format[PSC_TEMPERATURE ] = linear, + .format[PSC_CURRENT_OUT ] = linear, + .format[PSC_POWER ] = linear, + .func[0 ] =PMBUS_HAVE_VIN |PMBUS_HAVE_IIN |PMBUS_HAVE_PIN | +PMBUS_HAVE_IOUT |PMBUS_HAVE_POUT |PMBUS_HAVE_VMON | + PMBUS_HAVE_STATUS_IOUT | PMBUS_HAVE_STATUS_VOUT |
Quoted 9 lines
drivers/hwmon/pmbus/pm6764tr.c
Quoted 6 lines
+
PMBUS_HAVE_TEMP|PMBUS_HAVE_STATUS_TEMP,drivers/hwmon/pmbus/pm6764tr.c new file +5
-0+ .read_word_data = pm6764tr_read_word_data, +}; + +static int pm6764tr_probe (struct i2c_client *client, +const struct i2c_device_id *id)Please use the new style probe function (
probe_new).
Change form .probe to .probe_new in v2.
Quoted 16 lines
Quoted 16 lines
drivers/hwmon/pmbus/pm6764tr.c new file +16
-0+{ +return pmbus_do_probe (client, id, &pm6764tr_info); +} + +static const struct i2c_device_id pm6764tr_id[] = { + {"pm6764tr" ,0 }, + {} +}; +MODULE_DEVICE_TABLE (i2c, pm6764tr_id); + +static const struct of_device_id pm6764tr_of_match[] = { + {.compatible ="pm6764tr" }, + {} +}; +/* This is the driver that will be inserted */ +static struct i2c_driver pm6764tr_driver = {
Quoted 9 lines
drivers/hwmon/pmbus/pm6764tr.c
Quoted 6 lines
+ .driver = {
drivers/hwmon/pmbus/pm6764tr.c new file +5
-0+ .name = "pm6764tr", + .of_match_table =of_match_ptr (pm6764tr_of_match), + }, + .probe = pm6764tr_probe, + .remove = pmbus_do_remove,
pmbus_do_removeno longer exists.
remove .remove = pmbus_do_remove in v2.
Quoted 10 lines
Quoted 10 lines
+ .id_table =
pm6764tr_id,drivers/hwmon/pmbus/pm6764tr.c new file +7
-1+}; + +module_i2c_driver (pm6764tr_driver); + +MODULE_AUTHOR ("Charles Hsu" ); +MODULE_DESCRIPTION ("PMBus driver for ST PM6764TR" ); +MODULE_LICENSE ("GPL" ); --2.25.1