comparison src/cs/drivers/drv_core/abb/abb.c @ 648:337e6d3a4454

abb.c: disable superdeep sleep on Luna
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 07 May 2020 06:28:56 +0000
parents d7b25dca1266
children 4f458e31b6e1
comparison
equal deleted inserted replaced
647:94cb5e76b3b5 648:337e6d3a4454
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