From patchwork Sun Sep 27 08:17:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Malcolm Priestley X-Patchwork-Id: 7273151 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BD4D8BEEA4 for ; Sun, 27 Sep 2015 08:19:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D69BE2095F for ; Sun, 27 Sep 2015 08:18:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EB4812090E for ; Sun, 27 Sep 2015 08:18:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755035AbbI0ISs (ORCPT ); Sun, 27 Sep 2015 04:18:48 -0400 Received: from mail-wi0-f171.google.com ([209.85.212.171]:35544 "EHLO mail-wi0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753642AbbI0IS1 (ORCPT ); Sun, 27 Sep 2015 04:18:27 -0400 Received: by wicge5 with SMTP id ge5so67941491wic.0 for ; Sun, 27 Sep 2015 01:18:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/Kifj0ocIwn04bYZTFrL9+XAHxIGD+OgdjiqreQbYz0=; b=R+Rt7hcYjjgPe4p+hfuRJ+HCdAmj09H0maA/zrDcXHUsn31+qeA+5L+TWUhIecZS/w yWMeHHQvxRGTJsBpMpowxxtZ7sw0f/5koAzvxsZTBP9jVkd8tD/lu1+Nwp4ygHLXuxz3 mMdBox6pixdES5QfKX1d1mReAC26vf+h9nsNBjadnWB+Y5bSL21drwZwyr7NaMDTZ+OO 3HXae+Q+ScA7+Q+ID/7W2pabTy/njLuMI9l/5RdvbsiID9X3WS11lFSnPJtlhux8ZiXv zV6A2lrVAyOiYu7eBGR3CALDx8EeL0QYDqP8yOizC04KNbA6YNmoUeyQ18pZcgp5PaSi oyLA== X-Received: by 10.180.37.113 with SMTP id x17mr11461167wij.33.1443341906418; Sun, 27 Sep 2015 01:18:26 -0700 (PDT) Received: from tipsey.3.home (188.31.176.126.threembb.co.uk. [188.31.176.126]) by smtp.gmail.com with ESMTPSA id o10sm11949040wia.4.2015.09.27.01.18.24 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 27 Sep 2015 01:18:25 -0700 (PDT) From: Malcolm Priestley To: gregkh@linuxfoundation.org Cc: linux-wireless@vger.kernel.org, Malcolm Priestley Subject: [PATCH 3/6] staging: vt6656: implement power saving code. Date: Sun, 27 Sep 2015 09:17:41 +0100 Message-Id: <1443341864-2756-3-git-send-email-tvboxspy@gmail.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1443341864-2756-1-git-send-email-tvboxspy@gmail.com> References: <1443341864-2756-1-git-send-email-tvboxspy@gmail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The device should ready to listen to next beacon so on count down of wake_up_count == 1. schedule command WLAN_CMD_TBTT_WAKEUP which calls vnt_next_tbtt_wakeup which wakes the device. This restores this back to vendors code with a slight difference the count down is in the interrupt handler. Signed-off-by: Malcolm Priestley --- drivers/staging/vt6656/device.h | 2 ++ drivers/staging/vt6656/int.c | 14 +++++++++++--- drivers/staging/vt6656/power.c | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h index 635d931..dec36f2 100644 --- a/drivers/staging/vt6656/device.h +++ b/drivers/staging/vt6656/device.h @@ -389,6 +389,8 @@ struct vnt_private { u8 bb_pre_ed_rssi; u8 bb_pre_ed_index; + u16 wake_up_count; + /* command timer */ struct delayed_work run_command_work; diff --git a/drivers/staging/vt6656/int.c b/drivers/staging/vt6656/int.c index 2ef70e4..14b8ebc 100644 --- a/drivers/staging/vt6656/int.c +++ b/drivers/staging/vt6656/int.c @@ -149,10 +149,18 @@ void vnt_int_process_data(struct vnt_private *priv) priv->op_mode == NL80211_IFTYPE_AP) vnt_schedule_command(priv, WLAN_CMD_BECON_SEND); - if (int_data->isr0 & ISR_TBTT) { - if (priv->hw->conf.flags & IEEE80211_CONF_PS) + if (int_data->isr0 & ISR_TBTT && + priv->hw->conf.flags & IEEE80211_CONF_PS) { + if (!priv->wake_up_count) + priv->wake_up_count = + priv->hw->conf.listen_interval; + + --priv->wake_up_count; + + /* Turn on wake up to listen next beacon */ + if (priv->wake_up_count == 1) vnt_schedule_command(priv, - WLAN_CMD_TBTT_WAKEUP); + WLAN_CMD_TBTT_WAKEUP); } priv->current_tsf = le64_to_cpu(int_data->tsf); diff --git a/drivers/staging/vt6656/power.c b/drivers/staging/vt6656/power.c index 0ffbaed..d5912d2 100644 --- a/drivers/staging/vt6656/power.c +++ b/drivers/staging/vt6656/power.c @@ -134,7 +134,7 @@ int vnt_next_tbtt_wakeup(struct vnt_private *priv) struct ieee80211_conf *conf = &hw->conf; int wake_up = false; - if (conf->listen_interval == 1) { + if (conf->listen_interval > 1) { /* Turn on wake up to listen next beacon */ vnt_mac_reg_bits_on(priv, MAC_REG_PSCTL, PSCTL_LNBCN); wake_up = true;