public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] regulator: lp8788: Remove lp8788_dldo_id and lp8788_aldo_id arrays
@ 2013-04-01 15:26 Axel Lin
  2013-04-01 15:28 ` [PATCH 2/2] regulator: lp8788: Implement list_voltage for lp8788_ldo_voltage_fixed_ops Axel Lin
  2013-04-01 23:07 ` [PATCH 1/2] regulator: lp8788: Remove lp8788_dldo_id and lp8788_aldo_id arrays Kim, Milo
  0 siblings, 2 replies; 4+ messages in thread
From: Axel Lin @ 2013-04-01 15:26 UTC (permalink / raw)
  To: Mark Brown; +Cc: Milo Kim, Liam Girdwood, linux-kernel

The id for DLDOx matches the entries in enum lp8788_ldo_id and it's easy to
calculate the id for ALDOx. Thus remove lp8788_dldo_id and lp8788_aldo_id
arrays.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/regulator/lp8788-ldo.c |   32 ++------------------------------
 1 file changed, 2 insertions(+), 30 deletions(-)

diff --git a/drivers/regulator/lp8788-ldo.c b/drivers/regulator/lp8788-ldo.c
index fcba90a..c29aeae 100644
--- a/drivers/regulator/lp8788-ldo.c
+++ b/drivers/regulator/lp8788-ldo.c
@@ -156,34 +156,6 @@ static const int lp8788_aldo7_vtbl[] = {
 	1200000, 1300000, 1400000, 1500000, 1600000, 1700000, 1800000, 1800000,
 };
 
-static enum lp8788_ldo_id lp8788_dldo_id[] = {
-	DLDO1,
-	DLDO2,
-	DLDO3,
-	DLDO4,
-	DLDO5,
-	DLDO6,
-	DLDO7,
-	DLDO8,
-	DLDO9,
-	DLDO10,
-	DLDO11,
-	DLDO12,
-};
-
-static enum lp8788_ldo_id lp8788_aldo_id[] = {
-	ALDO1,
-	ALDO2,
-	ALDO3,
-	ALDO4,
-	ALDO5,
-	ALDO6,
-	ALDO7,
-	ALDO8,
-	ALDO9,
-	ALDO10,
-};
-
 static int lp8788_ldo_enable_time(struct regulator_dev *rdev)
 {
 	struct lp8788_ldo *ldo = rdev_get_drvdata(rdev);
@@ -566,7 +538,7 @@ static int lp8788_dldo_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	ldo->lp = lp;
-	ret = lp8788_config_ldo_enable_mode(pdev, ldo, lp8788_dldo_id[id]);
+	ret = lp8788_config_ldo_enable_mode(pdev, ldo, id);
 	if (ret)
 		return ret;
 
@@ -627,7 +599,7 @@ static int lp8788_aldo_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	ldo->lp = lp;
-	ret = lp8788_config_ldo_enable_mode(pdev, ldo, lp8788_aldo_id[id]);
+	ret = lp8788_config_ldo_enable_mode(pdev, ldo, id + ALDO1);
 	if (ret)
 		return ret;
 
-- 
1.7.10.4




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] regulator: lp8788: Implement list_voltage for lp8788_ldo_voltage_fixed_ops
  2013-04-01 15:26 [PATCH 1/2] regulator: lp8788: Remove lp8788_dldo_id and lp8788_aldo_id arrays Axel Lin
@ 2013-04-01 15:28 ` Axel Lin
  2013-04-03 17:46   ` Mark Brown
  2013-04-01 23:07 ` [PATCH 1/2] regulator: lp8788: Remove lp8788_dldo_id and lp8788_aldo_id arrays Kim, Milo
  1 sibling, 1 reply; 4+ messages in thread
From: Axel Lin @ 2013-04-01 15:28 UTC (permalink / raw)
  To: Mark Brown; +Cc: Milo Kim, Liam Girdwood, linux-kernel

For fixed voltage, we can just set min_uV and use regulator_list_voltage_linear
for list_voltage callback. Regulator core will call list_voltage(rdev, 0) if
both get_voltage get_voltage_sel are not implemented. Thus we can also remove
lp8788_ldo_fixed_get_voltage() function.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/regulator/lp8788-ldo.c |   27 +++++++++------------------
 1 file changed, 9 insertions(+), 18 deletions(-)

diff --git a/drivers/regulator/lp8788-ldo.c b/drivers/regulator/lp8788-ldo.c
index c29aeae..0ce2c4c 100644
--- a/drivers/regulator/lp8788-ldo.c
+++ b/drivers/regulator/lp8788-ldo.c
@@ -170,23 +170,6 @@ static int lp8788_ldo_enable_time(struct regulator_dev *rdev)
 	return ENABLE_TIME_USEC * val;
 }
 
-static int lp8788_ldo_fixed_get_voltage(struct regulator_dev *rdev)
-{
-	enum lp8788_ldo_id id = rdev_get_id(rdev);
-
-	switch (id) {
-	case ALDO2 ... ALDO5:
-		return 2850000;
-	case DLDO12:
-	case ALDO8 ... ALDO9:
-		return 2500000;
-	case ALDO10:
-		return 1100000;
-	default:
-		return -EINVAL;
-	}
-}
-
 static struct regulator_ops lp8788_ldo_voltage_table_ops = {
 	.list_voltage = regulator_list_voltage_table,
 	.set_voltage_sel = regulator_set_voltage_sel_regmap,
@@ -198,7 +181,7 @@ static struct regulator_ops lp8788_ldo_voltage_table_ops = {
 };
 
 static struct regulator_ops lp8788_ldo_voltage_fixed_ops = {
-	.get_voltage = lp8788_ldo_fixed_get_voltage,
+	.list_voltage = regulator_list_voltage_linear,
 	.enable = regulator_enable_regmap,
 	.disable = regulator_disable_regmap,
 	.is_enabled = regulator_is_enabled_regmap,
@@ -358,6 +341,7 @@ static struct regulator_desc lp8788_dldo_desc[] = {
 		.owner = THIS_MODULE,
 		.enable_reg = LP8788_EN_LDO_B,
 		.enable_mask = LP8788_EN_DLDO12_M,
+		.min_uV = 2500000,
 	},
 };
 
@@ -384,6 +368,7 @@ static struct regulator_desc lp8788_aldo_desc[] = {
 		.owner = THIS_MODULE,
 		.enable_reg = LP8788_EN_LDO_B,
 		.enable_mask = LP8788_EN_ALDO2_M,
+		.min_uV = 2850000,
 	},
 	{
 		.name = "aldo3",
@@ -394,6 +379,7 @@ static struct regulator_desc lp8788_aldo_desc[] = {
 		.owner = THIS_MODULE,
 		.enable_reg = LP8788_EN_LDO_B,
 		.enable_mask = LP8788_EN_ALDO3_M,
+		.min_uV = 2850000,
 	},
 	{
 		.name = "aldo4",
@@ -404,6 +390,7 @@ static struct regulator_desc lp8788_aldo_desc[] = {
 		.owner = THIS_MODULE,
 		.enable_reg = LP8788_EN_LDO_B,
 		.enable_mask = LP8788_EN_ALDO4_M,
+		.min_uV = 2850000,
 	},
 	{
 		.name = "aldo5",
@@ -414,6 +401,7 @@ static struct regulator_desc lp8788_aldo_desc[] = {
 		.owner = THIS_MODULE,
 		.enable_reg = LP8788_EN_LDO_C,
 		.enable_mask = LP8788_EN_ALDO5_M,
+		.min_uV = 2850000,
 	},
 	{
 		.name = "aldo6",
@@ -450,6 +438,7 @@ static struct regulator_desc lp8788_aldo_desc[] = {
 		.owner = THIS_MODULE,
 		.enable_reg = LP8788_EN_LDO_C,
 		.enable_mask = LP8788_EN_ALDO8_M,
+		.min_uV = 2500000,
 	},
 	{
 		.name = "aldo9",
@@ -460,6 +449,7 @@ static struct regulator_desc lp8788_aldo_desc[] = {
 		.owner = THIS_MODULE,
 		.enable_reg = LP8788_EN_LDO_C,
 		.enable_mask = LP8788_EN_ALDO9_M,
+		.min_uV = 2500000,
 	},
 	{
 		.name = "aldo10",
@@ -470,6 +460,7 @@ static struct regulator_desc lp8788_aldo_desc[] = {
 		.owner = THIS_MODULE,
 		.enable_reg = LP8788_EN_LDO_C,
 		.enable_mask = LP8788_EN_ALDO10_M,
+		.min_uV = 1100000,
 	},
 };
 
-- 
1.7.10.4




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH 1/2] regulator: lp8788: Remove lp8788_dldo_id and lp8788_aldo_id arrays
  2013-04-01 15:26 [PATCH 1/2] regulator: lp8788: Remove lp8788_dldo_id and lp8788_aldo_id arrays Axel Lin
  2013-04-01 15:28 ` [PATCH 2/2] regulator: lp8788: Implement list_voltage for lp8788_ldo_voltage_fixed_ops Axel Lin
@ 2013-04-01 23:07 ` Kim, Milo
  1 sibling, 0 replies; 4+ messages in thread
From: Kim, Milo @ 2013-04-01 23:07 UTC (permalink / raw)
  To: Axel Lin; +Cc: Mark Brown, Liam Girdwood, linux-kernel@vger.kernel.org

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 399 bytes --]

> The id for DLDOx matches the entries in enum lp8788_ldo_id and it's
> easy to
> calculate the id for ALDOx. Thus remove lp8788_dldo_id and
> lp8788_aldo_id
> arrays.

Both patches look good, thanks!

Acked-by: Milo Kim <milo.kim@ti.com>
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] regulator: lp8788: Implement list_voltage for lp8788_ldo_voltage_fixed_ops
  2013-04-01 15:28 ` [PATCH 2/2] regulator: lp8788: Implement list_voltage for lp8788_ldo_voltage_fixed_ops Axel Lin
@ 2013-04-03 17:46   ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2013-04-03 17:46 UTC (permalink / raw)
  To: Axel Lin; +Cc: Milo Kim, Liam Girdwood, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 365 bytes --]

On Mon, Apr 01, 2013 at 11:28:48PM +0800, Axel Lin wrote:
> For fixed voltage, we can just set min_uV and use regulator_list_voltage_linear
> for list_voltage callback. Regulator core will call list_voltage(rdev, 0) if
> both get_voltage get_voltage_sel are not implemented. Thus we can also remove
> lp8788_ldo_fixed_get_voltage() function.

Applied both, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-04-03 17:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-01 15:26 [PATCH 1/2] regulator: lp8788: Remove lp8788_dldo_id and lp8788_aldo_id arrays Axel Lin
2013-04-01 15:28 ` [PATCH 2/2] regulator: lp8788: Implement list_voltage for lp8788_ldo_voltage_fixed_ops Axel Lin
2013-04-03 17:46   ` Mark Brown
2013-04-01 23:07 ` [PATCH 1/2] regulator: lp8788: Remove lp8788_dldo_id and lp8788_aldo_id arrays Kim, Milo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox