Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d72fb540 authored by Matthew Xie's avatar Matthew Xie
Browse files

Make GKI_TIMER_INTERVAL_FOR_WAKELOCK configurable for different target

Set the default value as 3000 ms
Bug: 18549150

Change-Id: I1d5b4fca627c22fdd8a32a41d5beac6837b6dff4
parent 49353a82
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@
**              settop projects that already use pthreads and not pth.
**
*****************************************************************************/
#include "bt_target.h"

#include <assert.h>
#include <sys/times.h>
@@ -95,11 +96,6 @@ static timer_t posix_timer;
static bool timer_created;


// If the next wakeup time is less than this threshold, we should acquire
// a wakelock instead of setting a wake alarm so we're not bouncing in
// and out of suspend frequently.
static const uint32_t TIMER_INTERVAL_FOR_WAKELOCK_IN_MS = 100;

/*****************************************************************************
**  Externs
******************************************************************************/
@@ -217,7 +213,7 @@ void alarm_service_reschedule()
    }

    UINT64 ticks_in_millis = GKI_TICKS_TO_MS(ticks_till_next_exp);
    if (ticks_in_millis <= TIMER_INTERVAL_FOR_WAKELOCK_IN_MS)
    if (ticks_in_millis <= GKI_TIMER_INTERVAL_FOR_WAKELOCK)
    {
        // The next deadline is close, just take a wakelock and set a regular (non-wake) timer.
        int rc = bt_os_callouts->acquire_wake_lock(WAKE_LOCK_ID);
+8 −0
Original line number Diff line number Diff line
@@ -191,6 +191,14 @@
#define LINUX_GKI_INCLUDED  TRUE
#endif

// If the next wakeup time is less than this threshold, we should acquire
// a wakelock instead of setting a wake alarm so we're not bouncing in
// and out of suspend frequently.
// in millisecond
#ifndef GKI_TIMER_INTERVAL_FOR_WAKELOCK
#define GKI_TIMER_INTERVAL_FOR_WAKELOCK 3000
#endif

#ifndef BTA_SYS_TIMER_PERIOD
#define BTA_SYS_TIMER_PERIOD  100
#endif