diff --git a/fmapp2/src/com/caf/fmradio/FMRadioService.java b/fmapp2/src/com/caf/fmradio/FMRadioService.java index 5744d961cd91bf1d230877952235d1048df27f83..7f6775b8eb231598d586eca307aaf405fbf027f9 100644 --- a/fmapp2/src/com/caf/fmradio/FMRadioService.java +++ b/fmapp2/src/com/caf/fmradio/FMRadioService.java @@ -219,6 +219,7 @@ public class FMRadioService extends Service private static final int FM_OFF_FROM_APPLICATION = 1; private static final int FM_OFF_FROM_ANTENNA = 2; private static final int RADIO_TIMEOUT = 1500; + private static final int RESET_SLIMBUS_DATA_PORT = 1; private static Object mNotchFilterLock = new Object(); @@ -1596,6 +1597,7 @@ public class FMRadioService extends Service switch (msg.arg1) { case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT: Log.v(LOGTAG, "AudioFocus: received AUDIOFOCUS_LOSS_TRANSIENT"); + mReceiver.EnableSlimbus(RESET_SLIMBUS_DATA_PORT); if (true == isFmRecordingOn()) stopRecording(); case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK: @@ -1608,6 +1610,8 @@ public class FMRadioService extends Service case AudioManager.AUDIOFOCUS_LOSS: Log.v(LOGTAG, "AudioFocus: received AUDIOFOCUS_LOSS"); //intentional fall through. + mReceiver.EnableSlimbus(RESET_SLIMBUS_DATA_PORT); + if (mSpeakerPhoneOn) { mSpeakerDisableHandler.removeCallbacks(mSpeakerDisableTask); mSpeakerDisableHandler.postDelayed(mSpeakerDisableTask, 0); diff --git a/helium/radio-helium-commands.h b/helium/radio-helium-commands.h index c5dfba9f701acdb637661ef5d879d2c4f4733acb..46ed6513e779a6c6e9c514ffd42826254101fb33 100644 --- a/helium/radio-helium-commands.h +++ b/helium/radio-helium-commands.h @@ -115,5 +115,8 @@ enum helium_cmd_t { HCI_FM_HELIUM_AUDIO_MODE, HCI_FM_HELIUM_RMSSI, HCI_FM_HELIUM_AUDIO_MUTE, + + /*FM VSC command to enable/disable slimbus data port*/ + HCI_FM_HELIUM_AUDIO = 0x00980940, }; #endif /* __RADIO_CHEROKEE_COMMANDS_H */ diff --git a/helium/radio-helium.h b/helium/radio-helium.h index 070dafadfb492947b8834df0814009e1a05f11e8..200e006a5a3ade465a11cedef393c2479d256dc1 100644 --- a/helium/radio-helium.h +++ b/helium/radio-helium.h @@ -245,6 +245,7 @@ typedef struct { #define HCI_OCF_FM_RDS_RT_REQ 0x0008 #define HCI_OCF_FM_RDS_PS_REQ 0x0009 +#define HCI_OCF_FM_ENABLE_SLIMBUS (0x000E) /* HCI common control commands opcode */ #define HCI_OCF_FM_TUNE_STATION_REQ 0x0001 @@ -1231,6 +1232,7 @@ int hci_fm_enable_lpf(int enable); int hci_fm_default_data_write_req(struct hci_fm_def_data_wr_req * data_wrt); int hci_fm_get_station_dbg_param_req(); int hci_fm_get_station_cmd_param_req(); +int hci_fm_enable_slimbus(uint8_t enable); struct fm_hal_t { struct radio_helium_device *radio; diff --git a/helium/radio_helium_hal.c b/helium/radio_helium_hal.c index 742f0512a28473a614a429701a37c2dd596beddc..86725136f539d775c60aa11cd097bc1c74f89137 100644 --- a/helium/radio_helium_hal.c +++ b/helium/radio_helium_hal.c @@ -1604,6 +1604,10 @@ static int set_fm_ctrl(int cmd, int val) ALOGI("%s: command sent sucessfully", __func__, val); } break; + case HCI_FM_HELIUM_AUDIO: + ALOGE("%s slimbus port", val ? "enable" : "disable"); + ret = hci_fm_enable_slimbus(val); + break; default: ALOGE("%s:%s: Not a valid FM CMD!!", LOG_TAG, __func__); ret = 0; diff --git a/helium/radio_helium_hal_cmds.c b/helium/radio_helium_hal_cmds.c index 520ec12793719c8fa40b1506623738900dbd1c99..b783c537933aaebc0e97aeaf80cfe35da5fc8789 100644 --- a/helium/radio_helium_hal_cmds.c +++ b/helium/radio_helium_hal_cmds.c @@ -461,3 +461,13 @@ int hci_fm_enable_lpf(int enable) HCI_OCF_FM_LOW_PASS_FILTER_CTRL); return send_fm_cmd_pkt(opcode, sizeof(enable_lpf), &enable_lpf); } +int hci_fm_enable_slimbus(uint8_t val) { + ALOGE("%s", __func__); + uint16_t opcode = 0; + + opcode = hci_opcode_pack(HCI_OGF_FM_DIAGNOSTIC_CMD_REQ, + HCI_OCF_FM_ENABLE_SLIMBUS); + + ALOGE("%s:val = %d, uint8 val = %d", __func__, val, (uint8_t)val); + return send_fm_cmd_pkt(opcode , sizeof(val), &val); +} diff --git a/jni/FmConst.h b/jni/FmConst.h index 26eb616fa09aeda9b0a9a05fa9dc2cdd2ec759e5..e37160fd69ded1ff8609bd796ecb0963fd97469e 100644 --- a/jni/FmConst.h +++ b/jni/FmConst.h @@ -153,6 +153,8 @@ enum FM_V4L2_PRV_CONTROLS V4L2_CID_PRV_IRIS_LOWER_BAND, V4L2_CID_PRV_IRIS_AUDIO_MODE, V4L2_CID_PRV_IRIS_RMSSI, + + V4L2_CID_PRV_ENABLE_SLIMBUS = 0x00980940, }; #endif diff --git a/jni/android_hardware_fm.cpp b/jni/android_hardware_fm.cpp index b5b0a5edbb71bd669a71f4e54312a7019fcddb57..05990020375a45c66c3f83be7d5ba259deae63db 100644 --- a/jni/android_hardware_fm.cpp +++ b/jni/android_hardware_fm.cpp @@ -1498,6 +1498,15 @@ static jint android_hardware_fmradio_FmReceiverJNI_setSpurDataNative return FM_JNI_SUCCESS; } +static jint android_hardware_fmradio_FmReceiverJNI_enableSlimbusNative + (JNIEnv * env, jobject thiz, jint fd, jint val) +{ + ALOGD("%s: val = %d\n", __func__, val); + int err = JNI_ERR; + err = vendor_interface->set_fm_ctrl(V4L2_CID_PRV_ENABLE_SLIMBUS, val); + return err; +} + static void classInitNative(JNIEnv* env, jclass clazz) { ALOGI("ClassInit native called \n"); @@ -1644,6 +1653,8 @@ static JNINativeMethod gMethods[] = { (void*)android_hardware_fmradio_FmReceiverJNI_setSpurDataNative}, { "configurePerformanceParams", "(I)V", (void*)android_hardware_fmradio_FmReceiverJNI_configurePerformanceParams}, + { "enableSlimbus", "(II)I", + (void*)android_hardware_fmradio_FmReceiverJNI_enableSlimbusNative}, }; int register_android_hardware_fm_fmradio(JNIEnv* env) diff --git a/qcom/fmradio/FmReceiver.java b/qcom/fmradio/FmReceiver.java index af7191a8bf15ffdc9c427cf6e6760f464c8f7e12..b15d512bd99afe0a716eaae87e946069a9d53a00 100644 --- a/qcom/fmradio/FmReceiver.java +++ b/qcom/fmradio/FmReceiver.java @@ -2974,7 +2974,7 @@ public class FmReceiver extends FmTransceiver case TelephonyManager.NETWORK_TYPE_UMTS: if ((mEnableLpfUmts & RatConf) == mEnableLpfUmts ) { Log.v (TAG, "set LPF for net_type: " + Integer.toString(net_type)); - Log.v (TAG, "enable:" + enable); + Log.v (TAG, "enable:" + enable); mControl.enableLPF(sFd, enable); } break; @@ -3079,4 +3079,8 @@ public class FmReceiver extends FmTransceiver break; } } + public void EnableSlimbus(int enable) { + Log.d(TAG, "EnableSlimbus :enable =" + enable); + mControl.enableSlimbus(sFd, enable); + } } diff --git a/qcom/fmradio/FmReceiverJNI.java b/qcom/fmradio/FmReceiverJNI.java index c5835ff674d75a571e5915fda74f7790f9567e4b..d9fa79aaa582077661e8c9e399eb215952880fa8 100644 --- a/qcom/fmradio/FmReceiverJNI.java +++ b/qcom/fmradio/FmReceiverJNI.java @@ -547,4 +547,5 @@ class FmReceiverJNI { */ static native int setSpurDataNative(int fd, short buff[], int len); static native void configurePerformanceParams(int fd); + static native int enableSlimbus(int fd, int val); } diff --git a/qcom/fmradio/FmRxControls.java b/qcom/fmradio/FmRxControls.java index 7b9fb7cc3be90fb4139bbd3eb24e7f2e02d9c354..a3eba2adb97f26d7044ff370a4fba37f2fb60d88 100644 --- a/qcom/fmradio/FmRxControls.java +++ b/qcom/fmradio/FmRxControls.java @@ -786,4 +786,13 @@ class FmRxControls return true; } } + public boolean enableSlimbus(int fd, int enable) { + int ret; + Log.d(TAG, "enableSlimbus : enable = " + enable); + ret = FmReceiverJNI.enableSlimbus(fd, enable); + if (ret == 0) + return true; + else + return false; + } }