summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2013-04-09 10:03:40 -0700
committerChromeBot <chrome-bot@google.com>2013-04-10 14:24:10 -0700
commite5f4032866d703735808f934375d31072ff8603b (patch)
treeb3cfa99414ee2b45520d17fd714aedb448652657 /include
parenta1c99c7228086a4f3d06fc299fa43ba7928c6b48 (diff)
downloadchrome-ec-e5f4032866d703735808f934375d31072ff8603b.tar.gz
Clean up USB external power module
Make internal APIs static, and remove board_ prefix for clarity. Move TSU6721 calls from charger task to extpower_usb functions for better encapsulation. No functional changes, just moving code. Yes, this will make cherry-picking back from spring to TOT less convenient, but now the code is more readable and it will make maintaining the PMU code easier as we add boards. BUG=chrome-os-partner:18343 BRANCH=none TEST=build spring Change-Id: I52b37e57fc8519859996a110b0503277c6f0bbc8 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47657
Diffstat (limited to 'include')
-rw-r--r--include/extpower.h5
-rw-r--r--include/extpower_usb.h39
2 files changed, 44 insertions, 0 deletions
diff --git a/include/extpower.h b/include/extpower.h
index d3f9a4f6ef..36c5535633 100644
--- a/include/extpower.h
+++ b/include/extpower.h
@@ -10,6 +10,11 @@
#include "common.h"
+#ifdef CONFIG_EXTPOWER_USB
+/* USB-power-specific methods */
+#include "extpower_usb.h"
+#endif
+
/**
* Return non-zero if external power is present.
*/
diff --git a/include/extpower_usb.h b/include/extpower_usb.h
new file mode 100644
index 0000000000..dc5c68c117
--- /dev/null
+++ b/include/extpower_usb.h
@@ -0,0 +1,39 @@
+/* Copyright (c) 2013 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.
+ */
+
+/* External power via USB for Chrome EC */
+
+#ifndef __CROS_EC_EXTPOWER_USB_H
+#define __CROS_EC_EXTPOWER_USB_H
+
+#include "common.h"
+
+/*
+ * TODO: this currently piggy-backs on the charger task. Should be able to
+ * move updates to deferred functions and get rid of all the ifdef's in the
+ * charger task. At that point, all these APIs will be internal to the
+ * extpower module and this entire header file can go away.
+ */
+
+/**
+ * Properly limit input power on EC boot.
+ *
+ * Called from charger task.
+ */
+void extpower_charge_init(void);
+
+/**
+ * Update external power state.
+ *
+ * Called from charger task.
+ */
+void extpower_charge_update(int force_update);
+
+/**
+ * Return non-zero if external power needs update from charge task.
+ */
+int extpower_charge_needs_update(void);
+
+#endif /* __CROS_EC_EXTPOWER_USB_H */