Skip to content
Snippets Groups Projects
Commit b9ed7d5c authored by Balakrishna Godavarthi's avatar Balakrishna Godavarthi
Browse files

FM: Use flushCommands() before FM close

To align with respective LAZY HAL, use flushCommands() after calling
IFmHci close. This will ensure to decrement the HIDL usage counter
by one.

Change-Id: I5294738268e0ae6d10a64e3330aba9311d82d394
parent 9186a7bd
Branches
No related tags found
No related merge requests found
...@@ -19,6 +19,11 @@ LOCAL_SHARED_LIBRARIES := \ ...@@ -19,6 +19,11 @@ LOCAL_SHARED_LIBRARIES := \
LOCAL_CFLAGS := -Wno-unused-parameter LOCAL_CFLAGS := -Wno-unused-parameter
# Enable LAZY HAL
ifeq ($(TARGET_ARCH), arm)
LOCAL_CFLAGS += -DARCH_ARM_32
endif
LOCAL_C_INCLUDES += \ LOCAL_C_INCLUDES += \
$(LOCAL_PATH)/../helium \ $(LOCAL_PATH)/../helium \
$(LOCAL_PATH)/fm_hci $(LOCAL_PATH)/fm_hci
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include <mutex> // std::mutex, std::unique_lock #include <mutex> // std::mutex, std::unique_lock
#include <condition_variable> // std::condition_variable #include <condition_variable> // std::condition_variable
#include <cstdlib> #include <cstdlib>
#include <cutils/properties.h>
#include <thread> #include <thread>
#include <utils/Log.h> #include <utils/Log.h>
...@@ -48,10 +49,10 @@ ...@@ -48,10 +49,10 @@
#include <vendor/qti/hardware/fm/1.0/IFmHci.h> #include <vendor/qti/hardware/fm/1.0/IFmHci.h>
#include <vendor/qti/hardware/fm/1.0/IFmHciCallbacks.h> #include <vendor/qti/hardware/fm/1.0/IFmHciCallbacks.h>
#include <vendor/qti/hardware/fm/1.0/types.h> #include <vendor/qti/hardware/fm/1.0/types.h>
#include <hwbinder/IPCThreadState.h>
#include "fm_hci.h" #include "fm_hci.h"
#include <hwbinder/ProcessState.h> using android::hardware::IPCThreadState;
using vendor::qti::hardware::fm::V1_0::IFmHci; using vendor::qti::hardware::fm::V1_0::IFmHci;
using vendor::qti::hardware::fm::V1_0::IFmHciCallbacks; using vendor::qti::hardware::fm::V1_0::IFmHciCallbacks;
using vendor::qti::hardware::fm::V1_0::HciPacket; using vendor::qti::hardware::fm::V1_0::HciPacket;
...@@ -525,6 +526,31 @@ class FmHciCallbacks : public IFmHciCallbacks { ...@@ -525,6 +526,31 @@ class FmHciCallbacks : public IFmHciCallbacks {
} }
}; };
#ifdef ARCH_ARM_32
bool IsLazyHalSupported()
{
static bool isPropertyRead = false;
static bool isLazyHalEnabled = false;
ALOGD("%s isPropertyRead: %d isLazyHalEnabled: %d", __func__, isPropertyRead,
isLazyHalEnabled);
if (!isPropertyRead) {
char device[PROPERTY_VALUE_MAX]= {'\0'};
int len = property_get("ro.board.platform", device, "");
if (len) {
isPropertyRead = true;
isLazyHalEnabled = (!strcmp(device, "bengal") ? true : false);
ALOGD("%s isLazyHalEnabled: %d", __func__, isLazyHalEnabled);
} else {
ALOGE("%s: Failed to read property", __func__);
}
}
return isLazyHalEnabled;
}
#endif
/******************************************************************************* /*******************************************************************************
** **
** Function hci_initialize ** Function hci_initialize
...@@ -609,6 +635,13 @@ static void hci_close() ...@@ -609,6 +635,13 @@ static void hci_close()
auto hidl_daemon_status = fmHci->close(); auto hidl_daemon_status = fmHci->close();
if(!hidl_daemon_status.isOk()) { if(!hidl_daemon_status.isOk()) {
ALOGE("%s: HIDL daemon is dead", __func__); ALOGE("%s: HIDL daemon is dead", __func__);
} else {
#ifdef ARCH_ARM_32
if (IsLazyHalSupported()) {
ALOGD("%s: decrementing HIDL usage counter", __func__);
IPCThreadState::self()->flushCommands();
}
#endif
} }
fmHci = nullptr; fmHci = nullptr;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment