static void android_hardware_fmradio_FmReceiverJNI_configurePerformanceParams
    (JNIEnv * env, jobject thiz, jint fd)
{

     ConfigFmThs thsObj;

     thsObj.SetRxSearchAfThs(FM_PERFORMANCE_PARAMS, fd);
}
//Downlaod FM SOC Patches
//Turn On FM Chip
//return FM_FAILURE on failure FM_SUCCESS
//on success
int FmRadioController_qcom :: Initialise
(
)
{
    int ret;
    struct timespec ts;
    ConfigFmThs thsObj;

    if(cur_fm_state == FM_OFF) {
        set_fm_state(FM_ON_IN_PROGRESS);
        fd_driver = open(FM_DEVICE_PATH, O_RDONLY, O_NONBLOCK);
        if(fd_driver < 0) {
            ALOGE("FM kernel driver file open failed: %d\n", fd_driver);
            set_fm_state(FM_OFF);
            return FM_FAILURE;
        }
        ret = QcomFmIoctlsInterface::start_fm_patch_dl(fd_driver);
        if(ret != FM_SUCCESS) {
            ALOGE("FM patch downloader failed: %d\n", ret);
            close(fd_driver);
            fd_driver = -1;
            set_fm_state(FM_OFF);
            return FM_FAILURE;
        }
        if(event_listener_thread == 0) {
           ret = pthread_create(&event_listener_thread, NULL,
                               handle_events, this);
           if(ret == 0) {
              ALOGI("Lock the mutex for FM turn on cond\n");
              pthread_mutex_lock(&mutex_turn_on_cond);
              ts = set_time_out(READY_EVENT_TIMEOUT);
              ret = QcomFmIoctlsInterface::set_control(fd_driver,
                               V4L2_CID_PRV_STATE, FM_RX);
              if(ret == FM_SUCCESS) {
                 ALOGI("Waiting for timedout or FM on\n");
                 pthread_cond_timedwait(&turn_on_cond, &mutex_turn_on_cond, &ts);
                 ALOGI("Unlocked the mutex and timedout or condition satisfied\n");
                 pthread_mutex_unlock(&mutex_turn_on_cond);
                 if(cur_fm_state == FM_ON) {
                    thsObj.SetRxSearchAfThs(FM_PERFORMANCE_PARAMS, fd_driver);
                    return FM_SUCCESS;
                 }else {
                    QcomFmIoctlsInterface::set_control(fd_driver,
                                    V4L2_CID_PRV_STATE, FM_DEV_NONE);
                    event_listener_canceled = true;
                    pthread_join(event_listener_thread, NULL);
                    close(fd_driver);
                    fd_driver = -1;
                    set_fm_state(FM_OFF);
                    return FM_FAILURE;
                 }
              }else {
                 ALOGE("Set FM on control failed\n");
                 pthread_mutex_unlock(&mutex_turn_on_cond);
                 ALOGI("Unlocked the FM on cond mutex\n");
                 event_listener_canceled = true;
                 pthread_join(event_listener_thread, NULL);
                 close(fd_driver);
                 fd_driver = -1;
                 set_fm_state(FM_OFF);
                 return FM_FAILURE;
              }
           }else {
              ALOGE("FM event listener thread failed: %d\n", ret);
              set_fm_state(FM_OFF);
              return FM_FAILURE;
           }
        }else {
           return FM_SUCCESS;
        }
    }else if(cur_fm_state != FM_ON_IN_PROGRESS) {
        return FM_SUCCESS;
    }else {
        return FM_FAILURE;
    }
}