summaryrefslogtreecommitdiff
path: root/include/usb_charge.h
diff options
context:
space:
mode:
authorVic Yang <victoryang@google.com>2012-01-10 15:29:26 +0800
committerVic Yang <victoryang@google.com>2012-01-19 10:54:37 +0800
commitaf8026cdf99aeaa2db7ad6671ef9cad2cef60772 (patch)
tree1f555170c9f1ee5e10a29af991c7b540729906b3 /include/usb_charge.h
parent37dcc1ab56c6817aae90e244f42ebff1d62bbfcb (diff)
downloadchrome-ec-af8026cdf99aeaa2db7ad6671ef9cad2cef60772.tar.gz
USB Charging control
Implement TPS2543 USB charging control. It contains routine for setting each USB port as dedicated charging port or standard downstream port. To allow us controlling the current distributed to each port, we can select whether to allow 500mA or 1500mA for each port. BUG=chrome-os-partner:7476 TEST=Added USB port definition for BDS and tested GPIO output voltage level is correct for all modes. Change-Id: I19bc4b30d333aa802f868ebfc3a398b30e99ba0f
Diffstat (limited to 'include/usb_charge.h')
-rw-r--r--include/usb_charge.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/include/usb_charge.h b/include/usb_charge.h
new file mode 100644
index 0000000000..0b3b7a497f
--- /dev/null
+++ b/include/usb_charge.h
@@ -0,0 +1,34 @@
+/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* USB charging control module for Chrome EC */
+
+#ifndef __CROS_EC_USB_CHARGE_H
+#define __CROS_EC_USB_CHARGE_H
+
+#include "board.h"
+
+enum usb_charge_mode {
+ /* Disable USB port. */
+ USB_CHARGE_MODE_DISABLED,
+ /* Set USB port to be dedicated charging port, auto selecting charging
+ * schemes. */
+ USB_CHARGE_MODE_CHARGE_AUTO,
+ /* Set USB port to be dedicated charging port following USB Battery
+ * Charging Specification 1.2. */
+ USB_CHARGE_MODE_CHARGE_BC12,
+ /* Set USB port to be standard downstream port, with current limit set
+ * to 500mA or 1500mA. */
+ USB_CHARGE_MODE_DOWNSTREAM_500MA,
+ USB_CHARGE_MODE_DOWNSTREAM_1500MA,
+
+ USB_CHARGE_MODE_COUNT
+};
+
+int usb_charge_set_mode(int usb_port_id, enum usb_charge_mode);
+
+int usb_charge_init(void);
+
+#endif /* __CROS_EC_USB_CHARGE_H */