samus_pd: Add workaround for unwanted pericom resets

Our pericom charge detectors can reset themselves on rapid charger plug
/ unplug, which resets the interrupt enable to the power-on default
(off). Work around this problem by re-enabling pericom interrupts from
the VBUS interrupt.

BUG=chrome-os-partner:33823
TEST=Manual on samus. Rapidly plug + unplug charger, verify that Pericom
continues to trigger interrupts.
BRANCH=Samus

Change-Id: I7370525e28c59bdde3765e52523d5158d1d6175d
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/231700
Reviewed-by: Alec Berg <alecaberg@chromium.org>
This commit is contained in:
Shawn Nematbakhsh
2014-11-24 11:54:53 -08:00
committed by chrome-internal-fetch
parent 16eef671c2
commit f512b0c659
2 changed files with 30 additions and 0 deletions

View File

@@ -57,15 +57,41 @@ const int supplier_priority[] = {
};
BUILD_ASSERT(ARRAY_SIZE(supplier_priority) == CHARGE_SUPPLIER_COUNT);
static void pericom_port0_reenable_interrupts(void)
{
pi3usb9281_enable_interrupts(0);
}
DECLARE_DEFERRED(pericom_port0_reenable_interrupts);
static void pericom_port1_reenable_interrupts(void)
{
pi3usb9281_enable_interrupts(1);
}
DECLARE_DEFERRED(pericom_port1_reenable_interrupts);
void vbus0_evt(enum gpio_signal signal)
{
ccprintf("VBUS %d, %d!\n", signal, gpio_get_level(signal));
/*
* Re-enable interrupts on pericom charger detector since the
* chip may periodically reset itself, and come back up with
* registers in default state. TODO(crosbug.com/p/33823): Fix
* these unwanted resets.
*/
hook_call_deferred(pericom_port0_reenable_interrupts, 0);
task_wake(TASK_ID_PD_C0);
}
void vbus1_evt(enum gpio_signal signal)
{
ccprintf("VBUS %d, %d!\n", signal, gpio_get_level(signal));
/*
* Re-enable interrupts on pericom charger detector since the
* chip may periodically reset itself, and come back up with
* registers in default state. TODO(crosbug.com/p/33823): Fix
* these unwanted resets.
*/
hook_call_deferred(pericom_port1_reenable_interrupts, 0);
task_wake(TASK_ID_PD_C1);
}

View File

@@ -65,6 +65,10 @@
*/
#define CONFIG_SYSTEM_UNLOCKED
/* 10 deferrable tasks on this board */
#undef DEFERRABLE_MAX_COUNT
#define DEFERRABLE_MAX_COUNT 10
#ifndef __ASSEMBLER__
/* Timer selection */