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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1461332608-14760-1-git-send-email-rf@opensource.wolfsonmicro.com>
Date:	Fri, 22 Apr 2016 14:43:28 +0100
From:	Richard Fitzgerald <rf@...nsource.wolfsonmicro.com>
To:	<broonie@...nel.org>
CC:	<lgirdwood@...il.com>, <patches@...nsource.wolfsonmicro.com>,
	<linux-kernel@...r.kernel.org>
Subject: [PATCH] regulator: arizona-ldo1: Only enable status change if we have LDOENA

The driver was hardcoding REGULATOR_CHANGE_STATUS on the regulator
which made the regulator core assume that it can be powered off.

The power state of the regulator is controlled by the LDOENA pin so
this patch changes to only setting the REGULATOR_CHANGE_STATUS flag
if we have a valid gpio for LDOENA.

Signed-off-by: Richard Fitzgerald <rf@...nsource.wolfsonmicro.com>
---
 drivers/regulator/arizona-ldo1.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/regulator/arizona-ldo1.c b/drivers/regulator/arizona-ldo1.c
index f7c88ff..edeb36b 100644
--- a/drivers/regulator/arizona-ldo1.c
+++ b/drivers/regulator/arizona-ldo1.c
@@ -161,16 +161,12 @@ static const struct regulator_init_data arizona_ldo1_dvfs = {
 	.constraints = {
 		.min_uV = 1200000,
 		.max_uV = 1800000,
-		.valid_ops_mask = REGULATOR_CHANGE_STATUS |
-				  REGULATOR_CHANGE_VOLTAGE,
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
 	},
 	.num_consumer_supplies = 1,
 };
 
 static const struct regulator_init_data arizona_ldo1_default = {
-	.constraints = {
-		.valid_ops_mask = REGULATOR_CHANGE_STATUS,
-	},
 	.num_consumer_supplies = 1,
 };
 
@@ -178,8 +174,7 @@ static const struct regulator_init_data arizona_ldo1_wm5110 = {
 	.constraints = {
 		.min_uV = 1175000,
 		.max_uV = 1200000,
-		.valid_ops_mask = REGULATOR_CHANGE_STATUS |
-				  REGULATOR_CHANGE_VOLTAGE,
+		.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
 	},
 	.num_consumer_supplies = 1,
 };
@@ -290,9 +285,9 @@ static int arizona_ldo1_probe(struct platform_device *pdev)
 	config.ena_gpio = arizona->pdata.ldoena;
 
 	if (arizona->pdata.ldo1)
-		config.init_data = arizona->pdata.ldo1;
-	else
-		config.init_data = &ldo1->init_data;
+		ldo1->init_data = *arizona->pdata.ldo1;
+
+	config.init_data = &ldo1->init_data;
 
 	/*
 	 * LDO1 can only be used to supply DCVDD so if it has no
@@ -301,6 +296,15 @@ static int arizona_ldo1_probe(struct platform_device *pdev)
 	if (config.init_data->num_consumer_supplies == 0)
 		arizona->external_dcvdd = true;
 
+	if (!arizona->external_dcvdd &&
+	    (config.ena_gpio || config.ena_gpio_initialized) &&
+	    gpio_is_valid(config.ena_gpio))
+		ldo1->init_data.constraints.valid_ops_mask |=
+			REGULATOR_CHANGE_STATUS;
+	else
+		dev_warn(arizona->dev,
+			 "No LDOENA: regulator will be always-on\n");
+
 	ldo1->regulator = devm_regulator_register(&pdev->dev, desc, &config);
 
 	of_node_put(config.of_node);
-- 
1.9.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ