From patchwork Wed May 11 17:02:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 9073401 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-ath10k@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 A107E9F1C1 for ; Wed, 11 May 2016 17:03:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C978220142 for ; Wed, 11 May 2016 17:03:38 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E64E72010F for ; Wed, 11 May 2016 17:03:37 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1b0XXk-0003TZ-Gj; Wed, 11 May 2016 17:03:28 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1b0XXi-0003PS-Fm for ath10k@bombadil.infradead.org; Wed, 11 May 2016 17:03:26 +0000 Received: from mail2.candelatech.com ([208.74.158.173]) by merlin.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1b0XXg-0005TR-Gb for ath10k@lists.infradead.org; Wed, 11 May 2016 17:03:25 +0000 Received: from ben-dt3.candelatech.com (firewall.candelatech.com [50.251.239.81]) by mail2.candelatech.com (Postfix) with ESMTP id 361C840BC03; Wed, 11 May 2016 10:02:42 -0700 (PDT) From: greearb@candelatech.com To: ath10k@lists.infradead.org Subject: [PATCH v2 03/21] ath10k: Allow changing ath10k debug mask at runtime. Date: Wed, 11 May 2016 10:02:15 -0700 Message-Id: <1462986153-16318-4-git-send-email-greearb@candelatech.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1462986153-16318-1-git-send-email-greearb@candelatech.com> References: <1462986153-16318-1-git-send-email-greearb@candelatech.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160511_130324_623282_17FB4233 X-CRM114-Status: UNSURE ( 7.70 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -3.3 (---) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ben Greear , linux-wireless@vger.kernel.org MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 From: Ben Greear Using debugfs. More convenient than module options in some cases. Signed-off-by: Ben Greear --- drivers/net/wireless/ath/ath10k/debug.c | 62 +++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c index e251155..d552a4a 100644 --- a/drivers/net/wireless/ath/ath10k/debug.c +++ b/drivers/net/wireless/ath/ath10k/debug.c @@ -870,6 +870,65 @@ static const struct file_operations fops_reg_addr = { .llseek = default_llseek, }; +static ssize_t ath10k_read_debug_level(struct file *file, + char __user *user_buf, + size_t count, loff_t *ppos) +{ + int sz; + const char buf[] = + "To change debug level, set value adding up desired flags:\n" + "PCI: 0x1\n" + "WMI: 0x2\n" + "HTC: 0x4\n" + "HTT: 0x8\n" + "MAC: 0x10\n" + "BOOT: 0x20\n" + "PCI-DUMP: 0x40\n" + "HTT-DUMP: 0x80\n" + "MGMT: 0x100\n" + "DATA: 0x200\n" + "BMI: 0x400\n" + "REGULATORY: 0x800\n" + "TESTMODE: 0x1000\n" + "INFO-AS-DBG: 0x40000000\n" + "FW: 0x80000000\n" + "ALL: 0xFFFFFFFF\n"; + char wbuf[sizeof(buf) + 60]; + sz = snprintf(wbuf, sizeof(wbuf), "Current debug level: 0x%x\n\n%s", + ath10k_debug_mask, buf); + wbuf[sizeof(wbuf) - 1] = 0; + + return simple_read_from_buffer(user_buf, count, ppos, wbuf, sz); +} + +/* Set logging level. + */ +static ssize_t ath10k_write_debug_level(struct file *file, + const char __user *user_buf, + size_t count, loff_t *ppos) +{ + struct ath10k *ar = file->private_data; + int ret; + unsigned long mask; + + ret = kstrtoul_from_user(user_buf, count, 0, &mask); + if (ret) + return ret; + + ath10k_warn(ar, "Setting debug-mask to: 0x%lx old: 0x%x\n", + mask, ath10k_debug_mask); + ath10k_debug_mask = mask; + return count; +} + +static const struct file_operations fops_debug_level = { + .read = ath10k_read_debug_level, + .write = ath10k_write_debug_level, + .open = simple_open, + .owner = THIS_MODULE, + .llseek = default_llseek, +}; + static ssize_t ath10k_reg_value_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) @@ -2375,6 +2434,9 @@ int ath10k_debug_register(struct ath10k *ar) debugfs_create_file("mem_value", S_IRUSR | S_IWUSR, ar->debug.debugfs_phy, ar, &fops_mem_value); + debugfs_create_file("debug_level", S_IRUSR, ar->debug.debugfs_phy, + ar, &fops_debug_level); + debugfs_create_file("chip_id", S_IRUSR, ar->debug.debugfs_phy, ar, &fops_chip_id);