# HG changeset patch # User Mychaela Falconia # Date 1603525194 0 # Node ID 7bf39f5e834dce759d48470e857a3233aa5f7141 # Parent 1876b5f8d9221568c15dd98ffec16451a946ab51 backlight control on Luna: switch PWL instead of LEDB This change is preliminary toward upcoming rework of backlight control logic in our UI firmware. LEDB does not exist on Tango-based platforms (it is not brought out on Tango modules), thus turning it on and off produces absolutely no effect beyond making L1 disable deep sleep when LEDB is turned on. However, both iWOW DSK and our upcoming FC Caramel2 boards have a PWL LED, so let's switch that LED on and off to indicate the state of the UI firmware's backlight control. Note that we are NOT switching the actual Luna LCD backlight here, even though it is trivially controlled with a GPIO. The reason for this seemingly strange choice is that we don't want to turn this development board LCD backlight off until we bring the higher-level backlight control logic up to par, including new logic to "swallow" the first keypress that turns on the darkened LCD. diff -r 1876b5f8d922 -r 7bf39f5e834d src/condat/com/src/driver/light.c --- a/src/condat/com/src/driver/light.c Fri Oct 23 06:08:25 2020 +0000 +++ b/src/condat/com/src/driver/light.c Sat Oct 24 07:39:54 2020 +0000 @@ -56,7 +56,9 @@ #endif +#include "main/sys_types.h" #include "fc-target.h" +#include "armio.h" /*==== EXPORT =====================================================*/ @@ -97,6 +99,11 @@ { backlight_status = LIGHT_STATUS_OFF; +#ifdef CONFIG_TARGET_LUNA + /* PWL module clock enable */ + *(volatile SYS_UWORD8 *)0xFFFE8001 = 0x01; +#endif + return DRV_OK; } @@ -142,15 +149,14 @@ { case LIGHT_STATUS_OFF: light_setBacklightOff(); -// Apr 26, 2005 REF : CRR 30627 xpradipg -#ifndef FF_MMI_SERVICES_MIGRATION +/* ancient code for C-Sample and earlier removed in FreeCalypso */ +#if 0 LT_Disable (); #endif break; default: light_setBacklightOn(); -// Apr 26, 2005 REF : CRR 30627 xpradipg -#ifndef FF_MMI_SERVICES_MIGRATION +#if 0 LT_Enable (); LT_Level (255); #endif @@ -254,12 +260,15 @@ { if (backLightState == BACKLIGHT_OFF) { - #ifdef CONFIG_TARGET_C139 - AI_SetBit(1); + #ifdef CONFIG_TARGET_LUNA + /* turn on PWL */ + *(volatile SYS_UWORD8 *)0xFFFE8000 = 255; + #else + #ifdef CONFIG_TARGET_C139 + AI_SetBit(1); + #endif + lls_switch_on(LLS_BACKLIGHT); //Switch backlight on #endif - //#ifdef DSAMPLE_COLOUR - lls_switch_on(LLS_BACKLIGHT); //Switch backlight on - //#endif } backLightState = BACKLIGHT_ON; } @@ -280,12 +289,15 @@ (backLightState == BACKLIGHT_IDLE1)) { backLightState = BACKLIGHT_OFF; - #ifdef CONFIG_TARGET_C139 - AI_ResetBit(1); + #ifdef CONFIG_TARGET_LUNA + /* turn off PWL */ + *(volatile SYS_UWORD8 *)0xFFFE8000 = 0; + #else + #ifdef CONFIG_TARGET_C139 + AI_ResetBit(1); + #endif + lls_switch_off(LLS_BACKLIGHT); //Switch backlight off #endif - //#ifdef DSAMPLE_COLOUR - lls_switch_off(LLS_BACKLIGHT); //Switch backlight on - //#endif } } /*******************************************************************************