libfmjni: Add support for internal antenna hardware
* Devices defining the hw.fm.internal_antenna property
will switch to internal antenna to allow proper FM receival
Change-Id: I3dabccb27dee8110def3b6c46bbb61252a6e3267
Signed-off-by: AdrianDC <radian.dc@gmail.com>
diff --git a/FM_Const.h b/FM_Const.h
index b0cc684..026283c 100644
--- a/FM_Const.h
+++ b/FM_Const.h
@@ -118,6 +118,7 @@
const char *const FM_MODE_PROP = "hw.fm.mode";
const char *const FM_VERSION_PROP = "hw.fm.version";
const char *const FM_INIT_PROP = "hw.fm.init";
+const char *const FM_INTERNAL_ANTENNA_PROP = "hw.fm.internal_antenna";
const char *const SCRIPT_START_PROP = "ctl.start";
const char *const FM_SOC_DL_SCRIPT = "fm_dl";
const char *const SCRIPT_STOP_PROP = "ctl.stOP";
diff --git a/FmRadioController.cpp b/FmRadioController.cpp
index 613a062..ece88e7 100644
--- a/FmRadioController.cpp
+++ b/FmRadioController.cpp
@@ -225,6 +225,13 @@
ret = FM_FAILURE;
goto exit;
}
+
+ if (property_get_bool(FM_INTERNAL_ANTENNA_PROP, false)) {
+ ret = FmIoctlsInterface::set_control(fd_driver,
+ V4L2_CID_PRV_ANTENNA, 1);
+ ALOGD("Internal antenna set, status : %d\n", ret);
+ }
+
return FM_SUCCESS;
} else { //if time out
ret = FM_FAILURE;