Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1520235 > unrolled thread

[PATCH 0/4] regulator: twl: preparation for TWL6032 support

Started byNicolae Rosia <Nicolae_Rosia@mentor.com>
First post2016-11-12 13:50 +0100
Last post2016-11-18 13:10 +0100
Articles 5 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/4] regulator: twl: preparation for TWL6032 support Nicolae Rosia <Nicolae_Rosia@mentor.com> - 2016-11-12 13:50 +0100
    [PATCH 1/4] regulator: twl: make driver DT only Nicolae Rosia <Nicolae_Rosia@mentor.com> - 2016-11-12 13:50 +0100
      Applied "regulator: twl: make driver DT only" to the regulator tree Mark Brown <broonie@kernel.org> - 2016-11-18 13:10 +0100
    [PATCH 3/4] regulator: twl-regulator: rework fixed regulator definition Nicolae Rosia <Nicolae_Rosia@mentor.com> - 2016-11-12 13:50 +0100
      Applied "regulator: twl-regulator: rework fixed regulator definition" to the regulator tree Mark Brown <broonie@kernel.org> - 2016-11-18 13:10 +0100

#1520235 — [PATCH 0/4] regulator: twl: preparation for TWL6032 support

FromNicolae Rosia <Nicolae_Rosia@mentor.com>
Date2016-11-12 13:50 +0100
Subject[PATCH 0/4] regulator: twl: preparation for TWL6032 support
Message-ID<sCFUR-27N-3@gated-at.bofh.it>
Hello,

I'm planning on adding TWL6032 support but working with the existing twl
regulator driver is hard because of a lot of legacy code.
This series removes unused code and splits up the TWL6030 logic
from TWL4030 so it is easier to build on.

I'm keeping the same name for TWL4030 (twl-regulator.c) to have a clean history
and same CONFIG symbol for both files so we don't break existing users.

Checkpatch warnings are inherited from twl-regulator.c and will be fixed in a
subsequent patch.

Depends on [0] which is already queued in Tony's for-next [1]
branch.

[0] http://www.spinics.net/lists/arm-kernel/msg539812.html
[1] https://git.kernel.org/cgit/linux/kernel/git/tmlind/linux-omap.git/log/?h=for-next

Nicolae Rosia (4):
  regulator: twl: make driver DT only
  regulator: twl: kill unused functions
  regulator: twl-regulator: rework fixed regulator definition
  regulator: twl: split twl6030 logic into its own file

 MAINTAINERS                           |   1 +
 drivers/regulator/Makefile            |   2 +-
 drivers/regulator/twl-regulator.c     | 666 +---------------------------
 drivers/regulator/twl6030-regulator.c | 805 ++++++++++++++++++++++++++++++++++
 4 files changed, 825 insertions(+), 649 deletions(-)
 create mode 100644 drivers/regulator/twl6030-regulator.c

-- 
2.5.5

[toc] | [next] | [standalone]


#1520236 — [PATCH 1/4] regulator: twl: make driver DT only

FromNicolae Rosia <Nicolae_Rosia@mentor.com>
Date2016-11-12 13:50 +0100
Subject[PATCH 1/4] regulator: twl: make driver DT only
Message-ID<sCFUS-27N-9@gated-at.bofh.it>
In reply to#1520235
All users are DT only, remove unused code.

Signed-off-by: Nicolae Rosia <Nicolae_Rosia@mentor.com>
---
 drivers/regulator/twl-regulator.c | 37 ++++++-------------------------------
 1 file changed, 6 insertions(+), 31 deletions(-)

diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c
index 210681d..f92b13a 100644
--- a/drivers/regulator/twl-regulator.c
+++ b/drivers/regulator/twl-regulator.c
@@ -1165,37 +1165,20 @@ static int twlreg_probe(struct platform_device *pdev)
 	struct regulator_init_data	*initdata;
 	struct regulation_constraints	*c;
 	struct regulator_dev		*rdev;
-	struct twl_regulator_driver_data	*drvdata;
 	const struct of_device_id	*match;
 	struct regulator_config		config = { };
 
 	match = of_match_device(twl_of_match, &pdev->dev);
-	if (match) {
-		template = match->data;
-		id = template->desc.id;
-		initdata = of_get_regulator_init_data(&pdev->dev,
-						      pdev->dev.of_node,
-						      &template->desc);
-		drvdata = NULL;
-	} else {
-		id = pdev->id;
-		initdata = dev_get_platdata(&pdev->dev);
-		for (i = 0, template = NULL; i < ARRAY_SIZE(twl_of_match); i++) {
-			template = twl_of_match[i].data;
-			if (template && template->desc.id == id)
-				break;
-		}
-		if (i == ARRAY_SIZE(twl_of_match))
-			return -ENODEV;
-
-		drvdata = initdata->driver_data;
-		if (!drvdata)
-			return -EINVAL;
-	}
+	if (!match)
+		return -ENODEV;
 
+	template = match->data;
 	if (!template)
 		return -ENODEV;
 
+	id = template->desc.id;
+	initdata = of_get_regulator_init_data(&pdev->dev, pdev->dev.of_node,
+						&template->desc);
 	if (!initdata)
 		return -EINVAL;
 
@@ -1203,14 +1186,6 @@ static int twlreg_probe(struct platform_device *pdev)
 	if (!info)
 		return -ENOMEM;
 
-	if (drvdata) {
-		/* copy the driver data into regulator data */
-		info->features = drvdata->features;
-		info->data = drvdata->data;
-		info->set_voltage = drvdata->set_voltage;
-		info->get_voltage = drvdata->get_voltage;
-	}
-
 	/* Constrain board-specific capabilities according to what
 	 * this driver and the chip itself can actually do.
 	 */
-- 
2.5.5

[toc] | [prev] | [next] | [standalone]


#1525237 — Applied "regulator: twl: make driver DT only" to the regulator tree

FromMark Brown <broonie@kernel.org>
Date2016-11-18 13:10 +0100
SubjectApplied "regulator: twl: make driver DT only" to the regulator tree
Message-ID<sEQ9s-6V1-35@gated-at.bofh.it>
In reply to#1520236
The patch

   regulator: twl: make driver DT only

has been applied to the regulator tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

From 25d82337705e24203b27e23762144950f87a1016 Mon Sep 17 00:00:00 2001
From: Nicolae Rosia <Nicolae_Rosia@mentor.com>
Date: Sat, 12 Nov 2016 14:42:12 +0200
Subject: [PATCH] regulator: twl: make driver DT only

All users are DT only, remove unused code.

Signed-off-by: Nicolae Rosia <Nicolae_Rosia@mentor.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/regulator/twl-regulator.c | 37 ++++++-------------------------------
 1 file changed, 6 insertions(+), 31 deletions(-)

diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c
index 23f7b31f6355..a777c9d0d2df 100644
--- a/drivers/regulator/twl-regulator.c
+++ b/drivers/regulator/twl-regulator.c
@@ -1175,37 +1175,20 @@ static int twlreg_probe(struct platform_device *pdev)
 	struct regulator_init_data	*initdata;
 	struct regulation_constraints	*c;
 	struct regulator_dev		*rdev;
-	struct twl_regulator_driver_data	*drvdata;
 	const struct of_device_id	*match;
 	struct regulator_config		config = { };
 
 	match = of_match_device(twl_of_match, &pdev->dev);
-	if (match) {
-		template = match->data;
-		id = template->desc.id;
-		initdata = of_get_regulator_init_data(&pdev->dev,
-						      pdev->dev.of_node,
-						      &template->desc);
-		drvdata = NULL;
-	} else {
-		id = pdev->id;
-		initdata = dev_get_platdata(&pdev->dev);
-		for (i = 0, template = NULL; i < ARRAY_SIZE(twl_of_match); i++) {
-			template = twl_of_match[i].data;
-			if (template && template->desc.id == id)
-				break;
-		}
-		if (i == ARRAY_SIZE(twl_of_match))
-			return -ENODEV;
-
-		drvdata = initdata->driver_data;
-		if (!drvdata)
-			return -EINVAL;
-	}
+	if (!match)
+		return -ENODEV;
 
+	template = match->data;
 	if (!template)
 		return -ENODEV;
 
+	id = template->desc.id;
+	initdata = of_get_regulator_init_data(&pdev->dev, pdev->dev.of_node,
+						&template->desc);
 	if (!initdata)
 		return -EINVAL;
 
@@ -1213,14 +1196,6 @@ static int twlreg_probe(struct platform_device *pdev)
 	if (!info)
 		return -ENOMEM;
 
-	if (drvdata) {
-		/* copy the driver data into regulator data */
-		info->features = drvdata->features;
-		info->data = drvdata->data;
-		info->set_voltage = drvdata->set_voltage;
-		info->get_voltage = drvdata->get_voltage;
-	}
-
 	/* Constrain board-specific capabilities according to what
 	 * this driver and the chip itself can actually do.
 	 */
-- 
2.10.2

[toc] | [prev] | [next] | [standalone]


#1520237 — [PATCH 3/4] regulator: twl-regulator: rework fixed regulator definition

FromNicolae Rosia <Nicolae_Rosia@mentor.com>
Date2016-11-12 13:50 +0100
Subject[PATCH 3/4] regulator: twl-regulator: rework fixed regulator definition
Message-ID<sCFUS-27N-11@gated-at.bofh.it>
In reply to#1520235
TWL603X and TWL4030 are different and have different code logic.
Rework the regulator definition method so we can split the file
easily in twl4030 and twl6030.

Signed-off-by: Nicolae Rosia <Nicolae_Rosia@mentor.com>
---
 drivers/regulator/twl-regulator.c | 38 ++++++++++++++++++++++++--------------
 1 file changed, 24 insertions(+), 14 deletions(-)

diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c
index e0d81f8..3f9f53d 100644
--- a/drivers/regulator/twl-regulator.c
+++ b/drivers/regulator/twl-regulator.c
@@ -873,15 +873,6 @@ static struct regulator_ops twlsmps_ops = {
 
 /*----------------------------------------------------------------------*/
 
-#define TWL4030_FIXED_LDO(label, offset, mVolts, num, turnon_delay, \
-			remap_conf) \
-		TWL_FIXED_LDO(label, offset, mVolts, num, turnon_delay, \
-			remap_conf, TWL4030, twl4030fixed_ops, \
-			twl4030reg_map_mode)
-#define TWL6030_FIXED_LDO(label, offset, mVolts, turnon_delay) \
-		TWL_FIXED_LDO(label, offset, mVolts, 0x0, turnon_delay, \
-			0x0, TWL6030, twl6030fixed_ops, NULL)
-
 #define TWL4030_ADJUSTABLE_LDO(label, offset, num, turnon_delay, remap_conf) \
 static const struct twlreg_info TWL4030_INFO_##label = { \
 	.base = offset, \
@@ -958,8 +949,27 @@ static const struct twlreg_info TWL6032_INFO_##label = { \
 		}, \
 	}
 
-#define TWL_FIXED_LDO(label, offset, mVolts, num, turnon_delay, remap_conf, \
-		family, operations, map_mode) \
+#define TWL6030_FIXED_LDO(label, offset, mVolts, turnon_delay) \
+static const struct twlreg_info TWLFIXED_INFO_##label = { \
+	.base = offset, \
+	.id = 0, \
+	.min_mV = mVolts, \
+	.remap = 0, \
+	.desc = { \
+		.name = #label, \
+		.id = TWL6030##_REG_##label, \
+		.n_voltages = 1, \
+		.ops = &twl6030fixed_ops, \
+		.type = REGULATOR_VOLTAGE, \
+		.owner = THIS_MODULE, \
+		.min_uV = mVolts * 1000, \
+		.enable_time = turnon_delay, \
+		.of_map_mode = NULL, \
+		}, \
+	}
+
+#define TWL4030_FIXED_LDO(label, offset, mVolts, num, turnon_delay, \
+			remap_conf) \
 static const struct twlreg_info TWLFIXED_INFO_##label = { \
 	.base = offset, \
 	.id = num, \
@@ -967,14 +977,14 @@ static const struct twlreg_info TWLFIXED_INFO_##label = { \
 	.remap = remap_conf, \
 	.desc = { \
 		.name = #label, \
-		.id = family##_REG_##label, \
+		.id = TWL4030##_REG_##label, \
 		.n_voltages = 1, \
-		.ops = &operations, \
+		.ops = &twl4030fixed_ops, \
 		.type = REGULATOR_VOLTAGE, \
 		.owner = THIS_MODULE, \
 		.min_uV = mVolts * 1000, \
 		.enable_time = turnon_delay, \
-		.of_map_mode = map_mode, \
+		.of_map_mode = twl4030reg_map_mode, \
 		}, \
 	}
 
-- 
2.5.5

[toc] | [prev] | [next] | [standalone]


#1525232 — Applied "regulator: twl-regulator: rework fixed regulator definition" to the regulator tree

FromMark Brown <broonie@kernel.org>
Date2016-11-18 13:10 +0100
SubjectApplied "regulator: twl-regulator: rework fixed regulator definition" to the regulator tree
Message-ID<sEQ9r-6V1-3@gated-at.bofh.it>
In reply to#1520237
The patch

   regulator: twl-regulator: rework fixed regulator definition

has been applied to the regulator tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

From dab780a3b489b038a47d8fbbc49c33aae1e7a682 Mon Sep 17 00:00:00 2001
From: Nicolae Rosia <Nicolae_Rosia@mentor.com>
Date: Sat, 12 Nov 2016 14:42:14 +0200
Subject: [PATCH] regulator: twl-regulator: rework fixed regulator definition

TWL603X and TWL4030 are different and have different code logic.
Rework the regulator definition method so we can split the file
easily in twl4030 and twl6030.

Signed-off-by: Nicolae Rosia <Nicolae_Rosia@mentor.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/regulator/twl-regulator.c | 38 ++++++++++++++++++++++++--------------
 1 file changed, 24 insertions(+), 14 deletions(-)

diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c
index 210681d6b743..23f7b31f6355 100644
--- a/drivers/regulator/twl-regulator.c
+++ b/drivers/regulator/twl-regulator.c
@@ -898,15 +898,6 @@ static struct regulator_ops twlsmps_ops = {
 
 /*----------------------------------------------------------------------*/
 
-#define TWL4030_FIXED_LDO(label, offset, mVolts, num, turnon_delay, \
-			remap_conf) \
-		TWL_FIXED_LDO(label, offset, mVolts, num, turnon_delay, \
-			remap_conf, TWL4030, twl4030fixed_ops, \
-			twl4030reg_map_mode)
-#define TWL6030_FIXED_LDO(label, offset, mVolts, turnon_delay) \
-		TWL_FIXED_LDO(label, offset, mVolts, 0x0, turnon_delay, \
-			0x0, TWL6030, twl6030fixed_ops, NULL)
-
 #define TWL4030_ADJUSTABLE_LDO(label, offset, num, turnon_delay, remap_conf) \
 static const struct twlreg_info TWL4030_INFO_##label = { \
 	.base = offset, \
@@ -983,8 +974,27 @@ static const struct twlreg_info TWL6032_INFO_##label = { \
 		}, \
 	}
 
-#define TWL_FIXED_LDO(label, offset, mVolts, num, turnon_delay, remap_conf, \
-		family, operations, map_mode) \
+#define TWL6030_FIXED_LDO(label, offset, mVolts, turnon_delay) \
+static const struct twlreg_info TWLFIXED_INFO_##label = { \
+	.base = offset, \
+	.id = 0, \
+	.min_mV = mVolts, \
+	.remap = 0, \
+	.desc = { \
+		.name = #label, \
+		.id = TWL6030##_REG_##label, \
+		.n_voltages = 1, \
+		.ops = &twl6030fixed_ops, \
+		.type = REGULATOR_VOLTAGE, \
+		.owner = THIS_MODULE, \
+		.min_uV = mVolts * 1000, \
+		.enable_time = turnon_delay, \
+		.of_map_mode = NULL, \
+		}, \
+	}
+
+#define TWL4030_FIXED_LDO(label, offset, mVolts, num, turnon_delay, \
+			remap_conf) \
 static const struct twlreg_info TWLFIXED_INFO_##label = { \
 	.base = offset, \
 	.id = num, \
@@ -992,14 +1002,14 @@ static const struct twlreg_info TWLFIXED_INFO_##label = { \
 	.remap = remap_conf, \
 	.desc = { \
 		.name = #label, \
-		.id = family##_REG_##label, \
+		.id = TWL4030##_REG_##label, \
 		.n_voltages = 1, \
-		.ops = &operations, \
+		.ops = &twl4030fixed_ops, \
 		.type = REGULATOR_VOLTAGE, \
 		.owner = THIS_MODULE, \
 		.min_uV = mVolts * 1000, \
 		.enable_time = turnon_delay, \
-		.of_map_mode = map_mode, \
+		.of_map_mode = twl4030reg_map_mode, \
 		}, \
 	}
 
-- 
2.10.2

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web