From patchwork Mon Mar 5 06:59:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anilkumar Kolli X-Patchwork-Id: 10258223 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4B17D60211 for ; Mon, 5 Mar 2018 06:59:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 382B3288ED for ; Mon, 5 Mar 2018 06:59:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2BBA528918; Mon, 5 Mar 2018 06:59:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C9247288ED for ; Mon, 5 Mar 2018 06:59:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=og32NjoZScko4nWFjhNmEKv9URJKhqXyqq55w6wxZKQ=; b=IqLYcz1xp9uUY8/D+RPx2fXwuR 0GPXg1BM4Hav1YapeAmXUYoIblhN5jU7vPO1eqqt6/C4wenTtZUa+xCw874W9ldgRM35MP0z7SuLP GfkzLaSFOfRkTOig7oUauq2paWnfSNmF7Eyad30lpvKMhYxYvsHecK/4pnZJk910wlMQB1xjMoy30 7Em1G8QBmRWCRy8IKKsizgVLHqDRzlcbC0yoPwfluUPMdTDs3J0chgekQ2Js8KBd7nRZdszFBRd1J LYPiErMCuUpBpNRA8wcmPAWSmdPirZlxuPI3rkgM62uY5HNCBgj4LvM03sbi5prjlFnRE5KPZj8PB qe1z42rg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1esk5c-00026r-7x; Mon, 05 Mar 2018 06:59:16 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1esk5Y-00024o-IG for ath10k@lists.infradead.org; Mon, 05 Mar 2018 06:59:14 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 7A5DF607E5; Mon, 5 Mar 2018 06:59:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1520233151; bh=bhV+NByYSHQBMcwERGeAGclPLt4Cnedz3Y2OPwcvWc0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GuiisYYpopNtJRDKjveJjRRswrnTl+CutExfH3yM6kUZLCYGBne4Oav5F2yLwQCeO 4ktpi0i8gVqnpxSOuPHMsyr5nF5iIeAG50+V65JPwviAztlO3OziNi7O9VSneVQk2w DUziFUxWynsmzqN/sP40k6lOXT9bOtkpEVCPTe9s= Received: from localhost (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: akolli@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 381AE6055B; Mon, 5 Mar 2018 06:59:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1520233150; bh=bhV+NByYSHQBMcwERGeAGclPLt4Cnedz3Y2OPwcvWc0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SDC0v8rWWN896AwWC5Fz23fgsuFPXxho/P02U2XZQufPDmBS2P7gcq1pFgBuwC/Ca YHaj9h8mAHN/AjWMgoDQBTpyOfIZEW/DmjI54qghOa4W48NjiFqaeOVpf8h0R/EPNY Q/+e6CvXjq07uT01yFwja+aTDgHKUThcDM8/2JYg= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 381AE6055B Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=akolli@codeaurora.org From: Anilkumar Kolli To: ath10k@lists.infradead.org Subject: [PATCH 2/2] ath10k: add debugfs support to configure fwtest parameters Date: Mon, 5 Mar 2018 12:29:08 +0530 Message-Id: <1520233148-26050-3-git-send-email-akolli@codeaurora.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1520233148-26050-1-git-send-email-akolli@codeaurora.org> References: <1520233148-26050-1-git-send-email-akolli@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180304_225912_740485_0B57727E X-CRM114-Status: GOOD ( 12.41 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sathishkumar Muruganandam , linux-wireless@vger.kernel.org, Anilkumar Kolli MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sathishkumar Muruganandam Added a debugfs file "fw_test" to configure the tx parameters through WMI_FWTEST_CMD Usage: cat /sys/kernel/debug/ieee80211/phy0/ath10k/fw_test echo > /sys/kernel/debug/ieee80211/phy0/ath10k/fw_test Signed-off-by: Sathishkumar Muruganandam Signed-off-by: Anilkumar Kolli --- drivers/net/wireless/ath/ath10k/core.h | 3 ++ drivers/net/wireless/ath/ath10k/debug.c | 81 +++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index fe6b30356d3b..2db734138877 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -1,6 +1,7 @@ /* * Copyright (c) 2005-2011 Atheros Communications Inc. * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. + * Copyright (c) 2018, The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -496,6 +497,8 @@ struct ath10k_debug { u32 reg_addr; u32 nf_cal_period; void *cal_data; + u32 fw_test_param_id; + u32 fw_test_param_value; }; enum ath10k_state { diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c index 554cd7856cb6..245237a6660b 100644 --- a/drivers/net/wireless/ath/ath10k/debug.c +++ b/drivers/net/wireless/ath/ath10k/debug.c @@ -2088,6 +2088,83 @@ static ssize_t ath10k_read_peer_stats(struct file *file, char __user *ubuf, .open = simple_open }; +static ssize_t ath10k_read_fops_fw_test(struct file *file, + char __user *user_buf, + size_t count, loff_t *ppos) +{ + const char buf[] = + "Commands used for FW test'\n" + "Syntax example:\n" + "echo 5 0 > /sys/kernel/debug/ieee80211/phy0/ath10k/fw_test'\n"; + + return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf)); +} + +/* fw_test support + */ +static ssize_t ath10k_write_fw_test(struct file *file, + const char __user *user_buf, + size_t count, loff_t *ppos) +{ + struct ath10k *ar = file->private_data; + char buf[32] = {0}; + ssize_t rc; + u32 param_id; + u32 param_value; + int ret; + + rc = simple_write_to_buffer(buf, sizeof(buf) - 1, + ppos, user_buf, count); + if (rc < 0) + return rc; + + buf[*ppos - 1] = '\0'; + + ret = sscanf(buf, "%u %x", ¶m_id, ¶m_value); + + if (ret != 2) + return -EINVAL; + + mutex_lock(&ar->conf_mutex); + + if (ar->state != ATH10K_STATE_ON && + ar->state != ATH10K_STATE_RESTARTED) { + ret = -ENETDOWN; + goto exit; + } + + if (param_id) { + ar->debug.fw_test_param_id = param_id; + ar->debug.fw_test_param_value = param_value; + } else { + ath10k_warn(ar, "Enter a valid param ID!"); + ret = -EINVAL; + goto exit; + } + + ret = ath10k_wmi_fw_test(ar, ar->debug.fw_test_param_id, + ar->debug.fw_test_param_value); + + if (ret) { + ath10k_warn(ar, "failed to do fw_test: %d\n", ret); + goto exit; + } + + ret = count; + +exit: + mutex_unlock(&ar->conf_mutex); + return ret; +} + +static const struct file_operations fops_fw_test = { + .read = ath10k_read_fops_fw_test, + .write = ath10k_write_fw_test, + .open = simple_open, + .owner = THIS_MODULE, + .llseek = default_llseek, +}; + static ssize_t ath10k_debug_fw_checksums_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) @@ -2258,6 +2335,10 @@ int ath10k_debug_register(struct ath10k *ar) debugfs_create_file("fw_checksums", 0400, ar->debug.debugfs_phy, ar, &fops_fw_checksums); + if (test_bit(WMI_SERVICE_FWTEST, ar->wmi.svc_map)) + debugfs_create_file("fw_test", 0600, ar->debug.debugfs_phy, ar, + &fops_fw_test); + return 0; }