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: <1349536671-31714-6-git-send-email-ldewangan@nvidia.com>
Date:	Sat, 6 Oct 2012 20:47:50 +0530
From:	Laxman Dewangan <ldewangan@...dia.com>
To:	<broonie@...nsource.wolfsonmicro.com>, <lrg@...com>,
	<sameo@...ux.intel.com>
CC:	<vbyravarasu@...dia.com>, <axel.lin@...il.com>,
	<linux-kernel@...r.kernel.org>,
	Laxman Dewangan <ldewangan@...dia.com>
Subject: [PATCH 4/5] regulator: tps65090: Add voltage out level in platform data

TPS65090's DCDCs and FETs act as switch and so output
voltage can be enable or disable only. The output voltage
of this regulators depends on the input voltage.
Add the voltage parameter to tell the output voltage value
of these rails.

Signed-off-by: Laxman Dewangan <ldewangan@...dia.com>
---
 drivers/regulator/tps65090-regulator.c       |   32 ++++++++++++++++++++++++-
 include/linux/regulator/tps65090-regulator.h |    2 +
 2 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/tps65090-regulator.c b/drivers/regulator/tps65090-regulator.c
index 254ee66..279154b 100644
--- a/drivers/regulator/tps65090-regulator.c
+++ b/drivers/regulator/tps65090-regulator.c
@@ -27,18 +27,44 @@
 #include <linux/regulator/tps65090-regulator.h>
 
 struct tps65090_regulator {
+	int			microvolts;
 	struct device		*dev;
 	struct regulator_desc	*desc;
 	struct regulator_dev	*rdev;
 };
 
+static int tps65090_voltage_get_voltage(struct regulator_dev *rdev)
+{
+	struct tps65090_regulator *ri = rdev_get_drvdata(rdev);
+
+	if (ri->microvolts)
+		return ri->microvolts;
+	else
+		return -EINVAL;
+}
+
+static int tps65090_voltage_list_voltage(struct regulator_dev *rdev,
+				      unsigned selector)
+{
+	struct tps65090_regulator *ri = rdev_get_drvdata(rdev);
+
+	if (selector != 0)
+		return -EINVAL;
+
+	return ri->microvolts;
+}
+
 static struct regulator_ops tps65090_ops = {
+	.get_voltage	= tps65090_voltage_get_voltage,
+	.list_voltage	= tps65090_voltage_list_voltage,
 	.enable = regulator_enable_regmap,
 	.disable = regulator_disable_regmap,
 	.is_enabled = regulator_is_enabled_regmap,
 };
 
 static struct regulator_ops tps65090_ldo_ops = {
+	.get_voltage	= tps65090_voltage_get_voltage,
+	.list_voltage	= tps65090_voltage_list_voltage,
 };
 
 #define tps65090_REG_DESC(_id, _sname, _en_reg, _ops)	\
@@ -105,10 +131,12 @@ static int __devinit tps65090_regulator_probe(struct platform_device *pdev)
 		config.dev = &pdev->dev;
 		config.driver_data = ri;
 		config.regmap = tps65090_mfd->rmap;
-		if (tps_pdata)
+		if (tps_pdata) {
+			ri->microvolts = tps_pdata->microvolts;
 			config.init_data = tps_pdata->reg_init_data;
-		else
+		} else {
 			config.init_data = NULL;
+		}
 
 		rdev = regulator_register(ri->desc, &config);
 		if (IS_ERR(rdev)) {
diff --git a/include/linux/regulator/tps65090-regulator.h b/include/linux/regulator/tps65090-regulator.h
index 48e3db1..0b29ffa 100644
--- a/include/linux/regulator/tps65090-regulator.h
+++ b/include/linux/regulator/tps65090-regulator.h
@@ -45,10 +45,12 @@ enum {
  * struct tps65090_regulator_platform_data
  *
  * @reg_init_data: The regulator init data.
+ * @microvolts: The rail's voltage level.
  */
 
 struct tps65090_regulator_platform_data {
 	struct regulator_init_data *reg_init_data;
+	int microvolts;
 };
 
 #endif	/* __REGULATOR_TPS65090_H */
-- 
1.7.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ