mmc: core: SDXC speed class support
[linux-2.6.git] / include / linux / smb349-charger.h
1 /*
2  * include/linux/smb349-charger.h
3  *
4  * Battery charger driver interface for Summit SMB349
5  *
6  * Copyright (c) 2012, NVIDIA CORPORATION.  All rights reserved.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation;
11  *
12  * This program is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
15  * more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20  *
21  */
22
23 #ifndef __LINUX_SMB349_CHARGER_H
24 #define __LINUX_SMB349_CHARGER_H
25
26 #include <linux/regulator/machine.h>
27 #include <linux/platform_device.h>
28 #include <linux/regulator/driver.h>
29 #include <linux/usb/otg.h>
30
31 struct smb349_charger_platform_data {
32         int regulator_id;
33         int max_charge_volt_mV;
34         int max_charge_current_mA;
35         int charging_term_current_mA;
36         int num_consumer_supplies;
37         struct regulator_consumer_supply *consumer_supplies;
38         int otg_regulator_id;
39         int num_otg_consumer_supplies;
40         struct regulator_consumer_supply *otg_consumer_supplies;
41 };
42
43 enum charging_states {
44         idle,
45         progress,
46         completed,
47         stopped,
48 };
49
50 enum charger_type {
51         NONE,
52         AC,
53         USB,
54 };
55
56 typedef void (*charging_callback_t)(enum charging_states state,
57 enum charger_type chrg_type, void *args);
58
59 struct smb349_charger {
60         struct i2c_client       *client;
61         struct device   *dev;
62         void    *charger_cb_data;
63         enum charging_states state;
64         enum charger_type chrg_type;
65         charging_callback_t     charger_cb;
66
67         int is_otg_enabled;
68         struct regulator_dev    *rdev;
69         struct regulator_desc   reg_desc;
70         struct regulator_init_data      reg_init_data;
71         struct regulator_dev    *otg_rdev;
72         struct regulator_desc   otg_reg_desc;
73         struct regulator_init_data      otg_reg_init_data;
74 };
75
76 int smb349_battery_online(void);
77 /*
78  * Register callback function for the client.
79  * Used by fuel-gauge driver to get battery charging properties.
80  */
81 extern int register_callback(charging_callback_t cb, void *args);
82 extern int update_charger_status(void);
83
84 #endif /*__LINUX_SMB349_CHARGER_H */