comparison src/cs/drivers/drv_core/abb/abb.c @ 192:4f40ae165be4

abb.c & init.c: sync with Magnetite for Luna additions These Luna target-specific additions are conditionalized on CONFIG_TARGET_LUNA, a C preprocessor symbol that will never be defined in Selenite, hence this change has exactly zero impact on FC Selenite. However, they are being pulled in as a sync in order to keep the diff between Magnetite and Selenite to a minimum; keeping this diff to a minimum increases our opportunities for possible evolution of future FC firmwares.
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 23 May 2020 07:03:46 +0000
parents b6a5e36de839
children ed876f98fdfd
comparison
equal deleted inserted replaced
191:4725fe5932c4 192:4f40ae165be4
90 * and measurement are appropriate. 90 * and measurement are appropriate.
91 */ 91 */
92 92
93 #define ENABLE_BACKUP_BATTERY 0 93 #define ENABLE_BACKUP_BATTERY 0
94 94
95 /*
96 * The following ABB_sleep_allowed global variable is yet another FreeCalypso
97 * addition. Here is the issue: some handset boards have the controller/driver
98 * chip in the LCD powered from Iota VRIO, which is generally a very sensible
99 * arrangement. As one reference example, our 176x220 pixel TFT LCDs which
100 * we are considering for our own FC handset draw about 3 mA from their Vci
101 * supply which we connect to VRIO - perfectly fine when the regulators are
102 * in their normal Active mode. But what about sleep mode? Sleep mode VRIO
103 * current limit is only 1 mA, thus the combination of the LCD being on and
104 * drawing 3 mA with the ABB in sleep mode is invalid. TI's original code
105 * already had a check for VRPCSTS: PWON and RPWON need to be released and
106 * the charger needs to be unplugged in order to enter ABB superdeep sleep.
107 * We are extending this check with one more condition: ABB_sleep_allowed
108 * needs to be nonzero; the intent is that this variable will be set by the
109 * code responsible for putting the LCD into its own powerdown mode.
110 * This logic is included only for affected targets with LCDs.
111 */
112
113 #ifdef CONFIG_TARGET_LUNA
114 int ABB_sleep_allowed = 0;
115 #endif
116
95 #if (ABB_SEMAPHORE_PROTECTION) 117 #if (ABB_SEMAPHORE_PROTECTION)
96 118
97 static NU_SEMAPHORE abb_sem; 119 static NU_SEMAPHORE abb_sem;
98 120
99 /*-----------------------------------------------------------------------*/ 121 /*-----------------------------------------------------------------------*/
854 876
855 #elif (ANLG_FAM == 2) 877 #elif (ANLG_FAM == 2)
856 // Read VRPCSTS register value and extract status of meaningfull inputs. 878 // Read VRPCSTS register value and extract status of meaningfull inputs.
857 reg_val = ABB_ReadRegister(VRPCSTS) & 0x0070; 879 reg_val = ABB_ReadRegister(VRPCSTS) & 0x0070;
858 880
881 #ifdef CONFIG_TARGET_LUNA
882 if (reg_val == 0x30 && ABB_sleep_allowed)
883 #else
859 if (reg_val == 0x30) 884 if (reg_val == 0x30)
885 #endif
860 { 886 {
861 // start the SLPDLY counter in order to switch the ABB in sleep mode. This transmission sets IOTA sleep bit. 887 // start the SLPDLY counter in order to switch the ABB in sleep mode. This transmission sets IOTA sleep bit.
862 ABB_WriteRegister(VRPCDEV, 0x02); 888 ABB_WriteRegister(VRPCDEV, 0x02);
863 } 889 }
864 890