aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorAnton Vorontsov <cbouatmailru@gmail.com>2008-10-18 12:28:24 -0400
committerAnton Vorontsov <cbouatmailru@gmail.com>2008-10-18 12:28:24 -0400
commited8c3174dd227031d1f3b9fa4fbb512f8f623434 (patch)
treebac4953f8899d6600f4716c0bcde1e25e34c2591 /drivers/power
parent8aef7e8f8de2d900da892085edbf14ea35fe6881 (diff)
parent0cfd81031a26717fe14380d18275f8e217571615 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts: drivers/power/Makefile
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/Kconfig8
-rw-r--r--drivers/power/Makefile2
-rw-r--r--drivers/power/olpc_battery.c20
-rw-r--r--drivers/power/palmtx_battery.c198
-rw-r--r--drivers/power/power_supply_core.c4
-rw-r--r--drivers/power/wm97xx_battery.c272
6 files changed, 287 insertions, 217 deletions
diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
index ae095a498db4..8e0c2b47803c 100644
--- a/drivers/power/Kconfig
+++ b/drivers/power/Kconfig
@@ -56,11 +56,11 @@ config BATTERY_TOSA
56 Say Y to enable support for the battery on the Sharp Zaurus 56 Say Y to enable support for the battery on the Sharp Zaurus
57 SL-6000 (tosa) models. 57 SL-6000 (tosa) models.
58 58
59config BATTERY_PALMTX 59config BATTERY_WM97XX
60 tristate "Palm T|X battery" 60 bool "WM97xx generic battery driver"
61 depends on MACH_PALMTX 61 depends on TOUCHSCREEN_WM97XX=y
62 help 62 help
63 Say Y to enable support for the battery in Palm T|X. 63 Say Y to enable support for battery measured by WM97xx aux port.
64 64
65config BATTERY_BQ27x00 65config BATTERY_BQ27x00
66 tristate "BQ27200 battery driver" 66 tristate "BQ27200 battery driver"
diff --git a/drivers/power/Makefile b/drivers/power/Makefile
index 6cb301b779a7..e8f1ecec5d8f 100644
--- a/drivers/power/Makefile
+++ b/drivers/power/Makefile
@@ -21,5 +21,5 @@ obj-$(CONFIG_BATTERY_DS2760) += ds2760_battery.o
21obj-$(CONFIG_BATTERY_PMU) += pmu_battery.o 21obj-$(CONFIG_BATTERY_PMU) += pmu_battery.o
22obj-$(CONFIG_BATTERY_OLPC) += olpc_battery.o 22obj-$(CONFIG_BATTERY_OLPC) += olpc_battery.o
23obj-$(CONFIG_BATTERY_TOSA) += tosa_battery.o 23obj-$(CONFIG_BATTERY_TOSA) += tosa_battery.o
24obj-$(CONFIG_BATTERY_PALMTX) += palmtx_battery.o 24obj-$(CONFIG_BATTERY_WM97XX) += wm97xx_battery.o
25obj-$(CONFIG_BATTERY_BQ27x00) += bq27x00_battery.o 25obj-$(CONFIG_BATTERY_BQ27x00) += bq27x00_battery.o
diff --git a/drivers/power/olpc_battery.c b/drivers/power/olpc_battery.c
index 32570af3c5c9..5fbca2681baa 100644
--- a/drivers/power/olpc_battery.c
+++ b/drivers/power/olpc_battery.c
@@ -205,9 +205,9 @@ static int olpc_bat_get_property(struct power_supply *psy,
205 union power_supply_propval *val) 205 union power_supply_propval *val)
206{ 206{
207 int ret = 0; 207 int ret = 0;
208 int16_t ec_word; 208 __be16 ec_word;
209 uint8_t ec_byte; 209 uint8_t ec_byte;
210 uint64_t ser_buf; 210 __be64 ser_buf;
211 211
212 ret = olpc_ec_cmd(EC_BAT_STATUS, NULL, 0, &ec_byte, 1); 212 ret = olpc_ec_cmd(EC_BAT_STATUS, NULL, 0, &ec_byte, 1);
213 if (ret) 213 if (ret)
@@ -257,16 +257,14 @@ static int olpc_bat_get_property(struct power_supply *psy,
257 if (ret) 257 if (ret)
258 return ret; 258 return ret;
259 259
260 ec_word = be16_to_cpu(ec_word); 260 val->intval = (int)be16_to_cpu(ec_word) * 9760L / 32;
261 val->intval = ec_word * 9760L / 32;
262 break; 261 break;
263 case POWER_SUPPLY_PROP_CURRENT_AVG: 262 case POWER_SUPPLY_PROP_CURRENT_AVG:
264 ret = olpc_ec_cmd(EC_BAT_CURRENT, NULL, 0, (void *)&ec_word, 2); 263 ret = olpc_ec_cmd(EC_BAT_CURRENT, NULL, 0, (void *)&ec_word, 2);
265 if (ret) 264 if (ret)
266 return ret; 265 return ret;
267 266
268 ec_word = be16_to_cpu(ec_word); 267 val->intval = (int)be16_to_cpu(ec_word) * 15625L / 120;
269 val->intval = ec_word * 15625L / 120;
270 break; 268 break;
271 case POWER_SUPPLY_PROP_CAPACITY: 269 case POWER_SUPPLY_PROP_CAPACITY:
272 ret = olpc_ec_cmd(EC_BAT_SOC, NULL, 0, &ec_byte, 1); 270 ret = olpc_ec_cmd(EC_BAT_SOC, NULL, 0, &ec_byte, 1);
@@ -278,24 +276,22 @@ static int olpc_bat_get_property(struct power_supply *psy,
278 ret = olpc_ec_cmd(EC_BAT_TEMP, NULL, 0, (void *)&ec_word, 2); 276 ret = olpc_ec_cmd(EC_BAT_TEMP, NULL, 0, (void *)&ec_word, 2);
279 if (ret) 277 if (ret)
280 return ret; 278 return ret;
281 ec_word = be16_to_cpu(ec_word); 279
282 val->intval = ec_word * 100 / 256; 280 val->intval = (int)be16_to_cpu(ec_word) * 100 / 256;
283 break; 281 break;
284 case POWER_SUPPLY_PROP_TEMP_AMBIENT: 282 case POWER_SUPPLY_PROP_TEMP_AMBIENT:
285 ret = olpc_ec_cmd(EC_AMB_TEMP, NULL, 0, (void *)&ec_word, 2); 283 ret = olpc_ec_cmd(EC_AMB_TEMP, NULL, 0, (void *)&ec_word, 2);
286 if (ret) 284 if (ret)
287 return ret; 285 return ret;
288 286
289 ec_word = be16_to_cpu(ec_word); 287 val->intval = (int)be16_to_cpu(ec_word) * 100 / 256;
290 val->intval = ec_word * 100 / 256;
291 break; 288 break;
292 case POWER_SUPPLY_PROP_CHARGE_COUNTER: 289 case POWER_SUPPLY_PROP_CHARGE_COUNTER:
293 ret = olpc_ec_cmd(EC_BAT_ACR, NULL, 0, (void *)&ec_word, 2); 290 ret = olpc_ec_cmd(EC_BAT_ACR, NULL, 0, (void *)&ec_word, 2);
294 if (ret) 291 if (ret)
295 return ret; 292 return ret;
296 293
297 ec_word = be16_to_cpu(ec_word); 294 val->intval = (int)be16_to_cpu(ec_word) * 6250 / 15;
298 val->intval = ec_word * 6250 / 15;
299 break; 295 break;
300 case POWER_SUPPLY_PROP_SERIAL_NUMBER: 296 case POWER_SUPPLY_PROP_SERIAL_NUMBER:
301 ret = olpc_ec_cmd(EC_BAT_SERIAL, NULL, 0, (void *)&ser_buf, 8); 297 ret = olpc_ec_cmd(EC_BAT_SERIAL, NULL, 0, (void *)&ser_buf, 8);
diff --git a/drivers/power/palmtx_battery.c b/drivers/power/palmtx_battery.c
deleted file mode 100644
index 7035bfa41c62..000000000000
--- a/drivers/power/palmtx_battery.c
+++ /dev/null
@@ -1,198 +0,0 @@
1/*
2 * linux/drivers/power/palmtx_battery.c
3 *
4 * Battery measurement code for Palm T|X Handheld computer
5 *
6 * based on tosa_battery.c
7 *
8 * Copyright (C) 2008 Marek Vasut <marek.vasut@gmail.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 *
14 */
15#include <linux/kernel.h>
16#include <linux/module.h>
17#include <linux/power_supply.h>
18#include <linux/wm97xx.h>
19#include <linux/delay.h>
20#include <linux/spinlock.h>
21#include <linux/interrupt.h>
22#include <linux/gpio.h>
23
24#include <asm/mach-types.h>
25#include <mach/palmtx.h>
26
27static DEFINE_MUTEX(bat_lock);
28static struct work_struct bat_work;
29struct mutex work_lock;
30int bat_status = POWER_SUPPLY_STATUS_DISCHARGING;
31
32static unsigned long palmtx_read_bat(struct power_supply *bat_ps)
33{
34 return wm97xx_read_aux_adc(bat_ps->dev->parent->driver_data,
35 WM97XX_AUX_ID3) * 1000 / 414;
36}
37
38static unsigned long palmtx_read_temp(struct power_supply *bat_ps)
39{
40 return wm97xx_read_aux_adc(bat_ps->dev->parent->driver_data,
41 WM97XX_AUX_ID2);
42}
43
44static int palmtx_bat_get_property(struct power_supply *bat_ps,
45 enum power_supply_property psp,
46 union power_supply_propval *val)
47{
48 switch (psp) {
49 case POWER_SUPPLY_PROP_STATUS:
50 val->intval = bat_status;
51 break;
52 case POWER_SUPPLY_PROP_TECHNOLOGY:
53 val->intval = POWER_SUPPLY_TECHNOLOGY_LIPO;
54 break;
55 case POWER_SUPPLY_PROP_VOLTAGE_NOW:
56 val->intval = palmtx_read_bat(bat_ps);
57 break;
58 case POWER_SUPPLY_PROP_VOLTAGE_MAX:
59 case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN:
60 val->intval = PALMTX_BAT_MAX_VOLTAGE;
61 break;
62 case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN:
63 val->intval = PALMTX_BAT_MIN_VOLTAGE;
64 break;
65 case POWER_SUPPLY_PROP_TEMP:
66 val->intval = palmtx_read_temp(bat_ps);
67 break;
68 case POWER_SUPPLY_PROP_PRESENT:
69 val->intval = 1;
70 break;
71 default:
72 return -EINVAL;
73 }
74 return 0;
75}
76
77static void palmtx_bat_external_power_changed(struct power_supply *bat_ps)
78{
79 schedule_work(&bat_work);
80}
81
82static char *status_text[] = {
83 [POWER_SUPPLY_STATUS_UNKNOWN] = "Unknown",
84 [POWER_SUPPLY_STATUS_CHARGING] = "Charging",
85 [POWER_SUPPLY_STATUS_DISCHARGING] = "Discharging",
86};
87
88static void palmtx_bat_update(struct power_supply *bat_ps)
89{
90 int old_status = bat_status;
91
92 mutex_lock(&work_lock);
93
94 bat_status = gpio_get_value(GPIO_NR_PALMTX_POWER_DETECT) ?
95 POWER_SUPPLY_STATUS_CHARGING :
96 POWER_SUPPLY_STATUS_DISCHARGING;
97
98 if (old_status != bat_status) {
99 pr_debug("%s %s -> %s\n", bat_ps->name,
100 status_text[old_status],
101 status_text[bat_status]);
102 power_supply_changed(bat_ps);
103 }
104
105 mutex_unlock(&work_lock);
106}
107
108static enum power_supply_property palmtx_bat_main_props[] = {
109 POWER_SUPPLY_PROP_STATUS,
110 POWER_SUPPLY_PROP_TECHNOLOGY,
111 POWER_SUPPLY_PROP_VOLTAGE_NOW,
112 POWER_SUPPLY_PROP_VOLTAGE_MAX,
113 POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
114 POWER_SUPPLY_PROP_TEMP,
115 POWER_SUPPLY_PROP_PRESENT,
116};
117
118struct power_supply bat_ps = {
119 .name = "main-battery",
120 .type = POWER_SUPPLY_TYPE_BATTERY,
121 .properties = palmtx_bat_main_props,
122 .num_properties = ARRAY_SIZE(palmtx_bat_main_props),
123 .get_property = palmtx_bat_get_property,
124 .external_power_changed = palmtx_bat_external_power_changed,
125 .use_for_apm = 1,
126};
127
128static void palmtx_bat_work(struct work_struct *work)
129{
130 palmtx_bat_update(&bat_ps);
131}
132
133#ifdef CONFIG_PM
134static int palmtx_bat_suspend(struct platform_device *dev, pm_message_t state)
135{
136 flush_scheduled_work();
137 return 0;
138}
139
140static int palmtx_bat_resume(struct platform_device *dev)
141{
142 schedule_work(&bat_work);
143 return 0;
144}
145#else
146#define palmtx_bat_suspend NULL
147#define palmtx_bat_resume NULL
148#endif
149
150static int __devinit palmtx_bat_probe(struct platform_device *dev)
151{
152 int ret = 0;
153
154 if (!machine_is_palmtx())
155 return -ENODEV;
156
157 mutex_init(&work_lock);
158
159 INIT_WORK(&bat_work, palmtx_bat_work);
160
161 ret = power_supply_register(&dev->dev, &bat_ps);
162 if (!ret)
163 schedule_work(&bat_work);
164
165 return ret;
166}
167
168static int __devexit palmtx_bat_remove(struct platform_device *dev)
169{
170 power_supply_unregister(&bat_ps);
171 return 0;
172}
173
174static struct platform_driver palmtx_bat_driver = {
175 .driver.name = "wm97xx-battery",
176 .driver.owner = THIS_MODULE,
177 .probe = palmtx_bat_probe,
178 .remove = __devexit_p(palmtx_bat_remove),
179 .suspend = palmtx_bat_suspend,
180 .resume = palmtx_bat_resume,
181};
182
183static int __init palmtx_bat_init(void)
184{
185 return platform_driver_register(&palmtx_bat_driver);
186}
187
188static void __exit palmtx_bat_exit(void)
189{
190 platform_driver_unregister(&palmtx_bat_driver);
191}
192
193module_init(palmtx_bat_init);
194module_exit(palmtx_bat_exit);
195
196MODULE_LICENSE("GPL");
197MODULE_AUTHOR("Marek Vasut <marek.vasut@gmail.com>");
198MODULE_DESCRIPTION("Palm T|X battery driver");
diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c
index f44f5b608f6a..5520040449c4 100644
--- a/drivers/power/power_supply_core.c
+++ b/drivers/power/power_supply_core.c
@@ -115,8 +115,8 @@ int power_supply_register(struct device *parent, struct power_supply *psy)
115{ 115{
116 int rc = 0; 116 int rc = 0;
117 117
118 psy->dev = device_create_drvdata(power_supply_class, parent, 0, 118 psy->dev = device_create(power_supply_class, parent, 0, psy,
119 psy, "%s", psy->name); 119 "%s", psy->name);
120 if (IS_ERR(psy->dev)) { 120 if (IS_ERR(psy->dev)) {
121 rc = PTR_ERR(psy->dev); 121 rc = PTR_ERR(psy->dev);
122 goto dev_create_failed; 122 goto dev_create_failed;
diff --git a/drivers/power/wm97xx_battery.c b/drivers/power/wm97xx_battery.c
new file mode 100644
index 000000000000..8bde92126d34
--- /dev/null
+++ b/drivers/power/wm97xx_battery.c
@@ -0,0 +1,272 @@
1/*
2 * linux/drivers/power/wm97xx_battery.c
3 *
4 * Battery measurement code for WM97xx
5 *
6 * based on tosa_battery.c
7 *
8 * Copyright (C) 2008 Marek Vasut <marek.vasut@gmail.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 *
14 */
15
16#include <linux/init.h>
17#include <linux/kernel.h>
18#include <linux/module.h>
19#include <linux/platform_device.h>
20#include <linux/power_supply.h>
21#include <linux/wm97xx.h>
22#include <linux/spinlock.h>
23#include <linux/interrupt.h>
24#include <linux/gpio.h>
25#include <linux/wm97xx_batt.h>
26
27static DEFINE_MUTEX(bat_lock);
28static struct work_struct bat_work;
29struct mutex work_lock;
30static int bat_status = POWER_SUPPLY_STATUS_UNKNOWN;
31static struct wm97xx_batt_info *pdata;
32static enum power_supply_property *prop;
33
34static unsigned long wm97xx_read_bat(struct power_supply *bat_ps)
35{
36 return wm97xx_read_aux_adc(bat_ps->dev->parent->driver_data,
37 pdata->batt_aux) * pdata->batt_mult /
38 pdata->batt_div;
39}
40
41static unsigned long wm97xx_read_temp(struct power_supply *bat_ps)
42{
43 return wm97xx_read_aux_adc(bat_ps->dev->parent->driver_data,
44 pdata->temp_aux) * pdata->temp_mult /
45 pdata->temp_div;
46}
47
48static int wm97xx_bat_get_property(struct power_supply *bat_ps,
49 enum power_supply_property psp,
50 union power_supply_propval *val)
51{
52 switch (psp) {
53 case POWER_SUPPLY_PROP_STATUS:
54 val->intval = bat_status;
55 break;
56 case POWER_SUPPLY_PROP_TECHNOLOGY:
57 val->intval = pdata->batt_tech;
58 break;
59 case POWER_SUPPLY_PROP_VOLTAGE_NOW:
60 if (pdata->batt_aux >= 0)
61 val->intval = wm97xx_read_bat(bat_ps);
62 else
63 return -EINVAL;
64 break;
65 case POWER_SUPPLY_PROP_TEMP:
66 if (pdata->temp_aux >= 0)
67 val->intval = wm97xx_read_temp(bat_ps);
68 else
69 return -EINVAL;
70 break;
71 case POWER_SUPPLY_PROP_VOLTAGE_MAX:
72 if (pdata->max_voltage >= 0)
73 val->intval = pdata->max_voltage;
74 else
75 return -EINVAL;
76 break;
77 case POWER_SUPPLY_PROP_VOLTAGE_MIN:
78 if (pdata->min_voltage >= 0)
79 val->intval = pdata->min_voltage;
80 else
81 return -EINVAL;
82 break;
83 case POWER_SUPPLY_PROP_PRESENT:
84 val->intval = 1;
85 break;
86 default:
87 return -EINVAL;
88 }
89 return 0;
90}
91
92static void wm97xx_bat_external_power_changed(struct power_supply *bat_ps)
93{
94 schedule_work(&bat_work);
95}
96
97static void wm97xx_bat_update(struct power_supply *bat_ps)
98{
99 int old_status = bat_status;
100
101 mutex_lock(&work_lock);
102
103 bat_status = (pdata->charge_gpio >= 0) ?
104 (gpio_get_value(pdata->charge_gpio) ?
105 POWER_SUPPLY_STATUS_DISCHARGING :
106 POWER_SUPPLY_STATUS_CHARGING) :
107 POWER_SUPPLY_STATUS_UNKNOWN;
108
109 if (old_status != bat_status) {
110 pr_debug("%s: %i -> %i\n", bat_ps->name, old_status,
111 bat_status);
112 power_supply_changed(bat_ps);
113 }
114
115 mutex_unlock(&work_lock);
116}
117
118static struct power_supply bat_ps = {
119 .type = POWER_SUPPLY_TYPE_BATTERY,
120 .get_property = wm97xx_bat_get_property,
121 .external_power_changed = wm97xx_bat_external_power_changed,
122 .use_for_apm = 1,
123};
124
125static void wm97xx_bat_work(struct work_struct *work)
126{
127 wm97xx_bat_update(&bat_ps);
128}
129
130#ifdef CONFIG_PM
131static int wm97xx_bat_suspend(struct platform_device *dev, pm_message_t state)
132{
133 flush_scheduled_work();
134 return 0;
135}
136
137static int wm97xx_bat_resume(struct platform_device *dev)
138{
139 schedule_work(&bat_work);
140 return 0;
141}
142#else
143#define wm97xx_bat_suspend NULL
144#define wm97xx_bat_resume NULL
145#endif
146
147static int __devinit wm97xx_bat_probe(struct platform_device *dev)
148{
149 int ret = 0;
150 int props = 1; /* POWER_SUPPLY_PROP_PRESENT */
151 int i = 0;
152
153 if (dev->id != -1)
154 return -EINVAL;
155
156 mutex_init(&work_lock);
157
158 if (!pdata) {
159 dev_err(&dev->dev, "Please use wm97xx_bat_set_pdata\n");
160 return -EINVAL;
161 }
162
163 if (pdata->charge_gpio >= 0 && gpio_is_valid(pdata->charge_gpio)) {
164 ret = gpio_request(pdata->charge_gpio, "BATT CHRG");
165 if (ret)
166 goto err;
167 ret = gpio_direction_input(pdata->charge_gpio);
168 if (ret)
169 goto err2;
170 props++; /* POWER_SUPPLY_PROP_STATUS */
171 }
172
173 if (pdata->batt_tech >= 0)
174 props++; /* POWER_SUPPLY_PROP_TECHNOLOGY */
175 if (pdata->temp_aux >= 0)
176 props++; /* POWER_SUPPLY_PROP_TEMP */
177 if (pdata->batt_aux >= 0)
178 props++; /* POWER_SUPPLY_PROP_VOLTAGE_NOW */
179 if (pdata->max_voltage >= 0)
180 props++; /* POWER_SUPPLY_PROP_VOLTAGE_MAX */
181 if (pdata->min_voltage >= 0)
182 props++; /* POWER_SUPPLY_PROP_VOLTAGE_MIN */
183
184 prop = kzalloc(props * sizeof(*prop), GFP_KERNEL);
185 if (!prop)
186 goto err2;
187
188 prop[i++] = POWER_SUPPLY_PROP_PRESENT;
189 if (pdata->charge_gpio >= 0)
190 prop[i++] = POWER_SUPPLY_PROP_STATUS;
191 if (pdata->batt_tech >= 0)
192 prop[i++] = POWER_SUPPLY_PROP_TECHNOLOGY;
193 if (pdata->temp_aux >= 0)
194 prop[i++] = POWER_SUPPLY_PROP_TEMP;
195 if (pdata->batt_aux >= 0)
196 prop[i++] = POWER_SUPPLY_PROP_VOLTAGE_NOW;
197 if (pdata->max_voltage >= 0)
198 prop[i++] = POWER_SUPPLY_PROP_VOLTAGE_MAX;
199 if (pdata->min_voltage >= 0)
200 prop[i++] = POWER_SUPPLY_PROP_VOLTAGE_MIN;
201
202 INIT_WORK(&bat_work, wm97xx_bat_work);
203
204 if (!pdata->batt_name) {
205 dev_info(&dev->dev, "Please consider setting proper battery "
206 "name in platform definition file, falling "
207 "back to name \"wm97xx-batt\"\n");
208 bat_ps.name = "wm97xx-batt";
209 } else
210 bat_ps.name = pdata->batt_name;
211
212 bat_ps.properties = prop;
213 bat_ps.num_properties = props;
214
215 ret = power_supply_register(&dev->dev, &bat_ps);
216 if (!ret)
217 schedule_work(&bat_work);
218 else
219 goto err3;
220
221 return 0;
222err3:
223 kfree(prop);
224err2:
225 gpio_free(pdata->charge_gpio);
226err:
227 return ret;
228}
229
230static int __devexit wm97xx_bat_remove(struct platform_device *dev)
231{
232 if (pdata && pdata->charge_gpio && pdata->charge_gpio >= 0)
233 gpio_free(pdata->charge_gpio);
234 flush_scheduled_work();
235 power_supply_unregister(&bat_ps);
236 kfree(prop);
237 return 0;
238}
239
240static struct platform_driver wm97xx_bat_driver = {
241 .driver = {
242 .name = "wm97xx-battery",
243 .owner = THIS_MODULE,
244 },
245 .probe = wm97xx_bat_probe,
246 .remove = __devexit_p(wm97xx_bat_remove),
247 .suspend = wm97xx_bat_suspend,
248 .resume = wm97xx_bat_resume,
249};
250
251static int __init wm97xx_bat_init(void)
252{
253 return platform_driver_register(&wm97xx_bat_driver);
254}
255
256static void __exit wm97xx_bat_exit(void)
257{
258 platform_driver_unregister(&wm97xx_bat_driver);
259}
260
261void __init wm97xx_bat_set_pdata(struct wm97xx_batt_info *data)
262{
263 pdata = data;
264}
265EXPORT_SYMBOL_GPL(wm97xx_bat_set_pdata);
266
267module_init(wm97xx_bat_init);
268module_exit(wm97xx_bat_exit);
269
270MODULE_LICENSE("GPL");
271MODULE_AUTHOR("Marek Vasut <marek.vasut@gmail.com>");
272MODULE_DESCRIPTION("WM97xx battery driver");