blob: 81b720107c3a4458c22ff218f2ad5c94efdc353e [file] [log] [blame]
Anton Vorontsovb2998042007-05-04 00:32:17 +04001/*
2 * Common power driver for PDAs and phones with one or two external
3 * power supplies (AC/USB) connected to main and backup batteries,
4 * and optional builtin charger.
5 *
6 * Copyright © 2007 Anton Vorontsov <cbou@mail.ru>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/module.h>
14#include <linux/platform_device.h>
Philipp Zabel5bf2b992009-01-18 17:40:27 +010015#include <linux/err.h>
Anton Vorontsovb2998042007-05-04 00:32:17 +040016#include <linux/interrupt.h>
Dima Zavin9ad63982011-07-10 16:01:15 -070017#include <linux/notifier.h>
Anton Vorontsovb2998042007-05-04 00:32:17 +040018#include <linux/power_supply.h>
19#include <linux/pda_power.h>
Philipp Zabel5bf2b992009-01-18 17:40:27 +010020#include <linux/regulator/consumer.h>
Anton Vorontsovb2998042007-05-04 00:32:17 +040021#include <linux/timer.h>
22#include <linux/jiffies.h>
Philipp Zabel5bf2b992009-01-18 17:40:27 +010023#include <linux/usb/otg.h>
Anton Vorontsovb2998042007-05-04 00:32:17 +040024
25static inline unsigned int get_irq_flags(struct resource *res)
26{
Philipp Zabel74194cc2009-01-18 14:46:21 +010027 unsigned int flags = IRQF_SAMPLE_RANDOM | IRQF_SHARED;
Anton Vorontsovb2998042007-05-04 00:32:17 +040028
29 flags |= res->flags & IRQF_TRIGGER_MASK;
30
31 return flags;
32}
33
34static struct device *dev;
35static struct pda_power_pdata *pdata;
36static struct resource *ac_irq, *usb_irq;
37static struct timer_list charger_timer;
38static struct timer_list supply_timer;
Anton Vorontsovc3caeba2008-01-13 02:44:20 +030039static struct timer_list polling_timer;
40static int polling;
Anton Vorontsovb2998042007-05-04 00:32:17 +040041
Philipp Zabel5bf2b992009-01-18 17:40:27 +010042static struct otg_transceiver *transceiver;
Dima Zavin9ad63982011-07-10 16:01:15 -070043static struct notifier_block otg_nb;
Philipp Zabel5bf2b992009-01-18 17:40:27 +010044static struct regulator *ac_draw;
45
Anton Vorontsovbfde2662008-01-13 02:39:17 +030046enum {
47 PDA_PSY_OFFLINE = 0,
48 PDA_PSY_ONLINE = 1,
49 PDA_PSY_TO_CHANGE,
50};
51static int new_ac_status = -1;
52static int new_usb_status = -1;
53static int ac_status = -1;
54static int usb_status = -1;
55
Anton Vorontsovb2998042007-05-04 00:32:17 +040056static int pda_power_get_property(struct power_supply *psy,
57 enum power_supply_property psp,
58 union power_supply_propval *val)
59{
60 switch (psp) {
61 case POWER_SUPPLY_PROP_ONLINE:
62 if (psy->type == POWER_SUPPLY_TYPE_MAINS)
63 val->intval = pdata->is_ac_online ?
64 pdata->is_ac_online() : 0;
65 else
66 val->intval = pdata->is_usb_online ?
67 pdata->is_usb_online() : 0;
68 break;
69 default:
70 return -EINVAL;
71 }
72 return 0;
73}
74
75static enum power_supply_property pda_power_props[] = {
76 POWER_SUPPLY_PROP_ONLINE,
77};
78
79static char *pda_power_supplied_to[] = {
80 "main-battery",
81 "backup-battery",
82};
83
Anton Vorontsovbfde2662008-01-13 02:39:17 +030084static struct power_supply pda_psy_ac = {
85 .name = "ac",
86 .type = POWER_SUPPLY_TYPE_MAINS,
87 .supplied_to = pda_power_supplied_to,
88 .num_supplicants = ARRAY_SIZE(pda_power_supplied_to),
89 .properties = pda_power_props,
90 .num_properties = ARRAY_SIZE(pda_power_props),
91 .get_property = pda_power_get_property,
Anton Vorontsovb2998042007-05-04 00:32:17 +040092};
93
Anton Vorontsovbfde2662008-01-13 02:39:17 +030094static struct power_supply pda_psy_usb = {
95 .name = "usb",
96 .type = POWER_SUPPLY_TYPE_USB,
97 .supplied_to = pda_power_supplied_to,
98 .num_supplicants = ARRAY_SIZE(pda_power_supplied_to),
99 .properties = pda_power_props,
100 .num_properties = ARRAY_SIZE(pda_power_props),
101 .get_property = pda_power_get_property,
102};
103
104static void update_status(void)
105{
106 if (pdata->is_ac_online)
107 new_ac_status = !!pdata->is_ac_online();
108
109 if (pdata->is_usb_online)
110 new_usb_status = !!pdata->is_usb_online();
111}
112
Anton Vorontsovb2998042007-05-04 00:32:17 +0400113static void update_charger(void)
114{
Philipp Zabel5bf2b992009-01-18 17:40:27 +0100115 static int regulator_enabled;
116 int max_uA = pdata->ac_max_uA;
Anton Vorontsovb2998042007-05-04 00:32:17 +0400117
Philipp Zabel5bf2b992009-01-18 17:40:27 +0100118 if (pdata->set_charge) {
119 if (new_ac_status > 0) {
120 dev_dbg(dev, "charger on (AC)\n");
121 pdata->set_charge(PDA_POWER_CHARGE_AC);
122 } else if (new_usb_status > 0) {
123 dev_dbg(dev, "charger on (USB)\n");
124 pdata->set_charge(PDA_POWER_CHARGE_USB);
125 } else {
126 dev_dbg(dev, "charger off\n");
127 pdata->set_charge(0);
128 }
129 } else if (ac_draw) {
130 if (new_ac_status > 0) {
131 regulator_set_current_limit(ac_draw, max_uA, max_uA);
132 if (!regulator_enabled) {
133 dev_dbg(dev, "charger on (AC)\n");
134 regulator_enable(ac_draw);
135 regulator_enabled = 1;
136 }
137 } else {
138 if (regulator_enabled) {
139 dev_dbg(dev, "charger off\n");
140 regulator_disable(ac_draw);
141 regulator_enabled = 0;
142 }
143 }
Anton Vorontsovb2998042007-05-04 00:32:17 +0400144 }
Anton Vorontsovb2998042007-05-04 00:32:17 +0400145}
146
Anton Vorontsovbfde2662008-01-13 02:39:17 +0300147static void supply_timer_func(unsigned long unused)
Anton Vorontsovb2998042007-05-04 00:32:17 +0400148{
Anton Vorontsovbfde2662008-01-13 02:39:17 +0300149 if (ac_status == PDA_PSY_TO_CHANGE) {
150 ac_status = new_ac_status;
151 power_supply_changed(&pda_psy_ac);
152 }
Jeff Garzik5ebf6e62007-07-14 19:12:04 -0400153
Anton Vorontsovbfde2662008-01-13 02:39:17 +0300154 if (usb_status == PDA_PSY_TO_CHANGE) {
155 usb_status = new_usb_status;
156 power_supply_changed(&pda_psy_usb);
157 }
Anton Vorontsovb2998042007-05-04 00:32:17 +0400158}
159
Anton Vorontsovbfde2662008-01-13 02:39:17 +0300160static void psy_changed(void)
Anton Vorontsovb2998042007-05-04 00:32:17 +0400161{
162 update_charger();
163
Anton Vorontsovbfde2662008-01-13 02:39:17 +0300164 /*
165 * Okay, charger set. Now wait a bit before notifying supplicants,
166 * charge power should stabilize.
167 */
Anton Vorontsovb2998042007-05-04 00:32:17 +0400168 mod_timer(&supply_timer,
169 jiffies + msecs_to_jiffies(pdata->wait_for_charger));
Anton Vorontsovb2998042007-05-04 00:32:17 +0400170}
171
Anton Vorontsovbfde2662008-01-13 02:39:17 +0300172static void charger_timer_func(unsigned long unused)
173{
174 update_status();
175 psy_changed();
176}
177
Jeff Garzik5ebf6e62007-07-14 19:12:04 -0400178static irqreturn_t power_changed_isr(int irq, void *power_supply)
Anton Vorontsovb2998042007-05-04 00:32:17 +0400179{
Anton Vorontsovbfde2662008-01-13 02:39:17 +0300180 if (power_supply == &pda_psy_ac)
181 ac_status = PDA_PSY_TO_CHANGE;
182 else if (power_supply == &pda_psy_usb)
183 usb_status = PDA_PSY_TO_CHANGE;
184 else
185 return IRQ_NONE;
186
187 /*
188 * Wait a bit before reading ac/usb line status and setting charger,
189 * because ac/usb status readings may lag from irq.
190 */
Anton Vorontsovb2998042007-05-04 00:32:17 +0400191 mod_timer(&charger_timer,
192 jiffies + msecs_to_jiffies(pdata->wait_for_status));
Anton Vorontsovbfde2662008-01-13 02:39:17 +0300193
Anton Vorontsovb2998042007-05-04 00:32:17 +0400194 return IRQ_HANDLED;
195}
196
Anton Vorontsovc3caeba2008-01-13 02:44:20 +0300197static void polling_timer_func(unsigned long unused)
198{
199 int changed = 0;
200
201 dev_dbg(dev, "polling...\n");
202
203 update_status();
204
205 if (!ac_irq && new_ac_status != ac_status) {
206 ac_status = PDA_PSY_TO_CHANGE;
207 changed = 1;
208 }
209
210 if (!usb_irq && new_usb_status != usb_status) {
211 usb_status = PDA_PSY_TO_CHANGE;
212 changed = 1;
213 }
214
215 if (changed)
216 psy_changed();
217
218 mod_timer(&polling_timer,
219 jiffies + msecs_to_jiffies(pdata->polling_interval));
220}
221
Philipp Zabel5bf2b992009-01-18 17:40:27 +0100222#ifdef CONFIG_USB_OTG_UTILS
223static int otg_is_usb_online(void)
224{
Dima Zavin9ad63982011-07-10 16:01:15 -0700225 return (transceiver->last_event == USB_EVENT_VBUS ||
226 transceiver->last_event == USB_EVENT_ENUMERATED);
227}
228
229static int otg_is_ac_online(void)
230{
231 return (transceiver->last_event == USB_EVENT_CHARGER);
232}
233
234static int otg_handle_notification(struct notifier_block *nb,
235 unsigned long event, void *unused)
236{
237 switch (event) {
238 case USB_EVENT_CHARGER:
239 ac_status = PDA_PSY_TO_CHANGE;
240 break;
241 case USB_EVENT_VBUS:
242 case USB_EVENT_ENUMERATED:
243 usb_status = PDA_PSY_TO_CHANGE;
244 break;
245 case USB_EVENT_NONE:
246 ac_status = PDA_PSY_TO_CHANGE;
247 usb_status = PDA_PSY_TO_CHANGE;
248 break;
249 default:
250 return NOTIFY_OK;
251 }
252
253 /*
254 * Wait a bit before reading ac/usb line status and setting charger,
255 * because ac/usb status readings may lag from irq.
256 */
257 mod_timer(&charger_timer,
258 jiffies + msecs_to_jiffies(pdata->wait_for_status));
259
260 return NOTIFY_OK;
Philipp Zabel5bf2b992009-01-18 17:40:27 +0100261}
262#endif
263
Anton Vorontsovb2998042007-05-04 00:32:17 +0400264static int pda_power_probe(struct platform_device *pdev)
265{
266 int ret = 0;
267
268 dev = &pdev->dev;
269
270 if (pdev->id != -1) {
271 dev_err(dev, "it's meaningless to register several "
272 "pda_powers; use id = -1\n");
273 ret = -EINVAL;
274 goto wrongid;
275 }
276
277 pdata = pdev->dev.platform_data;
278
Philipp Zabelf6b6b182008-04-12 13:47:45 +0200279 if (pdata->init) {
280 ret = pdata->init(dev);
281 if (ret < 0)
282 goto init_failed;
283 }
284
Anton Vorontsovbfde2662008-01-13 02:39:17 +0300285 update_status();
Anton Vorontsovb2998042007-05-04 00:32:17 +0400286 update_charger();
287
288 if (!pdata->wait_for_status)
289 pdata->wait_for_status = 500;
290
291 if (!pdata->wait_for_charger)
292 pdata->wait_for_charger = 500;
293
Anton Vorontsovc3caeba2008-01-13 02:44:20 +0300294 if (!pdata->polling_interval)
295 pdata->polling_interval = 2000;
296
Philipp Zabel5bf2b992009-01-18 17:40:27 +0100297 if (!pdata->ac_max_uA)
298 pdata->ac_max_uA = 500000;
299
Anton Vorontsovb2998042007-05-04 00:32:17 +0400300 setup_timer(&charger_timer, charger_timer_func, 0);
301 setup_timer(&supply_timer, supply_timer_func, 0);
302
303 ac_irq = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "ac");
304 usb_irq = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "usb");
Anton Vorontsovb2998042007-05-04 00:32:17 +0400305
306 if (pdata->supplied_to) {
Anton Vorontsovbfde2662008-01-13 02:39:17 +0300307 pda_psy_ac.supplied_to = pdata->supplied_to;
308 pda_psy_ac.num_supplicants = pdata->num_supplicants;
309 pda_psy_usb.supplied_to = pdata->supplied_to;
310 pda_psy_usb.num_supplicants = pdata->num_supplicants;
Anton Vorontsovb2998042007-05-04 00:32:17 +0400311 }
312
Philipp Zabel5bf2b992009-01-18 17:40:27 +0100313 ac_draw = regulator_get(dev, "ac_draw");
314 if (IS_ERR(ac_draw)) {
315 dev_dbg(dev, "couldn't get ac_draw regulator\n");
316 ac_draw = NULL;
317 ret = PTR_ERR(ac_draw);
318 }
319
Dima Zavin9ad63982011-07-10 16:01:15 -0700320 transceiver = otg_get_transceiver();
321 if (transceiver && !pdata->is_usb_online) {
322 pdata->is_usb_online = otg_is_usb_online;
323 }
324 if (transceiver && !pdata->is_ac_online) {
325 pdata->is_ac_online = otg_is_ac_online;
326 }
327
Dmitry Baryshkov9ef45102008-01-07 04:12:39 +0300328 if (pdata->is_ac_online) {
Anton Vorontsovbfde2662008-01-13 02:39:17 +0300329 ret = power_supply_register(&pdev->dev, &pda_psy_ac);
Anton Vorontsovb2998042007-05-04 00:32:17 +0400330 if (ret) {
Dmitry Baryshkov9ef45102008-01-07 04:12:39 +0300331 dev_err(dev, "failed to register %s power supply\n",
Anton Vorontsovbfde2662008-01-13 02:39:17 +0300332 pda_psy_ac.name);
Dmitry Baryshkov9ef45102008-01-07 04:12:39 +0300333 goto ac_supply_failed;
334 }
335
336 if (ac_irq) {
337 ret = request_irq(ac_irq->start, power_changed_isr,
338 get_irq_flags(ac_irq), ac_irq->name,
Anton Vorontsovbfde2662008-01-13 02:39:17 +0300339 &pda_psy_ac);
Dmitry Baryshkov9ef45102008-01-07 04:12:39 +0300340 if (ret) {
341 dev_err(dev, "request ac irq failed\n");
342 goto ac_irq_failed;
343 }
Anton Vorontsovc3caeba2008-01-13 02:44:20 +0300344 } else {
345 polling = 1;
Anton Vorontsovb2998042007-05-04 00:32:17 +0400346 }
347 }
348
Dmitry Baryshkov9ef45102008-01-07 04:12:39 +0300349 if (pdata->is_usb_online) {
Anton Vorontsovbfde2662008-01-13 02:39:17 +0300350 ret = power_supply_register(&pdev->dev, &pda_psy_usb);
Anton Vorontsovb2998042007-05-04 00:32:17 +0400351 if (ret) {
Dmitry Baryshkov9ef45102008-01-07 04:12:39 +0300352 dev_err(dev, "failed to register %s power supply\n",
Anton Vorontsovbfde2662008-01-13 02:39:17 +0300353 pda_psy_usb.name);
Dmitry Baryshkov9ef45102008-01-07 04:12:39 +0300354 goto usb_supply_failed;
355 }
356
357 if (usb_irq) {
358 ret = request_irq(usb_irq->start, power_changed_isr,
359 get_irq_flags(usb_irq),
Anton Vorontsovbfde2662008-01-13 02:39:17 +0300360 usb_irq->name, &pda_psy_usb);
Dmitry Baryshkov9ef45102008-01-07 04:12:39 +0300361 if (ret) {
362 dev_err(dev, "request usb irq failed\n");
363 goto usb_irq_failed;
364 }
Anton Vorontsovc3caeba2008-01-13 02:44:20 +0300365 } else {
366 polling = 1;
Anton Vorontsovb2998042007-05-04 00:32:17 +0400367 }
368 }
369
Dima Zavin9ad63982011-07-10 16:01:15 -0700370 if (transceiver && pdata->use_otg_notifier) {
371 otg_nb.notifier_call = otg_handle_notification;
372 ret = otg_register_notifier(transceiver, &otg_nb);
373 if (ret) {
374 dev_err(dev, "failure to register otg notifier\n");
375 goto otg_reg_notifier_failed;
376 }
377 polling = 0;
378 }
379
Anton Vorontsovc3caeba2008-01-13 02:44:20 +0300380 if (polling) {
381 dev_dbg(dev, "will poll for status\n");
382 setup_timer(&polling_timer, polling_timer_func, 0);
383 mod_timer(&polling_timer,
384 jiffies + msecs_to_jiffies(pdata->polling_interval));
385 }
386
387 if (ac_irq || usb_irq)
388 device_init_wakeup(&pdev->dev, 1);
Dmitry Baryshkov8f8e9b32008-01-13 02:35:43 +0300389
Dmitry Baryshkov9ef45102008-01-07 04:12:39 +0300390 return 0;
Anton Vorontsovb2998042007-05-04 00:32:17 +0400391
Dima Zavin9ad63982011-07-10 16:01:15 -0700392otg_reg_notifier_failed:
393 if (pdata->is_usb_online && usb_irq)
394 free_irq(usb_irq->start, &pda_psy_usb);
Anton Vorontsovb2998042007-05-04 00:32:17 +0400395usb_irq_failed:
Dmitry Baryshkov9ef45102008-01-07 04:12:39 +0300396 if (pdata->is_usb_online)
Anton Vorontsovbfde2662008-01-13 02:39:17 +0300397 power_supply_unregister(&pda_psy_usb);
Dmitry Baryshkov9ef45102008-01-07 04:12:39 +0300398usb_supply_failed:
399 if (pdata->is_ac_online && ac_irq)
Anton Vorontsovbfde2662008-01-13 02:39:17 +0300400 free_irq(ac_irq->start, &pda_psy_ac);
Philipp Zabel5bf2b992009-01-18 17:40:27 +0100401 if (transceiver)
402 otg_put_transceiver(transceiver);
Anton Vorontsovb2998042007-05-04 00:32:17 +0400403ac_irq_failed:
Dmitry Baryshkov9ef45102008-01-07 04:12:39 +0300404 if (pdata->is_ac_online)
Anton Vorontsovbfde2662008-01-13 02:39:17 +0300405 power_supply_unregister(&pda_psy_ac);
Dmitry Baryshkov9ef45102008-01-07 04:12:39 +0300406ac_supply_failed:
Philipp Zabel5bf2b992009-01-18 17:40:27 +0100407 if (ac_draw) {
408 regulator_put(ac_draw);
409 ac_draw = NULL;
410 }
Philipp Zabelf6b6b182008-04-12 13:47:45 +0200411 if (pdata->exit)
412 pdata->exit(dev);
413init_failed:
Anton Vorontsovb2998042007-05-04 00:32:17 +0400414wrongid:
Anton Vorontsovb2998042007-05-04 00:32:17 +0400415 return ret;
416}
417
418static int pda_power_remove(struct platform_device *pdev)
419{
Dmitry Baryshkov9ef45102008-01-07 04:12:39 +0300420 if (pdata->is_usb_online && usb_irq)
Anton Vorontsovbfde2662008-01-13 02:39:17 +0300421 free_irq(usb_irq->start, &pda_psy_usb);
Dmitry Baryshkov9ef45102008-01-07 04:12:39 +0300422 if (pdata->is_ac_online && ac_irq)
Anton Vorontsovbfde2662008-01-13 02:39:17 +0300423 free_irq(ac_irq->start, &pda_psy_ac);
424
Anton Vorontsovc3caeba2008-01-13 02:44:20 +0300425 if (polling)
426 del_timer_sync(&polling_timer);
Anton Vorontsovb2998042007-05-04 00:32:17 +0400427 del_timer_sync(&charger_timer);
428 del_timer_sync(&supply_timer);
Anton Vorontsovbfde2662008-01-13 02:39:17 +0300429
Dmitry Baryshkov9ef45102008-01-07 04:12:39 +0300430 if (pdata->is_usb_online)
Anton Vorontsovbfde2662008-01-13 02:39:17 +0300431 power_supply_unregister(&pda_psy_usb);
Dmitry Baryshkov9ef45102008-01-07 04:12:39 +0300432 if (pdata->is_ac_online)
Anton Vorontsovbfde2662008-01-13 02:39:17 +0300433 power_supply_unregister(&pda_psy_ac);
Philipp Zabel5bf2b992009-01-18 17:40:27 +0100434#ifdef CONFIG_USB_OTG_UTILS
435 if (transceiver)
436 otg_put_transceiver(transceiver);
437#endif
438 if (ac_draw) {
439 regulator_put(ac_draw);
440 ac_draw = NULL;
441 }
Philipp Zabelf6b6b182008-04-12 13:47:45 +0200442 if (pdata->exit)
443 pdata->exit(dev);
Anton Vorontsovbfde2662008-01-13 02:39:17 +0300444
Anton Vorontsovb2998042007-05-04 00:32:17 +0400445 return 0;
446}
447
Dmitry Baryshkov8f8e9b32008-01-13 02:35:43 +0300448#ifdef CONFIG_PM
Robert Jarzmike82374f2008-08-11 22:22:27 +0200449static int ac_wakeup_enabled;
450static int usb_wakeup_enabled;
451
Dmitry Baryshkov8f8e9b32008-01-13 02:35:43 +0300452static int pda_power_suspend(struct platform_device *pdev, pm_message_t state)
453{
Daniel Macka3bcbbee2010-04-12 23:33:22 +0200454 if (pdata->suspend) {
455 int ret = pdata->suspend(state);
456
457 if (ret)
458 return ret;
459 }
460
Dmitry Baryshkov8f8e9b32008-01-13 02:35:43 +0300461 if (device_may_wakeup(&pdev->dev)) {
462 if (ac_irq)
Robert Jarzmike82374f2008-08-11 22:22:27 +0200463 ac_wakeup_enabled = !enable_irq_wake(ac_irq->start);
Dmitry Baryshkov8f8e9b32008-01-13 02:35:43 +0300464 if (usb_irq)
Robert Jarzmike82374f2008-08-11 22:22:27 +0200465 usb_wakeup_enabled = !enable_irq_wake(usb_irq->start);
Dmitry Baryshkov8f8e9b32008-01-13 02:35:43 +0300466 }
467
468 return 0;
469}
470
471static int pda_power_resume(struct platform_device *pdev)
472{
473 if (device_may_wakeup(&pdev->dev)) {
Robert Jarzmike82374f2008-08-11 22:22:27 +0200474 if (usb_irq && usb_wakeup_enabled)
Dmitry Baryshkov8f8e9b32008-01-13 02:35:43 +0300475 disable_irq_wake(usb_irq->start);
Robert Jarzmike82374f2008-08-11 22:22:27 +0200476 if (ac_irq && ac_wakeup_enabled)
Dmitry Baryshkov8f8e9b32008-01-13 02:35:43 +0300477 disable_irq_wake(ac_irq->start);
478 }
479
Daniel Macka3bcbbee2010-04-12 23:33:22 +0200480 if (pdata->resume)
481 return pdata->resume();
482
Dmitry Baryshkov8f8e9b32008-01-13 02:35:43 +0300483 return 0;
484}
485#else
486#define pda_power_suspend NULL
487#define pda_power_resume NULL
488#endif /* CONFIG_PM */
489
Kay Sievers2f5a5cf2008-07-25 01:45:46 -0700490MODULE_ALIAS("platform:pda-power");
491
Anton Vorontsovb2998042007-05-04 00:32:17 +0400492static struct platform_driver pda_power_pdrv = {
493 .driver = {
494 .name = "pda-power",
495 },
496 .probe = pda_power_probe,
497 .remove = pda_power_remove,
Dmitry Baryshkov8f8e9b32008-01-13 02:35:43 +0300498 .suspend = pda_power_suspend,
499 .resume = pda_power_resume,
Anton Vorontsovb2998042007-05-04 00:32:17 +0400500};
501
502static int __init pda_power_init(void)
503{
504 return platform_driver_register(&pda_power_pdrv);
505}
506
507static void __exit pda_power_exit(void)
508{
509 platform_driver_unregister(&pda_power_pdrv);
Anton Vorontsovb2998042007-05-04 00:32:17 +0400510}
511
512module_init(pda_power_init);
513module_exit(pda_power_exit);
514MODULE_LICENSE("GPL");
515MODULE_AUTHOR("Anton Vorontsov <cbou@mail.ru>");