Commit | Line | Data |
---|---|---|
1668f811 AM |
1 | /* |
2 | * Copyright (C) ST-Ericsson SA 2012 | |
3 | * Author: Johan Gardsmark <johan.gardsmark@stericsson.com> for ST-Ericsson. | |
4 | * License terms: GNU General Public License (GPL), version 2 | |
5 | */ | |
6 | ||
7 | #ifndef _UX500_CHARGALG_H | |
8 | #define _UX500_CHARGALG_H | |
9 | ||
10 | #include <linux/power_supply.h> | |
11 | ||
297d716f KK |
12 | /* |
13 | * Valid only for supplies of type: | |
14 | * - POWER_SUPPLY_TYPE_MAINS, | |
15 | * - POWER_SUPPLY_TYPE_USB, | |
16 | * because only them store as drv_data pointer to struct ux500_charger. | |
17 | */ | |
18 | #define psy_to_ux500_charger(x) power_supply_get_drvdata(psy) | |
1668f811 AM |
19 | |
20 | /* Forward declaration */ | |
21 | struct ux500_charger; | |
22 | ||
23 | struct ux500_charger_ops { | |
24 | int (*enable) (struct ux500_charger *, int, int, int); | |
4dcdf577 | 25 | int (*check_enable) (struct ux500_charger *, int, int); |
1668f811 AM |
26 | int (*kick_wd) (struct ux500_charger *); |
27 | int (*update_curr) (struct ux500_charger *, int); | |
db43e6c4 LJ |
28 | int (*pp_enable) (struct ux500_charger *, bool); |
29 | int (*pre_chg_enable) (struct ux500_charger *, bool); | |
1668f811 AM |
30 | }; |
31 | ||
32 | /** | |
33 | * struct ux500_charger - power supply ux500 charger sub class | |
34 | * @psy power supply base class | |
35 | * @ops ux500 charger operations | |
36 | * @max_out_volt maximum output charger voltage in mV | |
37 | * @max_out_curr maximum output charger current in mA | |
01ec8c54 | 38 | * @enabled indicates if this charger is used or not |
e07a5645 | 39 | * @external external charger unit (pm2xxx) |
db43e6c4 | 40 | * @power_path USB power path support |
1668f811 AM |
41 | */ |
42 | struct ux500_charger { | |
297d716f | 43 | struct power_supply *psy; |
1668f811 AM |
44 | struct ux500_charger_ops ops; |
45 | int max_out_volt; | |
46 | int max_out_curr; | |
e07a5645 | 47 | int wdt_refresh; |
01ec8c54 | 48 | bool enabled; |
e07a5645 | 49 | bool external; |
db43e6c4 | 50 | bool power_path; |
1668f811 AM |
51 | }; |
52 | ||
8891716e LJ |
53 | extern struct blocking_notifier_head charger_notifier_list; |
54 | ||
1668f811 | 55 | #endif |