From patchwork Sat Jun 30 06:08:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Manoharan, Rajkumar" X-Patchwork-Id: 1134081 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 62BC040AC1 for ; Sat, 30 Jun 2012 06:08:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751517Ab2F3GIE (ORCPT ); Sat, 30 Jun 2012 02:08:04 -0400 Received: from wolverine02.qualcomm.com ([199.106.114.251]:25301 "EHLO wolverine02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751204Ab2F3GIC (ORCPT ); Sat, 30 Jun 2012 02:08:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1341036482; x=1372572482; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=vwy5KQYkXRPI46GG/BzWULNu0x1guQz3sRWDMssReaQ=; b=t7B8ZFH7sJynN9Ax+Y9Y3e6Mqt8JZFhM7pzPHt20T1c09NqLL+6QIHAS SyYfd8T94B8zSczbRIIdUlc7Taw6La9+6OEKn+F+NpUDLi/oi3W/8ziC0 Os6rEWFO4U7uEyERZ+27bcTNsouRXKyT7jV4Ql9l4ICAnsPNjGtBpN3E8 A=; X-IronPort-AV: E=McAfee;i="5400,1158,6757"; a="203875532" Received: from ironmsg03-r.qualcomm.com ([172.30.46.17]) by wolverine02.qualcomm.com with ESMTP; 29 Jun 2012 23:08:02 -0700 X-IronPort-AV: E=Sophos;i="4.77,501,1336374000"; d="scan'208";a="280887584" Received: from nasanexhc08.na.qualcomm.com ([172.30.39.7]) by Ironmsg03-R.qualcomm.com with ESMTP/TLS/RC4-SHA; 29 Jun 2012 23:08:02 -0700 Received: from qcmail1.qualcomm.com (172.30.39.5) by qcmail1.qualcomm.com (172.30.39.7) with Microsoft SMTP Server (TLS) id 14.2.283.3; Fri, 29 Jun 2012 23:08:00 -0700 Received: by qcmail1.qualcomm.com (sSMTP sendmail emulation); Sat, 30 Jun 2012 11:39:22 +0530 From: Rajkumar Manoharan To: CC: , Rajkumar Manoharan Subject: [PATCH v2 4/5] ath9k: fix power consumption on network sleep when BTCOEX is enabled Date: Sat, 30 Jun 2012 11:38:48 +0530 Message-ID: <1341036529-10823-4-git-send-email-rmanohar@qca.qualcomm.com> X-Mailer: git-send-email 1.7.11.1 In-Reply-To: <1341036529-10823-1-git-send-email-rmanohar@qca.qualcomm.com> References: <1341036529-10823-1-git-send-email-rmanohar@qca.qualcomm.com> MIME-Version: 1.0 X-Originating-IP: [172.30.39.5] Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org The chip is waken up for every 45ms in btcoex timer cycle to for sharing the radio between BT and WLAN. Whenever the wlan interface is in network sleep mode, do not schedule hw timers. This could reduce power consumption on idle associated state. Signed-off-by: Rajkumar Manoharan --- drivers/net/wireless/ath/ath9k/gpio.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/net/wireless/ath/ath9k/gpio.c b/drivers/net/wireless/ath/ath9k/gpio.c index 9ae6a4d..c17168e 100644 --- a/drivers/net/wireless/ath/ath9k/gpio.c +++ b/drivers/net/wireless/ath/ath9k/gpio.c @@ -194,6 +194,16 @@ static void ath_btcoex_period_timer(unsigned long data) struct ath_mci_profile *mci = &btcoex->mci; u32 timer_period; bool is_btscan; + unsigned long flags; + + spin_lock_irqsave(&sc->sc_pm_lock, flags); + if (sc->sc_ah->power_mode == ATH9K_PM_NETWORK_SLEEP) { + spin_unlock_irqrestore(&sc->sc_pm_lock, flags); + if (btcoex->hw_timer_enabled) + ath9k_gen_timer_stop(ah, btcoex->no_stomp_timer); + goto skip_hw_wakeup; + } + spin_unlock_irqrestore(&sc->sc_pm_lock, flags); ath9k_ps_wakeup(sc); if (!(ah->caps.hw_caps & ATH9K_HW_CAP_MCI)) @@ -232,6 +242,7 @@ static void ath_btcoex_period_timer(unsigned long data) } ath9k_ps_restore(sc); +skip_hw_wakeup: timer_period = btcoex->btcoex_period; mod_timer(&btcoex->period_timer, jiffies + msecs_to_jiffies(timer_period)); }