summaryrefslogtreecommitdiff
path: root/drivers/hwmon/pmbus/xdpe12284.c
diff options
context:
space:
mode:
authorMarcello Sylvester Bauer <sylv@sylv.io>2022-03-02 10:49:20 +0100
committerGuenter Roeck <linux@roeck-us.net>2022-03-02 09:51:11 -0800
commitefdab64d88ab693bdcadc23780e347cc4185d4be (patch)
tree8ad1372ee5ccca0e2c7c41f7b774a6ccf910d1e6 /drivers/hwmon/pmbus/xdpe12284.c
parentff4670ed6e8137642b0760aa198bc04188451b80 (diff)
hwmon: (xdpe12284) Add support for xdpe11280
Add support for another Infineon Multi-phase controller chip. The xdpe11280 uses linear instead of vid data format for VOUT. Detect VOUT_MODE format during identification and skip the xdpe122 related adaptions in case it is linear. Signed-off-by: Marcello Sylvester Bauer <sylv@sylv.io> Link: https://lore.kernel.org/r/fa6a4b636a05ecb337d132824efca2545188a2a2.1646214248.git.sylv@sylv.io Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/pmbus/xdpe12284.c')
-rw-r--r--drivers/hwmon/pmbus/xdpe12284.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/hwmon/pmbus/xdpe12284.c b/drivers/hwmon/pmbus/xdpe12284.c
index b07da06a40c9..b979c88d2e87 100644
--- a/drivers/hwmon/pmbus/xdpe12284.c
+++ b/drivers/hwmon/pmbus/xdpe12284.c
@@ -76,7 +76,22 @@ static int xdpe122_identify(struct i2c_client *client,
struct pmbus_driver_info *info)
{
u8 vout_params;
- int i, ret;
+ int i, ret, vout_mode;
+
+ vout_mode = pmbus_read_byte_data(client, 0, PMBUS_VOUT_MODE);
+ if (vout_mode >= 0 && vout_mode != 0xff) {
+ switch (vout_mode >> 5) {
+ case 0:
+ info->format[PSC_VOLTAGE_OUT] = linear;
+ return 0;
+ case 1:
+ info->format[PSC_VOLTAGE_OUT] = vid;
+ info->read_word_data = xdpe122_read_word_data;
+ break;
+ default:
+ return -ENODEV;
+ }
+ }
for (i = 0; i < XDPE122_PAGE_NUM; i++) {
/* Read the register with VOUT scaling value.*/
@@ -110,7 +125,6 @@ static int xdpe122_identify(struct i2c_client *client,
static struct pmbus_driver_info xdpe122_info = {
.pages = XDPE122_PAGE_NUM,
.format[PSC_VOLTAGE_IN] = linear,
- .format[PSC_VOLTAGE_OUT] = vid,
.format[PSC_TEMPERATURE] = linear,
.format[PSC_CURRENT_IN] = linear,
.format[PSC_CURRENT_OUT] = linear,
@@ -124,7 +138,6 @@ static struct pmbus_driver_info xdpe122_info = {
PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP |
PMBUS_HAVE_POUT | PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT,
.identify = xdpe122_identify,
- .read_word_data = xdpe122_read_word_data,
};
static int xdpe122_probe(struct i2c_client *client)
@@ -140,6 +153,7 @@ static int xdpe122_probe(struct i2c_client *client)
}
static const struct i2c_device_id xdpe122_id[] = {
+ {"xdpe11280", 0},
{"xdpe12254", 0},
{"xdpe12284", 0},
{}
@@ -148,6 +162,7 @@ static const struct i2c_device_id xdpe122_id[] = {
MODULE_DEVICE_TABLE(i2c, xdpe122_id);
static const struct of_device_id __maybe_unused xdpe122_of_match[] = {
+ {.compatible = "infineon,xdpe11280"},
{.compatible = "infineon,xdpe12254"},
{.compatible = "infineon,xdpe12284"},
{}