1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) ST-Ericsson SA 2012
4 * Author: Johan Gardsmark <johan.gardsmark@stericsson.com> for ST-Ericsson.
7 #ifndef _AB8500_CHARGALG_H_
8 #define _AB8500_CHARGALG_H_
10 #include <linux/power_supply.h>
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.
18 #define psy_to_ux500_charger(x) power_supply_get_drvdata(x)
20 /* Forward declaration */
23 struct ux500_charger_ops {
24 int (*enable) (struct ux500_charger *, int, int, int);
25 int (*check_enable) (struct ux500_charger *, int, int);
26 int (*kick_wd) (struct ux500_charger *);
27 int (*update_curr) (struct ux500_charger *, int);
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_uv maximum output charger voltage in uV
35 * @max_out_curr_ua maximum output charger current in uA
36 * @enabled indicates if this charger is used or not
38 struct ux500_charger {
39 struct power_supply *psy;
40 struct ux500_charger_ops ops;
47 #endif /* _AB8500_CHARGALG_H_ */