summaryrefslogtreecommitdiffstats
path: root/drivers/regulator/anatop-regulator.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-13 12:04:35 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-13 12:04:35 -0800
commit8b0cab14951fbf8126795ab301835a8f8126a988 (patch)
tree2bf23662944ac9bfcd34d13ef81a6e331266ebf9 /drivers/regulator/anatop-regulator.c
parentfd62c5450324af7f6cc12897b09b77285cd48a92 (diff)
parent4ffc45c3604dd8e283884ce006faf0e955cbd9e6 (diff)
downloadlinux-8b0cab14951fbf8126795ab301835a8f8126a988.tar.gz
linux-8b0cab14951fbf8126795ab301835a8f8126a988.tar.bz2
linux-8b0cab14951fbf8126795ab301835a8f8126a988.zip
Merge tag 'regulator-3.8' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
Pull regulator updates from Mark Brown: "A fairly quiet release again, a couple of relatively small new features and a bunch of driver specific work including yet more code elimination and fixes from Axel Lin. - Addidion of linear_min_sel for offsetting linear selectors in the helpers. - Support for continuous voltage ranges for regulators with extremely high resolution. - Drivers for AS3711, DA9055, MAX9873, TPS51632, TPS80031 and ARM vexpress." Fix up trivial conflict (due to typo fix) in palmas-regulator.c * tag 'regulator-3.8' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (80 commits) regulator: core: Fix logic to determinate if regulator can change voltage regulator: s5m8767: Fix to work even if no DVS gpio present regulator: s5m8767: Fix to read the first DVS register. regulator: s5m8767: Fix to work when platform registers less regulators regulator: gpio-regulator: gpio_set_value should use cansleep regulator: gpio-regulator: Fix logical error in for() loop regulator: anatop: Use regulator_[get|set]_voltage_sel_regmap regulator: anatop: Use linear_min_sel with linear mapping regulator: max1586: Implement get_voltage_sel callback regulator: lp8788-buck: Kill _gpio_request function regulator: tps80031: Convert tps80031_ldo_ops to linear_min_sel and list_voltage_linear regulator: lp8788-ldo: Remove val array in lp8788_config_ldo_enable_mode regulator: gpio-regulator: Add ifdef CONFIG_OF guard for regulator_gpio_of_match regulator: palmas: Convert palmas_ops_smps to regulator_[get|set]_voltage_sel_regmap regulator: palmas: Return raw register values as the selectors in [get|set]_voltage_sel regulators: add regulator_can_change_voltage() function regulator: tps51632: Ensure [base|max]_voltage_uV pdata settings are valid regulator: wm831x-dcdc: Add MODULE_ALIAS for wm831x-boostp regulator: wm831x-dcdc: Ensure selected voltage falls within requested range regulator: tps51632: Use linear_min_sel and regulator_[map|list]_voltage_linear ...
Diffstat (limited to 'drivers/regulator/anatop-regulator.c')
-rw-r--r--drivers/regulator/anatop-regulator.c34
1 files changed, 12 insertions, 22 deletions
diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c
index 1af97686f444..0199eeea63b1 100644
--- a/drivers/regulator/anatop-regulator.c
+++ b/drivers/regulator/anatop-regulator.c
@@ -48,36 +48,21 @@ static int anatop_regmap_set_voltage_sel(struct regulator_dev *reg,
unsigned selector)
{
struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg);
- u32 val, mask;
if (!anatop_reg->control_reg)
return -ENOTSUPP;
- val = anatop_reg->min_bit_val + selector;
- dev_dbg(&reg->dev, "%s: calculated val %d\n", __func__, val);
- mask = ((1 << anatop_reg->vol_bit_width) - 1) <<
- anatop_reg->vol_bit_shift;
- val <<= anatop_reg->vol_bit_shift;
- regmap_update_bits(anatop_reg->anatop, anatop_reg->control_reg,
- mask, val);
-
- return 0;
+ return regulator_set_voltage_sel_regmap(reg, selector);
}
static int anatop_regmap_get_voltage_sel(struct regulator_dev *reg)
{
struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg);
- u32 val, mask;
if (!anatop_reg->control_reg)
return -ENOTSUPP;
- regmap_read(anatop_reg->anatop, anatop_reg->control_reg, &val);
- mask = ((1 << anatop_reg->vol_bit_width) - 1) <<
- anatop_reg->vol_bit_shift;
- val = (val & mask) >> anatop_reg->vol_bit_shift;
-
- return val - anatop_reg->min_bit_val;
+ return regulator_get_voltage_sel_regmap(reg);
}
static struct regulator_ops anatop_rops = {
@@ -87,7 +72,7 @@ static struct regulator_ops anatop_rops = {
.map_voltage = regulator_map_voltage_linear,
};
-static int __devinit anatop_regulator_probe(struct platform_device *pdev)
+static int anatop_regulator_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct device_node *np = dev->of_node;
@@ -158,15 +143,20 @@ static int __devinit anatop_regulator_probe(struct platform_device *pdev)
goto anatop_probe_end;
}
- rdesc->n_voltages = (sreg->max_voltage - sreg->min_voltage)
- / 25000 + 1;
+ rdesc->n_voltages = (sreg->max_voltage - sreg->min_voltage) / 25000 + 1
+ + sreg->min_bit_val;
rdesc->min_uV = sreg->min_voltage;
rdesc->uV_step = 25000;
+ rdesc->linear_min_sel = sreg->min_bit_val;
+ rdesc->vsel_reg = sreg->control_reg;
+ rdesc->vsel_mask = ((1 << sreg->vol_bit_width) - 1) <<
+ sreg->vol_bit_shift;
config.dev = &pdev->dev;
config.init_data = initdata;
config.driver_data = sreg;
config.of_node = pdev->dev.of_node;
+ config.regmap = sreg->anatop;
/* register regulator */
rdev = regulator_register(rdesc, &config);
@@ -186,7 +176,7 @@ anatop_probe_end:
return ret;
}
-static int __devexit anatop_regulator_remove(struct platform_device *pdev)
+static int anatop_regulator_remove(struct platform_device *pdev)
{
struct regulator_dev *rdev = platform_get_drvdata(pdev);
struct anatop_regulator *sreg = rdev_get_drvdata(rdev);
@@ -210,7 +200,7 @@ static struct platform_driver anatop_regulator_driver = {
.of_match_table = of_anatop_regulator_match_tbl,
},
.probe = anatop_regulator_probe,
- .remove = __devexit_p(anatop_regulator_remove),
+ .remove = anatop_regulator_remove,
};
static int __init anatop_regulator_init(void)