mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-11 18:35:28 +00:00
g: fix rdd to enable sleep
When the debug cable is disconnected the a USB suspend interrupt is triggered and puts the chip to sleep before rdd can detect a change on the cc lines and disconnect from CCD. This prevents the DEBUG_STATE_MAP from being reset to detect the debug connect and is left detecting the disconnect. Since the debug accessory is already disconnected the RDD interrupt will wake up the chip right after it goes to sleep. The UTMI and PIN wake source still cause the chip to wake up before the RDD interrupt, so disable those to test this change. BUG=chrome-os-partner:54796 BRANCH=none TEST=Disable wake pin and utmi wake sources. Put cr50 to sleep. Attach a reworked suzy q and make sure cr50 wakes up. Detach it and check that it goes back to sleep. Do that a couple of times. Check CCD is still enabled when the debug accessory is detected and disabled on disconnect. Change-Id: I58a012895bc874dcdd512aa84de9a917469f3139 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/360234 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
This commit is contained in:
@@ -8,9 +8,12 @@
|
||||
#include "hooks.h"
|
||||
#include "rdd.h"
|
||||
#include "registers.h"
|
||||
#include "system.h"
|
||||
#include "task.h"
|
||||
#include "usb_api.h"
|
||||
|
||||
#define CPRINTS(format, args...) cprints(CC_USB, format, ## args)
|
||||
|
||||
static uint16_t debug_detect;
|
||||
|
||||
int debug_cable_is_attached(void)
|
||||
@@ -24,15 +27,17 @@ int debug_cable_is_attached(void)
|
||||
void rdd_interrupt(void)
|
||||
{
|
||||
if (debug_cable_is_attached()) {
|
||||
ccprintf("Debug Accessory connected\n");
|
||||
CPRINTS("Debug Accessory connected");
|
||||
disable_sleep(SLEEP_MASK_RDD);
|
||||
/* Detect when debug cable is disconnected */
|
||||
GWRITE(RDD, PROG_DEBUG_STATE_MAP, ~debug_detect);
|
||||
rdd_attached();
|
||||
} else {
|
||||
ccprintf("Debug Accessory disconnected\n");
|
||||
CPRINTS("Debug Accessory disconnected");
|
||||
/* Detect when debug cable is connected */
|
||||
GWRITE(RDD, PROG_DEBUG_STATE_MAP, debug_detect);
|
||||
rdd_detached();
|
||||
enable_sleep(SLEEP_MASK_RDD);
|
||||
}
|
||||
|
||||
/* Clear interrupt */
|
||||
|
||||
@@ -317,6 +317,7 @@ enum {
|
||||
SLEEP_MASK_I2C_SLAVE = (1 << 7), /* I2C slave communication ongoing */
|
||||
SLEEP_MASK_FAN = (1 << 8), /* Fan control loop ongoing */
|
||||
SLEEP_MASK_USB_DEVICE = (1 << 9), /* Generic USB device in use */
|
||||
SLEEP_MASK_RDD = (1 << 10),/* RDD ongoing */
|
||||
|
||||
SLEEP_MASK_FORCE_NO_DSLEEP = (1 << 15), /* Force disable. */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user