Arun Murthy | 1668f8115 | 2012-02-29 21:54:25 +0530 | [diff] [blame] | 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 | |
Krzysztof Kozlowski | 297d716 | 2015-03-12 08:44:11 +0100 | [diff] [blame^] | 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) |
Arun Murthy | 1668f8115 | 2012-02-29 21:54:25 +0530 | [diff] [blame] | 19 | |
| 20 | /* Forward declaration */ |
| 21 | struct ux500_charger; |
| 22 | |
| 23 | struct ux500_charger_ops { |
| 24 | int (*enable) (struct ux500_charger *, int, int, int); |
Lee Jones | 4dcdf57 | 2013-02-14 09:24:10 +0000 | [diff] [blame] | 25 | int (*check_enable) (struct ux500_charger *, int, int); |
Arun Murthy | 1668f8115 | 2012-02-29 21:54:25 +0530 | [diff] [blame] | 26 | int (*kick_wd) (struct ux500_charger *); |
| 27 | int (*update_curr) (struct ux500_charger *, int); |
Lee Jones | db43e6c | 2013-02-14 12:39:15 +0000 | [diff] [blame] | 28 | int (*pp_enable) (struct ux500_charger *, bool); |
| 29 | int (*pre_chg_enable) (struct ux500_charger *, bool); |
Arun Murthy | 1668f8115 | 2012-02-29 21:54:25 +0530 | [diff] [blame] | 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 |
Michel JAOUEN | 01ec8c5 | 2012-04-26 10:00:04 +0200 | [diff] [blame] | 38 | * @enabled indicates if this charger is used or not |
Loic Pallardy | e07a564 | 2012-05-10 15:33:56 +0200 | [diff] [blame] | 39 | * @external external charger unit (pm2xxx) |
Lee Jones | db43e6c | 2013-02-14 12:39:15 +0000 | [diff] [blame] | 40 | * @power_path USB power path support |
Arun Murthy | 1668f8115 | 2012-02-29 21:54:25 +0530 | [diff] [blame] | 41 | */ |
| 42 | struct ux500_charger { |
Krzysztof Kozlowski | 297d716 | 2015-03-12 08:44:11 +0100 | [diff] [blame^] | 43 | struct power_supply *psy; |
Arun Murthy | 1668f8115 | 2012-02-29 21:54:25 +0530 | [diff] [blame] | 44 | struct ux500_charger_ops ops; |
| 45 | int max_out_volt; |
| 46 | int max_out_curr; |
Loic Pallardy | e07a564 | 2012-05-10 15:33:56 +0200 | [diff] [blame] | 47 | int wdt_refresh; |
Michel JAOUEN | 01ec8c5 | 2012-04-26 10:00:04 +0200 | [diff] [blame] | 48 | bool enabled; |
Loic Pallardy | e07a564 | 2012-05-10 15:33:56 +0200 | [diff] [blame] | 49 | bool external; |
Lee Jones | db43e6c | 2013-02-14 12:39:15 +0000 | [diff] [blame] | 50 | bool power_path; |
Arun Murthy | 1668f8115 | 2012-02-29 21:54:25 +0530 | [diff] [blame] | 51 | }; |
| 52 | |
Lee Jones | 8891716 | 2013-02-13 11:39:19 +0000 | [diff] [blame] | 53 | extern struct blocking_notifier_head charger_notifier_list; |
| 54 | |
Arun Murthy | 1668f8115 | 2012-02-29 21:54:25 +0530 | [diff] [blame] | 55 | #endif |