aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/bq24022.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/regulator/bq24022.c')
-rw-r--r--drivers/regulator/bq24022.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/drivers/regulator/bq24022.c b/drivers/regulator/bq24022.c
index 263699d6152d..366565aba865 100644
--- a/drivers/regulator/bq24022.c
+++ b/drivers/regulator/bq24022.c
@@ -18,13 +18,13 @@
18#include <linux/regulator/bq24022.h> 18#include <linux/regulator/bq24022.h>
19#include <linux/regulator/driver.h> 19#include <linux/regulator/driver.h>
20 20
21
21static int bq24022_set_current_limit(struct regulator_dev *rdev, 22static int bq24022_set_current_limit(struct regulator_dev *rdev,
22 int min_uA, int max_uA) 23 int min_uA, int max_uA)
23{ 24{
24 struct platform_device *pdev = rdev_get_drvdata(rdev); 25 struct bq24022_mach_info *pdata = rdev_get_drvdata(rdev);
25 struct bq24022_mach_info *pdata = pdev->dev.platform_data;
26 26
27 dev_dbg(&pdev->dev, "setting current limit to %s mA\n", 27 dev_dbg(rdev_get_dev(rdev), "setting current limit to %s mA\n",
28 max_uA >= 500000 ? "500" : "100"); 28 max_uA >= 500000 ? "500" : "100");
29 29
30 /* REVISIT: maybe return error if min_uA != 0 ? */ 30 /* REVISIT: maybe return error if min_uA != 0 ? */
@@ -34,18 +34,16 @@ static int bq24022_set_current_limit(struct regulator_dev *rdev,
34 34
35static int bq24022_get_current_limit(struct regulator_dev *rdev) 35static int bq24022_get_current_limit(struct regulator_dev *rdev)
36{ 36{
37 struct platform_device *pdev = rdev_get_drvdata(rdev); 37 struct bq24022_mach_info *pdata = rdev_get_drvdata(rdev);
38 struct bq24022_mach_info *pdata = pdev->dev.platform_data;
39 38
40 return gpio_get_value(pdata->gpio_iset2) ? 500000 : 100000; 39 return gpio_get_value(pdata->gpio_iset2) ? 500000 : 100000;
41} 40}
42 41
43static int bq24022_enable(struct regulator_dev *rdev) 42static int bq24022_enable(struct regulator_dev *rdev)
44{ 43{
45 struct platform_device *pdev = rdev_get_drvdata(rdev); 44 struct bq24022_mach_info *pdata = rdev_get_drvdata(rdev);
46 struct bq24022_mach_info *pdata = pdev->dev.platform_data;
47 45
48 dev_dbg(&pdev->dev, "enabling charger\n"); 46 dev_dbg(rdev_get_dev(rdev), "enabling charger\n");
49 47
50 gpio_set_value(pdata->gpio_nce, 0); 48 gpio_set_value(pdata->gpio_nce, 0);
51 return 0; 49 return 0;
@@ -53,10 +51,9 @@ static int bq24022_enable(struct regulator_dev *rdev)
53 51
54static int bq24022_disable(struct regulator_dev *rdev) 52static int bq24022_disable(struct regulator_dev *rdev)
55{ 53{
56 struct platform_device *pdev = rdev_get_drvdata(rdev); 54 struct bq24022_mach_info *pdata = rdev_get_drvdata(rdev);
57 struct bq24022_mach_info *pdata = pdev->dev.platform_data;
58 55
59 dev_dbg(&pdev->dev, "disabling charger\n"); 56 dev_dbg(rdev_get_dev(rdev), "disabling charger\n");
60 57
61 gpio_set_value(pdata->gpio_nce, 1); 58 gpio_set_value(pdata->gpio_nce, 1);
62 return 0; 59 return 0;
@@ -108,7 +105,7 @@ static int __init bq24022_probe(struct platform_device *pdev)
108 ret = gpio_direction_output(pdata->gpio_iset2, 0); 105 ret = gpio_direction_output(pdata->gpio_iset2, 0);
109 ret = gpio_direction_output(pdata->gpio_nce, 1); 106 ret = gpio_direction_output(pdata->gpio_nce, 1);
110 107
111 bq24022 = regulator_register(&bq24022_desc, pdev); 108 bq24022 = regulator_register(&bq24022_desc, &pdev->dev, pdata);
112 if (IS_ERR(bq24022)) { 109 if (IS_ERR(bq24022)) {
113 dev_dbg(&pdev->dev, "couldn't register regulator\n"); 110 dev_dbg(&pdev->dev, "couldn't register regulator\n");
114 ret = PTR_ERR(bq24022); 111 ret = PTR_ERR(bq24022);