From e5f4032866d703735808f934375d31072ff8603b Mon Sep 17 00:00:00 2001 From: Randall Spangler Date: Tue, 9 Apr 2013 10:03:40 -0700 Subject: 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 Reviewed-on: https://gerrit.chromium.org/gerrit/47657 --- include/extpower.h | 5 +++++ include/extpower_usb.h | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 include/extpower_usb.h (limited to 'include') 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 */ -- cgit v1.2.1