summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPeter Chen <peter.chen@freescale.com>2013-11-14 13:52:14 +0800
committerPeter Chen <peter.chen@freescale.com>2013-11-18 15:05:43 +0800
commit8d5051f9e8cdfad26e554c8e628a863097f4ca85 (patch)
tree87c46e2fd222cdd459e08327434e6d3dc03aef8a /include
parent1bfc070d9d87ed52ecbb0bf2858e7c7497cc985d (diff)
ENGR00287992-1 power: imx6: add imx6 USB charger detection
Add imx6 USB charger detection, the vbus supplier will create and remove struct usb_charger, and notify vbus connect and disconnect event. The detail USB charger detection flow is at: "i.MX6 RM, Chapter Universal Serial Bus 2.0 Integrated PHY (USB-PHY), Charger detection, Charger detection software flow". Since imx6 only has charger detection function, and no charging current function is existed. It the user wants the detection abilities from SoC, it can use this detection method (add imx6-usb-charger-detection at dts). If the charger IC already has USB charger detection function, and the user wants to use the detection method from charger IC, please do not add imx6-usb-charger-detection property at dts. Signed-off-by: Peter Chen <peter.chen@freescale.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/power/imx6_usb_charger.h80
1 files changed, 80 insertions, 0 deletions
diff --git a/include/linux/power/imx6_usb_charger.h b/include/linux/power/imx6_usb_charger.h
new file mode 100644
index 000000000000..39358d22f396
--- /dev/null
+++ b/include/linux/power/imx6_usb_charger.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2013 Freescale Semiconductor, Inc. All Rights Reserved.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+#ifndef __IMXUSB6_CHARGER_H
+#define __IMXUSB6_CHARGER_H
+
+#include <linux/power_supply.h>
+enum battery_charging_spec {
+ BATTERY_CHARGING_SPEC_NONE = 0,
+ BATTERY_CHARGING_SPEC_UNKNOWN,
+ BATTERY_CHARGING_SPEC_1_0,
+ BATTERY_CHARGING_SPEC_1_1,
+ BATTERY_CHARGING_SPEC_1_2,
+};
+
+struct usb_charger {
+ /* The anatop regmap */
+ struct regmap *anatop;
+ /* USB controller */
+ struct device *dev;
+ struct power_supply psy;
+ struct mutex lock;
+
+ /* Compliant with Battery Charging Specification version (if any) */
+ enum battery_charging_spec bc;
+
+ /* properties */
+ unsigned present:1;
+ unsigned online:1;
+ unsigned max_current;
+ int (*connect)(struct usb_charger *charger);
+ int (*disconnect)(struct usb_charger *charger);
+ int (*set_power)(struct usb_charger *charger, unsigned mA);
+
+ int (*detect)(struct usb_charger *charger);
+};
+
+#ifdef CONFIG_IMX6_USB_CHARGER
+extern void imx6_usb_remove_charger(struct usb_charger *charger);
+extern int imx6_usb_create_charger(struct usb_charger *charger,
+ const char *name);
+extern int imx6_usb_vbus_disconnect(struct usb_charger *charger);
+extern int imx6_usb_vbus_connect(struct usb_charger *charger);
+extern int imx6_usb_charger_detect_post(struct usb_charger *charger);
+#else
+void imx6_usb_remove_charger(struct usb_charger *charger)
+{
+
+}
+
+int imx6_usb_create_charger(struct usb_charger *charger,
+ const char *name)
+{
+ return -ENODEV;
+}
+
+int imx6_usb_vbus_disconnect(struct usb_charger *charger)
+{
+ return -ENODEV;
+}
+
+int imx6_usb_vbus_connect(struct usb_charger *charger)
+{
+ return -ENODEV;
+}
+int imx6_usb_charger_detect_post(struct usb_charger *charger)
+{
+ return -ENODEV;
+}
+#endif
+
+#endif /* __IMXUSB6_CHARGER_H */