Thomas Gleixner | af873fc | 2019-05-28 09:57:21 -0700 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Arun Murthy | 1668f8115 | 2012-02-29 21:54:25 +0530 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) ST-Ericsson SA 2012 |
| 4 | * Author: Johan Gardsmark <johan.gardsmark@stericsson.com> for ST-Ericsson. |
Arun Murthy | 1668f8115 | 2012-02-29 21:54:25 +0530 | [diff] [blame] | 5 | */ |
| 6 | |
Linus Walleij | a65aa0c | 2021-03-12 09:36:03 +0100 | [diff] [blame] | 7 | #ifndef _AB8500_CHARGALG_H_ |
| 8 | #define _AB8500_CHARGALG_H_ |
Arun Murthy | 1668f8115 | 2012-02-29 21:54:25 +0530 | [diff] [blame] | 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 | */ |
Linus Walleij | f1c74a6 | 2021-06-27 01:47:49 +0200 | [diff] [blame^] | 18 | #define psy_to_ux500_charger(x) power_supply_get_drvdata(x) |
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); |
| 28 | }; |
| 29 | |
| 30 | /** |
| 31 | * struct ux500_charger - power supply ux500 charger sub class |
| 32 | * @psy power supply base class |
| 33 | * @ops ux500 charger operations |
| 34 | * @max_out_volt maximum output charger voltage in mV |
| 35 | * @max_out_curr maximum output charger current in mA |
Michel JAOUEN | 01ec8c5 | 2012-04-26 10:00:04 +0200 | [diff] [blame] | 36 | * @enabled indicates if this charger is used or not |
Loic Pallardy | e07a564 | 2012-05-10 15:33:56 +0200 | [diff] [blame] | 37 | * @external external charger unit (pm2xxx) |
Arun Murthy | 1668f8115 | 2012-02-29 21:54:25 +0530 | [diff] [blame] | 38 | */ |
| 39 | struct ux500_charger { |
Krzysztof Kozlowski | 297d716 | 2015-03-12 08:44:11 +0100 | [diff] [blame] | 40 | struct power_supply *psy; |
Arun Murthy | 1668f8115 | 2012-02-29 21:54:25 +0530 | [diff] [blame] | 41 | struct ux500_charger_ops ops; |
| 42 | int max_out_volt; |
| 43 | int max_out_curr; |
Loic Pallardy | e07a564 | 2012-05-10 15:33:56 +0200 | [diff] [blame] | 44 | int wdt_refresh; |
Michel JAOUEN | 01ec8c5 | 2012-04-26 10:00:04 +0200 | [diff] [blame] | 45 | bool enabled; |
Loic Pallardy | e07a564 | 2012-05-10 15:33:56 +0200 | [diff] [blame] | 46 | bool external; |
Arun Murthy | 1668f8115 | 2012-02-29 21:54:25 +0530 | [diff] [blame] | 47 | }; |
| 48 | |
Lee Jones | 8891716 | 2013-02-13 11:39:19 +0000 | [diff] [blame] | 49 | extern struct blocking_notifier_head charger_notifier_list; |
| 50 | |
Linus Walleij | a65aa0c | 2021-03-12 09:36:03 +0100 | [diff] [blame] | 51 | #endif /* _AB8500_CHARGALG_H_ */ |