Example #1
0
//------------------------------------------------------------------------------
//
//  Function:  disable_lcd_backlight
//
//  This function disables the backlight for the LCD controller
//
UINT32 disable_lcd_backlight( void )
{
    HANDLE hTwl;

     //OALMSG(OAL_INFO, (L"disable_lcd_backlight+\r\n"));
    // Enable LEDA on TPS659XX
    hTwl = TWLOpen();

#ifdef BSP_EVM2
	if(!IsLVDSMode())
		TWLWriteByteReg(hTwl, TWL_LEDEN, 0x00);
#else
    // The hardware design is completely backwards.  In order
    // to disable the LED control signal, the LEDPWM signal must 
    // be enabled 100%
    // Set LEDAON, LEDAPWM
    TWLWriteByteReg(hTwl, TWL_LEDEN, 0x11);
    // Set PWM registers to same value to trigger 100% duty cycle
    TWLWriteByteReg(hTwl, TWL_PWMAOFF, 0x00);
    TWLWriteByteReg(hTwl, TWL_PWMAON, 0x00);
#endif
    
    TWLClose(hTwl);
     //OALMSG(OAL_INFO, (L"disable_lcd_backlight-\r\n"));
    return ERROR_SUCCESS;
}
Example #2
0
//------------------------------------------------------------------------------
//
//  Function:  enable_lcd_backlight
//
//  This function enables the backlight for the LCD controller
//
UINT32 enable_lcd_backlight( void )
{
    void* hTwl;
    
     //OALMSG(OAL_INFO, (L"enable_lcd_backlight+\r\n"));

    // Enable LEDA on TPS659XX
    hTwl = TWLOpen();

#ifdef BSP_EVM2
    TWLWriteByteReg(hTwl, TWL_LEDEN, 0x11);
    // Set PWM registers to same value to trigger 100% duty cycle
    //TWLWriteByteReg(hTwl, TWL_PWMAOFF, 0x00);
    //TWLWriteByteReg(hTwl, TWL_PWMAON, 0x00);
	if(!IsLVDSMode())
	{
		TWLWriteByteReg(hTwl, TWL_PWMAOFF, 0x20);
		TWLWriteByteReg(hTwl, TWL_PWMAON, 0x01);
	}
	else
	{
		TWLWriteByteReg(hTwl, TWL_PWMAOFF, 0x7F);
		TWLWriteByteReg(hTwl, TWL_PWMAON, 0x7E);
	}
#else
    // The hardware design is completely backwards.  
    // In order to get 100% brightness, the LEDPWM must 
    // be disabled.
    // Clear LEDAON, LEDAPWM
    TWLWriteByteReg(hTwl, TWL_LEDEN, 0x00);
#endif    
    TWLClose(hTwl);
    
     //OALMSG(OAL_INFO, (L"enable_lcd_backlight-\r\n"));
    return ERROR_SUCCESS;
}
Example #3
0
//------------------------------------------------------------------------------
//
//  Function:  KPD_Deinit
//
//  Called by device manager to uninitialize device.
//
BOOL KPD_Deinit(DWORD context)
{
    BOOL rc = FALSE;
    KeypadDevice_t *pDevice = (KeypadDevice_t*)context;


    DEBUGMSG(ZONE_FUNCTION, (L"+KPD_Deinit(0x%08x)\r\n", context));

    // Check if we get correct context
    if ((pDevice == NULL) || (pDevice->cookie != KPD_DEVICE_COOKIE))
        {
        DEBUGMSG (ZONE_ERROR, (L"ERROR: KPD_Deinit: "
            L"Incorrect context parameter\r\n"
            ));
        goto cleanUp;
        }

    // Signal stop to threads
    pDevice->intrThreadExit = TRUE;
        
    // Close interrupt thread
    if (pDevice->hIntrThreadKeypad != NULL)
        {
        // Set event to wake it
        SetEvent(pDevice->hIntrEventKeypad);
        // Wait until thread exits
        WaitForSingleObject(pDevice->hIntrThreadKeypad, INFINITE);
        // Close handle
        CloseHandle(pDevice->hIntrThreadKeypad);
        }

    // Close interrupt thread
    if( pDevice->hLightThread )
            {
            // Set event to wake it
        SetEvent(pDevice->hKeypressEvent);
            // Wait until thread exits
        WaitForSingleObject(pDevice->hLightThread, INFINITE);
            // Close handle
        CloseHandle(pDevice->hLightThread);
        }


    // Close TWL driver
    if (pDevice->hTWL != NULL)
        {
        TWLInterruptMask(pDevice->hTWL, TWL_INTR_ITKPI, TRUE);
        
        if (pDevice->hIntrEventKeypad != NULL)
            {
            TWLInterruptDisable(pDevice->hTWL, TWL_INTR_ITKPI);
            }
        
        TWLClose(pDevice->hTWL);
        }

    // Close interrupt handler
    if (pDevice->hIntrEventKeypad != NULL) CloseHandle(pDevice->hIntrEventKeypad);
    if (pDevice->hKeypressEvent != NULL) CloseHandle(pDevice->hKeypressEvent);
    // Free device structure
    LocalFree(pDevice);

    // Done
    rc = TRUE;

cleanUp:
    DEBUGMSG(ZONE_FUNCTION, (L"-KPD_Deinit(rc = %d)\r\n", rc));
    return rc;
}