OSDN Git Service

Avoid using alarm APIs for LPM when Idle timeout is zero
authorJaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
Fri, 12 Feb 2016 15:03:06 +0000 (20:33 +0530)
committerPavlin Radoslavov <pavlin@google.com>
Wed, 30 Mar 2016 18:28:08 +0000 (11:28 -0700)
For some vendors the idle timer value is configured to zero. But with
the current LPM timer implementation it will use the alarm APIs to
schedule wake_deassert(), which introduces context switch overhead.
The code is modified to trigger the wake_deassert immediately if the
idle timeout value is configured to zero. These changes improve OPP
throughput.

Change-Id: Ic48e7b990ccf55525a0d15b65c03daedfe03c582
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
Signed-off-by: Zhiquan Liu <zhiquan.liu@intel.com>
hci/src/low_power_manager.c

index f231502..f82a69f 100644 (file)
@@ -72,6 +72,7 @@ static wake_state_t wake_state;
 static uint32_t idle_timeout_ms;
 static alarm_t *idle_alarm;
 static bool transmit_is_done;
+static void wake_deassert();
 
 // Interface functions
 
@@ -186,7 +187,11 @@ static void idle_timer_expired(UNUSED_ATTR void *context) {
 
 static void start_idle_timer() {
   if (state == LPM_ENABLED) {
-    alarm_set(idle_alarm, idle_timeout_ms, idle_timer_expired, NULL);
+    if (idle_timeout_ms == 0) {
+       wake_deassert();
+    } else {
+       alarm_set(idle_alarm, idle_timeout_ms, idle_timer_expired, NULL);
+    }
   }
 }