]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - include/linux/power/imx6_usb_charger.h
ARM: dts: imx6-tx6*: fix 'flexcan' labels
[karo-tx-linux.git] / include / linux / power / imx6_usb_charger.h
1 /*
2  * Copyright (C) 2013 Freescale Semiconductor, Inc. All Rights Reserved.
3  *
4  * The code contained herein is licensed under the GNU General Public
5  * License. You may obtain a copy of the GNU General Public License
6  * Version 2 or later at the following locations:
7  *
8  * http://www.opensource.org/licenses/gpl-license.html
9  * http://www.gnu.org/copyleft/gpl.html
10  */
11
12 #ifndef __IMXUSB6_CHARGER_H
13 #define __IMXUSB6_CHARGER_H
14
15 #include <linux/power_supply.h>
16 enum battery_charging_spec {
17         BATTERY_CHARGING_SPEC_NONE = 0,
18         BATTERY_CHARGING_SPEC_UNKNOWN,
19         BATTERY_CHARGING_SPEC_1_0,
20         BATTERY_CHARGING_SPEC_1_1,
21         BATTERY_CHARGING_SPEC_1_2,
22 };
23
24 struct usb_charger {
25         /* The anatop regmap */
26         struct regmap           *anatop;
27         /* USB controller */
28         struct device           *dev;
29         struct power_supply     psy;
30         struct mutex            lock;
31
32         /* Compliant with Battery Charging Specification version (if any) */
33         enum battery_charging_spec      bc;
34
35         /* properties */
36         unsigned                present:1;
37         unsigned                online:1;
38         unsigned                max_current;
39         int     (*connect)(struct usb_charger *charger);
40         int     (*disconnect)(struct usb_charger *charger);
41         int     (*set_power)(struct usb_charger *charger, unsigned mA);
42
43         int     (*detect)(struct usb_charger *charger);
44 };
45
46 #ifdef CONFIG_IMX6_USB_CHARGER
47 extern void imx6_usb_remove_charger(struct usb_charger *charger);
48 extern int imx6_usb_create_charger(struct usb_charger *charger,
49                 const char *name);
50 extern int imx6_usb_vbus_disconnect(struct usb_charger *charger);
51 extern int imx6_usb_vbus_connect(struct usb_charger *charger);
52 extern int imx6_usb_charger_detect_post(struct usb_charger *charger);
53 #else
54 void imx6_usb_remove_charger(struct usb_charger *charger)
55 {
56
57 }
58
59 int imx6_usb_create_charger(struct usb_charger *charger,
60                 const char *name)
61 {
62         return -ENODEV;
63 }
64
65 int imx6_usb_vbus_disconnect(struct usb_charger *charger)
66 {
67         return -ENODEV;
68 }
69
70 int imx6_usb_vbus_connect(struct usb_charger *charger)
71 {
72         return -ENODEV;
73 }
74 int imx6_usb_charger_detect_post(struct usb_charger *charger)
75 {
76         return -ENODEV;
77 }
78 #endif
79
80 #endif /* __IMXUSB6_CHARGER_H */