OSDN Git Service

PM: Stop Power Manager Timer if in sniff mode
authorHemant Gupta <hemantg@codeaurora.org>
Thu, 12 Jun 2014 07:49:15 +0000 (13:19 +0530)
committerHemant Gupta <hemantg@codeaurora.org>
Wed, 16 Jul 2014 20:55:56 +0000 (02:25 +0530)
Power manager timer is started when ACL link is in active mode
depending on profile connected. This timer was never stopped
when link was put in sniff mode by remote device preventing
system from going to sleep since timer is still active resulting
in extra power consumption.

Change-Id: I7569eed3ad7e0487e411377977b4f0671f24df12

bta/dm/bta_dm_pm.c

index b896880..c496947 100644 (file)
@@ -806,6 +806,16 @@ void bta_dm_pm_btm_status(tBTA_DM_MSG *p_data)
             break;
 #endif
         case BTM_PM_STS_SNIFF:
+            if (p_data->pm_status.hci_status == 0)
+            {
+                /* Stop PM timer now if already active for
+                 * particular device since link is already
+                 * put in sniff mode by remote device, and
+                 * PM timer sole purpose is to put the link
+                 * in sniff mode from host side.
+                 */
+                bta_dm_pm_stop_timer(p_data->pm_status.bd_addr);
+            }
             p_dev->info &= ~(BTA_DM_DI_SET_SNIFF|BTA_DM_DI_INT_SNIFF|BTA_DM_DI_ACP_SNIFF);
             if (info & BTA_DM_DI_SET_SNIFF)
                 p_dev->info |= BTA_DM_DI_INT_SNIFF;