blob: 2a69db4b60b7164f28d7055086bd9c05b18a3961 [file] [log] [blame]
Thomas Gleixnerd2912cb2019-06-04 10:11:33 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Anton Vorontsovb2998042007-05-04 00:32:17 +04002/*
3 * Common power driver for PDAs and phones with one or two external
4 * power supplies (AC/USB) connected to main and backup batteries,
5 * and optional builtin charger.
6 *
7 * Copyright © 2007 Anton Vorontsov <cbou@mail.ru>
Anton Vorontsovb2998042007-05-04 00:32:17 +04008 */
9
10#ifndef __PDA_POWER_H__
11#define __PDA_POWER_H__
12
13#define PDA_POWER_CHARGE_AC (1 << 0)
14#define PDA_POWER_CHARGE_USB (1 << 1)
15
Philipp Zabelf6b6b182008-04-12 13:47:45 +020016struct device;
17
Anton Vorontsovb2998042007-05-04 00:32:17 +040018struct pda_power_pdata {
Philipp Zabelf6b6b182008-04-12 13:47:45 +020019 int (*init)(struct device *dev);
Anton Vorontsovb2998042007-05-04 00:32:17 +040020 int (*is_ac_online)(void);
21 int (*is_usb_online)(void);
22 void (*set_charge)(int flags);
Philipp Zabelf6b6b182008-04-12 13:47:45 +020023 void (*exit)(struct device *dev);
Daniel Macka3bcbbe2010-04-12 23:33:22 +020024 int (*suspend)(pm_message_t state);
25 int (*resume)(void);
Anton Vorontsovb2998042007-05-04 00:32:17 +040026
27 char **supplied_to;
28 size_t num_supplicants;
29
30 unsigned int wait_for_status; /* msecs, default is 500 */
31 unsigned int wait_for_charger; /* msecs, default is 500 */
Anton Vorontsovc3caeba2008-01-13 02:44:20 +030032 unsigned int polling_interval; /* msecs, default is 2000 */
Philipp Zabel5bf2b992009-01-18 17:40:27 +010033
34 unsigned long ac_max_uA; /* current to draw when on AC */
Dima Zavin9ad63982011-07-10 16:01:15 -070035
36 bool use_otg_notifier;
Anton Vorontsovb2998042007-05-04 00:32:17 +040037};
38
39#endif /* __PDA_POWER_H__ */