Don't enable charger interrupt if charger task is disabled

This fixes pmu_init() failing on pit, where the charger task isn't
enabled yet (and thus the charger interrupt is NULL - which can't be
enabled).

BUG=chrome-os-partner:18657
BRANCH=none
TEST=build all platforms; on pit, check that pmu_init() no longer fails

Change-Id: I191bbaeb4df10241e3508ccf7ef5ea83f42c5697
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49550
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Randall Spangler
2013-04-29 16:15:45 -07:00
committed by ChromeBot
parent d9bddaa072
commit deb05123f8
2 changed files with 8 additions and 9 deletions

View File

@@ -600,15 +600,6 @@ void pmu_init(void)
if (!failure)
failure = pmu_clear_irq();
/* Enable charger interrupt. */
if (!failure)
failure = gpio_enable_interrupt(GPIO_CHARGER_INT);
#ifdef CONFIG_AC_POWER_STATUS
if (!failure)
failure = gpio_set_flags(GPIO_AC_STATUS, GPIO_OUT_HIGH);
#endif
/* Exit the retry loop if there was no failure */
if (!failure)
break;

View File

@@ -393,6 +393,14 @@ void charger_task(void)
timestamp_t pre_chg_start = get_time();
pmu_init();
/* Enable charger interrupt */
gpio_enable_interrupt(GPIO_CHARGER_INT);
#ifdef CONFIG_AC_POWER_STATUS
gpio_set_flags(GPIO_AC_STATUS, GPIO_OUT_HIGH);
#endif
/*
* EC STOP mode support
* The charging loop can be stopped in idle state with AC unplugged.