/** * a basic function fo AnalogClose, ckose analog power * @param DeviceType analog part power * @return status_t */ status_t AudioPlatformDevice::AnalogClose(AudioAnalogType::DEVICE_TYPE DeviceType) { ALOGD("AudioPlatformDevice AnalogClose DeviceType = %s", kAudioAnalogDeviceTypeName[DeviceType]); mLock.lock(); mBlockAttribute[DeviceType].mEnable = false; // here to open pmic digital part switch (DeviceType) { case AudioAnalogType::DEVICE_OUT_EARPIECER: case AudioAnalogType::DEVICE_OUT_EARPIECEL: mAudioAnalogReg->SetAnalogReg(ABB_AFE_CON0, 0x0000, 0x0001); // turn off DL // TopCtlChangeTrigger(); break; case AudioAnalogType::DEVICE_OUT_HEADSETR: case AudioAnalogType::DEVICE_OUT_HEADSETL: mAudioAnalogReg->SetAnalogReg(ABB_AFE_CON0, 0x0000, 0x0001); // turn off DL TopCtlChangeTrigger(); ALOGD("AnalogClose Reset mHpRightDcCalibration/mHpLeftDcCalibration from [0x%x] [0x%x]", mHpRightDcCalibration, mHpLeftDcCalibration); mAudioAnalogReg->SetAnalogReg(ABB_AFE_CON3, 0, 0xffff); // LCH cancel DC mAudioAnalogReg->SetAnalogReg(ABB_AFE_CON4, 0, 0xffff); // RCH cancel DC mAudioAnalogReg->SetAnalogReg(ABB_AFE_CON10, 0x0000, 0x0001); // enable DC cpmpensation DCChangeTrigger();//Trigger DC compensation break; case AudioAnalogType::DEVICE_OUT_SPEAKERR: case AudioAnalogType::DEVICE_OUT_SPEAKERL: #ifdef USING_EXTAMP_HP mLock.unlock(); AnalogClose(AudioAnalogType::DEVICE_OUT_HEADSETR); mLock.lock(); #else mLock.unlock(); AnalogClose(AudioAnalogType::DEVICE_OUT_EARPIECER); mLock.lock(); #endif break; case AudioAnalogType::DEVICE_OUT_SPEAKER_HEADSET_R: case AudioAnalogType::DEVICE_OUT_SPEAKER_HEADSET_L: mLock.unlock(); AnalogClose(AudioAnalogType::DEVICE_OUT_HEADSETR); mLock.lock(); break; case AudioAnalogType::DEVICE_IN_ADC1: case AudioAnalogType::DEVICE_IN_ADC2: mAudioAnalogReg->SetAnalogReg(ABB_AFE_CON0, 0x0000, 0x0002); // turn off UL // TopCtlChangeTrigger(); break; case AudioAnalogType::DEVICE_IN_DIGITAL_MIC: mAudioAnalogReg->SetAnalogReg(ABB_AFE_CON9, 0x0000, 0x0010); // disable digital mic mAudioAnalogReg->SetAnalogReg(ABB_AFE_CON0, 0x0000, 0x0002); // turn off UL // TopCtlChangeTrigger(); break; case AudioAnalogType::DEVICE_2IN1_SPK: if (IsAudioSupportFeature(AUDIO_SUPPORT_2IN1_SPEAKER)) { mLock.unlock(); AnalogClose(AudioAnalogType::DEVICE_OUT_EARPIECER); mLock.lock(); } break; } if (!GetDownLinkStatus() && !GetULinkStatus()) { mAudioAnalogReg->SetAnalogReg(TOP_CKPDN1_SET, 0x0100, 0x0100); // AUD 26M clock power down ALOGD("AudioPlatformDevice AnalogClose Power Down TOP_CKPDN1_SET"); } else { ALOGD("AudioPlatformDevice AnalogClose No Power Down TOP_CKPDN1_SET"); } mLock.unlock(); return NO_ERROR; }
/** * a basic function fo AnalogClose, ckose analog power * @param DeviceType analog part power * @return status_t */ status_t AudioPlatformDevice::AnalogClose(AudioAnalogType::DEVICE_TYPE DeviceType) { ALOGD("AudioPlatformDevice AnalogClose DeviceType = %s", kAudioAnalogDeviceTypeName[DeviceType]); mLock.lock (); mBlockAttribute[DeviceType].mEnable = false; // here to open pmic digital part switch(DeviceType) { case AudioAnalogType::DEVICE_OUT_EARPIECER: case AudioAnalogType::DEVICE_OUT_EARPIECEL: mAudioAnalogReg->SetAnalogReg(0x4022,0x00cc,0xffff); mAudioAnalogReg->SetAnalogReg(0x4004,0x1800,0xffff); if(GetULinkStatus() == false){ mAudioAnalogReg->SetAnalogReg(0x4000,0x0000,0xffff); } break; case AudioAnalogType::DEVICE_OUT_HEADSETR: case AudioAnalogType::DEVICE_OUT_HEADSETL: mAudioAnalogReg->SetAnalogReg(0x4022, 0x00cc, 0xffff); mAudioAnalogReg->SetAnalogReg(0x4004, 0x1800, 0xffff); if(GetULinkStatus() == false){ mAudioAnalogReg->SetAnalogReg(0x4000,0x0000,0xffff); } break; case AudioAnalogType::DEVICE_OUT_SPEAKERR: case AudioAnalogType::DEVICE_OUT_SPEAKERL: #ifdef USING_EXTAMP_HP mLock.unlock (); AnalogClose(AudioAnalogType::DEVICE_OUT_HEADSETR); mLock.lock (); #else mAudioAnalogReg->SetAnalogReg(0x4022, 0x00cc, 0xffff); mAudioAnalogReg->SetAnalogReg(0x4004, 0x1800, 0xffff); if(GetULinkStatus() == false){ mAudioAnalogReg->SetAnalogReg(0x4000,0x0000,0xffff); } mAudioAnalogReg->SetAnalogReg(0x0104 , 0x0604, 0xffff); #endif break; case AudioAnalogType::DEVICE_2IN1_SPK: mAudioAnalogReg->SetAnalogReg(0x4022, 0x00cc, 0xffff); mAudioAnalogReg->SetAnalogReg(0x4004, 0x1800, 0xffff); if(GetULinkStatus() == false){ mAudioAnalogReg->SetAnalogReg(0x4000,0x0000,0xffff); } break; case AudioAnalogType::DEVICE_OUT_SPEAKER_HEADSET_R: case AudioAnalogType::DEVICE_OUT_SPEAKER_HEADSET_L: mAudioAnalogReg->SetAnalogReg(0x4022, 0x00cc, 0xffff); mAudioAnalogReg->SetAnalogReg(0x4004, 0x1800, 0xffff); if(GetULinkStatus() == false){ mAudioAnalogReg->SetAnalogReg(0x4000,0x0000,0xffff); } mAudioAnalogReg->SetAnalogReg(0x0104 , 0x0604, 0xffff); break; case AudioAnalogType::DEVICE_IN_ADC1: case AudioAnalogType::DEVICE_IN_ADC2: mAudioAnalogReg->SetAnalogReg(0x4020 , 0x004c, 0xffff); mAudioAnalogReg->SetAnalogReg(0x4010 , 0x0000, 0xffff); if(GetDownLinkStatus() == false){ mAudioAnalogReg->SetAnalogReg(0x4000,0x0000,0xffff); } break; case AudioAnalogType::DEVICE_IN_DIGITAL_MIC: mAudioAnalogReg->SetAnalogReg(0x400e , 0x0000, 0xffff); mAudioAnalogReg->SetAnalogReg(0x4010 , 0x0000, 0xffff); if(GetDownLinkStatus() == false){ mAudioAnalogReg->SetAnalogReg(0x4000,0x0000,0xffff); } break; } mLock.unlock (); return NO_ERROR; }