diff src/cs/layer1/cust0/l1_cust.c @ 328:daddb933047d

L1 sleep logic change: allow big sleep when light is on or we are charging
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 14 Dec 2017 02:45:22 +0000
parents 50a15a54801e
children 047fb78947d5
line wrap: on
line diff
--- a/src/cs/layer1/cust0/l1_cust.c	Fri Dec 08 03:05:19 2017 +0000
+++ b/src/cs/layer1/cust0/l1_cust.c	Thu Dec 14 02:45:22 2017 +0000
@@ -272,7 +272,28 @@
 #endif
         // cut ARMIO and UWIRE clocks in big sleep
         l1s.pw_mgr.modules_status = ARMIO_CLK_CUT | UWIRE_CLK_CUT ;
-        return(FRAME_STOP);  // BIG sleep
+	/*
+	 * FreeCalypso change: in TI's original code, whenever
+	 * this Cust_check_system() function returns FRAME_STOP
+	 * instead of CLOCK_STOP, l1s_sleep_manager() would
+	 * abstain from all sleep and not just from deep sleep.
+	 * The comments there say that the intent is to avoid
+	 * big sleep when there is UART or SIM activity,
+	 * but the result is that when we tell L1 to do big sleep
+	 * instead of deep sleep because of the backlight or
+	 * charging, it doesn't sleep at all, except small sleep
+	 * via Nucleus idle loop.
+	 *
+	 * Our change preserves TI's abstention from big sleep
+	 * due to UART or SIM activity, but allows big sleep when
+	 * the cause is light or charging.  We've changed this
+	 * Cust_check_system() function to return DO_NOT_SLEEP
+	 * instead of FRAME_STOP for UART and SIM, while still
+	 * returning FRAME_STOP for light and charging, and
+	 * changed the code in l1s_sleep_manager() to do big sleep
+	 * when this Cust_check_system() function returns FRAME_STOP.
+	 */
+        return(DO_NOT_SLEEP);  // NO sleep
 #else // Simulation part
   return(CLOCK_STOP);   // DEEP sleep
 #endif