hwmon: (pmbus/max16601) Add MAX16602 support

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

Signed-off-by: Atif Ofluoglu <atif.ofluoglu@maximintegrated.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
Atif Ofluoglu 2022-04-15 16:34:29 +03:00 committed by Guenter Roeck
parent 229b159c50
commit e5c498ccc9
3 changed files with 18 additions and 7 deletions

View File

@ -21,6 +21,14 @@ Supported chips:
Datasheet: Not published Datasheet: Not published
* Maxim MAX16602
Prefix: 'max16602'
Addresses scanned: -
Datasheet: https://datasheets.maximintegrated.com/en/ds/MAX16602.pdf
Author: Guenter Roeck <linux@roeck-us.net> Author: Guenter Roeck <linux@roeck-us.net>

View File

@ -228,10 +228,10 @@ config SENSORS_MAX16064
be called max16064. be called max16064.
config SENSORS_MAX16601 config SENSORS_MAX16601
tristate "Maxim MAX16508, MAX16601" tristate "Maxim MAX16508, MAX16601, MAX16602"
help help
If you say yes here you get hardware monitoring support for Maxim If you say yes here you get hardware monitoring support for Maxim
MAX16508 and MAX16601. MAX16508, MAX16601 and MAX16602.
This driver can also be built as a module. If so, the module will This driver can also be built as a module. If so, the module will
be called max16601. be called max16601.

View File

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0 // 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: * Implementation notes:
* *
@ -31,7 +31,7 @@
#include "pmbus.h" #include "pmbus.h"
enum chips { max16508, max16601 }; enum chips { max16508, max16601, max16602 };
#define REG_DEFAULT_NUM_POP 0xc4 #define REG_DEFAULT_NUM_POP 0xc4
#define REG_SETPT_DVID 0xd1 #define REG_SETPT_DVID 0xd1
@ -202,7 +202,7 @@ static int max16601_identify(struct i2c_client *client,
else else
info->vrm_version[0] = vr12; info->vrm_version[0] = vr12;
if (data->id != max16601) if (data->id != max16601 && data->id != max16602)
return 0; return 0;
reg = i2c_smbus_read_byte_data(client, REG_DEFAULT_NUM_POP); reg = 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[] = { static const struct i2c_device_id max16601_id[] = {
{"max16508", max16508}, {"max16508", max16508},
{"max16601", max16601}, {"max16601", max16601},
{"max16602", max16602},
{} {}
}; };
MODULE_DEVICE_TABLE(i2c, max16601_id); MODULE_DEVICE_TABLE(i2c, max16601_id);
@ -280,13 +281,15 @@ static int max16601_get_id(struct i2c_client *client)
return -ENODEV; return -ENODEV;
/* /*
* PMBUS_IC_DEVICE_ID is expected to return "MAX16601y.xx" * PMBUS_IC_DEVICE_ID is expected to return "MAX16601y.xx" or
* or "MAX16500y.xx". * MAX16602y.xx or "MAX16500y.xx".cdxxcccccccccc
*/ */
if (!strncmp(buf, "MAX16500", 8)) { if (!strncmp(buf, "MAX16500", 8)) {
id = max16508; id = max16508;
} else if (!strncmp(buf, "MAX16601", 8)) { } else if (!strncmp(buf, "MAX16601", 8)) {
id = max16601; id = max16601;
} else if (!strncmp(buf, "MAX16602", 8)) {
id = max16602;
} else { } else {
buf[ret] = '\0'; buf[ret] = '\0';
dev_err(dev, "Unsupported chip '%s'\n", buf); dev_err(dev, "Unsupported chip '%s'\n", buf);