From patchwork Thu Jul 9 16:01:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Malcolm Priestley X-Patchwork-Id: 6757231 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A57B79F536 for ; Thu, 9 Jul 2015 16:01:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CBBDE206B8 for ; Thu, 9 Jul 2015 16:01:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E94752053B for ; Thu, 9 Jul 2015 16:01:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753296AbbGIQBt (ORCPT ); Thu, 9 Jul 2015 12:01:49 -0400 Received: from mail-wi0-f174.google.com ([209.85.212.174]:37405 "EHLO mail-wi0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753346AbbGIQBp (ORCPT ); Thu, 9 Jul 2015 12:01:45 -0400 Received: by wiclp1 with SMTP id lp1so113450727wic.0 for ; Thu, 09 Jul 2015 09:01:43 -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=8dC271An0sLfFG41qg8s8ZUXooSRw/IicZeTKP86HF8=; b=jLR4/MosEGB74ZuaTfpKKmWnHemrH1M3NyzCkUTYEo0d2SGtYKBjQfGjwVt5eckZmL tXrohXf5fLL2smTMG7HUUgeLonQKoIkicsu5BceuJfdlD35u9yezP6qH/bStFYjoW9tc 2/1bK1j4Rk05G5sIhEqv2ACuKe2kxELW9Vo+7Zj5rkPugXVaJ+rFujZH6uS+8kOjBKTr ML7v1ux9yjczW/fFSNJO3ye4Sqi9KSbgtCnzcDjD95i4rjHLJSkzwjRawo/EtkiTB6TW E0NPd5ge3U4jWHZmy6ufMZFPsIVYFFfZca9dScjDwWD/EQtGiHmBRcvHpMm2HmUC3RND mIcQ== X-Received: by 10.194.60.226 with SMTP id k2mr30297762wjr.10.1436457703947; Thu, 09 Jul 2015 09:01:43 -0700 (PDT) Received: from tipsey.3.home (188.31.121.40.threembb.co.uk. [188.31.121.40]) by smtp.gmail.com with ESMTPSA id m4sm9478511wjb.37.2015.07.09.09.01.42 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Jul 2015 09:01:43 -0700 (PDT) From: Malcolm Priestley To: gregkh@linuxfoundation.org Cc: linux-wireless@vger.kernel.org, Malcolm Priestley Subject: [PATCH 4/4] staging: vt6655: Correct listen interval TBTT wake up Date: Thu, 9 Jul 2015 17:01:27 +0100 Message-Id: <1436457687-3113-4-git-send-email-tvboxspy@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1436457687-3113-1-git-send-email-tvboxspy@gmail.com> References: <1436457687-3113-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=-7.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 PSbIsNextTBTTWakeUp is called at beacon intervals. The should listen to next beacon on count down of wake_up_count == 1. This restores this back to vendors code but modified for mac80211. Signed-off-by: Malcolm Priestley --- drivers/staging/vt6655/device.h | 1 + drivers/staging/vt6655/power.c | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/staging/vt6655/device.h b/drivers/staging/vt6655/device.h index 5cf1b33..6aebb49 100644 --- a/drivers/staging/vt6655/device.h +++ b/drivers/staging/vt6655/device.h @@ -403,6 +403,7 @@ struct vnt_private { unsigned char abyEEPROM[EEP_MAX_CONTEXT_SIZE]; /* unsigned long alignment */ unsigned short wBeaconInterval; + u16 wake_up_count; struct work_struct interrupt_work; diff --git a/drivers/staging/vt6655/power.c b/drivers/staging/vt6655/power.c index be3c4e9..06e6b9d 100644 --- a/drivers/staging/vt6655/power.c +++ b/drivers/staging/vt6655/power.c @@ -157,10 +157,18 @@ PSbIsNextTBTTWakeUp( struct ieee80211_conf *conf = &hw->conf; bool bWakeUp = false; - if (conf->listen_interval == 1) { - /* Turn on wake up to listen next beacon */ - MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_LNBCN); - bWakeUp = true; + if (conf->listen_interval > 1) { + if (!pDevice->wake_up_count) + pDevice->wake_up_count = conf->listen_interval; + + --pDevice->wake_up_count; + + if (pDevice->wake_up_count == 1) { + /* Turn on wake up to listen next beacon */ + MACvRegBitsOn(pDevice->PortOffset, + MAC_REG_PSCTL, PSCTL_LNBCN); + bWakeUp = true; + } } return bWakeUp;