lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230419-dynamic-vmon-v1-2-f48b7438e891@skidata.com>
Date:   Thu, 20 Apr 2023 12:29:21 +0200
From:   Benjamin Bara <bbara93@...il.com>
To:     Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>, support.opensource@...semi.com
Cc:     DLG-Adam.Ward.opensource@...renesas.com,
        linux-kernel@...r.kernel.org,
        Matti Vaittinen <mazziesaccount@...il.com>,
        Benjamin Bara <benjamin.bara@...data.com>
Subject: [PATCH RFC 2/2] regulator: da9063: disable monitoring while
 regulator is off

From: Benjamin Bara <benjamin.bara@...data.com>

The PWR_OK state of the da9063 indicates whether all monitored voltages
are within the expected range. When a regulator is disabled without
disabling its voltage monitor before, the PWR_OK state becomes false. On
our board, this invalid state leads to a hard reset.

Therefore, prevent the invalid state by disabling the monitor before the
regulator is disabled.

This still requires to explicitly enable the voltage monitor in the
device tree and has no impact otherwise.

TODO: clarify if a MODE change has impact on the voltage monitor

Signed-off-by: Benjamin Bara <benjamin.bara@...data.com>
---
 drivers/regulator/da9063-regulator.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/da9063-regulator.c b/drivers/regulator/da9063-regulator.c
index 82f52a2a031a..0fa320abad93 100644
--- a/drivers/regulator/da9063-regulator.c
+++ b/drivers/regulator/da9063-regulator.c
@@ -713,14 +713,27 @@ static irqreturn_t da9063_ldo_lim_event(int irq, void *data)
 /*
  * Probing and Initialisation functions
  */
+
+/* prevent !PWR_OK state by disabling monitoring while regulator is off. */
+static const struct monitoring_constraints da9063_vmon_constraints = {
+	.mon_disable_during_reg_off = 1,
+};
+
 static const struct regulator_init_data *da9063_get_regulator_initdata(
 		const struct da9063_regulators_pdata *regl_pdata, int id)
 {
+	struct regulator_init_data *initdata;
+	struct regulation_constraints *reg_constr;
 	int i;
 
 	for (i = 0; i < regl_pdata->n_regulators; i++) {
-		if (id == regl_pdata->regulator_data[i].id)
-			return regl_pdata->regulator_data[i].initdata;
+		if (id == regl_pdata->regulator_data[i].id) {
+			initdata = regl_pdata->regulator_data[i].initdata;
+			reg_constr = &initdata->constraints;
+			reg_constr->ov_constraints = &da9063_vmon_constraints;
+			reg_constr->uv_constraints = &da9063_vmon_constraints;
+			return initdata;
+		}
 	}
 
 	return NULL;

-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ