From patchwork Mon Feb 19 13:19:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitkumar Karwar X-Patchwork-Id: 10227855 X-Patchwork-Delegate: kvalo@adurom.com 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 9248B60467 for ; Mon, 19 Feb 2018 13:31:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 81C4428687 for ; Mon, 19 Feb 2018 13:31:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7632D28770; Mon, 19 Feb 2018 13:31:39 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F9C628687 for ; Mon, 19 Feb 2018 13:31:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752918AbeBSNbb (ORCPT ); Mon, 19 Feb 2018 08:31:31 -0500 Received: from mail-pl0-f67.google.com ([209.85.160.67]:35854 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752890AbeBSNb3 (ORCPT ); Mon, 19 Feb 2018 08:31:29 -0500 Received: by mail-pl0-f67.google.com with SMTP id v3so5636895plg.3; Mon, 19 Feb 2018 05:31:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=CkKkKlyy3DyrEH7qwlKS7dF+rA0yzpRESi9EIT5aN0M=; b=jFf1z61R/iu5+Niris3Y8Qq25RKyfhUD/sdO4P0ER7FRaIy+mFrz78fpilnt6WxE4n QhNbW8rMK8ApcIlPWAZCCz33VM+y5EZnO2nQylUQOd3ApxcfzH1h/+NyKbembHMFOoUv 0J96Lfb4EgoAmcxXqjUgNmP49tpYg0BJ4+cEuEBsl/SndnD/6NhMUcFm3GT0Yc3zeQVS EUgv0GwvZ1poHam3UECp5DOVJPejI59PVUYkKDlRyPLsu/EQmjuk7aJRpT6pDgUK2yOw essI9jkjvD5PzZv9P7jfpXVHIldjbAj1q2KY+nFY1n+vySd5FQOiQKxPTbP4zSLefUKn W2Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=CkKkKlyy3DyrEH7qwlKS7dF+rA0yzpRESi9EIT5aN0M=; b=dnMJ9/VOyZpLMYS4Zb8R1CG22shj9ajcoeXkgZoIKcU2bq4TFxv9coYvzKMf0xR8Yc QxLOj3oiW5VjD7nVYM/QoqYs5thhrf4HsdRLXVHt5k2LVyQMh74P0t0n9nRWY1p/tr6k Do2kSPSgZ14plHa+TGXA8/ZIv0vr5VBX03vB8Me63gl+L2Zf5ynaiK/dd7JhSkXNhwkD 5NhrLFJ9v9dQbQi4MJcbk9Bn8UwJ5+PrjDdc7yOTZFb7kFoGnTlWG1nq2Oa+6i/rVK+v mwsAidyjPeI4iOOItQ24z5TG4ZaIK74GFmhMyaw9ami8ljpX7NX2Q7U9kioDXQcxOVdG AOuA== X-Gm-Message-State: APf1xPAOCxdWhoSRMZbS4P9XNXJ3950BDylr2FksAmjHLWOzCwhyC8iD yQj63P47C3XuJmvrNBc2kZA= X-Google-Smtp-Source: AH8x2265+9KtKjM2DW5Dqwa07hERQWbk4Nd36oPUZGoMjFzh3I03xFAKt5HYlZdhnEcEY3vsCqDdnQ== X-Received: by 2002:a17:902:8498:: with SMTP id c24-v6mr14202120plo.450.1519047088705; Mon, 19 Feb 2018 05:31:28 -0800 (PST) Received: from cpu185.redpinesignals.com ([203.196.161.90]) by smtp.gmail.com with ESMTPSA id m24sm32584982pgv.14.2018.02.19.05.31.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 19 Feb 2018 05:31:27 -0800 (PST) From: Amitkumar Karwar To: Kalle Valo , marcel@holtmann.org Cc: linux-wireless@vger.kernel.org, Amitkumar Karwar , Prameela Rani Garnepudi , linux-bluetooth@vger.kernel.org, Siva Rebbagondla Subject: [v7 7/8] rsi: add module parameter operating mode Date: Mon, 19 Feb 2018 18:49:38 +0530 Message-Id: <1519046379-10068-8-git-send-email-amitkarwar@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519046379-10068-1-git-send-email-amitkarwar@gmail.com> References: <1519046379-10068-1-git-send-email-amitkarwar@gmail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Prameela Rani Garnepudi Operating mode determines the support for other protocols. This is made as module parameter for better usage. Signed-off-by: Prameela Rani Garnepudi Signed-off-by: Siva Rebbagondla Signed-off-by: Amitkumar Karwar --- drivers/net/wireless/rsi/rsi_91x_main.c | 48 ++++++++++++++++++++++++++++++--- drivers/net/wireless/rsi/rsi_91x_sdio.c | 10 ++++++- drivers/net/wireless/rsi/rsi_91x_usb.c | 10 ++++++- drivers/net/wireless/rsi/rsi_common.h | 2 +- drivers/net/wireless/rsi/rsi_hal.h | 11 ++++++++ 5 files changed, 74 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/rsi/rsi_91x_main.c b/drivers/net/wireless/rsi/rsi_91x_main.c index b3e7d75..1485a0c 100644 --- a/drivers/net/wireless/rsi/rsi_91x_main.c +++ b/drivers/net/wireless/rsi/rsi_91x_main.c @@ -70,8 +70,24 @@ EXPORT_SYMBOL_GPL(rsi_dbg); static char *opmode_str(int oper_mode) { switch (oper_mode) { - case RSI_DEV_OPMODE_WIFI_ALONE: + case DEV_OPMODE_WIFI_ALONE: return "Wi-Fi alone"; + case DEV_OPMODE_BT_ALONE: + return "BT EDR alone"; + case DEV_OPMODE_BT_LE_ALONE: + return "BT LE alone"; + case DEV_OPMODE_BT_DUAL: + return "BT Dual"; + case DEV_OPMODE_STA_BT: + return "Wi-Fi STA + BT EDR"; + case DEV_OPMODE_STA_BT_LE: + return "Wi-Fi STA + BT LE"; + case DEV_OPMODE_STA_BT_DUAL: + return "Wi-Fi STA + BT DUAL"; + case DEV_OPMODE_AP_BT: + return "Wi-Fi AP + BT EDR"; + case DEV_OPMODE_AP_BT_DUAL: + return "Wi-Fi AP + BT DUAL"; } return "Unknown"; @@ -278,7 +294,7 @@ void rsi_set_bt_context(void *priv, void *bt_context) * * Return: Pointer to the adapter structure on success, NULL on failure . */ -struct rsi_hw *rsi_91x_init(void) +struct rsi_hw *rsi_91x_init(u16 oper_mode) { struct rsi_hw *adapter = NULL; struct rsi_common *common = NULL; @@ -321,9 +337,33 @@ struct rsi_hw *rsi_91x_init(void) timer_setup(&common->roc_timer, rsi_roc_timeout, 0); init_completion(&common->wlan_init_completion); common->init_done = true; + adapter->device_model = RSI_DEV_9113; + common->oper_mode = oper_mode; + + /* Determine coex mode */ + switch (common->oper_mode) { + case DEV_OPMODE_STA_BT_DUAL: + case DEV_OPMODE_STA_BT: + case DEV_OPMODE_STA_BT_LE: + case DEV_OPMODE_BT_ALONE: + case DEV_OPMODE_BT_LE_ALONE: + case DEV_OPMODE_BT_DUAL: + common->coex_mode = 2; + break; + case DEV_OPMODE_AP_BT_DUAL: + case DEV_OPMODE_AP_BT: + common->coex_mode = 4; + break; + case DEV_OPMODE_WIFI_ALONE: + common->coex_mode = 1; + break; + default: + common->oper_mode = 1; + common->coex_mode = 1; + } + rsi_dbg(INFO_ZONE, "%s: oper_mode = %d, coex_mode = %d\n", + __func__, common->oper_mode, common->coex_mode); - common->coex_mode = RSI_DEV_COEX_MODE_WIFI_ALONE; - common->oper_mode = RSI_DEV_OPMODE_WIFI_ALONE; adapter->device_model = RSI_DEV_9113; #ifdef CONFIG_RSI_COEX if (common->coex_mode > 1) { diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio.c b/drivers/net/wireless/rsi/rsi_91x_sdio.c index ba38c6d..5722736 100644 --- a/drivers/net/wireless/rsi/rsi_91x_sdio.c +++ b/drivers/net/wireless/rsi/rsi_91x_sdio.c @@ -21,6 +21,14 @@ #include "rsi_coex.h" #include "rsi_hal.h" +/* Default operating mode is wlan STA + BT */ +static u16 dev_oper_mode = DEV_OPMODE_STA_BT_DUAL; +module_param(dev_oper_mode, ushort, 0444); +MODULE_PARM_DESC(dev_oper_mode, + "1[Wi-Fi], 4[BT], 8[BT LE], 5[Wi-Fi STA + BT classic]\n" + "9[Wi-Fi STA + BT LE], 13[Wi-Fi STA + BT classic + BT LE]\n" + "6[AP + BT classic], 14[AP + BT classic + BT LE]"); + /** * rsi_sdio_set_cmd52_arg() - This function prepares cmd 52 read/write arg. * @rw: Read/write @@ -926,7 +934,7 @@ static int rsi_probe(struct sdio_func *pfunction, rsi_dbg(INIT_ZONE, "%s: Init function called\n", __func__); - adapter = rsi_91x_init(); + adapter = rsi_91x_init(dev_oper_mode); if (!adapter) { rsi_dbg(ERR_ZONE, "%s: Failed to init os intf ops\n", __func__); diff --git a/drivers/net/wireless/rsi/rsi_91x_usb.c b/drivers/net/wireless/rsi/rsi_91x_usb.c index b33a05f..0a50cff 100644 --- a/drivers/net/wireless/rsi/rsi_91x_usb.c +++ b/drivers/net/wireless/rsi/rsi_91x_usb.c @@ -21,6 +21,14 @@ #include "rsi_hal.h" #include "rsi_coex.h" +/* Default operating mode is wlan STA + BT */ +static u16 dev_oper_mode = DEV_OPMODE_STA_BT_DUAL; +module_param(dev_oper_mode, ushort, 0444); +MODULE_PARM_DESC(dev_oper_mode, + "1[Wi-Fi], 4[BT], 8[BT LE], 5[Wi-Fi STA + BT classic]\n" + "9[Wi-Fi STA + BT LE], 13[Wi-Fi STA + BT classic + BT LE]\n" + "6[AP + BT classic], 14[AP + BT classic + BT LE]"); + /** * rsi_usb_card_write() - This function writes to the USB Card. * @adapter: Pointer to the adapter structure. @@ -708,7 +716,7 @@ static int rsi_probe(struct usb_interface *pfunction, rsi_dbg(INIT_ZONE, "%s: Init function called\n", __func__); - adapter = rsi_91x_init(); + adapter = rsi_91x_init(dev_oper_mode); if (!adapter) { rsi_dbg(ERR_ZONE, "%s: Failed to init os intf ops\n", __func__); diff --git a/drivers/net/wireless/rsi/rsi_common.h b/drivers/net/wireless/rsi/rsi_common.h index 4616585..d9ff3b8 100644 --- a/drivers/net/wireless/rsi/rsi_common.h +++ b/drivers/net/wireless/rsi/rsi_common.h @@ -81,7 +81,7 @@ static inline int rsi_kill_thread(struct rsi_thread *handle) void rsi_mac80211_detach(struct rsi_hw *hw); u16 rsi_get_connected_channel(struct ieee80211_vif *vif); -struct rsi_hw *rsi_91x_init(void); +struct rsi_hw *rsi_91x_init(u16 oper_mode); void rsi_91x_deinit(struct rsi_hw *adapter); int rsi_read_pkt(struct rsi_common *common, u8 *rx_pkt, s32 rcv_pkt_len); #ifdef CONFIG_PM diff --git a/drivers/net/wireless/rsi/rsi_hal.h b/drivers/net/wireless/rsi/rsi_hal.h index e712223..a7d3011 100644 --- a/drivers/net/wireless/rsi/rsi_hal.h +++ b/drivers/net/wireless/rsi/rsi_hal.h @@ -17,6 +17,17 @@ #ifndef __RSI_HAL_H__ #define __RSI_HAL_H__ +/* Device Operating modes */ +#define DEV_OPMODE_WIFI_ALONE 1 +#define DEV_OPMODE_BT_ALONE 4 +#define DEV_OPMODE_BT_LE_ALONE 8 +#define DEV_OPMODE_BT_DUAL 12 +#define DEV_OPMODE_STA_BT 5 +#define DEV_OPMODE_STA_BT_LE 9 +#define DEV_OPMODE_STA_BT_DUAL 13 +#define DEV_OPMODE_AP_BT 6 +#define DEV_OPMODE_AP_BT_DUAL 14 + #define FLASH_WRITE_CHUNK_SIZE (4 * 1024) #define FLASH_SECTOR_SIZE (4 * 1024)