diff options
author | Heiko Stübner <heiko@sntech.de> | 2012-03-02 07:57:44 -0500 |
---|---|---|
committer | Haojian Zhuang <haojian.zhuang@gmail.com> | 2012-03-06 20:48:58 -0500 |
commit | 8a16a701ad787b6db2949766341c5ad1b551de9f (patch) | |
tree | 374ff010e91020fdf8197b9320d72790a5b9a3de | |
parent | 6967cca8b431a181d3a02eee81f0c9f8b5e9e75a (diff) |
regulator: Remove bq24022 regulator driver
The bq24022 driver is just a specialised form of a gpio-regulator.
As all former users of it now use the gpio-regulator directly, there
is no need to keep it around.
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Haojian Zhuang <haojian.zhuang@gmail.com>
-rw-r--r-- | drivers/regulator/Kconfig | 8 | ||||
-rw-r--r-- | drivers/regulator/Makefile | 1 | ||||
-rw-r--r-- | drivers/regulator/bq24022.c | 162 | ||||
-rw-r--r-- | include/linux/regulator/bq24022.h | 24 |
4 files changed, 0 insertions, 195 deletions
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index 7a61b17ddd04..740f468ba65f 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig | |||
@@ -74,14 +74,6 @@ config REGULATOR_GPIO | |||
74 | and the platform has to provide a mapping of GPIO-states | 74 | and the platform has to provide a mapping of GPIO-states |
75 | to target volts/amps. | 75 | to target volts/amps. |
76 | 76 | ||
77 | config REGULATOR_BQ24022 | ||
78 | tristate "TI bq24022 Dual Input 1-Cell Li-Ion Charger IC" | ||
79 | help | ||
80 | This driver controls a TI bq24022 Charger attached via | ||
81 | GPIOs. The provided current regulator can enable/disable | ||
82 | charging select between 100 mA and 500 mA charging current | ||
83 | limit. | ||
84 | |||
85 | config REGULATOR_MAX1586 | 77 | config REGULATOR_MAX1586 |
86 | tristate "Maxim 1586/1587 voltage regulator" | 78 | tristate "Maxim 1586/1587 voltage regulator" |
87 | depends on I2C | 79 | depends on I2C |
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile index 503bac87715e..f53cf8082c62 100644 --- a/drivers/regulator/Makefile +++ b/drivers/regulator/Makefile | |||
@@ -11,7 +11,6 @@ obj-$(CONFIG_REGULATOR_USERSPACE_CONSUMER) += userspace-consumer.o | |||
11 | 11 | ||
12 | obj-$(CONFIG_REGULATOR_GPIO) += gpio-regulator.o | 12 | obj-$(CONFIG_REGULATOR_GPIO) += gpio-regulator.o |
13 | obj-$(CONFIG_REGULATOR_AD5398) += ad5398.o | 13 | obj-$(CONFIG_REGULATOR_AD5398) += ad5398.o |
14 | obj-$(CONFIG_REGULATOR_BQ24022) += bq24022.o | ||
15 | obj-$(CONFIG_REGULATOR_LP3971) += lp3971.o | 14 | obj-$(CONFIG_REGULATOR_LP3971) += lp3971.o |
16 | obj-$(CONFIG_REGULATOR_LP3972) += lp3972.o | 15 | obj-$(CONFIG_REGULATOR_LP3972) += lp3972.o |
17 | obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o | 16 | obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o |
diff --git a/drivers/regulator/bq24022.c b/drivers/regulator/bq24022.c deleted file mode 100644 index 9fab6d1bbe80..000000000000 --- a/drivers/regulator/bq24022.c +++ /dev/null | |||
@@ -1,162 +0,0 @@ | |||
1 | /* | ||
2 | * Support for TI bq24022 (bqTINY-II) Dual Input (USB/AC Adpater) | ||
3 | * 1-Cell Li-Ion Charger connected via GPIOs. | ||
4 | * | ||
5 | * Copyright (c) 2008 Philipp Zabel | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/platform_device.h> | ||
16 | #include <linux/err.h> | ||
17 | #include <linux/module.h> | ||
18 | #include <linux/gpio.h> | ||
19 | #include <linux/regulator/bq24022.h> | ||
20 | #include <linux/regulator/driver.h> | ||
21 | |||
22 | |||
23 | static int bq24022_set_current_limit(struct regulator_dev *rdev, | ||
24 | int min_uA, int max_uA) | ||
25 | { | ||
26 | struct bq24022_mach_info *pdata = rdev_get_drvdata(rdev); | ||
27 | |||
28 | dev_dbg(rdev_get_dev(rdev), "setting current limit to %s mA\n", | ||
29 | max_uA >= 500000 ? "500" : "100"); | ||
30 | |||
31 | /* REVISIT: maybe return error if min_uA != 0 ? */ | ||
32 | gpio_set_value(pdata->gpio_iset2, max_uA >= 500000); | ||
33 | return 0; | ||
34 | } | ||
35 | |||
36 | static int bq24022_get_current_limit(struct regulator_dev *rdev) | ||
37 | { | ||
38 | struct bq24022_mach_info *pdata = rdev_get_drvdata(rdev); | ||
39 | |||
40 | return gpio_get_value(pdata->gpio_iset2) ? 500000 : 100000; | ||
41 | } | ||
42 | |||
43 | static int bq24022_enable(struct regulator_dev *rdev) | ||
44 | { | ||
45 | struct bq24022_mach_info *pdata = rdev_get_drvdata(rdev); | ||
46 | |||
47 | dev_dbg(rdev_get_dev(rdev), "enabling charger\n"); | ||
48 | |||
49 | gpio_set_value(pdata->gpio_nce, 0); | ||
50 | return 0; | ||
51 | } | ||
52 | |||
53 | static int bq24022_disable(struct regulator_dev *rdev) | ||
54 | { | ||
55 | struct bq24022_mach_info *pdata = rdev_get_drvdata(rdev); | ||
56 | |||
57 | dev_dbg(rdev_get_dev(rdev), "disabling charger\n"); | ||
58 | |||
59 | gpio_set_value(pdata->gpio_nce, 1); | ||
60 | return 0; | ||
61 | } | ||
62 | |||
63 | static int bq24022_is_enabled(struct regulator_dev *rdev) | ||
64 | { | ||
65 | struct bq24022_mach_info *pdata = rdev_get_drvdata(rdev); | ||
66 | |||
67 | return !gpio_get_value(pdata->gpio_nce); | ||
68 | } | ||
69 | |||
70 | static struct regulator_ops bq24022_ops = { | ||
71 | .set_current_limit = bq24022_set_current_limit, | ||
72 | .get_current_limit = bq24022_get_current_limit, | ||
73 | .enable = bq24022_enable, | ||
74 | .disable = bq24022_disable, | ||
75 | .is_enabled = bq24022_is_enabled, | ||
76 | }; | ||
77 | |||
78 | static struct regulator_desc bq24022_desc = { | ||
79 | .name = "bq24022", | ||
80 | .ops = &bq24022_ops, | ||
81 | .type = REGULATOR_CURRENT, | ||
82 | .owner = THIS_MODULE, | ||
83 | }; | ||
84 | |||
85 | static int __init bq24022_probe(struct platform_device *pdev) | ||
86 | { | ||
87 | struct bq24022_mach_info *pdata = pdev->dev.platform_data; | ||
88 | struct regulator_dev *bq24022; | ||
89 | int ret; | ||
90 | |||
91 | if (!pdata || !pdata->gpio_nce || !pdata->gpio_iset2) | ||
92 | return -EINVAL; | ||
93 | |||
94 | ret = gpio_request(pdata->gpio_nce, "ncharge_en"); | ||
95 | if (ret) { | ||
96 | dev_dbg(&pdev->dev, "couldn't request nCE GPIO: %d\n", | ||
97 | pdata->gpio_nce); | ||
98 | goto err_ce; | ||
99 | } | ||
100 | ret = gpio_request(pdata->gpio_iset2, "charge_mode"); | ||
101 | if (ret) { | ||
102 | dev_dbg(&pdev->dev, "couldn't request ISET2 GPIO: %d\n", | ||
103 | pdata->gpio_iset2); | ||
104 | goto err_iset2; | ||
105 | } | ||
106 | ret = gpio_direction_output(pdata->gpio_iset2, 0); | ||
107 | ret = gpio_direction_output(pdata->gpio_nce, 1); | ||
108 | |||
109 | bq24022 = regulator_register(&bq24022_desc, &pdev->dev, | ||
110 | pdata->init_data, pdata, NULL); | ||
111 | if (IS_ERR(bq24022)) { | ||
112 | dev_dbg(&pdev->dev, "couldn't register regulator\n"); | ||
113 | ret = PTR_ERR(bq24022); | ||
114 | goto err_reg; | ||
115 | } | ||
116 | platform_set_drvdata(pdev, bq24022); | ||
117 | dev_dbg(&pdev->dev, "registered regulator\n"); | ||
118 | |||
119 | return 0; | ||
120 | err_reg: | ||
121 | gpio_free(pdata->gpio_iset2); | ||
122 | err_iset2: | ||
123 | gpio_free(pdata->gpio_nce); | ||
124 | err_ce: | ||
125 | return ret; | ||
126 | } | ||
127 | |||
128 | static int __devexit bq24022_remove(struct platform_device *pdev) | ||
129 | { | ||
130 | struct bq24022_mach_info *pdata = pdev->dev.platform_data; | ||
131 | struct regulator_dev *bq24022 = platform_get_drvdata(pdev); | ||
132 | |||
133 | regulator_unregister(bq24022); | ||
134 | gpio_free(pdata->gpio_iset2); | ||
135 | gpio_free(pdata->gpio_nce); | ||
136 | |||
137 | return 0; | ||
138 | } | ||
139 | |||
140 | static struct platform_driver bq24022_driver = { | ||
141 | .driver = { | ||
142 | .name = "bq24022", | ||
143 | }, | ||
144 | .remove = __devexit_p(bq24022_remove), | ||
145 | }; | ||
146 | |||
147 | static int __init bq24022_init(void) | ||
148 | { | ||
149 | return platform_driver_probe(&bq24022_driver, bq24022_probe); | ||
150 | } | ||
151 | |||
152 | static void __exit bq24022_exit(void) | ||
153 | { | ||
154 | platform_driver_unregister(&bq24022_driver); | ||
155 | } | ||
156 | |||
157 | module_init(bq24022_init); | ||
158 | module_exit(bq24022_exit); | ||
159 | |||
160 | MODULE_AUTHOR("Philipp Zabel"); | ||
161 | MODULE_DESCRIPTION("TI bq24022 Li-Ion Charger driver"); | ||
162 | MODULE_LICENSE("GPL"); | ||
diff --git a/include/linux/regulator/bq24022.h b/include/linux/regulator/bq24022.h deleted file mode 100644 index a6d014005d49..000000000000 --- a/include/linux/regulator/bq24022.h +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | /* | ||
2 | * Support for TI bq24022 (bqTINY-II) Dual Input (USB/AC Adpater) | ||
3 | * 1-Cell Li-Ion Charger connected via GPIOs. | ||
4 | * | ||
5 | * Copyright (c) 2008 Philipp Zabel | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | struct regulator_init_data; | ||
14 | |||
15 | /** | ||
16 | * bq24022_mach_info - platform data for bq24022 | ||
17 | * @gpio_nce: GPIO line connected to the nCE pin, used to enable / disable charging | ||
18 | * @gpio_iset2: GPIO line connected to the ISET2 pin, used to limit charging current to 100 mA / 500 mA | ||
19 | */ | ||
20 | struct bq24022_mach_info { | ||
21 | int gpio_nce; | ||
22 | int gpio_iset2; | ||
23 | struct regulator_init_data *init_data; | ||
24 | }; | ||