From: Benjamin Bara <benjamin.bara@xxxxxxxxxxx>
Add an op to get all active monitors of a regulator. This is useful to
find out if any monitor is turned on, of which the device-tree is not
aware of (e.g. by bootloader or OTP).
Signed-off-by: Benjamin Bara <benjamin.bara@xxxxxxxxxxx>
---
include/linux/regulator/driver.h | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index d3b4a3d4514a..9a9163cae769 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -25,6 +25,13 @@ struct regulator_config;
struct regulator_init_data;
struct regulator_enable_gpio;
+#define REGULATOR_MONITOR_NONE 0x0
+#define REGULATOR_MONITOR_OVER_CURRENT 0x1
+#define REGULATOR_MONITOR_OVER_VOLTAGE 0x2
+#define REGULATOR_MONITOR_UNDER_VOLTAGE 0x4
+#define REGULATOR_MONITOR_OVER_TEMPERATURE 0x8
+#define REGULATOR_MONITOR_ALL 0xF
+
enum regulator_status {
REGULATOR_STATUS_OFF,
REGULATOR_STATUS_ON,
@@ -112,6 +119,8 @@ enum regulator_detection_severity {
* @set_thermal_protection: Support enabling of and setting limits for over
* temperature situation detection.Detection can be configured for same
* severities as over current protection. Units of degree Kelvin.
+ * @get_active_protections: Get all enabled monitors of a regulator. OR'ed val
+ * of REGULATOR_MONITOR_*.
*
* @set_active_discharge: Set active discharge enable/disable of regulators.
*
@@ -183,6 +192,7 @@ struct regulator_ops {
int severity, bool enable);
int (*set_thermal_protection)(struct regulator_dev *, int lim,
int severity, bool enable);
+ int (*get_active_protections)(struct regulator_dev *dev, unsigned int *state);
int (*set_active_discharge)(struct regulator_dev *, bool enable);
/* enable/disable regulator */