From patchwork Sun Sep 27 08:17:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Malcolm Priestley X-Patchwork-Id: 7273111 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 E4ECB9F6CD for ; Sun, 27 Sep 2015 08:18:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 206422090E for ; Sun, 27 Sep 2015 08:18:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1CB782095F for ; Sun, 27 Sep 2015 08:18:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755028AbbI0ISl (ORCPT ); Sun, 27 Sep 2015 04:18:41 -0400 Received: from mail-wi0-f173.google.com ([209.85.212.173]:35486 "EHLO mail-wi0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754092AbbI0ISU (ORCPT ); Sun, 27 Sep 2015 04:18:20 -0400 Received: by wicge5 with SMTP id ge5so67939719wic.0 for ; Sun, 27 Sep 2015 01:18:19 -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=6ILx6RyPyq6PR8nTwyaeWNGg+UasqKEn+4ex4qj6V1w=; b=Xc6FoNky8zrRlDeYaYY2pVv2gu6oPpqDaz/2mG6XDdxRISuf4x/k4irtz4VdEf5LlT 1F+/BsaEya6KhXehdKtsbdPdCKuVNdtxiB67BKsDsJrhE1oY6i3KWyQtJH93YMiLqc76 BFv7yRHdWPhQA9DtZC8ANLePlBqX47RaWfhwSI+3qPpn/6VKqx4U5HEdzT0X77YlpViE cJfu+X2vzAxSY88R61/cgkzNSFgWQ/eGpBDUB2iqJLiTwUQyNQOv2K8SinyxwcoJpFEi Dp5fYbt+Prifsz0DIoxh2k6MNr1HbSBZAsr2N8hVuuKtrWwsjdlsD83/GPphHg/HFws/ fliA== X-Received: by 10.194.23.2 with SMTP id i2mr15140401wjf.106.1443341899402; Sun, 27 Sep 2015 01:18:19 -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.17 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 27 Sep 2015 01:18:18 -0700 (PDT) From: Malcolm Priestley To: gregkh@linuxfoundation.org Cc: linux-wireless@vger.kernel.org, Malcolm Priestley Subject: [PATCH 2/6] staging: vt6656: implement TSF counter Date: Sun, 27 Sep 2015 09:17:40 +0100 Message-Id: <1443341864-2756-2-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 TSF counter is presently unused on driver in infrastructure mode. It is needed to implement power saving functions and wireless stats that are passed in interrupt handling. Ensuring counter is synced with access point beacon. Signed-off-by: Malcolm Priestley --- drivers/staging/vt6656/main_usb.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index af572d7..7246c76 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -757,6 +757,26 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw, vnt_mac_reg_bits_off(priv, MAC_REG_TCR, TCR_AUTOBCNTX); } } + + if (changed & (BSS_CHANGED_ASSOC | BSS_CHANGED_BEACON_INFO) && + priv->op_mode != NL80211_IFTYPE_AP) { + if (conf->assoc && conf->beacon_rate) { + vnt_mac_reg_bits_on(priv, MAC_REG_TFTCTL, + TFTCTL_TSFCNTREN); + + vnt_adjust_tsf(priv, conf->beacon_rate->hw_value, + conf->sync_tsf, priv->current_tsf); + + vnt_mac_set_beacon_interval(priv, conf->beacon_int); + + vnt_reset_next_tbtt(priv, conf->beacon_int); + } else { + vnt_clear_current_tsf(priv); + + vnt_mac_reg_bits_off(priv, MAC_REG_TFTCTL, + TFTCTL_TSFCNTREN); + } + } } static u64 vnt_prepare_multicast(struct ieee80211_hw *hw,