📄 am_hw_primitive_builder_power.cc
字号:
/* (c) Copyright Motorola 1998-2006, All rights reserved. Motorola Confidential Proprietary Contains confidential proprietary information of Motorola, Inc. Reverse engineering is prohibited. The copyright notice does not imply publication. DESCRIPTION: File handles phone power related issues. *************** REVISION HISTORY ********************************************* Date Author Reference ======== ======== ========================== 2005-12-13 w16355 CR - LIBhh59411 AUL stereo DAC can take up to 160ms to fully power up. 2005-09-13 w16355 CR - LIBgg56718 Pebble DAI stops working when Volume is adjusted. 2005-07-25 w16355 CR - LIBgg35198 AM needs to minimize chgs between audio events. 2005-06-23 w16355 CR - LIBgg36361 Need additional logging capabilities. 2004-10-20 w16355 CR - LIBff17193 Extra click sound when scrolling through sounds. 04-07-13 w18944 CR - LIBee28697 Noise when setting AUD_LOW_PWR with bluetooth 04-06-15 w18944 CR - LIBee21933 Don't set AUDIO_LOW_PWER when EMU audio accessories are connected 04-06-07 w18944 CR - LIBee06612 PCAP2: set/clear AUDIO_LOW_POWER 00-08-09 mtaraba CR - CSGce55882 Eliminate file gsm.h from audio manager 99-01-22 blamers CR - CSGce27265 AM-DSP Queue Loses Commands - Check the Audio Queue before adding the DSP Command 98-03-26 mkloza PR - CSGce17807 Low Power mode function(s) - initial file creation*//************** INCLUDES ******************************************************/#include <audio/am_globals.h>#include <ENGINE_AUDIO/am_util_bits.h>#include <audio/AM_HW_Primitive_Builder.H>#include <audio/AM_HW_String_Primitive.H>#include <ENGINE_AUDIO/am_hw_string_primitive.h>#include <ENGINE_AUDIO/aud_interface.h>#include <SYNERGY_DEVICE_LAYER/dl_acc_auf.h>#include <ENGINE_HAPI/hapi_portlist.h>#include <ENGINE_HAPI/hapi_cap_bit.h>/************** LOCAL CONSTANTS ***********************************************/#define PCAP2_PHONE_CODEC_DELAY 100#define AUL_PHONE_CODEC_DELAY 100#define AUL_STEREO_DAC_DELAY 200/************** LOCAL STRUCTURES, ENUMS, AND TYPEDEFS *************************//************** LOCAL FUNCTION PROTOTYPES *************************************//************** LOCAL MACROS **************************************************//************** LOCAL VARIABLES ***********************************************/extern SU_SEMA_HANDLE sem_low_power;/************** FUNCTION DEFINITIONS ******************************************//* DESCRIPTION: Put phone in or out of a low power mode INPUTS: BOOL power - TRUE does not do anything - FALSE puts phone in low power mode OUTPUTS: none IMPORTANT NOTES: Any primitive sent to DSP ( other than one to put it in low power mode ) would take DSP out of the low power mode. */voidAM_HW_Primitive_Builder :: activate_power ( BOOL power, UINT8 am_hw_codec_mode ){ // Determine the type of audio/power IC that is in this phone. static UINT8 am_audio_power_ic = HAPI_get_power_ic_type(); static BOOL am_audio_power_first_time = TRUE; HAPI_CAP_REG register_selection; HAPI_CAP_MSG register_value; HAPI_CAP_MSG register_mask; //------------------------------- 1 --------------------------------------- /* False indicates that the phone is to be put into low power mode ... */ if( power == FALSE ) { /* set global indication that AM is now capable of deep sleep state */ set_bit(am_global, AM_AUDIO_DEEP_SLEEP_CAPABLE); #if (MAKE_HDW_EMU_BUS == TRUE) /* Don't set the low_power bit high when an EMU audio accessory * is connected. If done, the send/end on the headset won't work * because the 1.4V dc bias needed to operate the Send/End switch * inside headset will be disabled. */ if ( DL_AccGetConnectionStatus( DL_ACC_DM_HEADSET ) == FALSE ) #endif { if ( am_audio_power_ic == HAPI_POWER_IC_TYPE_AUL ) { // HAPI_AUL_REG_AUDRX0 - AUL REGISTER 36 / 0x24. register_selection = HAPI_AUL_REG_AUDRX0; register_value = 0x00000000; register_mask = 0x00000000; register_mask |= ( AUL_SET_VAUDIOON ); // Bit 0 register_mask |= ( AUL_SET_AUD_BIAS_EN ); // Bit 1 // Since register_value was cleared, and the VAUDIOON and AUL_BIAS_EN // bits were set, the call below will turn off the AUL audio block. am_log_hapi_cap_update_reg( register_selection, register_value, register_mask ); } else if ( am_audio_power_ic == HAPI_POWER_IC_TYPE_PCAP ) { // For PCAP2, the call below turns off the AUD_BIAS_EN signal. aud_hPortWrite( HAPI_AUDIO_LOW_PWR, HAPI_SIGNAL_ENABLE, AM_HW_AUDIO_LOW_PWR ); } /* PCAP is in master mode and supplies FSYNC and BITCLK to Bluetooth. * Setting AUD_LOW_PWR disables the clocks. We need to re-enable after * setting AUD_LOW_PWR */ if (DL_AccGetConnectionStatus( DL_ACC_DM_BT_HEADSET) || DL_AccGetConnectionStatus( DL_ACC_DM_BT_HANDSFREE)) { aud_hPortWrite( HAPI_CODEC_EN, HAPI_SIGNAL_ENABLE, AM_HW_CODEC_EN ); } } } else /* Power up the audio chip so we can play audio. */ { HAPI_DATA_T am_hapi_return_status = 0; dsp_awake = TRUE; /* clear global indication that AM is capable of deep sleep state */ clear_bit( am_global, AM_AUDIO_DEEP_SLEEP_CAPABLE ); // Read the current state of the low power bit. am_hapi_return_status = hPortRead( HAPI_AUDIO_LOW_PWR ); // We don't want to have to wait for PCAP2/ATLAS // to power up if it's already powered up. if ( am_hapi_return_status == HAPI_SIGNAL_ENABLE ) { if ( am_audio_power_ic == HAPI_POWER_IC_TYPE_AUL ) { if ( am_audio_power_first_time == TRUE ) { // HAPI_AUL_REG_SSI - AUL REGISTER 39 / 0x27. register_selection = HAPI_AUL_REG_SSI; register_mask = 0x00000000; register_value = 0x00000000; // Initialize these to off! register_mask |= ( AUL_SET_BCLK0 ); // Bit 12 register_mask |= ( AUL_SET_BCLK1 ); // Bit 13 am_log_hapi_cap_update_reg( register_selection, register_value, register_mask ); // HAPI_AUL_REG_AUDRX0 - AUL REGISTER 36 / 0x24. register_selection = HAPI_AUL_REG_AUDRX0; register_mask = 0x00000000; register_value = 0x00000000; // This is done to guarantee that the audio block in AUL is // always powered up slowly to prevent pops and missing audio. // A value of zero (set by the initialization above) will // power up the AUL slowly. register_mask |= ( AUL_SET_AUD_BIAS_FAST ); // Bit 2 am_log_hapi_cap_update_reg( register_selection, register_value, register_mask ); am_audio_power_first_time = FALSE; } // HAPI_AUL_REG_AUDRX0 - AUL REGISTER 36 / 0x24. register_selection = HAPI_AUL_REG_AUDRX0; register_mask = 0x00000000; register_value = 0x00000000; register_mask |= ( AUL_SET_VAUDIOON ); // Bit 0 register_mask |= ( AUL_SET_AUD_BIAS_EN ); // Bit 1 register_value |= ( AUL_SET_VAUDIOON ); // Bit 0 register_value |= ( AUL_SET_AUD_BIAS_EN ); // Bit 1 am_log_hapi_cap_update_reg( register_selection, register_value, register_mask ); //----------------------------- 2 ------------------------------ // The stereo dac and phone codec need to be fully // powered up before we can configure their registers! if ( am_hw_codec_mode == STEREO_CODEC ) { suSleep( AUL_STEREO_DAC_DELAY, NULL ); } else { suSleep( AUL_PHONE_CODEC_DELAY, NULL ); } } else if ( am_audio_power_ic == HAPI_POWER_IC_TYPE_PCAP ) { // Set a bit to power up the audio power IC. aud_hPortWrite( HAPI_AUDIO_LOW_PWR, HAPI_SIGNAL_DISABLE, AM_HW_AUDIO_LOW_PWR ); suSleep( PCAP2_PHONE_CODEC_DELAY, NULL ); } } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -