All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFT 1/2] regulator: tps62360: Convert to regulator_list_voltage_linear()
@ 2012-05-14  3:25 Axel Lin
  2012-05-14  3:27 ` [PATCH RFT 2/2] regulator: tps62360: Convert to set_voltage_sel and regulator_map_voltage_linear Axel Lin
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Axel Lin @ 2012-05-14  3:25 UTC (permalink / raw)
  To: linux-kernel; +Cc: Laxman Dewangan, Liam Girdwood, Mark Brown

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/regulator/tps62360-regulator.c |   20 ++++++--------------
 1 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/regulator/tps62360-regulator.c b/drivers/regulator/tps62360-regulator.c
index 60765cc..dae08a8 100644
--- a/drivers/regulator/tps62360-regulator.c
+++ b/drivers/regulator/tps62360-regulator.c
@@ -185,28 +185,17 @@ static int tps62360_dcdc_set_voltage(struct regulator_dev *dev,
 	return 0;
 }
 
-static int tps62360_dcdc_list_voltage(struct regulator_dev *dev,
-					unsigned selector)
-{
-	struct tps62360_chip *tps = rdev_get_drvdata(dev);
-
-	if (selector >= tps->desc.n_voltages)
-		return -EINVAL;
-
-	return tps->voltage_base + selector * 10000;
-}
-
 static int tps62360_set_voltage_time_sel(struct regulator_dev *rdev,
 		unsigned int old_selector, unsigned int new_selector)
 {
 	struct tps62360_chip *tps = rdev_get_drvdata(rdev);
 	int old_uV, new_uV;
 
-	old_uV = tps62360_dcdc_list_voltage(rdev, old_selector);
+	old_uV = regulator_list_voltage_linear(rdev, old_selector);
 	if (old_uV < 0)
 		return old_uV;
 
-	new_uV = tps62360_dcdc_list_voltage(rdev, new_selector);
+	new_uV = regulator_list_voltage_linear(rdev, new_selector);
 	if (new_uV < 0)
 		return new_uV;
 
@@ -216,7 +205,7 @@ static int tps62360_set_voltage_time_sel(struct regulator_dev *rdev,
 static struct regulator_ops tps62360_dcdc_ops = {
 	.get_voltage_sel	= tps62360_dcdc_get_voltage_sel,
 	.set_voltage		= tps62360_dcdc_set_voltage,
-	.list_voltage		= tps62360_dcdc_list_voltage,
+	.list_voltage		= regulator_list_voltage_linear,
 	.set_voltage_time_sel	= tps62360_set_voltage_time_sel,
 };
 
@@ -420,6 +409,9 @@ static int __devinit tps62360_probe(struct i2c_client *client,
 	tps->desc.ops = &tps62360_dcdc_ops;
 	tps->desc.type = REGULATOR_VOLTAGE;
 	tps->desc.owner = THIS_MODULE;
+	tps->desc.min_uV = tps->voltage_base;
+	tps->desc.uV_step = 10000;
+
 	tps->regmap = devm_regmap_init_i2c(client, &tps62360_regmap_config);
 	if (IS_ERR(tps->regmap)) {
 		ret = PTR_ERR(tps->regmap);
-- 
1.7.5.4




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

* [PATCH RFT 2/2] regulator: tps62360: Convert to set_voltage_sel and regulator_map_voltage_linear
  2012-05-14  3:25 [PATCH RFT 1/2] regulator: tps62360: Convert to regulator_list_voltage_linear() Axel Lin
@ 2012-05-14  3:27 ` Axel Lin
  2012-05-14  5:30 ` [PATCH RFT 1/2] regulator: tps62360: Convert to regulator_list_voltage_linear() Laxman Dewangan
  2012-05-14  8:12 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Axel Lin @ 2012-05-14  3:27 UTC (permalink / raw)
  To: linux-kernel; +Cc: Laxman Dewangan, Liam Girdwood, Mark Brown

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/regulator/tps62360-regulator.c |   24 +++++++-----------------
 1 files changed, 7 insertions(+), 17 deletions(-)

diff --git a/drivers/regulator/tps62360-regulator.c b/drivers/regulator/tps62360-regulator.c
index dae08a8..926c0e8 100644
--- a/drivers/regulator/tps62360-regulator.c
+++ b/drivers/regulator/tps62360-regulator.c
@@ -137,35 +137,24 @@ static int tps62360_dcdc_get_voltage_sel(struct regulator_dev *dev)
 	return vsel;
 }
 
-static int tps62360_dcdc_set_voltage(struct regulator_dev *dev,
-	     int min_uV, int max_uV, unsigned *selector)
+static int tps62360_dcdc_set_voltage_sel(struct regulator_dev *dev,
+					 unsigned selector)
 {
 	struct tps62360_chip *tps = rdev_get_drvdata(dev);
-	int vsel;
 	int ret;
 	bool found = false;
 	int new_vset_id = tps->curr_vset_id;
 
-	if ((max_uV < min_uV) || (max_uV < tps->voltage_base))
-		return -EINVAL;
-
-	if (min_uV > (tps->voltage_base + (tps->desc.n_voltages - 1) * 10000))
-		return -EINVAL;
-
-	vsel = DIV_ROUND_UP(min_uV - tps->voltage_base, 10000);
-	if (selector)
-		*selector = (vsel & tps->voltage_reg_mask);
-
 	/*
 	 * If gpios are available to select the VSET register then least
 	 * recently used register for new configuration.
 	 */
 	if (tps->valid_gpios)
-		found = find_voltage_set_register(tps, vsel, &new_vset_id);
+		found = find_voltage_set_register(tps, selector, &new_vset_id);
 
 	if (!found) {
 		ret = regmap_update_bits(tps->regmap, REG_VSET0 + new_vset_id,
-				tps->voltage_reg_mask, vsel);
+				tps->voltage_reg_mask, selector);
 		if (ret < 0) {
 			dev_err(tps->dev,
 				"%s(): register %d update failed with err %d\n",
@@ -173,7 +162,7 @@ static int tps62360_dcdc_set_voltage(struct regulator_dev *dev,
 			return ret;
 		}
 		tps->curr_vset_id = new_vset_id;
-		tps->curr_vset_vsel[new_vset_id] = vsel;
+		tps->curr_vset_vsel[new_vset_id] = selector;
 	}
 
 	/* Select proper VSET register vio gpios */
@@ -204,8 +193,9 @@ static int tps62360_set_voltage_time_sel(struct regulator_dev *rdev,
 
 static struct regulator_ops tps62360_dcdc_ops = {
 	.get_voltage_sel	= tps62360_dcdc_get_voltage_sel,
-	.set_voltage		= tps62360_dcdc_set_voltage,
+	.set_voltage_sel	= tps62360_dcdc_set_voltage_sel,
 	.list_voltage		= regulator_list_voltage_linear,
+	.map_voltage		= regulator_map_voltage_linear,
 	.set_voltage_time_sel	= tps62360_set_voltage_time_sel,
 };
 
-- 
1.7.5.4




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

* Re: [PATCH RFT 1/2] regulator: tps62360: Convert to regulator_list_voltage_linear()
  2012-05-14  3:25 [PATCH RFT 1/2] regulator: tps62360: Convert to regulator_list_voltage_linear() Axel Lin
  2012-05-14  3:27 ` [PATCH RFT 2/2] regulator: tps62360: Convert to set_voltage_sel and regulator_map_voltage_linear Axel Lin
@ 2012-05-14  5:30 ` Laxman Dewangan
  2012-05-14  8:12 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Laxman Dewangan @ 2012-05-14  5:30 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Liam Girdwood, Mark Brown

On Monday 14 May 2012 08:55 AM, Axel Lin wrote:
> Signed-off-by: Axel Lin<axel.lin@gmail.com>
> ---
>   drivers/regulator/tps62360-regulator.c |   20 ++++++--------------
>   1 files changed, 6 insertions(+), 14 deletions(-)

Acked-by: Laxman Dewangan <ldewangan@nvidia.com>

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

* Re: [PATCH RFT 1/2] regulator: tps62360: Convert to regulator_list_voltage_linear()
  2012-05-14  3:25 [PATCH RFT 1/2] regulator: tps62360: Convert to regulator_list_voltage_linear() Axel Lin
  2012-05-14  3:27 ` [PATCH RFT 2/2] regulator: tps62360: Convert to set_voltage_sel and regulator_map_voltage_linear Axel Lin
  2012-05-14  5:30 ` [PATCH RFT 1/2] regulator: tps62360: Convert to regulator_list_voltage_linear() Laxman Dewangan
@ 2012-05-14  8:12 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2012-05-14  8:12 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Laxman Dewangan, Liam Girdwood

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

On Mon, May 14, 2012 at 11:25:42AM +0800, Axel Lin wrote:
> Signed-off-by: Axel Lin <axel.lin@gmail.com>

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:[~2012-05-14  8:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-14  3:25 [PATCH RFT 1/2] regulator: tps62360: Convert to regulator_list_voltage_linear() Axel Lin
2012-05-14  3:27 ` [PATCH RFT 2/2] regulator: tps62360: Convert to set_voltage_sel and regulator_map_voltage_linear Axel Lin
2012-05-14  5:30 ` [PATCH RFT 1/2] regulator: tps62360: Convert to regulator_list_voltage_linear() Laxman Dewangan
2012-05-14  8:12 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.