changeset 221:5bf097aeaad7

LLS: when turning off all LEDs on boot, skip LED-C Having LLS turn off LED-A and LED-B on boot is normally unnecessary (they should already be off in Iota), but it is harmless, hence this logic is kept for robustness. However, having LLS read-modify-write the BCICTL2 register (to turn off LED-C) creates a potential race condition with FCHG writes to this register, especially in the case when baseband switch-on is caused by VCHG and charging is expected to start right away. Furthermore, control of the charging LED itself (on those hw targets that have it) is the responsibility of the FCHG SWE, hence LLS should leave it alone.
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 26 Apr 2021 21:55:13 +0000
parents 0ed36de51973
children c336ed5691a5
files src/cs/services/lls/lls_functions.c
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/cs/services/lls/lls_functions.c	Mon Apr 26 20:55:25 2021 +0000
+++ b/src/cs/services/lls/lls_functions.c	Mon Apr 26 21:55:13 2021 +0000
@@ -47,7 +47,7 @@
 
 /* Definition of the parameters for the equipment */
 #if (ANLG_FAM == 2)
-   static T_EQUIPMENT_PARAM_TABLE equipment_param_table = 
+   static T_EQUIPMENT_PARAM_TABLE equipment_param_table =
    {  {LLS_LED_A,         PAGE1, AUXLED,  0},
       {LLS_BACKLIGHT,     PAGE1, AUXLED,  1},
       {LLS_PRECHARGE_LED, PAGE0, BCICTL2, 5}
@@ -81,6 +81,7 @@
 T_RV_RET lls_initialize(void)
 {
    T_RV_RET ret = RV_OK;
+   T_LLS_EQUIPMENT equipment_sort;
    UINT8 i;
 
    /* Mutex initialization */
@@ -91,9 +92,13 @@
    /* Initialisation of the equipment at SWITCH_OFF */
    for (i = 0; i < NUMBER_OF_EQUIPMENT; i++)
    {
-      ret = lls_switch_off(equipment_param_table[i].equipment_sort);
-      if (ret != RV_OK)
-         return RV_INTERNAL_ERR;
+      equipment_sort = equipment_param_table[i].equipment_sort;
+      /* FreeCalypso change: don't touch LED-C, leave it to FCHG SWE */
+      if (equipment_sort != LLS_PRECHARGE_LED) {
+         ret = lls_switch_off(equipment_sort);
+         if (ret != RV_OK)
+            return RV_INTERNAL_ERR;
+      }
    }
 
    return RV_OK;