From patchwork Fri May 1 21:10:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yanbo Li X-Patchwork-Id: 6313091 Return-Path: X-Original-To: patchwork-ath10k@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 33B5EBEEE1 for ; Fri, 1 May 2015 21:13:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5166D203ED for ; Fri, 1 May 2015 21:13:24 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 628AC203C3 for ; Fri, 1 May 2015 21:13:23 +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 1YoIFB-0000CH-E4; Fri, 01 May 2015 21:13:09 +0000 Received: from sabertooth01.qualcomm.com ([65.197.215.72]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YoIF9-00008H-LD for ath10k@lists.infradead.org; Fri, 01 May 2015 21:13:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1430514787; x=1462050787; h=from:to:cc:subject:date:message-id:mime-version; bh=sL7WPUT47KZnDuQcwRZBVIOHXWBDOBU8nEY65WpCBxo=; b=o12X1WdEwTgFTlf9Tl2p5ykR3Gmo8pkThNeoi9qeSV7zB5UY4i1Llhm1 kA7oHu7b4/xW5Grp/Arjfvbdo4e1i7wQyoChFCloahgTpIBgYnfi/mt/0 VJJe7VO53QfVS8ejR6P92oqbECeUgoy3i+Fxnpxo1Sp4YEZLXqyX00wuu 0=; X-IronPort-AV: E=McAfee;i="5700,7163,7788"; a="88189020" Received: from ironmsg01-lv.qualcomm.com ([10.47.202.180]) by sabertooth01.qualcomm.com with ESMTP; 01 May 2015 14:12:43 -0700 X-IronPort-AV: E=Sophos;i="5.13,352,1427785200"; d="scan'208";a="33001672" Received: from nasanexm02e.na.qualcomm.com ([10.85.0.86]) by ironmsg01-lv.qualcomm.com with ESMTP/TLS/RC4-SHA; 01 May 2015 14:12:42 -0700 Received: from buildX11.qca.qualcomm.com (10.80.80.8) by nasanexm02e.na.qualcomm.com (10.85.0.86) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Fri, 1 May 2015 14:12:42 -0700 From: Yanbo Li To: Subject: [PATCH] ath10k: Debugfs entry to enable/disable BTC feature Date: Fri, 1 May 2015 14:10:59 -0700 Message-ID: <1430514659-11743-1-git-send-email-yanbol@qca.qualcomm.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanexm01a.na.qualcomm.com (10.85.0.81) To nasanexm02e.na.qualcomm.com (10.85.0.86) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150501_141307_764035_CFE24C41 X-CRM114-Status: UNSURE ( 9.39 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -5.1 (-----) Cc: dreamfly281@gmail.com, linux-wireless@vger.kernel.org, michal.kazior@tieto.com, ath10k@lists.infradead.org X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, 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 As some radio have no connection with BT modules, enable the BTC feature will has some side effect if the radio's GPIO connect with any other HW modules. Add the control switcher "btc_feature" at debugfs and set the feature as disable by default to avoid such case. To enable this feature, execute: echo 1 > /sys/kernel/debug/ieee80211/phyX/ath10k/btc_feature To disable: echo 0 > /sys/kernel/debug/ieee80211/phyX/ath10k/btc_feature Signed-off-by: Yanbo Li diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index 8444adf42195..6852e7fc5d5f 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -720,6 +720,8 @@ struct ath10k { u32 fw_cold_reset_counter; } stats; + bool btc_feature; + struct ath10k_thermal thermal; struct ath10k_wow wow; diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c index 8fa606a9c4dd..d686aff2e0cc 100644 --- a/drivers/net/wireless/ath/ath10k/debug.c +++ b/drivers/net/wireless/ath/ath10k/debug.c @@ -2092,6 +2092,54 @@ static const struct file_operations fops_quiet_period = { .open = simple_open }; +static ssize_t ath10k_write_btc_feature(struct file *file, + const char __user *ubuf, + size_t count, loff_t *ppos) +{ + struct ath10k *ar = file->private_data; + char buf[32]; + size_t buf_size; + bool val; + + buf_size = min(count, (sizeof(buf) - 1)); + if (copy_from_user(buf, ubuf, buf_size)) + return -EFAULT; + + buf[buf_size] = '\0'; + if (strtobool(buf, &val) != 0) { + ath10k_warn(ar, "Wrong BTC feature setting\n"); + return -EINVAL; + } + + mutex_lock(&ar->conf_mutex); + ar->btc_feature = val; + queue_work(ar->workqueue, &ar->restart_work); + mutex_unlock(&ar->conf_mutex); + + return count; +} + +static ssize_t ath10k_read_btc_feature(struct file *file, char __user *ubuf, + size_t count, loff_t *ppos) +{ + char buf[32]; + struct ath10k *ar = file->private_data; + int len = 0; + + mutex_lock(&ar->conf_mutex); + len = scnprintf(buf, sizeof(buf) - len, "%d\n", + ar->btc_feature); + mutex_unlock(&ar->conf_mutex); + + return simple_read_from_buffer(ubuf, count, ppos, buf, len); +} + +static const struct file_operations fops_btc_feature = { + .read = ath10k_read_btc_feature, + .write = ath10k_write_btc_feature, + .open = simple_open +}; + int ath10k_debug_create(struct ath10k *ar) { ar->debug.fw_crash_data = vzalloc(sizeof(*ar->debug.fw_crash_data)); @@ -2195,6 +2243,8 @@ int ath10k_debug_register(struct ath10k *ar) debugfs_create_file("quiet_period", S_IRUGO | S_IWUSR, ar->debug.debugfs_phy, ar, &fops_quiet_period); + debugfs_create_file("btc_feature", S_IRUGO | S_IWUSR, + ar->debug.debugfs_phy, ar, &fops_btc_feature); return 0; } diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c index ebaa096cf200..0d46168fbbb3 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c @@ -3933,7 +3933,8 @@ static struct sk_buff *ath10k_wmi_10_2_op_gen_init(struct ath10k *ar) cmd = (struct wmi_init_cmd_10_2 *)buf->data; features = WMI_10_2_RX_BATCH_MODE; - if (test_bit(WMI_SERVICE_COEX_GPIO, ar->wmi.svc_map)) + if (ar->btc_feature && + test_bit(WMI_SERVICE_COEX_GPIO, ar->wmi.svc_map)) features |= WMI_10_2_COEX_GPIO; cmd->resource_config.feature_mask = __cpu_to_le32(features);