From patchwork Thu Mar 19 11:08:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ashok Raj Nagarajan X-Patchwork-Id: 6048371 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 3A3CDBF90F for ; Thu, 19 Mar 2015 11:08:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 60B6D20520 for ; Thu, 19 Mar 2015 11:08:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5D8B820524 for ; Thu, 19 Mar 2015 11:08:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753807AbbCSLIo (ORCPT ); Thu, 19 Mar 2015 07:08:44 -0400 Received: from wolverine01.qualcomm.com ([199.106.114.254]:4637 "EHLO wolverine01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753667AbbCSLIm (ORCPT ); Thu, 19 Mar 2015 07:08:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qti.qualcomm.com; i=@qti.qualcomm.com; q=dns/txt; s=qcdkim; t=1426763323; x=1458299323; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=CcoGRZUCmYSgLZ5QOfbhEls1SdYwlut3oC0jsGYhl3k=; b=rYuMEr9iF/6Sj8m7tFEvU5p6hmtNoA2EGx5o92ISF/3Jo8sXVxwGT7M3 1LIdIyVOYGh+bGumEaFIiK2Ygo9gAP8wt/W5N5hl5+FUh6s7xmT6iEHTM 4nQjW+8T7DKaR/MjG6LxlCof9NU9CwR6oJGWjHogq9Ol46FE35I68qmR3 I=; X-IronPort-AV: E=McAfee;i="5600,1067,7744"; a="109234185" Received: from ironmsg01-lv.qualcomm.com ([10.47.202.180]) by wolverine01.qualcomm.com with ESMTP; 19 Mar 2015 04:08:42 -0700 X-IronPort-AV: E=Sophos;i="5.11,429,1422950400"; d="scan'208";a="32649844" Received: from nasanexm02e.na.qualcomm.com ([10.85.0.86]) by ironmsg01-lv.qualcomm.com with ESMTP/TLS/RC4-SHA; 19 Mar 2015 04:08:41 -0700 Received: from aphydexm01f.ap.qualcomm.com (10.252.127.15) by nasanexm02e.na.qualcomm.com (10.85.0.86) with Microsoft SMTP Server (TLS) id 15.0.995.29; Thu, 19 Mar 2015 04:08:40 -0700 Received: from qcmail1.qualcomm.com (10.80.80.8) by aphydexm01f.ap.qualcomm.com (10.252.127.15) with Microsoft SMTP Server (TLS) id 15.0.995.29; Thu, 19 Mar 2015 04:08:32 -0700 Received: by qcmail1.qualcomm.com (sSMTP sendmail emulation); Thu, 19 Mar 2015 16:38:22 +0530 From: Ashok Raj Nagarajan To: CC: , Ashok Raj Nagarajan Subject: [PATCH v2 2/2] ath10k: allow user to toggle ani_enable via debugfs Date: Thu, 19 Mar 2015 16:38:00 +0530 Message-ID: <1426763280-11284-2-git-send-email-arnagara@qti.qualcomm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1426763280-11284-1-git-send-email-arnagara@qti.qualcomm.com> References: <1426763280-11284-1-git-send-email-arnagara@qti.qualcomm.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanexm01a.na.qualcomm.com (10.85.0.81) To aphydexm01f.ap.qualcomm.com (10.252.127.15) 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_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable 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 Now that ANI is enabled by default, allow user to disable or enable ANI feature from debugfs echo 0|1 > /sys/kernel/debug/ieee80211/phyX/ath10k/ani_enable Signed-off-by: Ashok Raj Nagarajan --- v2: Updated commit log Lock ar->ani_enabled (Kalle Valo) remove reduntant debug message (Kalle Valo) drivers/net/wireless/ath/ath10k/core.h | 2 ++ drivers/net/wireless/ath/ath10k/debug.c | 58 +++++++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath10k/mac.c | 2 ++ 3 files changed, 62 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index 7cba781..29e0a8b 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -510,6 +510,8 @@ struct ath10k { u32 ht_cap_info; u32 vht_cap_info; u32 num_rf_chains; + /* protected by conf_mutex */ + bool ani_enabled; DECLARE_BITMAP(fw_features, ATH10K_FW_FEATURE_COUNT); diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c index 301081d..481e1cc 100644 --- a/drivers/net/wireless/ath/ath10k/debug.c +++ b/drivers/net/wireless/ath/ath10k/debug.c @@ -1708,6 +1708,61 @@ static int ath10k_debug_cal_data_release(struct inode *inode, return 0; } +static ssize_t ath10k_write_ani_enable(struct file *file, + const char __user *user_buf, + size_t count, loff_t *ppos) +{ + struct ath10k *ar = file->private_data; + int ret; + u8 enable; + + if (kstrtou8_from_user(user_buf, count, 0, &enable)) + return -EINVAL; + + mutex_lock(&ar->conf_mutex); + + if (ar->ani_enabled == enable) { + ret = count; + goto exit; + } + + ret = ath10k_wmi_pdev_set_param(ar, ar->wmi.pdev_param->ani_enable, + enable); + if (ret) { + ath10k_warn(ar, "ani_enable failed from debugfs: %d\n", ret); + goto exit; + } + ar->ani_enabled = enable; + + ret = count; + +exit: + mutex_unlock(&ar->conf_mutex); + + return ret; +} + +static ssize_t ath10k_read_ani_enable(struct file *file, char __user *user_buf, + size_t count, loff_t *ppos) +{ + struct ath10k *ar = file->private_data; + int len = 0; + char buf[32]; + + len = scnprintf(buf, sizeof(buf) - len, "%d\n", + ar->ani_enabled); + + return simple_read_from_buffer(user_buf, count, ppos, buf, len); +} + +static const struct file_operations fops_ani_enable = { + .read = ath10k_read_ani_enable, + .write = ath10k_write_ani_enable, + .open = simple_open, + .owner = THIS_MODULE, + .llseek = default_llseek, +}; + static const struct file_operations fops_cal_data = { .open = ath10k_debug_cal_data_open, .read = ath10k_debug_cal_data_read, @@ -2068,6 +2123,9 @@ int ath10k_debug_register(struct ath10k *ar) debugfs_create_file("cal_data", S_IRUSR, ar->debug.debugfs_phy, ar, &fops_cal_data); + debugfs_create_file("ani_enable", S_IRUSR | S_IWUSR, + ar->debug.debugfs_phy, ar, &fops_ani_enable); + debugfs_create_file("nf_cal_period", S_IRUSR | S_IWUSR, ar->debug.debugfs_phy, ar, &fops_nf_cal_period); diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 380d4b1..366c96f 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -2904,6 +2904,8 @@ static int ath10k_start(struct ieee80211_hw *hw) goto err_core_stop; } + ar->ani_enabled = true; + ar->num_started_vdevs = 0; ath10k_regd_update(ar);