Merge remote-tracking branch 'regulator/topic/tps516312' into regulator-next
[deliverable/linux.git] / drivers / regulator / wm831x-ldo.c
index 5cb70ca1e98d1f1843347fe14d7291d7a041eceb..1ec379a9a95c88807c9987b23568e892b14bdc1a 100644 (file)
@@ -205,6 +205,8 @@ static int wm831x_gp_ldo_get_status(struct regulator_dev *rdev)
 
        /* Is it reporting under voltage? */
        ret = wm831x_reg_read(wm831x, WM831X_LDO_UV_STATUS);
+       if (ret < 0)
+               return ret;
        if (ret & mask)
                return REGULATOR_STATUS_ERROR;
 
@@ -237,13 +239,15 @@ static struct regulator_ops wm831x_gp_ldo_ops = {
        .set_mode = wm831x_gp_ldo_set_mode,
        .get_status = wm831x_gp_ldo_get_status,
        .get_optimum_mode = wm831x_gp_ldo_get_optimum_mode,
+       .get_bypass = regulator_get_bypass_regmap,
+       .set_bypass = regulator_set_bypass_regmap,
 
        .is_enabled = regulator_is_enabled_regmap,
        .enable = regulator_enable_regmap,
        .disable = regulator_disable_regmap,
 };
 
-static __devinit int wm831x_gp_ldo_probe(struct platform_device *pdev)
+static int wm831x_gp_ldo_probe(struct platform_device *pdev)
 {
        struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent);
        struct wm831x_pdata *pdata = wm831x->dev->platform_data;
@@ -269,9 +273,9 @@ static __devinit int wm831x_gp_ldo_probe(struct platform_device *pdev)
 
        ldo->wm831x = wm831x;
 
-       res = platform_get_resource(pdev, IORESOURCE_IO, 0);
+       res = platform_get_resource(pdev, IORESOURCE_REG, 0);
        if (res == NULL) {
-               dev_err(&pdev->dev, "No I/O resource\n");
+               dev_err(&pdev->dev, "No REG resource\n");
                ret = -EINVAL;
                goto err;
        }
@@ -293,6 +297,8 @@ static __devinit int wm831x_gp_ldo_probe(struct platform_device *pdev)
        ldo->desc.vsel_mask = WM831X_LDO1_ON_VSEL_MASK;
        ldo->desc.enable_reg = WM831X_LDO_ENABLE;
        ldo->desc.enable_mask = 1 << id;
+       ldo->desc.bypass_reg = ldo->base;
+       ldo->desc.bypass_mask = WM831X_LDO1_SWI;
 
        config.dev = pdev->dev.parent;
        if (pdata)
@@ -328,7 +334,7 @@ err:
        return ret;
 }
 
-static __devexit int wm831x_gp_ldo_remove(struct platform_device *pdev)
+static int wm831x_gp_ldo_remove(struct platform_device *pdev)
 {
        struct wm831x_ldo *ldo = platform_get_drvdata(pdev);
 
@@ -343,7 +349,7 @@ static __devexit int wm831x_gp_ldo_remove(struct platform_device *pdev)
 
 static struct platform_driver wm831x_gp_ldo_driver = {
        .probe = wm831x_gp_ldo_probe,
-       .remove = __devexit_p(wm831x_gp_ldo_remove),
+       .remove = wm831x_gp_ldo_remove,
        .driver         = {
                .name   = "wm831x-ldo",
                .owner  = THIS_MODULE,
@@ -469,6 +475,8 @@ static int wm831x_aldo_get_status(struct regulator_dev *rdev)
 
        /* Is it reporting under voltage? */
        ret = wm831x_reg_read(wm831x, WM831X_LDO_UV_STATUS);
+       if (ret < 0)
+               return ret;
        if (ret & mask)
                return REGULATOR_STATUS_ERROR;
 
@@ -488,13 +496,15 @@ static struct regulator_ops wm831x_aldo_ops = {
        .get_mode = wm831x_aldo_get_mode,
        .set_mode = wm831x_aldo_set_mode,
        .get_status = wm831x_aldo_get_status,
+       .set_bypass = regulator_set_bypass_regmap,
+       .get_bypass = regulator_get_bypass_regmap,
 
        .is_enabled = regulator_is_enabled_regmap,
        .enable = regulator_enable_regmap,
        .disable = regulator_disable_regmap,
 };
 
-static __devinit int wm831x_aldo_probe(struct platform_device *pdev)
+static int wm831x_aldo_probe(struct platform_device *pdev)
 {
        struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent);
        struct wm831x_pdata *pdata = wm831x->dev->platform_data;
@@ -520,9 +530,9 @@ static __devinit int wm831x_aldo_probe(struct platform_device *pdev)
 
        ldo->wm831x = wm831x;
 
-       res = platform_get_resource(pdev, IORESOURCE_IO, 0);
+       res = platform_get_resource(pdev, IORESOURCE_REG, 0);
        if (res == NULL) {
-               dev_err(&pdev->dev, "No I/O resource\n");
+               dev_err(&pdev->dev, "No REG resource\n");
                ret = -EINVAL;
                goto err;
        }
@@ -544,6 +554,8 @@ static __devinit int wm831x_aldo_probe(struct platform_device *pdev)
        ldo->desc.vsel_mask = WM831X_LDO7_ON_VSEL_MASK;
        ldo->desc.enable_reg = WM831X_LDO_ENABLE;
        ldo->desc.enable_mask = 1 << id;
+       ldo->desc.bypass_reg = ldo->base;
+       ldo->desc.bypass_mask = WM831X_LDO7_SWI;
 
        config.dev = pdev->dev.parent;
        if (pdata)
@@ -578,7 +590,7 @@ err:
        return ret;
 }
 
-static __devexit int wm831x_aldo_remove(struct platform_device *pdev)
+static int wm831x_aldo_remove(struct platform_device *pdev)
 {
        struct wm831x_ldo *ldo = platform_get_drvdata(pdev);
 
@@ -591,7 +603,7 @@ static __devexit int wm831x_aldo_remove(struct platform_device *pdev)
 
 static struct platform_driver wm831x_aldo_driver = {
        .probe = wm831x_aldo_probe,
-       .remove = __devexit_p(wm831x_aldo_remove),
+       .remove = wm831x_aldo_remove,
        .driver         = {
                .name   = "wm831x-aldo",
                .owner  = THIS_MODULE,
@@ -648,7 +660,7 @@ static struct regulator_ops wm831x_alive_ldo_ops = {
        .disable = regulator_disable_regmap,
 };
 
-static __devinit int wm831x_alive_ldo_probe(struct platform_device *pdev)
+static int wm831x_alive_ldo_probe(struct platform_device *pdev)
 {
        struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent);
        struct wm831x_pdata *pdata = wm831x->dev->platform_data;
@@ -675,9 +687,9 @@ static __devinit int wm831x_alive_ldo_probe(struct platform_device *pdev)
 
        ldo->wm831x = wm831x;
 
-       res = platform_get_resource(pdev, IORESOURCE_IO, 0);
+       res = platform_get_resource(pdev, IORESOURCE_REG, 0);
        if (res == NULL) {
-               dev_err(&pdev->dev, "No I/O resource\n");
+               dev_err(&pdev->dev, "No REG resource\n");
                ret = -EINVAL;
                goto err;
        }
@@ -725,7 +737,7 @@ err:
        return ret;
 }
 
-static __devexit int wm831x_alive_ldo_remove(struct platform_device *pdev)
+static int wm831x_alive_ldo_remove(struct platform_device *pdev)
 {
        struct wm831x_ldo *ldo = platform_get_drvdata(pdev);
 
@@ -736,7 +748,7 @@ static __devexit int wm831x_alive_ldo_remove(struct platform_device *pdev)
 
 static struct platform_driver wm831x_alive_ldo_driver = {
        .probe = wm831x_alive_ldo_probe,
-       .remove = __devexit_p(wm831x_alive_ldo_remove),
+       .remove = wm831x_alive_ldo_remove,
        .driver         = {
                .name   = "wm831x-alive-ldo",
                .owner  = THIS_MODULE,
This page took 0.027922 seconds and 5 git commands to generate.