comparison src/cs/services/lls/lls_functions.c @ 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 4e78acac3d88
children
comparison
equal deleted inserted replaced
220:0ed36de51973 221:5bf097aeaad7
45 /* Table of parameters for all the equipment's */ 45 /* Table of parameters for all the equipment's */
46 typedef T_EQUIPMENT_PARAM T_EQUIPMENT_PARAM_TABLE[NUMBER_OF_EQUIPMENT]; 46 typedef T_EQUIPMENT_PARAM T_EQUIPMENT_PARAM_TABLE[NUMBER_OF_EQUIPMENT];
47 47
48 /* Definition of the parameters for the equipment */ 48 /* Definition of the parameters for the equipment */
49 #if (ANLG_FAM == 2) 49 #if (ANLG_FAM == 2)
50 static T_EQUIPMENT_PARAM_TABLE equipment_param_table = 50 static T_EQUIPMENT_PARAM_TABLE equipment_param_table =
51 { {LLS_LED_A, PAGE1, AUXLED, 0}, 51 { {LLS_LED_A, PAGE1, AUXLED, 0},
52 {LLS_BACKLIGHT, PAGE1, AUXLED, 1}, 52 {LLS_BACKLIGHT, PAGE1, AUXLED, 1},
53 {LLS_PRECHARGE_LED, PAGE0, BCICTL2, 5} 53 {LLS_PRECHARGE_LED, PAGE0, BCICTL2, 5}
54 }; 54 };
55 #else 55 #else
79 * function: lls_initialize 79 * function: lls_initialize
80 */ 80 */
81 T_RV_RET lls_initialize(void) 81 T_RV_RET lls_initialize(void)
82 { 82 {
83 T_RV_RET ret = RV_OK; 83 T_RV_RET ret = RV_OK;
84 T_LLS_EQUIPMENT equipment_sort;
84 UINT8 i; 85 UINT8 i;
85 86
86 /* Mutex initialization */ 87 /* Mutex initialization */
87 ret = rvf_initialize_mutex(&mutex); 88 ret = rvf_initialize_mutex(&mutex);
88 if (ret != RVF_OK) 89 if (ret != RVF_OK)
89 return RV_INTERNAL_ERR; 90 return RV_INTERNAL_ERR;
90 91
91 /* Initialisation of the equipment at SWITCH_OFF */ 92 /* Initialisation of the equipment at SWITCH_OFF */
92 for (i = 0; i < NUMBER_OF_EQUIPMENT; i++) 93 for (i = 0; i < NUMBER_OF_EQUIPMENT; i++)
93 { 94 {
94 ret = lls_switch_off(equipment_param_table[i].equipment_sort); 95 equipment_sort = equipment_param_table[i].equipment_sort;
95 if (ret != RV_OK) 96 /* FreeCalypso change: don't touch LED-C, leave it to FCHG SWE */
96 return RV_INTERNAL_ERR; 97 if (equipment_sort != LLS_PRECHARGE_LED) {
98 ret = lls_switch_off(equipment_sort);
99 if (ret != RV_OK)
100 return RV_INTERNAL_ERR;
101 }
97 } 102 }
98 103
99 return RV_OK; 104 return RV_OK;
100 } 105 }
101 106