summaryrefslogtreecommitdiffstats
path: root/jni
diff options
context:
space:
mode:
authorSatish Kodishala <skodisha@codeaurora.org>2014-04-06 02:43:03 +0530
committerSatish Kodishala <skodisha@codeaurora.org>2014-05-21 18:54:01 +0530
commit60ce44db389dcb748c618396996a98beaab70739 (patch)
tree91b6558190574fd4d29ee9a22080aac0855cf338 /jni
parent7fa19d58a347d27b67b8ae0048633e0c76605bce (diff)
downloadandroid_hardware_qcom_fm-60ce44db389dcb748c618396996a98beaab70739.tar.gz
android_hardware_qcom_fm-60ce44db389dcb748c618396996a98beaab70739.tar.bz2
android_hardware_qcom_fm-60ce44db389dcb748c618396996a98beaab70739.zip
FM: jni: Download patches to QCOM FM chips only.
Download patches to QCOM FM chips only. Change-Id: I621ebd0c2c45e44cdfed0539f9937a4940ee45d5
Diffstat (limited to 'jni')
-rw-r--r--jni/android_hardware_fm.cpp168
1 files changed, 99 insertions, 69 deletions
diff --git a/jni/android_hardware_fm.cpp b/jni/android_hardware_fm.cpp
index 46ae7c4..5954be8 100644
--- a/jni/android_hardware_fm.cpp
+++ b/jni/android_hardware_fm.cpp
@@ -103,28 +103,35 @@ static jint android_hardware_fmradio_FmReceiverJNI_acquireFdNative
} else {
return FM_JNI_FAILURE;
}
- /*Set the mode for soc downloader*/
- property_set("hw.fm.mode", "normal");
- /* Need to clear the hw.fm.init firstly */
- property_set("hw.fm.init", "0");
- property_set("ctl.start", "fm_dl");
- sched_yield();
- for(i=0; i<45; i++) {
- property_get("hw.fm.init", value, NULL);
- if (strcmp(value, "1") == 0) {
+
+ property_get("qcom.bluetooth.soc", value, NULL);
+
+ ALOGD("BT soc is %s\n", value);
+
+ if (strcmp(value, "rome") != 0)
+ {
+ /*Set the mode for soc downloader*/
+ property_set("hw.fm.mode", "normal");
+ /* Need to clear the hw.fm.init firstly */
+ property_set("hw.fm.init", "0");
+ property_set("ctl.start", "fm_dl");
+ sched_yield();
+ for(i=0; i<45; i++) {
+ property_get("hw.fm.init", value, NULL);
+ if (strcmp(value, "1") == 0) {
init_success = 1;
break;
- } else {
+ } else {
usleep(WAIT_TIMEOUT);
- }
- }
- ALOGE("init_success:%d after %f seconds \n", init_success, 0.2*i);
- if(!init_success) {
- property_set("ctl.stop", "fm_dl");
- // close the fd(power down)
-
- close(fd);
- return FM_JNI_FAILURE;
+ }
+ }
+ ALOGE("init_success:%d after %f seconds \n", init_success, 0.2*i);
+ if(!init_success) {
+ property_set("ctl.stop", "fm_dl");
+ // close the fd(power down)
+ close(fd);
+ return FM_JNI_FAILURE;
+ }
}
return fd;
}
@@ -135,9 +142,17 @@ static jint android_hardware_fmradio_FmReceiverJNI_closeFdNative
{
int i = 0;
int cleanup_success = 0;
- char value = 0, retval =0;
+ char retval =0;
+ char value[PROPERTY_VALUE_MAX] = {'\0'};
+
+ property_get("qcom.bluetooth.soc", value, NULL);
- property_set("ctl.stop", "fm_dl");
+ ALOGD("BT soc is %s\n", value);
+
+ if (strcmp(value, "rome") != 0)
+ {
+ property_set("ctl.stop", "fm_dl");
+ }
close(fd);
return FM_JNI_SUCCESS;
}
@@ -418,40 +433,48 @@ static jint android_hardware_fmradio_FmReceiverJNI_setNotchFilterNative(JNIEnv *
char notch[PROPERTY_VALUE_MAX] = {0x00};
struct v4l2_control control;
int err;
- /*Enable/Disable the WAN avoidance*/
- property_set("hw.fm.init", "0");
- if (aValue)
- property_set("hw.fm.mode", "wa_enable");
- else
- property_set("hw.fm.mode", "wa_disable");
-
- property_set("ctl.start", "fm_dl");
- sched_yield();
- for(i=0; i<10; i++) {
- property_get("hw.fm.init", value, NULL);
- if (strcmp(value, "1") == 0) {
- init_success = 1;
- break;
- } else {
- usleep(WAIT_TIMEOUT);
- }
- }
- ALOGE("init_success:%d after %f seconds \n", init_success, 0.2*i);
- property_get("notch.value", notch, NULL);
- ALOGE("Notch = %s",notch);
- if (!strncmp("HIGH",notch,strlen("HIGH")))
- control.value = HIGH_BAND;
- else if(!strncmp("LOW",notch,strlen("LOW")))
- control.value = LOW_BAND;
- else
- control.value = 0;
-
- ALOGE("Notch value : %d", control.value);
- control.id = id;
- err = ioctl(fd, VIDIOC_S_CTRL,&control );
- if(err < 0){
- return FM_JNI_FAILURE;
+ property_get("qcom.bluetooth.soc", value, NULL);
+
+ ALOGD("BT soc is %s\n", value);
+
+ if (strcmp(value, "rome") != 0)
+ {
+ /*Enable/Disable the WAN avoidance*/
+ property_set("hw.fm.init", "0");
+ if (aValue)
+ property_set("hw.fm.mode", "wa_enable");
+ else
+ property_set("hw.fm.mode", "wa_disable");
+
+ property_set("ctl.start", "fm_dl");
+ sched_yield();
+ for(i=0; i<10; i++) {
+ property_get("hw.fm.init", value, NULL);
+ if (strcmp(value, "1") == 0) {
+ init_success = 1;
+ break;
+ } else {
+ usleep(WAIT_TIMEOUT);
+ }
+ }
+ ALOGE("init_success:%d after %f seconds \n", init_success, 0.2*i);
+
+ property_get("notch.value", notch, NULL);
+ ALOGE("Notch = %s",notch);
+ if (!strncmp("HIGH",notch,strlen("HIGH")))
+ control.value = HIGH_BAND;
+ else if(!strncmp("LOW",notch,strlen("LOW")))
+ control.value = LOW_BAND;
+ else
+ control.value = 0;
+
+ ALOGE("Notch value : %d", control.value);
+ control.id = id;
+ err = ioctl(fd, VIDIOC_S_CTRL,&control );
+ if(err < 0){
+ return FM_JNI_FAILURE;
+ }
}
return FM_JNI_SUCCESS;
}
@@ -464,22 +487,29 @@ static jint android_hardware_fmradio_FmReceiverJNI_setAnalogModeNative(JNIEnv *
char value[PROPERTY_VALUE_MAX] = {'\0'};
char firmwareVersion[80];
- /*Enable/Disable Analog Mode FM*/
- property_set("hw.fm.init", "0");
- if (aValue) {
- property_set("hw.fm.isAnalog", "true");
- } else {
- property_set("hw.fm.isAnalog", "false");
- }
- property_set("hw.fm.mode","config_dac");
- property_set("ctl.start", "fm_dl");
- sched_yield();
- for(i=0; i<10; i++) {
- property_get("hw.fm.init", value, NULL);
- if (strcmp(value, "1") == 0) {
- return 1;
+ property_get("qcom.bluetooth.soc", value, NULL);
+
+ ALOGD("BT soc is %s\n", value);
+
+ if (strcmp(value, "rome") != 0)
+ {
+ /*Enable/Disable Analog Mode FM*/
+ property_set("hw.fm.init", "0");
+ if (aValue) {
+ property_set("hw.fm.isAnalog", "true");
} else {
- usleep(WAIT_TIMEOUT);
+ property_set("hw.fm.isAnalog", "false");
+ }
+ property_set("hw.fm.mode","config_dac");
+ property_set("ctl.start", "fm_dl");
+ sched_yield();
+ for(i=0; i<10; i++) {
+ property_get("hw.fm.init", value, NULL);
+ if (strcmp(value, "1") == 0) {
+ return 1;
+ } else {
+ usleep(WAIT_TIMEOUT);
+ }
}
}