Skip to content
Snippets Groups Projects
Commit a1805d9a authored by Kamal Negi's avatar Kamal Negi
Browse files

FM Radio: Wait for disable to complete

Make disable fm to be synchronous. On factory reset, disable fm
and enable fm called back to back. If enable fm command sent before
disable fm completes, fm enable fails. Hence wait for disable fm
to complete.

Change-Id: Ic3630f7bdd39ca812d9ae81b45a9c496049aef84
parent 9ae3a86e
No related branches found
No related tags found
No related merge requests found
......@@ -677,6 +677,12 @@ void fm_hci_close(void *arg) {
return;
}
event_notification(hci, HC_EVENT_EXIT);
pthread_mutex_lock(&hci->event_lock);
again:
pthread_cond_wait(&hci->event_cond, &hci->event_lock);
if (!(ready_events & HC_EVENT_EXIT_DONE))
goto again;
pthread_mutex_unlock(&hci->event_lock);
}
int fm_hci_init(fm_hci_hal_t *hci_hal)
......@@ -785,6 +791,7 @@ static void fm_hci_exit(void *arg)
vendor_close(hci);
pthread_cond_broadcast(&hci->event_cond);
pthread_cond_broadcast(&hci->cmd_credits_cond);
event_notification(hci, HC_EVENT_EXIT_DONE);
stop_rx_thread(hci);
stop_tx_thread(hci);
ALOGD("Tx, Rx Threads join done");
......
......@@ -46,6 +46,7 @@
#define HC_EVENT_LPM_IDLE_TIMEOUT 0x0100
#define HC_EVENT_EXIT 0x0200
#define HC_EVENT_EPILOG 0x0400
#define HC_EVENT_EXIT_DONE 0x8000
#define MAX_FM_CMD_CNT 100
#define FM_CMD 0x11
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment