summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRicardo Cerqueira <ricardo@cyngn.com>2014-11-04 15:14:08 +0000
committerEthan Chen <intervigil@gmail.com>2015-01-08 12:30:34 -0800
commit7dece93c2171d01e9354762722604814069256e9 (patch)
tree8ae5380c72e1e70419d16ca4b55d4edf57d66c06
parent4ed422967292dbe650485de81883e442ce320f47 (diff)
downloadandroid_hardware_qcom_fm-7dece93c2171d01e9354762722604814069256e9.tar.gz
android_hardware_qcom_fm-7dece93c2171d01e9354762722604814069256e9.tar.bz2
android_hardware_qcom_fm-7dece93c2171d01e9354762722604814069256e9.zip
jni: Skip loading FM firmware if requested
Not all boards require a firmware download for FM. Set TARGET_QCOM_NO_FM_FIRMWARE if the device doesn't require a fw image to run FM Change-Id: If18650af934f840a54f53fa9474a3341df0e3e68
-rw-r--r--jni/Android.mk4
-rw-r--r--jni/android_hardware_fm.cpp8
2 files changed, 12 insertions, 0 deletions
diff --git a/jni/Android.mk b/jni/Android.mk
index 97d5a7b..0fabbcc 100644
--- a/jni/Android.mk
+++ b/jni/Android.mk
@@ -19,5 +19,9 @@ LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
LOCAL_MODULE := libqcomfm_jni
LOCAL_MODULE_TAGS := optional
+ifeq ($(TARGET_QCOM_NO_FM_FIRMWARE),true)
+ LOCAL_CFLAGS += -DQCOM_NO_FM_FIRMWARE
+endif
+
include $(BUILD_SHARED_LIBRARY)
endif # is-vendor-board-platform
diff --git a/jni/android_hardware_fm.cpp b/jni/android_hardware_fm.cpp
index 8d2e610..230f2dd 100644
--- a/jni/android_hardware_fm.cpp
+++ b/jni/android_hardware_fm.cpp
@@ -114,6 +114,7 @@ static jint android_hardware_fmradio_FmReceiverJNI_acquireFdNative
/*Set the mode for soc downloader*/
property_set("hw.fm.mode", "normal");
/* Need to clear the hw.fm.init firstly */
+#ifndef QCOM_NO_FM_FIRMWARE
property_set("hw.fm.init", "0");
property_set("ctl.start", "fm_dl");
sched_yield();
@@ -134,6 +135,9 @@ static jint android_hardware_fmradio_FmReceiverJNI_acquireFdNative
return FM_JNI_FAILURE;
}
}
+#else
+ usleep(WAIT_TIMEOUT);
+#endif
return fd;
}
@@ -499,6 +503,7 @@ static jint android_hardware_fmradio_FmReceiverJNI_setNotchFilterNative(JNIEnv *
else
property_set("hw.fm.mode", "wa_disable");
+#ifndef QCOM_NO_FM_FIRMWARE
property_set("ctl.start", "fm_dl");
sched_yield();
for(i=0; i<10; i++) {
@@ -511,6 +516,9 @@ static jint android_hardware_fmradio_FmReceiverJNI_setNotchFilterNative(JNIEnv *
}
}
ALOGE("init_success:%d after %f seconds \n", init_success, 0.2*i);
+#else
+ usleep(WAIT_TIMEOUT);
+#endif
property_get("notch.value", notch, NULL);
ALOGE("Notch = %s",notch);