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: <20230317093911.1254530-2-nicolas.heemeryck@devialet.com>
Date:   Fri, 17 Mar 2023 10:39:10 +0100
From:   Nicolas Heemeryck <nicolas.heemeryck@...ialet.com>
To:     Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>
Cc:     linux-kernel@...r.kernel.org,
        Nicolas Heemeryck <nicolas.heemeryck@...ialet.com>
Subject: [PATCH 1/2] regulator: pca9450: Add LOADSW regulator

Make the load switch present in the PCA9450 accessible and configurable
from the devicetree. Note that the SWIn for the load switch is
connected to BUCK4.

Signed-off-by: Nicolas Heemeryck <nicolas.heemeryck@...ialet.com>
---
 drivers/regulator/pca9450-regulator.c | 32 +++++++++++++++++++++++++++
 include/linux/regulator/pca9450.h     |  4 ++++
 2 files changed, 36 insertions(+)

diff --git a/drivers/regulator/pca9450-regulator.c b/drivers/regulator/pca9450-regulator.c
index c6351fac9f4d..ccb61fc73a59 100644
--- a/drivers/regulator/pca9450-regulator.c
+++ b/drivers/regulator/pca9450-regulator.c
@@ -99,6 +99,12 @@ static const struct regulator_ops pca9450_ldo_regulator_ops = {
 	.get_voltage_sel = regulator_get_voltage_sel_regmap,
 };
 
+static const struct regulator_ops pca9450_loadsw_regulator_ops = {
+	.enable = regulator_enable_regmap,
+	.disable = regulator_disable_regmap,
+	.is_enabled = regulator_is_enabled_regmap,
+};
+
 /*
  * BUCK1/2/3
  * 0.60 to 2.1875V (12.5mV step)
@@ -452,6 +458,19 @@ static const struct pca9450_regulator_desc pca9450a_regulators[] = {
 			.owner = THIS_MODULE,
 		},
 	},
+	{
+		.desc = {
+			.name = "loadsw",
+			.of_match = of_match_ptr("LOADSW"),
+			.regulators_node = of_match_ptr("regulators"),
+			.id = PCA9450_LOADSW,
+			.ops = &pca9450_loadsw_regulator_ops,
+			.type = REGULATOR_VOLTAGE,
+			.enable_reg = PCA9450_REG_LOADSW_CTRL,
+			.enable_mask = LOADSW_CTRL_EN_MASK,
+			.owner = THIS_MODULE,
+		},
+	},
 };
 
 /*
@@ -661,6 +680,19 @@ static const struct pca9450_regulator_desc pca9450bc_regulators[] = {
 			.owner = THIS_MODULE,
 		},
 	},
+	{
+		.desc = {
+			.name = "loadsw",
+			.of_match = of_match_ptr("LOADSW"),
+			.regulators_node = of_match_ptr("regulators"),
+			.id = PCA9450_LOADSW,
+			.ops = &pca9450_loadsw_regulator_ops,
+			.type = REGULATOR_VOLTAGE,
+			.enable_reg = PCA9450_REG_LOADSW_CTRL,
+			.enable_mask = LOADSW_CTRL_EN_MASK,
+			.owner = THIS_MODULE,
+		},
+	},
 };
 
 static irqreturn_t pca9450_irq_handler(int irq, void *data)
diff --git a/include/linux/regulator/pca9450.h b/include/linux/regulator/pca9450.h
index 3c01c2bf84f5..4e922d6010cb 100644
--- a/include/linux/regulator/pca9450.h
+++ b/include/linux/regulator/pca9450.h
@@ -24,6 +24,7 @@ enum {
 	PCA9450_LDO3,
 	PCA9450_LDO4,
 	PCA9450_LDO5,
+	PCA9450_LOADSW,
 	PCA9450_REGULATOR_CNT,
 };
 
@@ -209,6 +210,9 @@ enum {
 #define LDO5H_EN_MASK			0xC0
 #define LDO5HOUT_MASK			0x0F
 
+/* PCA9450_REG_LOADSW_CTRL bits */
+#define LOADSW_CTRL_EN_MASK		0x03
+
 /* PCA9450_REG_IRQ bits */
 #define IRQ_PWRON			0x80
 #define IRQ_WDOGB			0x40
-- 
2.34.1


-- 
- Confidential -

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ