linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] hwmon: pmbus: Add Infineon PXE1610 VR driver
@ 2019-05-29 22:35 Vijay Khemka
  2019-05-29 22:35 ` [PATCH 2/2] Docs: hwmon: pmbus: Add PXE1610 driver Vijay Khemka
  2019-05-30  1:00 ` [PATCH 1/2] hwmon: pmbus: Add Infineon PXE1610 VR driver Guenter Roeck
  0 siblings, 2 replies; 8+ messages in thread
From: Vijay Khemka @ 2019-05-29 22:35 UTC (permalink / raw)
  To: Jean Delvare, Guenter Roeck, Jonathan Corbet, linux-hwmon,
	linux-doc, linux-kernel
  Cc: vijaykhemka, joel, linux-aspeed, sdasari, Greg Kroah-Hartman

Added pmbus driver for the new device Infineon pxe1610
voltage regulator. It also supports similar family device
PXE1110 and PXM1310.

Signed-off-by: Vijay Khemka <vijaykhemka@fb.com>
---
 drivers/hwmon/pmbus/Kconfig   |   9 +++
 drivers/hwmon/pmbus/Makefile  |   1 +
 drivers/hwmon/pmbus/pxe1610.c | 119 ++++++++++++++++++++++++++++++++++
 3 files changed, 129 insertions(+)
 create mode 100644 drivers/hwmon/pmbus/pxe1610.c

diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig
index 30751eb9550a..338ef9b5a395 100644
--- a/drivers/hwmon/pmbus/Kconfig
+++ b/drivers/hwmon/pmbus/Kconfig
@@ -154,6 +154,15 @@ config SENSORS_MAX8688
 	  This driver can also be built as a module. If so, the module will
 	  be called max8688.
 
+config SENSORS_PXE1610
+	tristate "Infineon PXE1610"
+	help
+	  If you say yes here you get hardware monitoring support for Infineon
+	  PXE1610.
+
+	  This driver can also be built as a module. If so, the module will
+	  be called pxe1610.
+
 config SENSORS_TPS40422
 	tristate "TI TPS40422"
 	help
diff --git a/drivers/hwmon/pmbus/Makefile b/drivers/hwmon/pmbus/Makefile
index 2219b9300316..b0fbd017a91a 100644
--- a/drivers/hwmon/pmbus/Makefile
+++ b/drivers/hwmon/pmbus/Makefile
@@ -18,6 +18,7 @@ obj-$(CONFIG_SENSORS_MAX20751)	+= max20751.o
 obj-$(CONFIG_SENSORS_MAX31785)	+= max31785.o
 obj-$(CONFIG_SENSORS_MAX34440)	+= max34440.o
 obj-$(CONFIG_SENSORS_MAX8688)	+= max8688.o
+obj-$(CONFIG_SENSORS_PXE1610)	+= pxe1610.o
 obj-$(CONFIG_SENSORS_TPS40422)	+= tps40422.o
 obj-$(CONFIG_SENSORS_TPS53679)	+= tps53679.o
 obj-$(CONFIG_SENSORS_UCD9000)	+= ucd9000.o
diff --git a/drivers/hwmon/pmbus/pxe1610.c b/drivers/hwmon/pmbus/pxe1610.c
new file mode 100644
index 000000000000..01e267944df5
--- /dev/null
+++ b/drivers/hwmon/pmbus/pxe1610.c
@@ -0,0 +1,119 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Hardware monitoring driver for Infineon PXE1610
+ *
+ * Copyright (c) 2019 Facebook Inc
+ *
+ */
+
+#include <linux/err.h>
+#include <linux/i2c.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include "pmbus.h"
+
+/*
+ * Identify chip parameters.
+ */
+static int pxe1610_identify(struct i2c_client *client,
+			  struct pmbus_driver_info *info)
+{
+	if (pmbus_check_byte_register(client, 0, PMBUS_VOUT_MODE)) {
+		int vout_mode;
+
+		vout_mode = pmbus_read_byte_data(client, 0, PMBUS_VOUT_MODE);
+		switch (vout_mode & 0x1f) {
+		case 1:
+			info->vrm_version = vr12;
+		break;
+		case 2:
+			info->vrm_version = vr13;
+		break;
+		default:
+			return -ENODEV;
+		}
+	}
+	return 0;
+}
+
+static int pxe1610_probe(struct i2c_client *client,
+			 const struct i2c_device_id *id)
+{
+	struct pmbus_driver_info *info;
+	u8 buf[I2C_SMBUS_BLOCK_MAX];
+	int ret;
+
+	if (!i2c_check_functionality(client->adapter,
+				     I2C_FUNC_SMBUS_READ_BYTE_DATA
+				| I2C_FUNC_SMBUS_READ_WORD_DATA
+				| I2C_FUNC_SMBUS_READ_BLOCK_DATA))
+		return -ENODEV;
+
+	/* By default this device doesn't boot to page 0, so set page 0
+	 * to access all pmbus registers.
+	 */
+	i2c_smbus_write_byte_data(client, 0, 0);
+
+	/* Read Manufacturer id */
+	ret = i2c_smbus_read_block_data(client, PMBUS_MFR_ID, buf);
+	if (ret < 0) {
+		dev_err(&client->dev, "Failed to read PMBUS_MFR_ID\n");
+		return ret;
+	}
+	if (ret != 2 || strncmp(buf, "XP", strlen("XP"))) {
+		dev_err(&client->dev, "MFR_ID unrecognised\n");
+		return -ENODEV;
+	}
+
+	info = devm_kzalloc(&client->dev, sizeof(struct pmbus_driver_info),
+			    GFP_KERNEL);
+	if (!info)
+		return -ENOMEM;
+
+	info->format[PSC_VOLTAGE_IN] = linear;
+	info->format[PSC_VOLTAGE_OUT] = vid;
+	info->format[PSC_CURRENT_IN] = linear;
+	info->format[PSC_CURRENT_OUT] = linear;
+	info->format[PSC_POWER] = linear;
+	info->format[PSC_TEMPERATURE] = linear;
+
+	info->func[0] = 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;
+	info->func[1] = info->func[0];
+	info->func[2] = info->func[0];
+
+	info->pages = id->driver_data;
+	info->identify = pxe1610_identify;
+
+	return pmbus_do_probe(client, id, info);
+}
+
+static const struct i2c_device_id pxe1610_id[] = {
+	{"pxe1610", 3},
+	{"pxe1110", 3},
+	{"pxm1310", 3},
+	{}
+};
+
+MODULE_DEVICE_TABLE(i2c, pxe1610_id);
+
+/* This is the driver that will be inserted */
+static struct i2c_driver pxe1610_driver = {
+	.driver = {
+		   .name = "pxe1610",
+		   },
+	.probe = pxe1610_probe,
+	.remove = pmbus_do_remove,
+	.id_table = pxe1610_id,
+};
+
+module_i2c_driver(pxe1610_driver);
+
+MODULE_AUTHOR("Vijay Khemka <vijaykhemka@fb.com>");
+MODULE_DESCRIPTION("PMBus driver for Infineon PXE1610, PXE1110 and PXM1310");
+MODULE_LICENSE("GPL");
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] Docs: hwmon: pmbus: Add PXE1610 driver
  2019-05-29 22:35 [PATCH 1/2] hwmon: pmbus: Add Infineon PXE1610 VR driver Vijay Khemka
@ 2019-05-29 22:35 ` Vijay Khemka
  2019-05-30  1:05   ` Guenter Roeck
  2019-05-30  1:00 ` [PATCH 1/2] hwmon: pmbus: Add Infineon PXE1610 VR driver Guenter Roeck
  1 sibling, 1 reply; 8+ messages in thread
From: Vijay Khemka @ 2019-05-29 22:35 UTC (permalink / raw)
  To: Jean Delvare, Guenter Roeck, Jonathan Corbet, linux-hwmon,
	linux-doc, linux-kernel
  Cc: vijaykhemka, joel, linux-aspeed, sdasari, Greg Kroah-Hartman

Added support for Infenion PXE1610 driver

Signed-off-by: Vijay Khemka <vijaykhemka@fb.com>
---
 Documentation/hwmon/pxe1610 | 84 +++++++++++++++++++++++++++++++++++++
 1 file changed, 84 insertions(+)
 create mode 100644 Documentation/hwmon/pxe1610

diff --git a/Documentation/hwmon/pxe1610 b/Documentation/hwmon/pxe1610
new file mode 100644
index 000000000000..b5c83edf027a
--- /dev/null
+++ b/Documentation/hwmon/pxe1610
@@ -0,0 +1,84 @@
+Kernel driver pxe1610
+=====================
+
+Supported chips:
+  * Infinion PXE1610
+    Prefix: 'pxe1610'
+    Addresses scanned: -
+    Datasheet: Datasheet is not publicly available.
+
+  * Infinion PXE1110
+    Prefix: 'pxe1110'
+    Addresses scanned: -
+    Datasheet: Datasheet is not publicly available.
+
+  * Infinion PXM1310
+    Prefix: 'pxm1310'
+    Addresses scanned: -
+    Datasheet: Datasheet is not publicly available.
+
+Author: Vijay Khemka <vijaykhemka@fb.com>
+
+
+Description
+-----------
+
+PXE1610 is a Multi-rail/Multiphase Digital Controllers and
+it is compliant to Intel VR13 DC-DC converter specifications.
+
+
+Usage Notes
+-----------
+
+This driver can be enabled with kernel config CONFIG_SENSORS_PXE1610
+set to 'y' or 'm'(for module).
+
+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 PXE1610
+at address 0x70 on I2C bus #4:
+
+# modprobe pxe1610
+# echo pxe1610 0x70 > /sys/bus/i2c/devices/i2c-4/new_device
+
+It can also be instantiated by declaring in device tree if it is
+built as a kernel not as a module.
+
+
+Sysfs attributes
+----------------
+
+curr1_label		"iin"
+curr1_input		Measured input current
+curr1_alarm		Current high alarm
+
+curr[2-4]_label		"iout[1-3]"
+curr[2-4]_input		Measured output current
+curr[2-4]_crit		Critical maximum current
+curr[2-4]_crit_alarm	Current critical high alarm
+
+in1_label		"vin"
+in1_input		Measured input voltage
+in1_crit		Critical maximum input voltage
+in1_crit_alarm		Input voltage critical high alarm
+
+in[2-4]_label		"vout[1-3]"
+in[2-4]_input		Measured output voltage
+in[2-4]_lcrit		Critical minimum output voltage
+in[2-4]_lcrit_alarm	Output voltage critical low alarm
+in[2-4]_crit		Critical maximum output voltage
+in[2-4]_crit_alarm	Output voltage critical high alarm
+
+power1_label		"pin"
+power1_input		Measured input power
+power1_alarm		Input power high alarm
+
+power[2-4]_label	"pout[1-3]"
+power[2-4]_input	Measured output power
+
+temp[1-3]_input		Measured temperature
+temp[1-3]_crit		Critical high temperature
+temp[1-3]_crit_alarm	Chip temperature critical high alarm
+temp[1-3]_max		Maximum temperature
+temp[1-3]_max_alarm	Chip temperature high alarm
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] hwmon: pmbus: Add Infineon PXE1610 VR driver
  2019-05-29 22:35 [PATCH 1/2] hwmon: pmbus: Add Infineon PXE1610 VR driver Vijay Khemka
  2019-05-29 22:35 ` [PATCH 2/2] Docs: hwmon: pmbus: Add PXE1610 driver Vijay Khemka
@ 2019-05-30  1:00 ` Guenter Roeck
  2019-05-30 18:55   ` Vijay Khemka
  1 sibling, 1 reply; 8+ messages in thread
From: Guenter Roeck @ 2019-05-30  1:00 UTC (permalink / raw)
  To: Vijay Khemka, Jean Delvare, Jonathan Corbet, linux-hwmon,
	linux-doc, linux-kernel
  Cc: joel, linux-aspeed, sdasari, Greg Kroah-Hartman

On 5/29/19 3:35 PM, Vijay Khemka wrote:
> Added pmbus driver for the new device Infineon pxe1610
> voltage regulator. It also supports similar family device
> PXE1110 and PXM1310.
> 
> Signed-off-by: Vijay Khemka <vijaykhemka@fb.com>
> ---
>   drivers/hwmon/pmbus/Kconfig   |   9 +++
>   drivers/hwmon/pmbus/Makefile  |   1 +
>   drivers/hwmon/pmbus/pxe1610.c | 119 ++++++++++++++++++++++++++++++++++
>   3 files changed, 129 insertions(+)
>   create mode 100644 drivers/hwmon/pmbus/pxe1610.c
> 
> diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig
> index 30751eb9550a..338ef9b5a395 100644
> --- a/drivers/hwmon/pmbus/Kconfig
> +++ b/drivers/hwmon/pmbus/Kconfig
> @@ -154,6 +154,15 @@ config SENSORS_MAX8688
>   	  This driver can also be built as a module. If so, the module will
>   	  be called max8688.
>   
> +config SENSORS_PXE1610
> +	tristate "Infineon PXE1610"
> +	help
> +	  If you say yes here you get hardware monitoring support for Infineon
> +	  PXE1610.
> +
> +	  This driver can also be built as a module. If so, the module will
> +	  be called pxe1610.
> +
>   config SENSORS_TPS40422
>   	tristate "TI TPS40422"
>   	help
> diff --git a/drivers/hwmon/pmbus/Makefile b/drivers/hwmon/pmbus/Makefile
> index 2219b9300316..b0fbd017a91a 100644
> --- a/drivers/hwmon/pmbus/Makefile
> +++ b/drivers/hwmon/pmbus/Makefile
> @@ -18,6 +18,7 @@ obj-$(CONFIG_SENSORS_MAX20751)	+= max20751.o
>   obj-$(CONFIG_SENSORS_MAX31785)	+= max31785.o
>   obj-$(CONFIG_SENSORS_MAX34440)	+= max34440.o
>   obj-$(CONFIG_SENSORS_MAX8688)	+= max8688.o
> +obj-$(CONFIG_SENSORS_PXE1610)	+= pxe1610.o
>   obj-$(CONFIG_SENSORS_TPS40422)	+= tps40422.o
>   obj-$(CONFIG_SENSORS_TPS53679)	+= tps53679.o
>   obj-$(CONFIG_SENSORS_UCD9000)	+= ucd9000.o
> diff --git a/drivers/hwmon/pmbus/pxe1610.c b/drivers/hwmon/pmbus/pxe1610.c
> new file mode 100644
> index 000000000000..01e267944df5
> --- /dev/null
> +++ b/drivers/hwmon/pmbus/pxe1610.c
> @@ -0,0 +1,119 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Hardware monitoring driver for Infineon PXE1610
> + *
> + * Copyright (c) 2019 Facebook Inc
> + *
> + */
> +
> +#include <linux/err.h>
> +#include <linux/i2c.h>
> +#include <linux/init.h>
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include "pmbus.h"
> +
> +/*
> + * Identify chip parameters.
> + */
> +static int pxe1610_identify(struct i2c_client *client,
> +			  struct pmbus_driver_info *info)

Please align continuation lines with '('.

> +{
> +	if (pmbus_check_byte_register(client, 0, PMBUS_VOUT_MODE)) {
> +		int vout_mode;
> +
> +		vout_mode = pmbus_read_byte_data(client, 0, PMBUS_VOUT_MODE);

pmbus_read_byte_data() can return an error. Calling pmbus_check_byte_register()
doesn't really add any value here, since the second call can still fail,
which needs to be checked.

> +		switch (vout_mode & 0x1f) {
> +		case 1:
> +			info->vrm_version = vr12;
> +		break;

Alignment is off.

> +		case 2:
> +			info->vrm_version = vr13;
> +		break;

Same here.

> +		default:
> +			return -ENODEV;
> +		}
> +	}
> +	return 0;
> +}
> +
> +static int pxe1610_probe(struct i2c_client *client,
> +			 const struct i2c_device_id *id)
> +{
> +	struct pmbus_driver_info *info;
> +	u8 buf[I2C_SMBUS_BLOCK_MAX];
> +	int ret;
> +
> +	if (!i2c_check_functionality(client->adapter,
> +				     I2C_FUNC_SMBUS_READ_BYTE_DATA
> +				| I2C_FUNC_SMBUS_READ_WORD_DATA
> +				| I2C_FUNC_SMBUS_READ_BLOCK_DATA))
> +		return -ENODEV;
> +
> +	/* By default this device doesn't boot to page 0, so set page 0
> +	 * to access all pmbus registers.
> +	 */

Please use standard multi-line comments.

> +	i2c_smbus_write_byte_data(client, 0, 0);
> +

Please use the PMBUS_PAGE command definition.

I wonder if it would make sense to initialize currpage in the core to an unreasonable
number for multi-page chips, but I guess that is a different question.

> +	/* Read Manufacturer id */
> +	ret = i2c_smbus_read_block_data(client, PMBUS_MFR_ID, buf);
> +	if (ret < 0) {
> +		dev_err(&client->dev, "Failed to read PMBUS_MFR_ID\n");
> +		return ret;
> +	}
> +	if (ret != 2 || strncmp(buf, "XP", strlen("XP"))) {

The strlen() is really unnecessary here. Just use 2 (and a define
for it if you like).

> +		dev_err(&client->dev, "MFR_ID unrecognised\n");

unrecognized. Oh well, turns out unrecognised is the British spelling and
just as valid, so feel free to keep it if you like.

> +		return -ENODEV;
> +	}
> +
> +	info = devm_kzalloc(&client->dev, sizeof(struct pmbus_driver_info),
> +			    GFP_KERNEL);
> +	if (!info)
> +		return -ENOMEM;
> +
> +	info->format[PSC_VOLTAGE_IN] = linear;
> +	info->format[PSC_VOLTAGE_OUT] = vid;
> +	info->format[PSC_CURRENT_IN] = linear;
> +	info->format[PSC_CURRENT_OUT] = linear;
> +	info->format[PSC_POWER] = linear;
> +	info->format[PSC_TEMPERATURE] = linear;
> +
> +	info->func[0] = 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;
> +	info->func[1] = info->func[0];
> +	info->func[2] = info->func[0];
> +
> +	info->pages = id->driver_data;
> +	info->identify = pxe1610_identify;
> +

It doesn't really add value to initialize all these parameters manually.
I would suggest to use the approach from tps53679.c, ie have a static
structure and use devm_kmemdup() to pass a copy to pmbus_do_probe().

> +	return pmbus_do_probe(client, id, info);
> +}
> +
> +static const struct i2c_device_id pxe1610_id[] = {
> +	{"pxe1610", 3},
> +	{"pxe1110", 3},
> +	{"pxm1310", 3},

Unless there are chips with different page counts in the queue, using
driver_data to pass the number of pages does not add any value. Just
set num_pages to 3.

If you like, feel free to use a define instead of a constant.

> +	{}
> +};
> +
> +MODULE_DEVICE_TABLE(i2c, pxe1610_id);
> +
> +/* This is the driver that will be inserted */

This comment does not add any value.

> +static struct i2c_driver pxe1610_driver = {
> +	.driver = {
> +		   .name = "pxe1610",
> +		   },
> +	.probe = pxe1610_probe,
> +	.remove = pmbus_do_remove,
> +	.id_table = pxe1610_id,
> +};
> +
> +module_i2c_driver(pxe1610_driver);
> +
> +MODULE_AUTHOR("Vijay Khemka <vijaykhemka@fb.com>");
> +MODULE_DESCRIPTION("PMBus driver for Infineon PXE1610, PXE1110 and PXM1310");
> +MODULE_LICENSE("GPL");
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] Docs: hwmon: pmbus: Add PXE1610 driver
  2019-05-29 22:35 ` [PATCH 2/2] Docs: hwmon: pmbus: Add PXE1610 driver Vijay Khemka
@ 2019-05-30  1:05   ` Guenter Roeck
  2019-05-30 18:51     ` Vijay Khemka
  0 siblings, 1 reply; 8+ messages in thread
From: Guenter Roeck @ 2019-05-30  1:05 UTC (permalink / raw)
  To: Vijay Khemka, Jean Delvare, Jonathan Corbet, linux-hwmon,
	linux-doc, linux-kernel
  Cc: joel, linux-aspeed, sdasari, Greg Kroah-Hartman

On 5/29/19 3:35 PM, Vijay Khemka wrote:
> Added support for Infenion PXE1610 driver
> 
> Signed-off-by: Vijay Khemka <vijaykhemka@fb.com>
> ---
>   Documentation/hwmon/pxe1610 | 84 +++++++++++++++++++++++++++++++++++++
>   1 file changed, 84 insertions(+)
>   create mode 100644 Documentation/hwmon/pxe1610
> 
> diff --git a/Documentation/hwmon/pxe1610 b/Documentation/hwmon/pxe1610
> new file mode 100644
> index 000000000000..b5c83edf027a
> --- /dev/null
> +++ b/Documentation/hwmon/pxe1610
> @@ -0,0 +1,84 @@
> +Kernel driver pxe1610
> +=====================
> +
> +Supported chips:
> +  * Infinion PXE1610
> +    Prefix: 'pxe1610'
> +    Addresses scanned: -
> +    Datasheet: Datasheet is not publicly available.
> +
> +  * Infinion PXE1110
> +    Prefix: 'pxe1110'
> +    Addresses scanned: -
> +    Datasheet: Datasheet is not publicly available.
> +
> +  * Infinion PXM1310
> +    Prefix: 'pxm1310'
> +    Addresses scanned: -
> +    Datasheet: Datasheet is not publicly available.
> +
> +Author: Vijay Khemka <vijaykhemka@fb.com>
> +
> +
> +Description
> +-----------
> +
> +PXE1610 is a Multi-rail/Multiphase Digital Controllers and
> +it is compliant to Intel VR13 DC-DC converter specifications.
> +

And the others ?

> +
> +Usage Notes
> +-----------
> +
> +This driver can be enabled with kernel config CONFIG_SENSORS_PXE1610
> +set to 'y' or 'm'(for module).
> +
The above does not really add value.

> +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 PXE1610
> +at address 0x70 on I2C bus #4:
> +
> +# modprobe pxe1610
> +# echo pxe1610 0x70 > /sys/bus/i2c/devices/i2c-4/new_device
> +
> +It can also be instantiated by declaring in device tree if it is
> +built as a kernel not as a module.
> +

I assume you mean "built into the kernel".
Why would devicetree based instantiation not work if the driver is built
as module ?

> +
> +Sysfs attributes
> +----------------
> +
> +curr1_label		"iin"
> +curr1_input		Measured input current
> +curr1_alarm		Current high alarm
> +
> +curr[2-4]_label		"iout[1-3]"
> +curr[2-4]_input		Measured output current
> +curr[2-4]_crit		Critical maximum current
> +curr[2-4]_crit_alarm	Current critical high alarm
> +
> +in1_label		"vin"
> +in1_input		Measured input voltage
> +in1_crit		Critical maximum input voltage
> +in1_crit_alarm		Input voltage critical high alarm
> +
> +in[2-4]_label		"vout[1-3]"
> +in[2-4]_input		Measured output voltage
> +in[2-4]_lcrit		Critical minimum output voltage
> +in[2-4]_lcrit_alarm	Output voltage critical low alarm
> +in[2-4]_crit		Critical maximum output voltage
> +in[2-4]_crit_alarm	Output voltage critical high alarm
> +
> +power1_label		"pin"
> +power1_input		Measured input power
> +power1_alarm		Input power high alarm
> +
> +power[2-4]_label	"pout[1-3]"
> +power[2-4]_input	Measured output power
> +
> +temp[1-3]_input		Measured temperature
> +temp[1-3]_crit		Critical high temperature
> +temp[1-3]_crit_alarm	Chip temperature critical high alarm
> +temp[1-3]_max		Maximum temperature
> +temp[1-3]_max_alarm	Chip temperature high alarm
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] Docs: hwmon: pmbus: Add PXE1610 driver
  2019-05-30  1:05   ` Guenter Roeck
@ 2019-05-30 18:51     ` Vijay Khemka
  2019-05-30 19:44       ` Guenter Roeck
  0 siblings, 1 reply; 8+ messages in thread
From: Vijay Khemka @ 2019-05-30 18:51 UTC (permalink / raw)
  To: Guenter Roeck, Jean Delvare, Jonathan Corbet, linux-hwmon,
	linux-doc, linux-kernel
  Cc: joel, linux-aspeed, Sai Dasari, Greg Kroah-Hartman



On 5/29/19, 6:05 PM, "Guenter Roeck" <groeck7@gmail.com on behalf of linux@roeck-us.net> wrote:

    On 5/29/19 3:35 PM, Vijay Khemka wrote:
    > Added support for Infenion PXE1610 driver
    > 
    > Signed-off-by: Vijay Khemka <vijaykhemka@fb.com>
    > ---
    >   Documentation/hwmon/pxe1610 | 84 +++++++++++++++++++++++++++++++++++++
    >   1 file changed, 84 insertions(+)
    >   create mode 100644 Documentation/hwmon/pxe1610
    > 
    > diff --git a/Documentation/hwmon/pxe1610 b/Documentation/hwmon/pxe1610
    > new file mode 100644
    > index 000000000000..b5c83edf027a
    > --- /dev/null
    > +++ b/Documentation/hwmon/pxe1610
    > @@ -0,0 +1,84 @@
    > +Kernel driver pxe1610
    > +=====================
    > +
    > +Supported chips:
    > +  * Infinion PXE1610
    > +    Prefix: 'pxe1610'
    > +    Addresses scanned: -
    > +    Datasheet: Datasheet is not publicly available.
    > +
    > +  * Infinion PXE1110
    > +    Prefix: 'pxe1110'
    > +    Addresses scanned: -
    > +    Datasheet: Datasheet is not publicly available.
    > +
    > +  * Infinion PXM1310
    > +    Prefix: 'pxm1310'
    > +    Addresses scanned: -
    > +    Datasheet: Datasheet is not publicly available.
    > +
    > +Author: Vijay Khemka <vijaykhemka@fb.com>
    > +
    > +
    > +Description
    > +-----------
    > +
    > +PXE1610 is a Multi-rail/Multiphase Digital Controllers and
    > +it is compliant to Intel VR13 DC-DC converter specifications.
    > +
    
    And the others ?
This supports VR12 as well and I don't see this controller supports any other VR versions.
    
    > +
    > +Usage Notes
    > +-----------
    > +
    > +This driver can be enabled with kernel config CONFIG_SENSORS_PXE1610
    > +set to 'y' or 'm'(for module).
    > +
    The above does not really add value.
Ok, I will remove it.
    
    > +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 PXE1610
    > +at address 0x70 on I2C bus #4:
    > +
    > +# modprobe pxe1610
    > +# echo pxe1610 0x70 > /sys/bus/i2c/devices/i2c-4/new_device
    > +
    > +It can also be instantiated by declaring in device tree if it is
    > +built as a kernel not as a module.
    > +
    
    I assume you mean "built into the kernel".
    Why would devicetree based instantiation not work if the driver is built
    as module ?
Will correct statement here.
    
    > +
    > +Sysfs attributes
    > +----------------
    > +
    > +curr1_label		"iin"
    > +curr1_input		Measured input current
    > +curr1_alarm		Current high alarm
    > +
    > +curr[2-4]_label		"iout[1-3]"
    > +curr[2-4]_input		Measured output current
    > +curr[2-4]_crit		Critical maximum current
    > +curr[2-4]_crit_alarm	Current critical high alarm
    > +
    > +in1_label		"vin"
    > +in1_input		Measured input voltage
    > +in1_crit		Critical maximum input voltage
    > +in1_crit_alarm		Input voltage critical high alarm
    > +
    > +in[2-4]_label		"vout[1-3]"
    > +in[2-4]_input		Measured output voltage
    > +in[2-4]_lcrit		Critical minimum output voltage
    > +in[2-4]_lcrit_alarm	Output voltage critical low alarm
    > +in[2-4]_crit		Critical maximum output voltage
    > +in[2-4]_crit_alarm	Output voltage critical high alarm
    > +
    > +power1_label		"pin"
    > +power1_input		Measured input power
    > +power1_alarm		Input power high alarm
    > +
    > +power[2-4]_label	"pout[1-3]"
    > +power[2-4]_input	Measured output power
    > +
    > +temp[1-3]_input		Measured temperature
    > +temp[1-3]_crit		Critical high temperature
    > +temp[1-3]_crit_alarm	Chip temperature critical high alarm
    > +temp[1-3]_max		Maximum temperature
    > +temp[1-3]_max_alarm	Chip temperature high alarm
    > 
    
    


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] hwmon: pmbus: Add Infineon PXE1610 VR driver
  2019-05-30  1:00 ` [PATCH 1/2] hwmon: pmbus: Add Infineon PXE1610 VR driver Guenter Roeck
@ 2019-05-30 18:55   ` Vijay Khemka
  0 siblings, 0 replies; 8+ messages in thread
From: Vijay Khemka @ 2019-05-30 18:55 UTC (permalink / raw)
  To: Guenter Roeck, Jean Delvare, Jonathan Corbet, linux-hwmon,
	linux-doc, linux-kernel
  Cc: joel, linux-aspeed, Sai Dasari, Greg Kroah-Hartman



On 5/29/19, 6:01 PM, "Guenter Roeck" <groeck7@gmail.com on behalf of linux@roeck-us.net> wrote:

    On 5/29/19 3:35 PM, Vijay Khemka wrote:
    > Added pmbus driver for the new device Infineon pxe1610
    > voltage regulator. It also supports similar family device
    > PXE1110 and PXM1310.
    > 
    > Signed-off-by: Vijay Khemka <vijaykhemka@fb.com>
    > ---
    >   drivers/hwmon/pmbus/Kconfig   |   9 +++
    >   drivers/hwmon/pmbus/Makefile  |   1 +
    >   drivers/hwmon/pmbus/pxe1610.c | 119 ++++++++++++++++++++++++++++++++++
    >   3 files changed, 129 insertions(+)
    >   create mode 100644 drivers/hwmon/pmbus/pxe1610.c
    > 
    > diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig
    > index 30751eb9550a..338ef9b5a395 100644
    > --- a/drivers/hwmon/pmbus/Kconfig
    > +++ b/drivers/hwmon/pmbus/Kconfig
    > @@ -154,6 +154,15 @@ config SENSORS_MAX8688
    >   	  This driver can also be built as a module. If so, the module will
    >   	  be called max8688.
    >   
    > +config SENSORS_PXE1610
    > +	tristate "Infineon PXE1610"
    > +	help
    > +	  If you say yes here you get hardware monitoring support for Infineon
    > +	  PXE1610.
    > +
    > +	  This driver can also be built as a module. If so, the module will
    > +	  be called pxe1610.
    > +
    >   config SENSORS_TPS40422
    >   	tristate "TI TPS40422"
    >   	help
    > diff --git a/drivers/hwmon/pmbus/Makefile b/drivers/hwmon/pmbus/Makefile
    > index 2219b9300316..b0fbd017a91a 100644
    > --- a/drivers/hwmon/pmbus/Makefile
    > +++ b/drivers/hwmon/pmbus/Makefile
    > @@ -18,6 +18,7 @@ obj-$(CONFIG_SENSORS_MAX20751)	+= max20751.o
    >   obj-$(CONFIG_SENSORS_MAX31785)	+= max31785.o
    >   obj-$(CONFIG_SENSORS_MAX34440)	+= max34440.o
    >   obj-$(CONFIG_SENSORS_MAX8688)	+= max8688.o
    > +obj-$(CONFIG_SENSORS_PXE1610)	+= pxe1610.o
    >   obj-$(CONFIG_SENSORS_TPS40422)	+= tps40422.o
    >   obj-$(CONFIG_SENSORS_TPS53679)	+= tps53679.o
    >   obj-$(CONFIG_SENSORS_UCD9000)	+= ucd9000.o
    > diff --git a/drivers/hwmon/pmbus/pxe1610.c b/drivers/hwmon/pmbus/pxe1610.c
    > new file mode 100644
    > index 000000000000..01e267944df5
    > --- /dev/null
    > +++ b/drivers/hwmon/pmbus/pxe1610.c
    > @@ -0,0 +1,119 @@
    > +// SPDX-License-Identifier: GPL-2.0+
    > +/*
    > + * Hardware monitoring driver for Infineon PXE1610
    > + *
    > + * Copyright (c) 2019 Facebook Inc
    > + *
    > + */
    > +
    > +#include <linux/err.h>
    > +#include <linux/i2c.h>
    > +#include <linux/init.h>
    > +#include <linux/kernel.h>
    > +#include <linux/module.h>
    > +#include "pmbus.h"
    > +
    > +/*
    > + * Identify chip parameters.
    > + */
    > +static int pxe1610_identify(struct i2c_client *client,
    > +			  struct pmbus_driver_info *info)
    
    Please align continuation lines with '('.
Ack.
    
    > +{
    > +	if (pmbus_check_byte_register(client, 0, PMBUS_VOUT_MODE)) {
    > +		int vout_mode;
    > +
    > +		vout_mode = pmbus_read_byte_data(client, 0, PMBUS_VOUT_MODE);
    
    pmbus_read_byte_data() can return an error. Calling pmbus_check_byte_register()
    doesn't really add any value here, since the second call can still fail,
    which needs to be checked.
Ack.
    
    > +		switch (vout_mode & 0x1f) {
    > +		case 1:
    > +			info->vrm_version = vr12;
    > +		break;
    
    Alignment is off.
Ack.
    
    > +		case 2:
    > +			info->vrm_version = vr13;
    > +		break;
    
    Same here.
    
    > +		default:
    > +			return -ENODEV;
    > +		}
    > +	}
    > +	return 0;
    > +}
    > +
    > +static int pxe1610_probe(struct i2c_client *client,
    > +			 const struct i2c_device_id *id)
    > +{
    > +	struct pmbus_driver_info *info;
    > +	u8 buf[I2C_SMBUS_BLOCK_MAX];
    > +	int ret;
    > +
    > +	if (!i2c_check_functionality(client->adapter,
    > +				     I2C_FUNC_SMBUS_READ_BYTE_DATA
    > +				| I2C_FUNC_SMBUS_READ_WORD_DATA
    > +				| I2C_FUNC_SMBUS_READ_BLOCK_DATA))
    > +		return -ENODEV;
    > +
    > +	/* By default this device doesn't boot to page 0, so set page 0
    > +	 * to access all pmbus registers.
    > +	 */
    
    Please use standard multi-line comments.
Ack.
    
    > +	i2c_smbus_write_byte_data(client, 0, 0);
    > +
    
    Please use the PMBUS_PAGE command definition.
Will use.
    
    I wonder if it would make sense to initialize currpage in the core to an unreasonable
    number for multi-page chips, but I guess that is a different question.
    
    > +	/* Read Manufacturer id */
    > +	ret = i2c_smbus_read_block_data(client, PMBUS_MFR_ID, buf);
    > +	if (ret < 0) {
    > +		dev_err(&client->dev, "Failed to read PMBUS_MFR_ID\n");
    > +		return ret;
    > +	}
    > +	if (ret != 2 || strncmp(buf, "XP", strlen("XP"))) {
    
    The strlen() is really unnecessary here. Just use 2 (and a define
    for it if you like).
Ack
    
    > +		dev_err(&client->dev, "MFR_ID unrecognised\n");
    
    unrecognized. Oh well, turns out unrecognised is the British spelling and
    just as valid, so feel free to keep it if you like.
    
    > +		return -ENODEV;
    > +	}
    > +
    > +	info = devm_kzalloc(&client->dev, sizeof(struct pmbus_driver_info),
    > +			    GFP_KERNEL);
    > +	if (!info)
    > +		return -ENOMEM;
    > +
    > +	info->format[PSC_VOLTAGE_IN] = linear;
    > +	info->format[PSC_VOLTAGE_OUT] = vid;
    > +	info->format[PSC_CURRENT_IN] = linear;
    > +	info->format[PSC_CURRENT_OUT] = linear;
    > +	info->format[PSC_POWER] = linear;
    > +	info->format[PSC_TEMPERATURE] = linear;
    > +
    > +	info->func[0] = 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;
    > +	info->func[1] = info->func[0];
    > +	info->func[2] = info->func[0];
    > +
    > +	info->pages = id->driver_data;
    > +	info->identify = pxe1610_identify;
    > +
    
    It doesn't really add value to initialize all these parameters manually.
    I would suggest to use the approach from tps53679.c, ie have a static
    structure and use devm_kmemdup() to pass a copy to pmbus_do_probe().
Will look into this.
    
    > +	return pmbus_do_probe(client, id, info);
    > +}
    > +
    > +static const struct i2c_device_id pxe1610_id[] = {
    > +	{"pxe1610", 3},
    > +	{"pxe1110", 3},
    > +	{"pxm1310", 3},    

    Unless there are chips with different page counts in the queue, using
    driver_data to pass the number of pages does not add any value. Just
    set num_pages to 3.
    
    If you like, feel free to use a define instead of a constant.
Ack.    

    > +	{}
    > +};
    > +
    > +MODULE_DEVICE_TABLE(i2c, pxe1610_id);
    > +
    > +/* This is the driver that will be inserted */
    
    This comment does not add any value.
    
    > +static struct i2c_driver pxe1610_driver = {
    > +	.driver = {
    > +		   .name = "pxe1610",
    > +		   },
    > +	.probe = pxe1610_probe,
    > +	.remove = pmbus_do_remove,
    > +	.id_table = pxe1610_id,
    > +};
    > +
    > +module_i2c_driver(pxe1610_driver);
    > +
    > +MODULE_AUTHOR("Vijay Khemka <vijaykhemka@fb.com>");
    > +MODULE_DESCRIPTION("PMBus driver for Infineon PXE1610, PXE1110 and PXM1310");
    > +MODULE_LICENSE("GPL");
    > 
    
    


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] Docs: hwmon: pmbus: Add PXE1610 driver
  2019-05-30 18:51     ` Vijay Khemka
@ 2019-05-30 19:44       ` Guenter Roeck
  2019-05-30 20:44         ` Vijay Khemka
  0 siblings, 1 reply; 8+ messages in thread
From: Guenter Roeck @ 2019-05-30 19:44 UTC (permalink / raw)
  To: Vijay Khemka
  Cc: Jean Delvare, Jonathan Corbet, linux-hwmon, linux-doc,
	linux-kernel, joel, linux-aspeed, Sai Dasari, Greg Kroah-Hartman

On Thu, May 30, 2019 at 06:51:52PM +0000, Vijay Khemka wrote:
> 
> 
> On 5/29/19, 6:05 PM, "Guenter Roeck" <groeck7@gmail.com on behalf of linux@roeck-us.net> wrote:
> 
>     On 5/29/19 3:35 PM, Vijay Khemka wrote:
>     > Added support for Infenion PXE1610 driver
>     > 
>     > Signed-off-by: Vijay Khemka <vijaykhemka@fb.com>
>     > ---
>     >   Documentation/hwmon/pxe1610 | 84 +++++++++++++++++++++++++++++++++++++
>     >   1 file changed, 84 insertions(+)
>     >   create mode 100644 Documentation/hwmon/pxe1610
>     > 
>     > diff --git a/Documentation/hwmon/pxe1610 b/Documentation/hwmon/pxe1610
>     > new file mode 100644
>     > index 000000000000..b5c83edf027a
>     > --- /dev/null
>     > +++ b/Documentation/hwmon/pxe1610
>     > @@ -0,0 +1,84 @@
>     > +Kernel driver pxe1610
>     > +=====================
>     > +
>     > +Supported chips:
>     > +  * Infinion PXE1610
>     > +    Prefix: 'pxe1610'
>     > +    Addresses scanned: -
>     > +    Datasheet: Datasheet is not publicly available.
>     > +
>     > +  * Infinion PXE1110
>     > +    Prefix: 'pxe1110'
>     > +    Addresses scanned: -
>     > +    Datasheet: Datasheet is not publicly available.
>     > +
>     > +  * Infinion PXM1310
>     > +    Prefix: 'pxm1310'
>     > +    Addresses scanned: -
>     > +    Datasheet: Datasheet is not publicly available.
>     > +
>     > +Author: Vijay Khemka <vijaykhemka@fb.com>
>     > +
>     > +
>     > +Description
>     > +-----------
>     > +
>     > +PXE1610 is a Multi-rail/Multiphase Digital Controllers and
>     > +it is compliant to Intel VR13 DC-DC converter specifications.
>     > +
>     
>     And the others ?
> This supports VR12 as well and I don't see this controller supports any other VR versions.
>     
The point here is that there is no description of the other controllers.

>     > +
>     > +Usage Notes
>     > +-----------
>     > +
>     > +This driver can be enabled with kernel config CONFIG_SENSORS_PXE1610
>     > +set to 'y' or 'm'(for module).
>     > +
>     The above does not really add value.
> Ok, I will remove it.
>     
>     > +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 PXE1610
>     > +at address 0x70 on I2C bus #4:
>     > +
>     > +# modprobe pxe1610
>     > +# echo pxe1610 0x70 > /sys/bus/i2c/devices/i2c-4/new_device
>     > +
>     > +It can also be instantiated by declaring in device tree if it is
>     > +built as a kernel not as a module.
>     > +
>     
>     I assume you mean "built into the kernel".
>     Why would devicetree based instantiation not work if the driver is built
>     as module ?
> Will correct statement here.
>     
>     > +
>     > +Sysfs attributes
>     > +----------------
>     > +
>     > +curr1_label		"iin"
>     > +curr1_input		Measured input current
>     > +curr1_alarm		Current high alarm
>     > +
>     > +curr[2-4]_label		"iout[1-3]"
>     > +curr[2-4]_input		Measured output current
>     > +curr[2-4]_crit		Critical maximum current
>     > +curr[2-4]_crit_alarm	Current critical high alarm
>     > +
>     > +in1_label		"vin"
>     > +in1_input		Measured input voltage
>     > +in1_crit		Critical maximum input voltage
>     > +in1_crit_alarm		Input voltage critical high alarm
>     > +
>     > +in[2-4]_label		"vout[1-3]"
>     > +in[2-4]_input		Measured output voltage
>     > +in[2-4]_lcrit		Critical minimum output voltage
>     > +in[2-4]_lcrit_alarm	Output voltage critical low alarm
>     > +in[2-4]_crit		Critical maximum output voltage
>     > +in[2-4]_crit_alarm	Output voltage critical high alarm
>     > +
>     > +power1_label		"pin"
>     > +power1_input		Measured input power
>     > +power1_alarm		Input power high alarm
>     > +
>     > +power[2-4]_label	"pout[1-3]"
>     > +power[2-4]_input	Measured output power
>     > +
>     > +temp[1-3]_input		Measured temperature
>     > +temp[1-3]_crit		Critical high temperature
>     > +temp[1-3]_crit_alarm	Chip temperature critical high alarm
>     > +temp[1-3]_max		Maximum temperature
>     > +temp[1-3]_max_alarm	Chip temperature high alarm
>     > 
>     
>     
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] Docs: hwmon: pmbus: Add PXE1610 driver
  2019-05-30 19:44       ` Guenter Roeck
@ 2019-05-30 20:44         ` Vijay Khemka
  0 siblings, 0 replies; 8+ messages in thread
From: Vijay Khemka @ 2019-05-30 20:44 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Jean Delvare, Jonathan Corbet, linux-hwmon, linux-doc,
	linux-kernel, joel, linux-aspeed, Sai Dasari, Greg Kroah-Hartman



On 5/30/19, 12:45 PM, "Guenter Roeck" <groeck7@gmail.com on behalf of linux@roeck-us.net> wrote:

    On Thu, May 30, 2019 at 06:51:52PM +0000, Vijay Khemka wrote:
    > 
    > 
    > On 5/29/19, 6:05 PM, "Guenter Roeck" <groeck7@gmail.com on behalf of linux@roeck-us.net> wrote:
    > 
    >     On 5/29/19 3:35 PM, Vijay Khemka wrote:
    >     > Added support for Infenion PXE1610 driver
    >     > 
    >     > Signed-off-by: Vijay Khemka <vijaykhemka@fb.com>
    >     > ---
    >     >   Documentation/hwmon/pxe1610 | 84 +++++++++++++++++++++++++++++++++++++
    >     >   1 file changed, 84 insertions(+)
    >     >   create mode 100644 Documentation/hwmon/pxe1610
    >     > 
    >     > diff --git a/Documentation/hwmon/pxe1610 b/Documentation/hwmon/pxe1610
    >     > new file mode 100644
    >     > index 000000000000..b5c83edf027a
    >     > --- /dev/null
    >     > +++ b/Documentation/hwmon/pxe1610
    >     > @@ -0,0 +1,84 @@
    >     > +Kernel driver pxe1610
    >     > +=====================
    >     > +
    >     > +Supported chips:
    >     > +  * Infinion PXE1610
    >     > +    Prefix: 'pxe1610'
    >     > +    Addresses scanned: -
    >     > +    Datasheet: Datasheet is not publicly available.
    >     > +
    >     > +  * Infinion PXE1110
    >     > +    Prefix: 'pxe1110'
    >     > +    Addresses scanned: -
    >     > +    Datasheet: Datasheet is not publicly available.
    >     > +
    >     > +  * Infinion PXM1310
    >     > +    Prefix: 'pxm1310'
    >     > +    Addresses scanned: -
    >     > +    Datasheet: Datasheet is not publicly available.
    >     > +
    >     > +Author: Vijay Khemka <vijaykhemka@fb.com>
    >     > +
    >     > +
    >     > +Description
    >     > +-----------
    >     > +
    >     > +PXE1610 is a Multi-rail/Multiphase Digital Controllers and
    >     > +it is compliant to Intel VR13 DC-DC converter specifications.
    >     > +
    >     
    >     And the others ?
    > This supports VR12 as well and I don't see this controller supports any other VR versions.
    >     
    The point here is that there is no description of the other controllers.
Ok, I get it, mainly all 3 controllers are from same family of Infineon controller but I will add details here.
    
    >     > +
    >     > +Usage Notes
    >     > +-----------
    >     > +
    >     > +This driver can be enabled with kernel config CONFIG_SENSORS_PXE1610
    >     > +set to 'y' or 'm'(for module).
    >     > +
    >     The above does not really add value.
    > Ok, I will remove it.
    >     
    >     > +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 PXE1610
    >     > +at address 0x70 on I2C bus #4:
    >     > +
    >     > +# modprobe pxe1610
    >     > +# echo pxe1610 0x70 > /sys/bus/i2c/devices/i2c-4/new_device
    >     > +
    >     > +It can also be instantiated by declaring in device tree if it is
    >     > +built as a kernel not as a module.
    >     > +
    >     
    >     I assume you mean "built into the kernel".
    >     Why would devicetree based instantiation not work if the driver is built
    >     as module ?
    > Will correct statement here.
    >     
    >     > +
    >     > +Sysfs attributes
    >     > +----------------
    >     > +
    >     > +curr1_label		"iin"
    >     > +curr1_input		Measured input current
    >     > +curr1_alarm		Current high alarm
    >     > +
    >     > +curr[2-4]_label		"iout[1-3]"
    >     > +curr[2-4]_input		Measured output current
    >     > +curr[2-4]_crit		Critical maximum current
    >     > +curr[2-4]_crit_alarm	Current critical high alarm
    >     > +
    >     > +in1_label		"vin"
    >     > +in1_input		Measured input voltage
    >     > +in1_crit		Critical maximum input voltage
    >     > +in1_crit_alarm		Input voltage critical high alarm
    >     > +
    >     > +in[2-4]_label		"vout[1-3]"
    >     > +in[2-4]_input		Measured output voltage
    >     > +in[2-4]_lcrit		Critical minimum output voltage
    >     > +in[2-4]_lcrit_alarm	Output voltage critical low alarm
    >     > +in[2-4]_crit		Critical maximum output voltage
    >     > +in[2-4]_crit_alarm	Output voltage critical high alarm
    >     > +
    >     > +power1_label		"pin"
    >     > +power1_input		Measured input power
    >     > +power1_alarm		Input power high alarm
    >     > +
    >     > +power[2-4]_label	"pout[1-3]"
    >     > +power[2-4]_input	Measured output power
    >     > +
    >     > +temp[1-3]_input		Measured temperature
    >     > +temp[1-3]_crit		Critical high temperature
    >     > +temp[1-3]_crit_alarm	Chip temperature critical high alarm
    >     > +temp[1-3]_max		Maximum temperature
    >     > +temp[1-3]_max_alarm	Chip temperature high alarm
    >     > 
    >     
    >     
    > 
    


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-05-30 20:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-29 22:35 [PATCH 1/2] hwmon: pmbus: Add Infineon PXE1610 VR driver Vijay Khemka
2019-05-29 22:35 ` [PATCH 2/2] Docs: hwmon: pmbus: Add PXE1610 driver Vijay Khemka
2019-05-30  1:05   ` Guenter Roeck
2019-05-30 18:51     ` Vijay Khemka
2019-05-30 19:44       ` Guenter Roeck
2019-05-30 20:44         ` Vijay Khemka
2019-05-30  1:00 ` [PATCH 1/2] hwmon: pmbus: Add Infineon PXE1610 VR driver Guenter Roeck
2019-05-30 18:55   ` Vijay Khemka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).