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
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)
19
20/* Forward declaration */
21struct ux500_charger;
22
23struct 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);
28	int (*pp_enable) (struct ux500_charger *, bool);
29	int (*pre_chg_enable) (struct ux500_charger *, bool);
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
38 * @enabled		indicates if this charger is used or not
39 * @external		external charger unit (pm2xxx)
40 * @power_path		USB power path support
41 */
42struct ux500_charger {
43	struct power_supply *psy;
44	struct ux500_charger_ops ops;
45	int max_out_volt;
46	int max_out_curr;
47	int wdt_refresh;
48	bool enabled;
49	bool external;
50	bool power_path;
51};
52
53extern struct blocking_notifier_head charger_notifier_list;
54
55#endif
56