summaryrefslogtreecommitdiff
path: root/board/daisy/board.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2013-07-19 16:26:36 -0700
committerChromeBot <chrome-bot@google.com>2013-07-23 11:14:16 -0700
commit64e38af781a42a346f59ef27c352f4818bfa1516 (patch)
treed4cadba6ebf88e5f41ab82008af9227a0187ba8c /board/daisy/board.c
parent4288e45815d8677147d582a46eb625a185f49162 (diff)
downloadchrome-ec-64e38af781a42a346f59ef27c352f4818bfa1516.tar.gz
Clean up and document PMU config options
No functional changes, just documenting and renaming. All boards which use the PMU must provide pmu_board_init(). This was already true - except that Daisy's pmu_board_init() was implemented as part of pmu_init() instead of its code living in board.c; I've moved the code there now. BUG=chrome-os-partner:18343 BRANCH=none TEST=build all platforms Change-Id: I85ad06dc3b6287ad917fe13acf83182f24a8f23d Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/62906 Reviewed-by: Vic Yang <victoryang@chromium.org>
Diffstat (limited to 'board/daisy/board.c')
-rw-r--r--board/daisy/board.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/board/daisy/board.c b/board/daisy/board.c
index dbd27ed0ef..d9a384983d 100644
--- a/board/daisy/board.c
+++ b/board/daisy/board.c
@@ -163,3 +163,32 @@ void keyboard_suppress_noise(void)
gpio_set_level(GPIO_CODEC_INT, 0);
gpio_set_level(GPIO_CODEC_INT, 1);
}
+
+/**
+ * Board-specific PMU init.
+ */
+
+#define CG_CTRL0 0x04
+#define CG_CTRL3 0x07
+
+int pmu_board_init(void)
+{
+ int failure = 0;
+
+ /* Init configuration
+ * Fast charge timer : 2 hours
+ * Charger : disable
+ * External pin control : enable
+ *
+ * TODO: move settings to battery pack specific init
+ */
+ if (!failure)
+ failure = pmu_write(CG_CTRL0, 2);
+ /* Limit full charge current to 50%
+ * TODO: remove this temporary hack.
+ */
+ if (!failure)
+ failure = pmu_write(CG_CTRL3, 0xbb);
+
+ return failure ? EC_ERROR_UNKNOWN : EC_SUCCESS;
+}