Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1518799ybv; Fri, 14 Feb 2020 01:04:49 -0800 (PST) X-Google-Smtp-Source: APXvYqxhKMOwVMQKhfIMia2MYZBkdFEZ8CayIEXm/wpq6jAM+mfVPqWnOefVA4MkumW/xmb20m1Q X-Received: by 2002:aca:d610:: with SMTP id n16mr1207849oig.108.1581671088940; Fri, 14 Feb 2020 01:04:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581671088; cv=none; d=google.com; s=arc-20160816; b=KR79AKrN/qquVZa9rNiAjN9zjyHEc/ElFKQFKwHg9GxFPLumczP0XY2S1rqtLJLvD+ H66rejnLaNgvT8uP7TshUfM4pl2DqlcxIDTS7ztHl25BZ5OBvn3bAdr29mEydhf9LJ9B onCeoIMdm1Bm+Qz7o6MQHQt3MC0z/kMWL8L8SU+Voj3zkeqzLbpMT3CXTkGitef0cS28 ehnTgB5i7j6seIf17gF705VSud87ZZDFnsu+Nnfb7V2Le0za72Ccq2YfFvvJIziT/g6O nXJJCU8GOEVQnUv4znuQt24yFk61DBEUsbRLv5fzAGyE2sdZIlqQqWjIPd+FvkIkIw9b 2FMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:authenticated-by; bh=w05dGZN/c+DvwzSh4f0gYIRlHfPZz+xug2zPDkW8jso=; b=PomzKnAS+tVbn1O4s7udbh+t6BvhLNASlR+9t5ew/kW1t4AtCLJ4JqGXcwIkOLFU2l zvTLyPSBU7wF3BDuFwjS3ya+M6LGlCgkYHilP4BpgA4mL1lE3IsW0DGJBtD4Ie7ZReSK QcetwYF6QWzmkCJ3mzeRjDFKgU3CBmrI7eXdtUBUFzPLY4TYpEvuc3gcMMog3tz5er8A ye2tTxawirKF5jDN2K2szBt98Kwv29QRhro4bPTOwJoRDMGYI/EgLTDs/ZpG/LDUln8M zd1uu56N5yXgArpnWUDQ1gPQHh9jmS46jTMn8/ZbMnSnC35q39OyVjo4vHtZoBwG1NIl +I8A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z1si2551366otp.70.2020.02.14.01.04.38; Fri, 14 Feb 2020 01:04:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729008AbgBNJEA (ORCPT + 99 others); Fri, 14 Feb 2020 04:04:00 -0500 Received: from rtits2.realtek.com ([211.75.126.72]:35653 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728522AbgBNJEA (ORCPT ); Fri, 14 Feb 2020 04:04:00 -0500 Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.62 with qID 01E93qYX032387, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (RTEXMB06.realtek.com.tw[172.21.6.99]) by rtits2.realtek.com.tw (8.15.2/2.57/5.78) with ESMTPS id 01E93qYX032387 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 14 Feb 2020 17:03:52 +0800 Received: from RTEXMB04.realtek.com.tw (172.21.6.97) by RTEXMB06.realtek.com.tw (172.21.6.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1779.2; Fri, 14 Feb 2020 17:03:52 +0800 Received: from localhost.localdomain (172.21.68.128) by RTEXMB04.realtek.com.tw (172.21.6.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1779.2; Fri, 14 Feb 2020 17:03:51 +0800 From: To: CC: , Subject: [PATCH 2/2] rtw88: add a debugfs entry to enable/disable coex mechanism Date: Fri, 14 Feb 2020 17:03:34 +0800 Message-ID: <20200214090334.330-3-yhchuang@realtek.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200214090334.330-1-yhchuang@realtek.com> References: <20200214090334.330-1-yhchuang@realtek.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.21.68.128] X-ClientProxiedBy: RTEXMB03.realtek.com.tw (172.21.6.96) To RTEXMB04.realtek.com.tw (172.21.6.97) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Yan-Hsuan Chuang Sometimes we need to stop the coex mechanism to debug, so that we can manually control the device through various outer commands. Hence, add a new debugfs coex_enable to allow us to enable/disable the coex mechanism when driver is running. To disable coex echo 0 > /sys/kernel/debug/ieee80211/phyX/rtw88/coex_enable To enable coex echo 1 > /sys/kernel/debug/ieee80211/phyX/rtw88/coex_enable To check coex dm is enabled or not cat /sys/kernel/debug/ieee80211/phyX/rtw88/coex_enable Signed-off-by: Yan-Hsuan Chuang --- drivers/net/wireless/realtek/rtw88/debug.c | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw88/debug.c b/drivers/net/wireless/realtek/rtw88/debug.c index b2d264270752..b00eee68b3fb 100644 --- a/drivers/net/wireless/realtek/rtw88/debug.c +++ b/drivers/net/wireless/realtek/rtw88/debug.c @@ -706,6 +706,46 @@ static int rtw_debugfs_get_coex_info(struct seq_file *m, void *v) return 0; } +static ssize_t rtw_debugfs_set_coex_enable(struct file *filp, + const char __user *buffer, + size_t count, loff_t *loff) +{ + struct seq_file *seqpriv = (struct seq_file *)filp->private_data; + struct rtw_debugfs_priv *debugfs_priv = seqpriv->private; + struct rtw_dev *rtwdev = debugfs_priv->rtwdev; + struct rtw_coex *coex = &rtwdev->coex; + char tmp[32 + 1]; + u32 enable; + int num; + + rtw_debugfs_copy_from_user(tmp, sizeof(tmp), buffer, count, 2); + + num = sscanf(tmp, "%d", &enable); + + if (num != 1) { + rtw_warn(rtwdev, "invalid arguments\n"); + return num; + } + + mutex_lock(&rtwdev->mutex); + coex->stop_dm = enable == 0; + mutex_unlock(&rtwdev->mutex); + + return count; +} + +static int rtw_debugfs_get_coex_enable(struct seq_file *m, void *v) +{ + struct rtw_debugfs_priv *debugfs_priv = m->private; + struct rtw_dev *rtwdev = debugfs_priv->rtwdev; + struct rtw_coex *coex = &rtwdev->coex; + + seq_printf(m, "coex mechanism %s\n", + coex->stop_dm ? "disabled" : "enabled"); + + return 0; +} + #define rtw_debug_impl_mac(page, addr) \ static struct rtw_debugfs_priv rtw_debug_priv_mac_ ##page = { \ .cb_read = rtw_debug_get_mac_page, \ @@ -796,6 +836,11 @@ static struct rtw_debugfs_priv rtw_debug_priv_phy_info = { .cb_read = rtw_debugfs_get_phy_info, }; +static struct rtw_debugfs_priv rtw_debug_priv_coex_enable = { + .cb_write = rtw_debugfs_set_coex_enable, + .cb_read = rtw_debugfs_get_coex_enable, +}; + static struct rtw_debugfs_priv rtw_debug_priv_coex_info = { .cb_read = rtw_debugfs_get_coex_info, }; @@ -831,6 +876,7 @@ void rtw_debugfs_init(struct rtw_dev *rtwdev) rtw_debugfs_add_rw(rsvd_page); rtw_debugfs_add_r(phy_info); rtw_debugfs_add_r(coex_info); + rtw_debugfs_add_rw(coex_enable); rtw_debugfs_add_r(mac_0); rtw_debugfs_add_r(mac_1); rtw_debugfs_add_r(mac_2); -- 2.17.1