libfmjni: 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
jni: Confine the firmware-load skipping to the actual loading
Change If18650af934f840a54f53fa9474a3341df0e3e68 removed the
property-setting steps from the initialization routine. Bring it
back, as we may want to use those properties to trigger module
state changes from init. The recommended flow for devices with
the latest IRIS driver is the following:
on property:vendor.hw.fm.init=0
write /sys/module/radio_iris_transport/parameters/fmsmd_set 0
on property:vendor.hw.fm.init=1
write /sys/module/radio_iris_transport/parameters/fmsmd_set 1
Change-Id: Ifddf678398fec2e4bfa9688c044da7d75898e056
diff --git a/Android.mk b/Android.mk
index 901bdda..d8b2dfe 100644
--- a/Android.mk
+++ b/Android.mk
@@ -24,6 +24,11 @@
#LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
#LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
+
+ifeq ($(TARGET_QCOM_NO_FM_FIRMWARE),true)
+ LOCAL_CFLAGS += -DQCOM_NO_FM_FIRMWARE
+endif
+
LOCAL_MODULE := libfmjni
include $(BUILD_SHARED_LIBRARY)
diff --git a/FmIoctlsInterface.cpp b/FmIoctlsInterface.cpp
index fbe035c..7c40886 100644
--- a/FmIoctlsInterface.cpp
+++ b/FmIoctlsInterface.cpp
@@ -46,7 +46,9 @@
int ret;
int init_success = 0;
char versionStr[MAX_VER_STR_LEN] = {'\0'};
+#ifndef QCOM_NO_FM_FIRMWARE
char prop_value[PROPERTY_VALUE_MAX] = {'\0'};
+#endif
struct v4l2_capability cap;
ALOGE("start_fm_patch_dl = %d\n",fd);
@@ -69,6 +71,7 @@
ALOGE("set FM_INIT_PROP done");
if(ret != PROP_SET_SUCC)
return FM_FAILURE;
+#ifndef QCOM_NO_FM_FIRMWARE
ret = property_set(SCRIPT_START_PROP, SOC_PATCH_DL_SCRPT);
if(ret != PROP_SET_SUCC)
return FM_FAILURE;
@@ -81,6 +84,13 @@
usleep(INIT_WAIT_TIMEOUT);
}
}
+#else
+ ret = property_set(FM_INIT_PROP, "1");
+ usleep(INIT_WAIT_TIMEOUT);
+ if(ret != PROP_SET_SUCC)
+ return FM_FAILURE;
+ init_success = 1;
+#endif
if(!init_success) {
property_set(SCRIPT_STOP_PROP, SOC_PATCH_DL_SCRPT);
return FM_FAILURE;
@@ -98,6 +108,7 @@
void
)
{
+#ifndef QCOM_NO_FM_FIRMWARE
int ret;
ret = property_set(SCRIPT_STOP_PROP, SOC_PATCH_DL_SCRPT);
@@ -106,6 +117,9 @@
}else {
return FM_SUCCESS;
}
+#else
+ return FM_SUCCESS;
+#endif
}
int FmIoctlsInterface :: get_cur_freq
@@ -167,9 +181,10 @@
int FmIoctlsInterface :: set_calibration
(
- UINT fd
+ UINT fd __unused
)
{
+#ifndef QCOM_NO_FM_FIRMWARE
int ret;
FILE *cal_fp;
struct v4l2_ext_control ext_ctl;
@@ -198,6 +213,9 @@
}else {
return FM_FAILURE;
}
+#else
+ return FM_SUCCESS;
+#endif
}
int FmIoctlsInterface :: get_control