[PATCH] hwmon: (pmbus/max16601) Add MAX16602 support

From: Atif Ofluoglu
Date: Fri Apr 15 2022 - 09:34:29 EST


Adding another MAX16602 chip support to MAX16601 driver
Tested with MAX16602 works as expected.

Signed-off-by: Atif Ofluoglu <mailto:atif.ofluoglu@xxxxxxxxxxxxxxxxxxx>
---
Documentation/hwmon/max16601.rst | 8 ++++++++
drivers/hwmon/pmbus/Kconfig | 4 ++--
drivers/hwmon/pmbus/max16601.c | 13 ++++++++-----
3 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/Documentation/hwmon/max16601.rst b/Documentation/hwmon/max1660=
1.rst
index 92c0a7d7808c..6a4eef8efbaf 100644
--- a/Documentation/hwmon/max16601.rst
+++ b/Documentation/hwmon/max16601.rst
@@ -21,6 +21,14 @@ Supported chips:
=20
Datasheet: Not published
=20
+ * Maxim MAX16602
+
+ Prefix: 'max16602'
+
+ Addresses scanned: -
+
+ Datasheet: https://datasheets.maximintegrated.com/en/ds/MAX16602.pdf
+
Author: Guenter Roeck <mailto:linux@xxxxxxxxxxxx>
=20
=20
diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig
index a2ea1d5a8765..53683d2d0fb2 100644
--- a/drivers/hwmon/pmbus/Kconfig
+++ b/drivers/hwmon/pmbus/Kconfig
@@ -228,10 +228,10 @@ config SENSORS_MAX16064
be called max16064.
=20
config SENSORS_MAX16601
- tristate "Maxim MAX16508, MAX16601"
+ tristate "Maxim MAX16508, MAX16601, MAX16602"
help
If you say yes here you get hardware monitoring support for Maxim
- MAX16508 and MAX16601.
+ MAX16508, MAX16601 and MAX16602.
=20
This driver can also be built as a module. If so, the module will
be called max16601.
diff --git a/drivers/hwmon/pmbus/max16601.c b/drivers/hwmon/pmbus/max16601.=
c
index 5a226a564776..b628405e6586 100644
--- a/drivers/hwmon/pmbus/max16601.c
+++ b/drivers/hwmon/pmbus/max16601.c
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
/*
- * Hardware monitoring driver for Maxim MAX16508 and MAX16601.
+ * Hardware monitoring driver for Maxim MAX16508, MAX16601 and MAX16602.
*
* Implementation notes:
*
@@ -31,7 +31,7 @@
=20
#include "pmbus.h"
=20
-enum chips { max16508, max16601 };
+enum chips { max16508, max16601, max16602 };
=20
#define REG_DEFAULT_NUM_POP 0xc4
#define REG_SETPT_DVID 0xd1
@@ -202,7 +202,7 @@ static int max16601_identify(struct i2c_client *client,
else
info->vrm_version[0] =3D vr12;
=20
- if (data->id !=3D max16601)
+ if (data->id !=3D max16601 && data->id !=3D max16602)
return 0;
=20
reg =3D i2c_smbus_read_byte_data(client, REG_DEFAULT_NUM_POP);
@@ -264,6 +264,7 @@ static void max16601_remove(void *_data)
static const struct i2c_device_id max16601_id[] =3D {
{"max16508", max16508},
{"max16601", max16601},
+ {"max16602", max16602},
{}
};
MODULE_DEVICE_TABLE(i2c, max16601_id);
@@ -280,13 +281,15 @@ static int max16601_get_id(struct i2c_client *client)
return -ENODEV;
=20
/*
- * PMBUS_IC_DEVICE_ID is expected to return "MAX16601y.xx"
- * or "MAX16500y.xx".
+ * PMBUS_IC_DEVICE_ID is expected to return "MAX16601y.xx" or
+ * MAX16602y.xx or "MAX16500y.xx".cdxxcccccccccc
*/
if (!strncmp(buf, "MAX16500", 8)) {
id =3D max16508;
} else if (!strncmp(buf, "MAX16601", 8)) {
id =3D max16601;
+ } else if (!strncmp(buf, "MAX16602", 8)) {
+ id =3D max16602;
} else {
buf[ret] =3D '\0';
dev_err(dev, "Unsupported chip '%s'\n", buf);
--=20
2.25.1