Skip to contentSkip to conversation

regulator: Convert tps6524x to set_voltage_sel

PATCH In review Axel Lin 2 participants 5 messages Mar 22, 2012 – Mar 28, 2012 Voltage and current regulator framework

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/2 regulator: Convert tps6524x to set_voltage_sel

---
 drivers/regulator/tps6524x-regulator.c |   18 +++---------------
 1 files changed, 3 insertions(+), 15 deletions(-)
drivers/regulator/tps6524x-regulator.c +3 -15
index 4a421be..3a4a1d5 100644
@@ -458,12 +458,10 @@ static int list_voltage(struct regulator_dev *rdev, unsigned selector)
 		info->voltages[selector] : -EINVAL);
 }
 
-static int set_voltage(struct regulator_dev *rdev, int min_uV, int max_uV,
-		       unsigned *selector)
+static int set_voltage_sel(struct regulator_dev *rdev, unsigned selector)
 {
 	const struct supply_info *info;
 	struct tps6524x *hw;
-	unsigned i;
 
 	hw	= rdev_get_drvdata(rdev);
 	info	= &supply_info[rdev_get_id(rdev)];
@@ -471,17 +469,7 @@ static int set_voltage(struct regulator_dev *rdev, int min_uV, int max_uV,
 	if (info->flags & FIXED_VOLTAGE)
 		return -EINVAL;
 
-	for (i = 0; i < info->n_voltages; i++)
-		if (min_uV <= info->voltages[i] &&
-		    max_uV >= info->voltages[i])
-			break;
-
-	if (i >= info->n_voltages)
-		i = info->n_voltages - 1;
-
-	*selector = i;
-
-	return write_field(hw, &info->voltage, i);
+	return write_field(hw, &info->voltage, selector);
 }
 
 static int get_voltage(struct regulator_dev *rdev)
@@ -588,7 +576,7 @@ static struct regulator_ops regulator_ops = {
 	.enable			= enable_supply,
 	.disable		= disable_supply,
 	.get_voltage		= get_voltage,
-	.set_voltage		= set_voltage,
+	.set_voltage_sel	= set_voltage_sel,
 	.list_voltage		= list_voltage,
 	.set_current_limit	= set_current_limit,
 	.get_current_limit	= get_current_limit,
Signature · 1 line
1.7.5.4
author
#1 lore raw

PATCH 2/2 regulator: Convert tps6524x to get_voltage_sel

---
 drivers/regulator/tps6524x-regulator.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/regulator/tps6524x-regulator.c +3 -3
index 3a4a1d5..2a828a0 100644
@@ -472,7 +472,7 @@ static int set_voltage_sel(struct regulator_dev *rdev, unsigned selector)
 	return write_field(hw, &info->voltage, selector);
 }
 
-static int get_voltage(struct regulator_dev *rdev)
+static int get_voltage_sel(struct regulator_dev *rdev)
 {
 	const struct supply_info *info;
 	struct tps6524x *hw;
@@ -490,7 +490,7 @@ static int get_voltage(struct regulator_dev *rdev)
 	if (WARN_ON(ret >= info->n_voltages))
 		return -EIO;
 
-	return info->voltages[ret];
+	return ret;
 }
 
 static int set_current_limit(struct regulator_dev *rdev, int min_uA,
@@ -575,7 +575,7 @@ static struct regulator_ops regulator_ops = {
 	.is_enabled		= is_supply_enabled,
 	.enable			= enable_supply,
 	.disable		= disable_supply,
-	.get_voltage		= get_voltage,
+	.get_voltage_sel	= get_voltage_sel,
 	.set_voltage_sel	= set_voltage_sel,
 	.list_voltage		= list_voltage,
 	.set_current_limit	= set_current_limit,
Signature · 1 line
1.7.5.4
author
#3 lore raw

2012/3/27 Mark Brown <[email protected]>:

Quoted 5 lines · Axel Lin
Quoted 1 line

These don't apply any more due to some of your other cleanups which got applied first, can you rebase please?

Hi Mark,
I tried to apply both patch to linux-next (20120326) and it looks ok. I checked you tree and found:
Both patch are appliable to your topic/drivers branch but failed to apply to your for-next branch.
It is because commit f03570cf "regulator: Fix setting selector in tps6524x set_voltage function" is missing from your for-next branch. ( Note this commit already in Linus' tree, so I don't think I should re-generate the patch against your for-next branch.)

I'm not sure if you still keep both patches, if a resend is required, just let me know.

Thanks,
Axel

#4 lore raw
Quoted 2 lines · Axel Lin

I'm not sure if you still keep both patches, if a resend is required, just let me know.

Please resend.