[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221128174715.1969957-2-Naresh.Solanki@9elements.com>
Date: Mon, 28 Nov 2022 18:47:13 +0100
From: Naresh Solanki <naresh.solanki@...ements.com>
To: Guenter Roeck <linux@...ck-us.net>, linux-hwmon@...r.kernel.org,
Jean Delvare <jdelvare@...e.com>
Cc: Patrick Rudolph <patrick.rudolph@...ements.com>,
Naresh Solanki <Naresh.Solanki@...ements.com>,
linux-kernel@...r.kernel.org
Subject: [PATCH v2 2/3] hwmon: (pmbus/core): Add events to regulator flag map
From: Patrick Rudolph <patrick.rudolph@...ements.com>
Add regulator events corresponding to regulator error in regulator flag
map.
Signed-off-by: Patrick Rudolph <patrick.rudolph@...ements.com>
Signed-off-by: Naresh Solanki <Naresh.Solanki@...ements.com>
---
drivers/hwmon/pmbus/pmbus_core.c | 62 +++++++++++++++++++++-----------
1 file changed, 41 insertions(+), 21 deletions(-)
diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index f5caceaaef2a..060e9d0a55bd 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -2738,9 +2738,9 @@ static int pmbus_regulator_disable(struct regulator_dev *rdev)
return _pmbus_regulator_on_off(rdev, 0);
}
-/* A PMBus status flag and the corresponding REGULATOR_ERROR_* flag */
+/* A PMBus status flag and the corresponding REGULATOR_ERROR_* and REGULATOR_EVENTS_* flag */
struct pmbus_regulator_status_assoc {
- int pflag, rflag;
+ int pflag, rflag, eflag;
};
/* PMBus->regulator bit mappings for a PMBus status register */
@@ -2755,51 +2755,71 @@ static const struct pmbus_regulator_status_category pmbus_regulator_flag_map[] =
.func = -1,
.reg = PMBUS_STATUS_BYTE,
.bits = (const struct pmbus_regulator_status_assoc[]) {
- { PB_STATUS_IOUT_OC, REGULATOR_ERROR_OVER_CURRENT },
- { PB_STATUS_VOUT_OV, REGULATOR_ERROR_REGULATION_OUT },
- { PB_STATUS_VIN_UV, REGULATOR_ERROR_UNDER_VOLTAGE },
+ { PB_STATUS_IOUT_OC, REGULATOR_ERROR_OVER_CURRENT,
+ REGULATOR_EVENT_OVER_CURRENT },
+ { PB_STATUS_VOUT_OV, REGULATOR_ERROR_REGULATION_OUT,
+ REGULATOR_EVENT_OVER_VOLTAGE_WARN },
+ { PB_STATUS_VIN_UV, REGULATOR_ERROR_UNDER_VOLTAGE,
+ REGULATOR_EVENT_UNDER_VOLTAGE },
{ },
},
}, {
.func = PMBUS_HAVE_STATUS_VOUT,
.reg = PMBUS_STATUS_VOUT,
.bits = (const struct pmbus_regulator_status_assoc[]) {
- { PB_VOLTAGE_UV_WARNING, REGULATOR_ERROR_UNDER_VOLTAGE_WARN },
- { PB_VOLTAGE_UV_FAULT, REGULATOR_ERROR_UNDER_VOLTAGE },
- { PB_VOLTAGE_OV_WARNING, REGULATOR_ERROR_OVER_VOLTAGE_WARN },
- { PB_VOLTAGE_OV_FAULT, REGULATOR_ERROR_REGULATION_OUT },
+ { PB_VOLTAGE_UV_WARNING, REGULATOR_ERROR_UNDER_VOLTAGE_WARN,
+ REGULATOR_EVENT_UNDER_VOLTAGE_WARN },
+ { PB_VOLTAGE_UV_FAULT, REGULATOR_ERROR_UNDER_VOLTAGE,
+ REGULATOR_EVENT_UNDER_VOLTAGE },
+ { PB_VOLTAGE_OV_WARNING, REGULATOR_ERROR_OVER_VOLTAGE_WARN,
+ REGULATOR_EVENT_OVER_VOLTAGE_WARN },
+ { PB_VOLTAGE_OV_FAULT, REGULATOR_ERROR_REGULATION_OUT,
+ REGULATOR_EVENT_OVER_VOLTAGE_WARN },
{ },
},
}, {
.func = PMBUS_HAVE_STATUS_IOUT,
.reg = PMBUS_STATUS_IOUT,
.bits = (const struct pmbus_regulator_status_assoc[]) {
- { PB_IOUT_OC_WARNING, REGULATOR_ERROR_OVER_CURRENT_WARN },
- { PB_IOUT_OC_FAULT, REGULATOR_ERROR_OVER_CURRENT },
- { PB_IOUT_OC_LV_FAULT, REGULATOR_ERROR_OVER_CURRENT },
- { PB_POUT_OP_FAULT, REGULATOR_ERROR_OVER_CURRENT },
+ { PB_IOUT_OC_WARNING, REGULATOR_ERROR_OVER_CURRENT_WARN,
+ REGULATOR_EVENT_OVER_CURRENT_WARN },
+ { PB_IOUT_OC_FAULT, REGULATOR_ERROR_OVER_CURRENT,
+ REGULATOR_EVENT_OVER_CURRENT },
+ { PB_IOUT_OC_LV_FAULT, REGULATOR_ERROR_OVER_CURRENT,
+ REGULATOR_EVENT_OVER_CURRENT },
+ { PB_POUT_OP_FAULT, REGULATOR_ERROR_OVER_CURRENT,
+ REGULATOR_EVENT_OVER_CURRENT },
{ },
},
}, {
.func = PMBUS_HAVE_STATUS_TEMP,
.reg = PMBUS_STATUS_TEMPERATURE,
.bits = (const struct pmbus_regulator_status_assoc[]) {
- { PB_TEMP_OT_WARNING, REGULATOR_ERROR_OVER_TEMP_WARN },
- { PB_TEMP_OT_FAULT, REGULATOR_ERROR_OVER_TEMP },
+ { PB_TEMP_OT_WARNING, REGULATOR_ERROR_OVER_TEMP_WARN,
+ REGULATOR_EVENT_OVER_TEMP_WARN },
+ { PB_TEMP_OT_FAULT, REGULATOR_ERROR_OVER_TEMP,
+ REGULATOR_EVENT_OVER_TEMP },
{ },
},
}, {
.func = PMBUS_HAVE_STATUS_INPUT,
.reg = PMBUS_STATUS_INPUT,
.bits = (const struct pmbus_regulator_status_assoc[]) {
- { PB_IIN_OC_FAULT, REGULATOR_ERROR_OVER_CURRENT },
- { PB_IIN_OC_WARNING, REGULATOR_ERROR_OVER_CURRENT_WARN },
- { PB_VOLTAGE_UV_FAULT, REGULATOR_ERROR_UNDER_VOLTAGE },
- { PB_VOLTAGE_UV_WARNING, REGULATOR_ERROR_UNDER_VOLTAGE_WARN },
- { PB_VOLTAGE_OV_WARNING, REGULATOR_ERROR_OVER_VOLTAGE_WARN },
- { PB_VOLTAGE_OV_FAULT, REGULATOR_ERROR_OVER_VOLTAGE_WARN },
+ { PB_IIN_OC_FAULT, REGULATOR_ERROR_OVER_CURRENT,
+ REGULATOR_EVENT_OVER_CURRENT },
+ { PB_IIN_OC_WARNING, REGULATOR_ERROR_OVER_CURRENT_WARN,
+ REGULATOR_EVENT_OVER_CURRENT_WARN },
+ { PB_VOLTAGE_UV_FAULT, REGULATOR_ERROR_UNDER_VOLTAGE,
+ REGULATOR_EVENT_UNDER_VOLTAGE },
+ { PB_VOLTAGE_UV_WARNING, REGULATOR_ERROR_UNDER_VOLTAGE_WARN,
+ REGULATOR_EVENT_UNDER_VOLTAGE_WARN },
+ { PB_VOLTAGE_OV_WARNING, REGULATOR_ERROR_OVER_VOLTAGE_WARN,
+ REGULATOR_ERROR_OVER_VOLTAGE_WARN },
+ { PB_VOLTAGE_OV_FAULT, REGULATOR_ERROR_OVER_VOLTAGE_WARN,
+ REGULATOR_ERROR_OVER_VOLTAGE_WARN },
{ },
},
+
},
};
--
2.37.3
Powered by blists - more mailing lists