diff options
author | Pawit Pornkitprasan <p.pawit@gmail.com> | 2011-08-23 22:28:50 +0700 |
---|---|---|
committer | Pawit Pornkitprasan <p.pawit@gmail.com> | 2011-08-23 22:28:50 +0700 |
commit | 259752f4761b3464b1e3ad7dc224cf514dd9d7c3 (patch) | |
tree | 3ec98940308daee7d14eed0f3946123551e57926 /libaudio | |
parent | 7651208dec295359168910409a15f89317a0a984 (diff) | |
download | device_samsung_aries-common-259752f4761b3464b1e3ad7dc224cf514dd9d7c3.zip device_samsung_aries-common-259752f4761b3464b1e3ad7dc224cf514dd9d7c3.tar.gz device_samsung_aries-common-259752f4761b3464b1e3ad7dc224cf514dd9d7c3.tar.bz2 |
Allow FM radio to be used on non-mic headset
The value associated with 'fm_on' and 'fm_off' should not be checked
because the values are different for mic/non-mic headphones. (And
there are no other instances where these properties are set.)
Change-Id: I4c8eef2da554314045769a6ae5099e5c147699bb
Diffstat (limited to 'libaudio')
-rw-r--r-- | libaudio/AudioHardware.cpp | 65 |
1 files changed, 28 insertions, 37 deletions
diff --git a/libaudio/AudioHardware.cpp b/libaudio/AudioHardware.cpp index e0bbf28..939c54c 100644 --- a/libaudio/AudioHardware.cpp +++ b/libaudio/AudioHardware.cpp @@ -471,12 +471,6 @@ status_t AudioHardware::setParameters(const String8& keyValuePairs) const char TTY_MODE_VALUE_VCO[] = "tty_vco"; const char TTY_MODE_VALUE_HCO[] = "tty_hco"; const char TTY_MODE_VALUE_FULL[] = "tty_full"; -#ifdef HAVE_FM_RADIO - const char FM_RADIO_KEY_ON[] = "fm_on"; - const char FM_RADIO_KEY_OFF[] = "fm_off"; - const char FM_RADIO_VALUE_ON[] = "2055"; - const char FM_RADIO_VALUE_OFF[] = "7"; -#endif key = String8(BT_NREC_KEY); if (param.get(key, value) == NO_ERROR) { @@ -517,49 +511,45 @@ status_t AudioHardware::setParameters(const String8& keyValuePairs) #ifdef HAVE_FM_RADIO // fm radio on - key = String8(FM_RADIO_KEY_ON); + key = String8(AudioParameter::keyFmOn); if (param.get(key, value) == NO_ERROR) { - if (value == FM_RADIO_VALUE_ON) { - LOGV("AudioHardware::setParameters() Turning FM Radio ON"); - if (mMixer == NULL) { - openPcmOut_l(); - openMixer_l(); - setInputSource_l(AUDIO_SOURCE_DEFAULT); - } - if (mMixer != NULL) { - LOGV("AudioHardware::setParameters() FM Radio is ON, calling setFMRadioPath_l()"); - setFMRadioPath_l(mOutput->device()); - } + LOGV("AudioHardware::setParameters() Turning FM Radio ON"); + if (mMixer == NULL) { + openPcmOut_l(); + openMixer_l(); + setInputSource_l(AUDIO_SOURCE_DEFAULT); + } + if (mMixer != NULL) { + LOGV("AudioHardware::setParameters() FM Radio is ON, calling setFMRadioPath_l()"); + setFMRadioPath_l(mOutput->device()); } } - param.remove(String8(FM_RADIO_KEY_ON)); + param.remove(key); // fm radio off - key = String8(FM_RADIO_KEY_OFF); + key = String8(AudioParameter::keyFmOff); if (param.get(key, value) == NO_ERROR) { - if (value == FM_RADIO_VALUE_OFF) { - LOGV("AudioHardware::setParameters() Turning FM Radio OFF"); + LOGV("AudioHardware::setParameters() Turning FM Radio OFF"); - if (mMixer != NULL) { - TRACE_DRIVER_IN(DRV_MIXER_GET) - struct mixer_ctl *ctl= mixer_get_control(mMixer, "FM Radio Path", 0); - TRACE_DRIVER_OUT + if (mMixer != NULL) { + TRACE_DRIVER_IN(DRV_MIXER_GET) + struct mixer_ctl *ctl= mixer_get_control(mMixer, "FM Radio Path", 0); + TRACE_DRIVER_OUT - if (ctl != NULL) { - TRACE_DRIVER_IN(DRV_MIXER_SEL) - mixer_ctl_select(ctl, "FMR_MIX_OFF"); - TRACE_DRIVER_OUT + if (ctl != NULL) { + TRACE_DRIVER_IN(DRV_MIXER_SEL) + mixer_ctl_select(ctl, "FMR_MIX_OFF"); + TRACE_DRIVER_OUT - TRACE_DRIVER_IN(DRV_MIXER_SEL) - mixer_ctl_select(ctl, "FMR_OFF"); - TRACE_DRIVER_OUT - } - closeMixer_l(); - closePcmOut_l(); + TRACE_DRIVER_IN(DRV_MIXER_SEL) + mixer_ctl_select(ctl, "FMR_OFF"); + TRACE_DRIVER_OUT } + closeMixer_l(); + closePcmOut_l(); } } - param.remove(String8(FM_RADIO_KEY_OFF)); + param.remove(key); #endif return NO_ERROR; @@ -816,6 +806,7 @@ status_t AudioHardware::setFMRadioPath_l(uint32_t device) break; case AudioSystem::DEVICE_OUT_WIRED_HEADSET: + case AudioSystem::DEVICE_OUT_WIRED_HEADPHONE: LOGD("setFMRadioPath_l() fmradio headphone route"); fmpath = "FMR_HP"; break; |