···114114 description: Enable pull down resistor when the regulator is disabled.115115 type: boolean116116117117+ system-critical-regulator:118118+ description: Set if the regulator is critical to system stability or119119+ functionality.120120+ type: boolean121121+117122 regulator-over-current-protection:118123 description: Enable over current protection.119124 type: boolean···185180 to disable detection and value '1' indicates that detection should186181 be enabled but limit setting can be omitted. Limit is given as microvolt187182 offset from voltage set to regulator.183183+184184+ regulator-uv-less-critical-window-ms:185185+ description: Specifies the time window (in milliseconds) following a186186+ critical under-voltage event during which the system can continue to187187+ operate safely while performing less critical operations. This property188188+ provides a defined duration before a more severe reaction to the189189+ under-voltage event is needed, allowing for certain non-urgent actions to190190+ be carried out in preparation for potential power loss.188191189192 regulator-temp-protection-kelvin:190193 description: Set over temperature protection limit. This is a limit where
+38
drivers/regulator/core.c
···1919#include <linux/delay.h>2020#include <linux/gpio/consumer.h>2121#include <linux/of.h>2222+#include <linux/reboot.h>2223#include <linux/regmap.h>2324#include <linux/regulator/of_regulator.h>2425#include <linux/regulator/consumer.h>···50675066EXPORT_SYMBOL_GPL(regulator_bulk_free);5068506750695068/**50695069+ * regulator_handle_critical - Handle events for system-critical regulators.50705070+ * @rdev: The regulator device.50715071+ * @event: The event being handled.50725072+ *50735073+ * This function handles critical events such as under-voltage, over-current,50745074+ * and unknown errors for regulators deemed system-critical. On detecting such50755075+ * events, it triggers a hardware protection shutdown with a defined timeout.50765076+ */50775077+static void regulator_handle_critical(struct regulator_dev *rdev,50785078+ unsigned long event)50795079+{50805080+ const char *reason = NULL;50815081+50825082+ if (!rdev->constraints->system_critical)50835083+ return;50845084+50855085+ switch (event) {50865086+ case REGULATOR_EVENT_UNDER_VOLTAGE:50875087+ reason = "System critical regulator: voltage drop detected";50885088+ break;50895089+ case REGULATOR_EVENT_OVER_CURRENT:50905090+ reason = "System critical regulator: over-current detected";50915091+ break;50925092+ case REGULATOR_EVENT_FAIL:50935093+ reason = "System critical regulator: unknown error";50945094+ }50955095+50965096+ if (!reason)50975097+ return;50985098+50995099+ hw_protection_shutdown(reason,51005100+ rdev->constraints->uv_less_critical_window_ms);51015101+}51025102+51035103+/**50705104 * regulator_notifier_call_chain - call regulator event notifier50715105 * @rdev: regulator source50725106 * @event: notifier block···51135077int regulator_notifier_call_chain(struct regulator_dev *rdev,51145078 unsigned long event, void *data)51155079{50805080+ regulator_handle_critical(rdev, event);50815081+51165082 _notifier_call_chain(rdev, event, data);51175083 return NOTIFY_DONE;51185084
+9
drivers/regulator/of_regulator.c
···131131 constraints->valid_ops_mask |= REGULATOR_CHANGE_STATUS;132132133133 constraints->pull_down = of_property_read_bool(np, "regulator-pull-down");134134+ constraints->system_critical = of_property_read_bool(np,135135+ "system-critical-regulator");134136135137 if (of_property_read_bool(np, "regulator-allow-bypass"))136138 constraints->valid_ops_mask |= REGULATOR_CHANGE_BYPASS;···174172 ret = of_property_read_u32(np, "regulator-enable-ramp-delay", &pval);175173 if (!ret)176174 constraints->enable_time = pval;175175+176176+ ret = of_property_read_u32(np, "regulator-uv-survival-time-ms", &pval);177177+ if (!ret)178178+ constraints->uv_less_critical_window_ms = pval;179179+ else180180+ constraints->uv_less_critical_window_ms =181181+ REGULATOR_DEF_UV_LESS_CRITICAL_WINDOW_MS;177182178183 constraints->soft_start = of_property_read_bool(np,179184 "regulator-soft-start");
+18
include/linux/regulator/machine.h
···4949#define DISABLE_IN_SUSPEND 15050#define ENABLE_IN_SUSPEND 251515252+/*5353+ * Default time window (in milliseconds) following a critical under-voltage5454+ * event during which less critical actions can be safely carried out by the5555+ * system.5656+ */5757+#define REGULATOR_DEF_UV_LESS_CRITICAL_WINDOW_MS 105858+5259/* Regulator active discharge flags */5360enum regulator_active_discharge {5461 REGULATOR_ACTIVE_DISCHARGE_DEFAULT,···134127 * @ramp_disable: Disable ramp delay when initialising or when setting voltage.135128 * @soft_start: Enable soft start so that voltage ramps slowly.136129 * @pull_down: Enable pull down when regulator is disabled.130130+ * @system_critical: Set if the regulator is critical to system stability or131131+ * functionality.137132 * @over_current_protection: Auto disable on over current event.138133 *139134 * @over_current_detection: Configure over current limits.···162153 * regulator_active_discharge values are used for163154 * initialisation.164155 * @enable_time: Turn-on time of the rails (unit: microseconds)156156+ * @uv_less_critical_window_ms: Specifies the time window (in milliseconds)157157+ * following a critical under-voltage (UV) event158158+ * during which less critical actions can be159159+ * safely carried out by the system (for example160160+ * logging). After this time window more critical161161+ * actions should be done (for example prevent162162+ * HW damage).165163 */166164struct regulation_constraints {167165···220204 unsigned int settling_time_up;221205 unsigned int settling_time_down;222206 unsigned int enable_time;207207+ unsigned int uv_less_critical_window_ms;223208224209 unsigned int active_discharge;225210···231214 unsigned ramp_disable:1; /* disable ramp delay */232215 unsigned soft_start:1; /* ramp voltage slowly */233216 unsigned pull_down:1; /* pull down resistor when regulator off */217217+ unsigned system_critical:1; /* critical to system stability */234218 unsigned over_current_protection:1; /* auto disable on over current */235219 unsigned over_current_detection:1; /* notify on over current */236220 unsigned over_voltage_detection:1; /* notify on over voltage */