regulator: wm831x-dcdc: Use regulator_get_voltage_sel_regmap()
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Sun, 15 Apr 2012 10:55:34 +0000 (11:55 +0100)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 16 Apr 2012 18:52:13 +0000 (19:52 +0100)
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
drivers/regulator/wm831x-dcdc.c

index f0da23c5826fe1342f8092ff838a0e8ac8707fae..97c7e267c8136b6bb4f4105f2d36a0247caf0d53 100644 (file)
@@ -679,23 +679,9 @@ static int wm831x_buckp_set_suspend_voltage(struct regulator_dev *rdev,
        return wm831x_buckp_set_voltage_int(rdev, reg, uV, uV, &selector);
 }
 
-static int wm831x_buckp_get_voltage_sel(struct regulator_dev *rdev)
-{
-       struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
-       struct wm831x *wm831x = dcdc->wm831x;
-       u16 reg = dcdc->base + WM831X_DCDC_ON_CONFIG;
-       int val;
-
-       val = wm831x_reg_read(wm831x, reg);
-       if (val < 0)
-               return val;
-
-       return val & WM831X_DC3_ON_VSEL_MASK;
-}
-
 static struct regulator_ops wm831x_buckp_ops = {
        .set_voltage = wm831x_buckp_set_voltage,
-       .get_voltage_sel = wm831x_buckp_get_voltage_sel,
+       .get_voltage_sel = regulator_get_voltage_sel_regmap,
        .list_voltage = wm831x_buckp_list_voltage,
        .set_suspend_voltage = wm831x_buckp_set_suspend_voltage,
 
@@ -753,10 +739,13 @@ static __devinit int wm831x_buckp_probe(struct platform_device *pdev)
        dcdc->desc.n_voltages = WM831X_BUCKP_MAX_SELECTOR + 1;
        dcdc->desc.ops = &wm831x_buckp_ops;
        dcdc->desc.owner = THIS_MODULE;
+       dcdc->desc.vsel_reg = dcdc->base + WM831X_DCDC_ON_CONFIG;
+       dcdc->desc.vsel_mask = WM831X_DC3_ON_VSEL_MASK;
 
        config.dev = pdev->dev.parent;
        config.init_data = pdata->dcdc[id];
        config.driver_data = dcdc;
+       config.regmap = wm831x->regmap;
 
        dcdc->regulator = regulator_register(&dcdc->desc, &config);
        if (IS_ERR(dcdc->regulator)) {