summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2013-10-31 09:42:28 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-10-31 21:57:24 +0000
commitaf8d3f9536010072c673dbf447bd08742628a222 (patch)
tree779c202bf5fa324566c9d1106fb03576237e70e0
parent9fd4258f365c6c74114c34dbe56e85819a585208 (diff)
downloadchrome-ec-af8d3f9536010072c673dbf447bd08742628a222.tar.gz
cleanup: TODO comments in extpower_spring
No code changes, just comment fixes. Added config #ifdefs for the debug commands as requested; they're enabled for Spring, so functionality is unchanged. BUG=chrome-os-partner:18343 BRANCH=none TEST=build spring; see that ilim and batdebug commands still exist Change-Id: I7c9f12281afa7ec68aa7e62dcfcd51682d88a16a Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/175216 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
-rw-r--r--board/spring/board.h2
-rw-r--r--common/extpower_spring.c33
-rw-r--r--include/config.h2
3 files changed, 24 insertions, 13 deletions
diff --git a/board/spring/board.h b/board/spring/board.h
index 99ead90b7d..031e8b96b7 100644
--- a/board/spring/board.h
+++ b/board/spring/board.h
@@ -21,6 +21,8 @@
#define CONFIG_BOARD_PRE_INIT
#define CONFIG_CHARGER_TPS65090
#define CONFIG_CHIPSET_GAIA
+#define CONFIG_CMD_BATDEBUG
+#define CONFIG_CMD_ILIM
#define CONFIG_CMD_PMU
#define CONFIG_CONSOLE_RESTRICTED_INPUT
#define CONFIG_EXTPOWER_SPRING
diff --git a/common/extpower_spring.c b/common/extpower_spring.c
index de294d4e9f..22b52ce80b 100644
--- a/common/extpower_spring.c
+++ b/common/extpower_spring.c
@@ -19,7 +19,10 @@
#include "keyboard_mkbp.h"
#include "pmu_tpschrome.h"
#include "pwm.h"
-/* TODO(rspangler): files in common should not use chip registers directly */
+/*
+ * TODO(crosbug.com/p/23745): Refactor low-level STM32 ADC code out of this
+ * module. Files in common should not use chip registers directly.
+ */
#include "registers.h"
#include "system.h"
#include "task.h"
@@ -215,10 +218,10 @@ static int apple_charger_current(void)
int type = 0;
int data[ADC_CH_COUNT];
- /* TODO(victoryang): Handle potential race condition. */
+ /* TODO(crosbug.com/p/23743): Handle potential race condition. */
tsu6721_disable_interrupts();
tsu6721_mux(TSU6721_MUX_USB);
- /* Wait 20ms for signal to stablize */
+ /* Wait for signal to stablize */
msleep(DELAY_USB_DP_DN_MS);
adc_read_all_channels(data);
vp = data[ADC_CH_USB_DP_SNS];
@@ -433,8 +436,8 @@ static void usb_detect_overcurrent(int dev_type)
power_removed_time[idx] = get_time();
power_removed_type[idx] = current_dev_type;
/*
- * TODO(victoryang): Record the maximum current seen during
- * retry?
+ * TODO(crosbug.com/p/23744): Record the maximum current seen
+ * during retry?
*/
power_removed_pwm_duty[idx] = current_pwm_duty;
} else if (dev_type & TSU6721_TYPE_VBUS_DEBOUNCED) {
@@ -608,15 +611,18 @@ void extpower_charge_init(void)
set_pwm_duty_cycle(I_LIMIT_500MA);
/*
- * Somehow TSU6721 comes up slowly. Let's wait for a moment before
- * accessing it.
- * TODO(victoryang): Investigate slow init issue.
+ * TODO(crosbug.com/p/23742): For some reason the TSU6721 comes up very
+ * slowly. Wait for a while before accessing it. This delay seems to
+ * be long enough. Once we understand the slow start, it may be
+ * possible to remove this delay.
*/
msleep(500);
tsu6721_reset();
gpio_enable_interrupt(GPIO_USB_CHG_INT);
- msleep(100); /* TSU6721 doesn't work properly right away. */
+
+ /* TODO(crosbug.com/p/23742): Need delay after reset as well */
+ msleep(100);
extpower_charge_update(1);
}
@@ -850,11 +856,9 @@ static void usb_charger_redetect(void)
DECLARE_HOOK(HOOK_SECOND, usb_charger_redetect, HOOK_PRIO_DEFAULT);
/*****************************************************************************/
-/*
- * Console commands for debugging.
- * TODO(victoryang): Gate with CONFIG flag after charging control is done.
- */
+/* Console commands for debugging */
+#ifdef CONFIG_CMD_ILIM
static int command_ilim(int argc, char **argv)
{
char *e;
@@ -886,7 +890,9 @@ DECLARE_CONSOLE_COMMAND(ilim, command_ilim,
"[percent | on | off]",
"Set or show ILIM duty cycle/GPIO value",
NULL);
+#endif /* CONFIG_CMD_ILIM */
+#ifdef CONFIG_CMD_BATDEBUG
static int command_batdebug(int argc, char **argv)
{
int val;
@@ -908,6 +914,7 @@ static int command_batdebug(int argc, char **argv)
}
DECLARE_CONSOLE_COMMAND(batdebug, command_batdebug,
NULL, NULL, NULL);
+#endif /* CONFIG_CMD_BATDEBUG */
/*****************************************************************************/
/* Host commands */
diff --git a/include/config.h b/include/config.h
index 345a606c5e..e53cc301e4 100644
--- a/include/config.h
+++ b/include/config.h
@@ -202,10 +202,12 @@
* console.
*/
+#undef CONFIG_CMD_BATDEBUG
#undef CONFIG_CMD_CLOCKGATES
#undef CONFIG_CMD_COMXTEST
#undef CONFIG_CMD_ECTEMP
#undef CONFIG_CMD_GSV
+#undef CONFIG_CMD_ILIM
#undef CONFIG_CMD_PLL
#undef CONFIG_CMD_PMU
#undef CONFIG_CMD_POWERLED