# HG changeset patch # User Mychaela Falconia # Date 1588832936 0 # Node ID 337e6d3a44546592a0f8ccdc9e8907682be4d1da # Parent 94cb5e76b3b59d9d652fd6b33391a018ad54457c abb.c: disable superdeep sleep on Luna diff -r 94cb5e76b3b5 -r 337e6d3a4454 src/cs/drivers/drv_core/abb/abb.c --- a/src/cs/drivers/drv_core/abb/abb.c Thu Apr 16 16:48:08 2020 +0000 +++ b/src/cs/drivers/drv_core/abb/abb.c Thu May 07 06:28:56 2020 +0000 @@ -92,6 +92,28 @@ #define ENABLE_BACKUP_BATTERY 0 +/* + * The following ABB_sleep_allowed global variable is yet another FreeCalypso + * addition. Here is the issue: some handset boards have the controller/driver + * chip in the LCD powered from Iota VRIO, which is generally a very sensible + * arrangement. As one reference example, our 176x220 pixel TFT LCDs which + * we are considering for our own FC handset draw about 3 mA from their Vci + * supply which we connect to VRIO - perfectly fine when the regulators are + * in their normal Active mode. But what about sleep mode? Sleep mode VRIO + * current limit is only 1 mA, thus the combination of the LCD being on and + * drawing 3 mA with the ABB in sleep mode is invalid. TI's original code + * already had a check for VRPCSTS: PWON and RPWON need to be released and + * the charger needs to be unplugged in order to enter ABB superdeep sleep. + * We are extending this check with one more condition: ABB_sleep_allowed + * needs to be nonzero; the intent is that this variable will be set by the + * code responsible for putting the LCD into its own powerdown mode. + * This logic is included only for affected targets with LCDs. + */ + +#ifdef CONFIG_TARGET_LUNA +int ABB_sleep_allowed = 0; +#endif + #if (ABB_SEMAPHORE_PROTECTION) static NU_SEMAPHORE abb_sem; @@ -856,7 +878,11 @@ // Read VRPCSTS register value and extract status of meaningfull inputs. reg_val = ABB_ReadRegister(VRPCSTS) & 0x0070; + #ifdef CONFIG_TARGET_LUNA + if (reg_val == 0x30 && ABB_sleep_allowed) + #else if (reg_val == 0x30) + #endif { // start the SLPDLY counter in order to switch the ABB in sleep mode. This transmission sets IOTA sleep bit. ABB_WriteRegister(VRPCDEV, 0x02);