Skip to contentSkip to conversation

regulator: Convert ab8500 to use get_voltage_sel()

RFC PATCH Applied Axel Lin 3 participants 3 messages Feb 24, 2012 – Feb 27, 2012 Voltage and current regulator framework

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

RFC PATCH 1/1 regulator: Convert ab8500 to use get_voltage_sel()

This change is required to make ab8500_regulator_get_voltage_sel work. The regulator core will call set_voltage_time_sel only when get_voltage_sel is implemented.

---
Hi,
I don't have this hardware, I'd appreciate if someone can test this patch.

Axel

 drivers/regulator/ab8500.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)
drivers/regulator/ab8500.c +4 -6
index c9b9253..c7ee4c1 100644
@@ -201,7 +201,7 @@ static int ab8500_list_voltage(struct regulator_dev *rdev, unsigned selector)
 	return info->voltages[selector];
 }
 
-static int ab8500_regulator_get_voltage(struct regulator_dev *rdev)
+static int ab8500_regulator_get_voltage_sel(struct regulator_dev *rdev)
 {
 	int ret, val;
 	struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
@@ -229,11 +229,9 @@ static int ab8500_regulator_get_voltage(struct regulator_dev *rdev)
 	/* vintcore has a different layout */
 	val = regval & info->voltage_mask;
 	if (info->desc.id == AB8500_LDO_INTCORE)
-		ret = info->voltages[val >> 0x3];
+		return val >> 0x3;
 	else
-		ret = info->voltages[val];
-
-	return ret;
+		return val;
 }
 
 static int ab8500_get_best_voltage_index(struct regulator_dev *rdev,
@@ -320,7 +318,7 @@ static struct regulator_ops ab8500_regulator_ops = {
 	.enable		= ab8500_regulator_enable,
 	.disable	= ab8500_regulator_disable,
 	.is_enabled	= ab8500_regulator_is_enabled,
-	.get_voltage	= ab8500_regulator_get_voltage,
+	.get_voltage_sel = ab8500_regulator_get_voltage_sel,
 	.set_voltage	= ab8500_regulator_set_voltage,
 	.list_voltage	= ab8500_list_voltage,
 	.enable_time	= ab8500_regulator_enable_time,
Signature · 1 line
1.7.5.4
Tested-by on v1 1/1
#1 lore raw
Quoted 8 lines · Axel Lin

This change is required to make ab8500_regulator_get_voltage_sel work. The regulator core will call set_voltage_time_sel only when get_voltage_sel is implemented.

---
Hi,
I don't have this hardware, I'd appreciate if someone can test this patch.

I've applied it and booted and it seems to work just fine, nice refactoring there Axel!

Thanks,
Linus Walleij

Applied
#2 lore raw
In reply to Axel Lin
Quoted 3 lines · Axel Lin

This change is required to make ab8500_regulator_get_voltage_sel work. The regulator core will call set_voltage_time_sel only when get_voltage_sel is implemented.

Applied, thanks.