Skip to contentSkip to conversation

Adding MAX20754 support

PATCH In review Atif Ofluoglu 3 participants 6 messages Jul 7, 2022 – Jul 13, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Adding MAX20754 support

From: Atif Ofluoglu <[email protected]>

Adding support for Maxim MAX20754 Dual-Output, Configurable Multiphase Power-Supply Controller with PMBus Interface.

The driver is tested on MAX20754 evalution kit hardware.

Atif Ofluoglu (2):
hwmon: (pmbus/max20754) Add support for MAX20754
Added documentation for Maxim Integrated max20754 hwmon userspace
sysfs.

 Documentation/hwmon/max20754.rst | 122 ++++++++++
 drivers/hwmon/pmbus/Kconfig      |   9 +
 drivers/hwmon/pmbus/Makefile     |   1 +
 drivers/hwmon/pmbus/max20754.c   | 390 +++++++++++++++++++++++++++++++
 4 files changed, 522 insertions(+)
 create mode 100644 Documentation/hwmon/max20754.rst
 create mode 100644 drivers/hwmon/pmbus/max20754.c
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/2 hwmon: (pmbus/max20754) Add support for MAX20754

From: Atif Ofluoglu <[email protected]>

---
 drivers/hwmon/pmbus/Kconfig    |   9 +
 drivers/hwmon/pmbus/Makefile   |   1 +
 drivers/hwmon/pmbus/max20754.c | 390 +++++++++++++++++++++++++++++++++
 3 files changed, 400 insertions(+)
 create mode 100644 drivers/hwmon/pmbus/max20754.c
drivers/hwmon/pmbus/Kconfig +9 -0
index dfae76db65ae..f259b8739766 100644
@@ -254,6 +254,15 @@ config SENSORS_MAX20751
 	  This driver can also be built as a module. If so, the module will
 	  be called max20751.
 
+config SENSORS_MAX20754
+	tristate "Maxim MAX20754"
+	help
+	  If you say yes here you get hardware monitoring support for Maxim
+	  MAX20754.
+
+	  This driver can also be built as a module. If so, the module will
+	  be called max20754.
+
 config SENSORS_MAX31785
 	tristate "Maxim MAX31785 and compatibles"
 	help
drivers/hwmon/pmbus/Makefile +1 -0
index 4678fba5012c..b8b1d8a84b3b 100644
@@ -27,6 +27,7 @@ obj-$(CONFIG_SENSORS_MAX16064)	+= max16064.o
 obj-$(CONFIG_SENSORS_MAX16601)	+= max16601.o
 obj-$(CONFIG_SENSORS_MAX20730)	+= max20730.o
 obj-$(CONFIG_SENSORS_MAX20751)	+= max20751.o
+obj-$(CONFIG_SENSORS_MAX20751)	+= max20754.o
 obj-$(CONFIG_SENSORS_MAX31785)	+= max31785.o
 obj-$(CONFIG_SENSORS_MAX34440)	+= max34440.o
 obj-$(CONFIG_SENSORS_MAX8688)	+= max8688.o
drivers/hwmon/pmbus/max20754.c new file +390 -0

390 lines not on this page · raw message

Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH 1/2] hwmon: (pmbus/max20754) Add support for MAX20754

Thank you for the patch! Yet something to improve:

Hi Atif,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on groeck-staging/hwmon-next]
[also build test ERROR on linus/master v5.19-rc5 next-20220707] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Atif-Ofluoglu/Adding-MAX20754-support/20220707-233249
base:   https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next
config: arc-randconfig-r043-20220707 (https://download.01.org/0day-ci/archive/20220708/[email protected]/config)
compiler: arceb-elf-gcc (GCC) 11.3.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/52ef0855bc74f95cd6c170b5475a3e957d7e1028
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Atif-Ofluoglu/Adding-MAX20754-support/20220707-233249
git checkout 52ef0855bc74f95cd6c170b5475a3e957d7e1028
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=arc SHELL=/bin/bash drivers/hwmon/pmbus/

If you fix the issue, kindly add following tag where applicable

All errors (new ones prefixed by >>):

>> drivers/hwmon/pmbus/max20754.c:381:19: error: 'pmbus_do_remove' undeclared here (not in a function); did you mean 'pmbus_do_probe'?
     381 |         .remove = pmbus_do_remove,
         |                   ^~~~~~~~~~~~~~~
         |                   pmbus_do_probe

vim +381 drivers/hwmon/pmbus/max20754.c

375
376 static struct i2c_driver max20754_driver = {
377 .driver = {
378 .name = "max20754",
379 },
380 .probe_new = max20754_probe,

 > 381		.remove = pmbus_do_remove,

382 .id_table = max20754_id,
383 };
384

Signature · 2 lines
0-DAY CI Kernel Test Service
https://01.org/lkp
maintainer
#3 lore raw

Re: [PATCH 1/2] hwmon: (pmbus/max20754) Add support for MAX20754

In reply to Atif Ofluoglu
Quoted 3 lines · Atif Ofluoglu

From: Atif Ofluoglu <[email protected]>

Please use lowercase for the e-mail address to avoid confusing checkpatch.

Quoted 56 lines
---
 drivers/hwmon/pmbus/Kconfig    |   9 +
 drivers/hwmon/pmbus/Makefile   |   1 +
 drivers/hwmon/pmbus/max20754.c | 390 +++++++++++++++++++++++++++++++++
 3 files changed, 400 insertions(+)
 create mode 100644 drivers/hwmon/pmbus/max20754.c
drivers/hwmon/pmbus/Kconfig +9 -0
index dfae76db65ae..f259b8739766 100644
@@ -254,6 +254,15 @@ config SENSORS_MAX20751
 	  This driver can also be built as a module. If so, the module will
 	  be called max20751.
 
+config SENSORS_MAX20754
+	tristate "Maxim MAX20754"
+	help
+	  If you say yes here you get hardware monitoring support for Maxim
+	  MAX20754.
+
+	  This driver can also be built as a module. If so, the module will
+	  be called max20754.
+
 config SENSORS_MAX31785
 	tristate "Maxim MAX31785 and compatibles"
 	help
drivers/hwmon/pmbus/Makefile +1 -0
index 4678fba5012c..b8b1d8a84b3b 100644
@@ -27,6 +27,7 @@ obj-$(CONFIG_SENSORS_MAX16064)	+= max16064.o
 obj-$(CONFIG_SENSORS_MAX16601)	+= max16601.o
 obj-$(CONFIG_SENSORS_MAX20730)	+= max20730.o
 obj-$(CONFIG_SENSORS_MAX20751)	+= max20751.o
+obj-$(CONFIG_SENSORS_MAX20751)	+= max20754.o
 obj-$(CONFIG_SENSORS_MAX31785)	+= max31785.o
 obj-$(CONFIG_SENSORS_MAX34440)	+= max34440.o
 obj-$(CONFIG_SENSORS_MAX8688)	+= max8688.o
drivers/hwmon/pmbus/max20754.c new file +11 -0
new file mode 100644
index 000000000000..5e29e8f8009b
@@ -0,0 +1,390 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Maxim MAX20754 Dual-Output, Configurable Multiphase
+ * Power-Supply Controller with PMBus Interface
+ * and Internal Buck Converter Driver
+ *
+ * Author: Atif Emre Ofluoglu <[email protected]>
+ * Copyright (C) 2022 Analog Devices
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under  the terms of  the GNU General  Public License as published

drivers/hwmon/pmbus/max20754.c line 21

Quoted 10 lines
drivers/hwmon/pmbus/max20754.c new file +10 -0
+ * by the Free Software Foundation;  either version 2 of the  License,
+ * or (at your option) any later version.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/err.h>
+#include <linux/i2c.h>
+#include <linux/hwmon.h>

Alphabetic include file order, please.

drivers/hwmon/pmbus/max20754.c line 22

Quoted 1 line
drivers/hwmon/pmbus/max20754.c new file +1 -0
+#include <linux/hwmon-sysfs.h>

Not needed.

drivers/hwmon/pmbus/max20754.c line 25

Quoted 3 lines
drivers/hwmon/pmbus/max20754.c new file +3 -0
+#include "pmbus.h"
+
+enum chips { max20754 };

Not needed unless you plan to add another chip to the driver later on, and then it should be added with the patch introducing that chip.

drivers/hwmon/pmbus/max20754.c line 28

Quoted 3 lines
drivers/hwmon/pmbus/max20754.c new file +3 -0
+
+#define MAX20754_NUM_PHASES 6
+#define MAX20754_LINEAR_EXPONENT -10

#define<space>NAME<tab>value, please. Also, (-10)

Quoted 16 lines
drivers/hwmon/pmbus/max20754.c new file +16 -0
+
+struct max20754_data {
+	enum chips id;
+	struct pmbus_driver_info info;
+	struct i2c_client *rail2;
+	bool smbus_i2c_block_read;
+};
+
+#define to_max20754_data(x) container_of(x, struct max20754_data, info)
+
+enum max20754_reg_index {
+	operation_index,
+	on_off_config_index,
+	vout_command_index,
+	num_regs,
+};

drivers/hwmon/pmbus/max20754.c line 54

Quoted 10 lines
drivers/hwmon/pmbus/max20754.c new file +10 -0
+
+static const u8 max20754_regs[num_regs][2] = {
+	[operation_index] = {PMBUS_OPERATION, 1},
+	[on_off_config_index] = {PMBUS_ON_OFF_CONFIG, 1},
+	[vout_command_index] = {PMBUS_VOUT_COMMAND, 2},
+};
+
+static u16 val_to_linear16(int val)
+{
+	return ((u16)val * 1000LL) >> -MAX20754_LINEAR_EXPONENT;

Double negation whenever MAX20754_LINEAR_EXPONENT ? What is the point of that ?

drivers/hwmon/pmbus/max20754.c line 60

Quoted 6 lines
drivers/hwmon/pmbus/max20754.c new file +6 -0
+}
+
+static long linear16_to_val(s64 val)
+{
+	if (val == 0)
+		return 0;

Why is that needed ?

Quoted 29 lines
drivers/hwmon/pmbus/max20754.c new file +29 -0
+
+	val <<= -MAX20754_LINEAR_EXPONENT;
+	val = DIV_ROUND_CLOSEST_ULL(val, 1000);
+	val = clamp_val(val, 0, 0xffff);
+	return val;
+}
+
+static int max20754_read_block_data(struct i2c_client *client, int reg,
+				    u8 length, u8 *values)
+{
+	const struct pmbus_driver_info *info = pmbus_get_driver_info(client);
+	struct max20754_data *data = to_max20754_data(info);
+	int ret;
+
+	if (data->smbus_i2c_block_read) {
+		ret = i2c_smbus_read_i2c_block_data(client, reg, length, values);
+		if (ret < 1)
+			return ret;
+		ret = ret - 1;
+		memcpy(values, &values[1], ret);
+	} else {
+		ret = i2c_smbus_read_block_data(client, reg, values);
+	}
+
+	return ret;
+}
+
+static int max20754_read_word(struct i2c_client *client, int page, int phase,
+			      int reg)

drivers/hwmon/pmbus/max20754.c line 99

Quoted 10 lines
drivers/hwmon/pmbus/max20754.c new file +10 -0
+{
+	const struct pmbus_driver_info *info = pmbus_get_driver_info(client);
+	struct max20754_data *data = to_max20754_data(info);
+
+	if (reg > 0xFF)
+		return -ENXIO;
+
+	if (reg == PMBUS_MFR_VOUT_MAX)
+		reg = PMBUS_VOUT_MAX;
+

I don't think this makes sense. MFR_VOUT_MAX is the _rated_ maximum output voltage, while VOUT_MAX is the _configured_ maximum output voltage. Those are distinctly diffferent.

Quoted 40 lines
drivers/hwmon/pmbus/max20754.c new file +40 -0
+	switch (page) {
+	case 0:		/* RAIL1 */
+		return i2c_smbus_read_word_data(client, reg);
+	case 1:		/* RAIL2 */
+		return i2c_smbus_read_word_data(data->rail2, reg);
+	default:
+		return -ENODATA;
+	}
+
+	return -ENODATA;
+}
+
+static int max20754_write_word(struct i2c_client *client, int page, int reg, u16 value)
+{
+	const struct pmbus_driver_info *info = pmbus_get_driver_info(client);
+	struct max20754_data *data = to_max20754_data(info);
+
+	switch (reg) {
+	case PMBUS_OPERATION:
+		if (value >= 0x90 && value <= 0x93)
+			return -EOPNOTSUPP;
+		break;
+	case PMBUS_MFR_VOUT_MAX:
+		reg = PMBUS_VOUT_MAX;
+		break;
+	default:
+		break;
+	}
+
+	switch (page) {
+	case 0:		/* RAIL1 */
+		return i2c_smbus_write_word_data(client, reg, value);
+	case 1:		/* RAIL2 */
+		return i2c_smbus_write_word_data(data->rail2, reg, value);
+	default:
+		return -EOPNOTSUPP;
+	}
+	return -ENODATA;
+}
+

drivers/hwmon/pmbus/max20754.c line 149

Quoted 10 lines
drivers/hwmon/pmbus/max20754.c new file +10 -0
+static int max20754_read_byte(struct i2c_client *client, int page, int reg)
+{
+	const struct pmbus_driver_info *info = pmbus_get_driver_info(client);
+	struct max20754_data *data = to_max20754_data(info);
+	int vout_mode;
+
+	if (reg == PMBUS_VOUT_MODE) {
+		vout_mode = i2c_smbus_read_byte_data(client, reg);
+		if (vout_mode != 0x2C)
+			vout_mode = 0x16;

This ignores errors.

drivers/hwmon/pmbus/max20754.c line 150

Quoted 1 line
drivers/hwmon/pmbus/max20754.c new file +1 -0
+		return vout_mode;

Needs explanation.

Quoted 47 lines
drivers/hwmon/pmbus/max20754.c new file +47 -0
+	}
+
+	switch (page) {
+	case 0:		/* RAIL1 */
+		return i2c_smbus_read_byte_data(client, reg);
+	case 1:		/* RAIL2 */
+		return i2c_smbus_read_byte_data(data->rail2, reg);
+	default:
+		return -ENODATA;
+	}
+	return -ENODATA;
+}
+
+static int max20754_write_byte(struct i2c_client *client, int page, u8 reg)
+{
+	const struct pmbus_driver_info *info = pmbus_get_driver_info(client);
+	struct max20754_data *data = to_max20754_data(info);
+
+	if (reg == PMBUS_CLEAR_FAULTS) {
+		switch (page) {
+		case 0:
+			return i2c_smbus_write_byte(client, reg);
+		case 1:
+			return i2c_smbus_write_byte(data->rail2, reg);
+		default:
+			return -ENODATA;
+		}
+	}
+	return -ENODATA;
+}
+
+static int max20754_identify(struct i2c_client *client,
+			     struct pmbus_driver_info *info)
+{
+	struct device *dev = &client->dev;
+	u8 buf[9] = {0};
+	int ret;
+
+	ret = max20754_read_block_data(client,
+				       PMBUS_IC_DEVICE_ID, 9,
+				       buf);
+
+	if (ret < 0 || ret < 8)
+		return -ENODEV;
+
+	/*
+	 * PMBUS_IC_DEVICE_ID is expected to return "MAX20754"

drivers/hwmon/pmbus/max20754.c line 207

Quoted 10 lines
drivers/hwmon/pmbus/max20754.c new file +10 -0
+	 */
+
+	if (strncmp(buf, "MAX20754", 8)) {
+		buf[ret] = '\0';
+		dev_err(dev, "Unsupported chip '%s'\n", buf);
+		return -ENODEV;
+	}
+
+	return 0;
+}

The above can and should be handled in the probe function. With this, the smbus_i2c_block_read boolean in struct max20754_data is no longer necessary.

Quoted 4 lines
drivers/hwmon/pmbus/max20754.c new file +4 -0
+
+static ssize_t max20754_register_store(struct device *dev,
+				       struct device_attribute *attr, const char *buf,
+				       size_t count)

drivers/hwmon/pmbus/max20754.c line 221

Quoted 10 lines
drivers/hwmon/pmbus/max20754.c new file +10 -0
+{
+	struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
+	struct i2c_client *client = to_i2c_client(dev->parent);
+	const struct pmbus_driver_info *info = pmbus_get_driver_info(client);
+	struct max20754_data *data = to_max20754_data(info);
+
+	u8 cmd = max20754_regs[sattr->index][0];
+	u8 reg_size = max20754_regs[sattr->index][1];
+	u8 rail_number = sattr->nr;
+	long val = 0;

Unnecessary initialization.

Quoted 26 lines
drivers/hwmon/pmbus/max20754.c new file +26 -0
+	int ret;
+
+	ret = kstrtol(buf, 10, &val);
+	if (ret)
+		return ret;
+
+	if (rail_number == 1)
+		client = data->rail2;
+
+	if (cmd == PMBUS_VOUT_COMMAND)
+		val = linear16_to_val(val);
+
+	switch (reg_size) {
+	case 1:
+		ret = i2c_smbus_write_byte_data(client, cmd, val);
+		break;
+	case 2:
+		ret = i2c_smbus_write_word_data(client, cmd, val);
+		break;
+	default:
+		break;
+	}
+
+	if (ret < 0)
+		return ret;
+

drivers/hwmon/pmbus/max20754.c line 257

Quoted 10 lines
drivers/hwmon/pmbus/max20754.c new file +10 -0
+	return count;
+}
+
+static ssize_t max20754_register_show(struct device *dev,
+				      struct device_attribute *attr, char *buf)
+{
+	struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
+	struct i2c_client *client = to_i2c_client(dev->parent);
+
+	int ret_val = 0;

Why ret_val instead of ret like everywhere else ?

Quoted 23 lines
drivers/hwmon/pmbus/max20754.c new file +23 -0
+	u8 cmd = max20754_regs[sattr->index][0];
+	u8 reg_size = max20754_regs[sattr->index][1];
+	u8 rail_number = sattr->nr;
+
+	switch (reg_size) {
+	case 1:
+		ret_val = max20754_read_byte(client, rail_number, cmd);
+		break;
+	case 2:
+		ret_val = max20754_read_word(client, rail_number, 0, cmd);
+		break;
+	default:
+		break;
+	}
+
+	if (ret_val < 0)
+		return -ENODATA;
+
+	if (cmd == PMBUS_VOUT_COMMAND)
+		ret_val = val_to_linear16(ret_val);
+
+	return sprintf(buf, "%d\n", ret_val);
+}

drivers/hwmon/pmbus/max20754.c line 290

Quoted 10 lines
drivers/hwmon/pmbus/max20754.c new file +10 -0
+
+#define MAX20754_REGISTER_ATTR_RW(__name, __reg_index, __size) \
+	SENSOR_DEVICE_ATTR_2_RW(__name, max20754_register, __size, __reg_index)
+
+static MAX20754_REGISTER_ATTR_RW(operation, operation_index, 0);
+static MAX20754_REGISTER_ATTR_RW(on_off_config, on_off_config_index, 0);
+
+static MAX20754_REGISTER_ATTR_RW(vout1_command, vout_command_index, 0);
+static MAX20754_REGISTER_ATTR_RW(vout2_command, vout_command_index, 1);
+

The above attributes are not acceptable. Register as regulator(s) if you want to control output voltage and operation.

Quoted 33 lines
drivers/hwmon/pmbus/max20754.c new file +33 -0
+static struct attribute *max20754_attrs[] = {
+	&sensor_dev_attr_operation.dev_attr.attr,
+	&sensor_dev_attr_on_off_config.dev_attr.attr,
+	&sensor_dev_attr_vout1_command.dev_attr.attr,
+	&sensor_dev_attr_vout2_command.dev_attr.attr,
+	NULL
+};
+ATTRIBUTE_GROUPS(max20754);
+
+static struct pmbus_driver_info max20754_info = {
+	.pages = 2,
+	.format[PSC_VOLTAGE_IN] = linear,
+	.format[PSC_VOLTAGE_OUT] = linear,
+	.vrm_version[0] = vr12,
+	.format[PSC_TEMPERATURE] = linear,
+	.format[PSC_CURRENT_OUT] = linear,
+	.format[PSC_POWER] = linear,
+	.func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT |
+		PMBUS_HAVE_STATUS_INPUT | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT |
+		PMBUS_HAVE_TEMP | PMBUS_HAVE_TEMP2 | PMBUS_HAVE_STATUS_TEMP,
+	.func[1] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT | PMBUS_HAVE_STATUS_INPUT |
+		PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT |
+		PMBUS_HAVE_TEMP2 | PMBUS_HAVE_STATUS_TEMP,
+	.identify = max20754_identify,
+	.read_byte_data = max20754_read_byte,
+	.read_word_data = max20754_read_word,
+	.write_byte = max20754_write_byte,
+	.write_word_data = max20754_write_word,
+};
+
+static void max20754_remove(void *_data)
+{
+	struct max20754_data *data = _data;

drivers/hwmon/pmbus/max20754.c line 333

Quoted 10 lines
drivers/hwmon/pmbus/max20754.c new file +10 -0
+
+	i2c_unregister_device(data->rail2);
+}
+
+static int max20754_probe(struct i2c_client *client)
+{
+	struct device *dev = &client->dev;
+	struct max20754_data *data;
+	bool i2c_block_data_ok = false;
+	int ret = 0;

Unnecessary assignment.

drivers/hwmon/pmbus/max20754.c line 338

Quoted 5 lines
drivers/hwmon/pmbus/max20754.c new file +5 -0
+
+	ret = i2c_check_functionality(client->adapter,
+				      I2C_FUNC_SMBUS_READ_BYTE_DATA |
+				      I2C_FUNC_SMBUS_READ_BLOCK_DATA);
+

Unnecessary empty line. Also, assigning the return value to a variable isn't really necessary.

	if (!i2c_check_functionality(...)) {
		...

drivers/hwmon/pmbus/max20754.c line 344

Quoted 6 lines
drivers/hwmon/pmbus/max20754.c new file +6 -0
+	if (!ret) 
+		ret = i2c_check_functionality(client->adapter,
+					      I2C_FUNC_SMBUS_READ_BYTE_DATA |
+					      I2C_FUNC_SMBUS_I2C_BLOCK);
+		if (!ret)
+			return -ENODEV;
		if (!i2c_check_functionality(...))
			return -ENODEV;
Quoted 27 lines
drivers/hwmon/pmbus/max20754.c new file +27 -0
+
+		i2c_block_data_ok = true;
+	}
+
+	data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
+	if (!data)
+		return -ENOMEM;
+
+	data->rail2 = i2c_new_dummy_device(client->adapter, client->addr + 1);
+	if (IS_ERR(data->rail2)) {
+		dev_err(dev, "Failed to register rail2 client\n");
+		return PTR_ERR(data->rail2);
+	}
+	ret = devm_add_action_or_reset(dev, max20754_remove, data);
+	if (ret)
+		return ret;
+
+	data->info = max20754_info;
+	data->info.groups = max20754_groups;
+	data->smbus_i2c_block_read = i2c_block_data_ok;
+
+	return pmbus_do_probe(client, &data->info);
+}
+
+static const struct i2c_device_id max20754_id[] = {
+	{"max20754", max20754},
+	{}

drivers/hwmon/pmbus/max20754.c line 381

Quoted 10 lines
drivers/hwmon/pmbus/max20754.c new file +10 -0
+};
+
+MODULE_DEVICE_TABLE(i2c, max20754_id);
+
+static struct i2c_driver max20754_driver = {
+	.driver = {
+		   .name = "max20754",
+		   },
+	.probe_new = max20754_probe,
+	.remove = pmbus_do_remove,

Please rebase to latest kernel. pmbus_do_remove() no longer exists.

Quoted 9 lines
drivers/hwmon/pmbus/max20754.c new file +9 -0
+	.id_table = max20754_id,
+};
+
+module_i2c_driver(max20754_driver);
+
+MODULE_AUTHOR("Atif Emre Ofluoglu <[email protected]>");
+MODULE_DESCRIPTION("PMBus driver for Maxim MAX20754");
+MODULE_LICENSE("GPL");
+MODULE_IMPORT_NS(PMBUS);
#4 lore raw

PATCH 2/2 Added documentation for Maxim Integrated max20754 hwmon userspace sysfs.

In reply to Atif Ofluoglu

From: Atif Ofluoglu <[email protected]>

---
 Documentation/hwmon/max20754.rst | 122 +++++++++++++++++++++++++++++++
 1 file changed, 122 insertions(+)
 create mode 100644 Documentation/hwmon/max20754.rst
Documentation/hwmon/max20754.rst new file +122 -0
new file mode 100644
index 000000000000..30cb1356cabf
@@ -0,0 +1,122 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+Kernel driver MAX20754
+======================
+
+Supported chips:
+
+  * Maxim MAX20754
+
+    Prefix: 'max20754'
+
+    Addresses scanned: -
+
+    Datasheet: https://datasheets.maximintegrated.com/en/ds/MAX20754.pdf
+    Application Note: 
+
+Author: Atif Emre Ofluoglu  <[email protected]>
+
+
+Description
+-----------
+
+This driver supports MAX20754 Dual-Output, Configurable Multiphase 
+Power-Supply Controller with PMBus Interface and Internal Buck Converter.
+
+The driver is a client driver to the core PMBus driver.
+Please see Documentation/hwmon/pmbus.rst for details on PMBus client drivers.
+
+
+Usage Notes
+-----------
+
+This driver does not auto-detect devices. You will have to instantiate the
+devices explicitly. Please see Documentation/i2c/instantiating-devices.rst for
+details.
+
+
+Platform data support
+---------------------
+
+The driver supports standard PMBus driver platform data.
+
+
+Sysfs entries
+-------------
+
+The following attributes are supported.
+
+=============================== ===============================================
+in1_input   Measured voltage on Supply Voltage. 
+in1_label   "vin1"
+in1_alarm   Input voltage under-voltage alarm
+
+in2_label		"vout1"
+in2_input		Measured voltage on RAIL1.
+in2_min			Minimum output voltage.
+in2_max			Maximum output voltage.
+in2_lcrit		Critical minimum output voltage.
+in2_crit		Critical maximum output voltage.
+in2_lcrit_alarm		Output voltage critical low alarm.
+in2_crit_alarm    Output voltage critical high alarm.
+in2_min_alarm		Output voltage low alarm.
+in2_max_alarm		Output voltage high alarm.
+in2_rated_max   Maximum rated output voltage
+in2_rated_min   Minimum rated output voltage
+
+in3_label		"vout2"
+in3_input		Measured voltage on RAIL2.
+in3_min			Minimum output voltage.
+in3_max			Maximum output voltage.
+in3_lcrit		Critical minimum output voltage.
+in3_crit		Critical maximum output voltage.
+in3_lcrit_alarm		Output voltage critical low alarm.
+in3_crit_alarm    Output voltage critical high alarm.
+in3_min_alarm		Output voltage low alarm.
+in3_max_alarm		Output voltage high alarm.
+in3_rated_max   Maximum rated output voltage
+in3_rated_min   Minimum rated output voltage
+
+curr1_input Measured output current  on RAIL1.
+curr1_label "iout1"
+curr1_max		Maximum output current.
+curr1_max_alarm   Output current high alarm.
+curr1_crit    Critical maximum current
+curr1_crit_alarm    Current critical high alarm
+
+curr2_input   Measured output current on RAIL2.
+curr2_label   "iout2"
+curr2_max   Maximum output current.
+curr2_max_alarm   Output current high alarm.
+curr2_crit    Critical maximum current
+curr2_crit_alarm    Current critical high alarm
+
+temp1_input   Measured Temperature value of Die Core
+temp1_crit    Maximum Temperature value of Die Core
+temp1_crit_alarm    Maximum Temperature Alarm of Die Core
+temp1_max   Over Temperature Warning value of Die Core
+temp1_max_alarm Over Temperature Warning value of Die Core
+temp1_min  Under Temperature value of Die Core
+temp1_min_alarm Under Temperature Alarm of Die Core
+
+temp1_input   Measured Temperature value of Temperature Sense 1
+temp1_crit    Maximum Temperature value of Temperature Sense 1
+temp1_crit_alarm    Maximum Temperature Alarm of Temperature Sense 1
+temp1_max   Over Temperature Warning value of Temperature Sense 1
+temp1_max_alarm Over Temperature Warning value of Temperature Sense 1
+temp1_min  Under Temperature value of Temperature Sense 1
+temp1_min_alarm Under Temperature Alarm of Temperature Sense 1
+
+temp1_input   Measured Temperature value of Temperature Sense 1
+temp1_crit    Maximum Temperature value of Temperature Sense 1
+temp1_crit_alarm    Maximum Temperature Alarm of Temperature Sense 1
+temp1_max   Over Temperature Warning value ofTemperature Sense 1
+temp1_max_alarm Over Temperature Warning Temperature Sense 1
+temp1_min  Under Temperature value of Temperature Sense 1
+temp1_min_alarm Under Temperature Alarm of Temperature Sense 1
+
+vout1_command   Determine Voltage read format of RAIL1
+vout2_command   Determine Voltage read format of RAIL2
+
+on_off_config   Configures Power On/Off behavior.
+operation   Configures Power Supply Operation Mode.
\ No newline at end of file
Signature · 1 line
2.25.1
#5 lore raw

Re: [PATCH 2/2] Added documentation for Maxim Integrated max20754 hwmon userspace sysfs.

Thank you for the patch! Perhaps something to improve:

Hi Atif,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on groeck-staging/hwmon-next]
[also build test WARNING on linus/master v5.19-rc5 next-20220707] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Atif-Ofluoglu/Adding-MAX20754-support/20220707-233249
base:   https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next
reproduce: make htmldocs

If you fix the issue, kindly add following tag where applicable

All warnings (new ones prefixed by >>):

>> Documentation/hwmon/max20754.rst: WARNING: document isn't included in any toctree
>> Documentation/hwmon/max20754.rst:49: WARNING: Malformed table.
Signature · 2 lines
0-DAY CI Kernel Test Service
https://01.org/lkp