123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231 |
- From a3b5cbab95f51e6923be2d6c3dca5482cae46468 Mon Sep 17 00:00:00 2001
- From: sebanc <22224731+sebanc@users.noreply.github.com>
- Date: Mon, 4 Nov 2019 09:30:57 +0100
- Subject: [PATCH 6/7] wifi
- ---
- .../net/wireless/marvell/mwifiex/cfg80211.c | 26 +++++++
- drivers/net/wireless/marvell/mwifiex/pcie.c | 74 ++++++++++---------
- .../net/wireless/marvell/mwifiex/sta_cmd.c | 26 +------
- 3 files changed, 67 insertions(+), 59 deletions(-)
- diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
- index d89684168500..108d7ac6a0dd 100644
- --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
- +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
- @@ -25,6 +25,11 @@
- static char *reg_alpha2;
- module_param(reg_alpha2, charp, 0);
-
- +static bool allow_ps_mode;
- +module_param(allow_ps_mode, bool, 0444);
- +MODULE_PARM_DESC(allow_ps_mode,
- + "allow WiFi power management to be enabled. (default: disallowed)");
- +
- static const struct ieee80211_iface_limit mwifiex_ap_sta_limits[] = {
- {
- .max = 3, .types = BIT(NL80211_IFTYPE_STATION) |
- @@ -439,6 +444,27 @@ mwifiex_cfg80211_set_power_mgmt(struct wiphy *wiphy,
-
- ps_mode = enabled;
-
- + /* Allow ps_mode to be enabled only when allow_ps_mode is set
- + * (but always allow ps_mode to be disabled in case it gets enabled
- + * for unknown reason and you want to disable it) */
- + if (ps_mode && !allow_ps_mode) {
- + dev_info(priv->adapter->dev,
- + "Request to enable ps_mode received but it's disallowed "
- + "by module parameter. Rejecting the request.\n");
- +
- + /* Return negative value to inform userspace tools that setting
- + * power_save to be enabled is not permitted. */
- + return -1;
- + }
- +
- + if (ps_mode)
- + dev_warn(priv->adapter->dev,
- + "WARN: Request to enable ps_mode received. Enabling it. "
- + "Disable it if you encounter connection instability.\n");
- + else
- + dev_info(priv->adapter->dev,
- + "Request to disable ps_mode received. Disabling it.\n");
- +
- return mwifiex_drv_set_power(priv, &ps_mode);
- }
-
- diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
- index fc1706d0647d..b3380ed75431 100644
- --- a/drivers/net/wireless/marvell/mwifiex/pcie.c
- +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
- @@ -149,35 +149,38 @@ static bool mwifiex_pcie_ok_to_access_hw(struct mwifiex_adapter *adapter)
- */
- static int mwifiex_pcie_suspend(struct device *dev)
- {
- + struct pci_dev *pdev = to_pci_dev(dev);
- + struct pcie_service_card *card = pci_get_drvdata(pdev);
- struct mwifiex_adapter *adapter;
- - struct pcie_service_card *card = dev_get_drvdata(dev);
- -
- + struct mwifiex_private *priv;
- + const struct mwifiex_pcie_card_reg *reg;
- + u32 fw_status;
- + int ret;
-
- /* Might still be loading firmware */
- wait_for_completion(&card->fw_done);
-
- adapter = card->adapter;
- - if (!adapter) {
- - dev_err(dev, "adapter is not valid\n");
- + if (!adapter || !adapter->priv_num)
- return 0;
- - }
-
- - mwifiex_enable_wake(adapter);
- + reg = card->pcie.reg;
- + if (reg)
- + ret = mwifiex_read_reg(adapter, reg->fw_status, &fw_status);
- + else
- + fw_status = -1;
- +
- + if (fw_status == FIRMWARE_READY_PCIE && !adapter->mfg_mode) {
- + mwifiex_deauthenticate_all(adapter);
-
- - /* Enable the Host Sleep */
- - if (!mwifiex_enable_hs(adapter)) {
- - mwifiex_dbg(adapter, ERROR,
- - "cmd: failed to suspend\n");
- - clear_bit(MWIFIEX_IS_HS_ENABLING, &adapter->work_flags);
- - mwifiex_disable_wake(adapter);
- - return -EFAULT;
- - }
- + priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
-
- - flush_workqueue(adapter->workqueue);
- + mwifiex_disable_auto_ds(priv);
-
- - /* Indicate device suspended */
- - set_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags);
- - clear_bit(MWIFIEX_IS_HS_ENABLING, &adapter->work_flags);
- + mwifiex_init_shutdown_fw(priv, MWIFIEX_FUNC_SHUTDOWN);
- + }
- +
- + mwifiex_remove_card(adapter);
-
- return 0;
- }
- @@ -192,28 +195,29 @@ static int mwifiex_pcie_suspend(struct device *dev)
- */
- static int mwifiex_pcie_resume(struct device *dev)
- {
- - struct mwifiex_adapter *adapter;
- - struct pcie_service_card *card = dev_get_drvdata(dev);
- + struct pci_dev *pdev = to_pci_dev(dev);
- + struct pcie_service_card *card = pci_get_drvdata(pdev);
- + int ret;
-
- + pr_debug("info: vendor=0x%4.04X device=0x%4.04X rev=%d\n",
- + pdev->vendor, pdev->device, pdev->revision);
-
- - if (!card->adapter) {
- - dev_err(dev, "adapter structure is not valid\n");
- - return 0;
- - }
- + init_completion(&card->fw_done);
-
- - adapter = card->adapter;
- + card->dev = pdev;
-
- - if (!test_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags)) {
- - mwifiex_dbg(adapter, WARN,
- - "Device already resumed\n");
- - return 0;
- + /* device tree node parsing and platform specific configuration */
- + if (pdev->dev.of_node) {
- + ret = mwifiex_pcie_probe_of(&pdev->dev);
- + if (ret)
- + return ret;
- }
-
- - clear_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags);
- -
- - mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA),
- - MWIFIEX_ASYNC_CMD);
- - mwifiex_disable_wake(adapter);
- + if (mwifiex_add_card(card, &card->fw_done, &pcie_ops,
- + MWIFIEX_PCIE, &pdev->dev)) {
- + pr_err("%s failed\n", __func__);
- + return -1;
- + }
-
- return 0;
- }
- @@ -267,6 +271,8 @@ static int mwifiex_pcie_probe(struct pci_dev *pdev,
- return -1;
- }
-
- + pdev->bus->self->bridge_d3 = false;
- +
- return 0;
- }
-
- diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
- index 4ed10cf82f9a..977b57c0908f 100644
- --- a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
- +++ b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
- @@ -2265,14 +2265,13 @@ int mwifiex_sta_prepare_cmd(struct mwifiex_private *priv, uint16_t cmd_no,
- int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta, bool init)
- {
- struct mwifiex_adapter *adapter = priv->adapter;
- - int ret;
- struct mwifiex_ds_11n_amsdu_aggr_ctrl amsdu_aggr_ctrl;
- - struct mwifiex_ds_auto_ds auto_ds;
- enum state_11d_t state_11d;
- struct mwifiex_ds_11n_tx_cfg tx_cfg;
- u8 sdio_sp_rx_aggr_enable;
- u16 packet_aggr_enable;
- int data;
- + int ret;
-
- if (first_sta) {
- if (priv->adapter->iface_type == MWIFIEX_PCIE) {
- @@ -2339,17 +2338,6 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta, bool init)
- if (ret)
- return -1;
-
- - if (priv->bss_type != MWIFIEX_BSS_TYPE_UAP) {
- - /* Enable IEEE PS by default */
- - priv->adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_PSP;
- - ret = mwifiex_send_cmd(priv,
- - HostCmd_CMD_802_11_PS_MODE_ENH,
- - EN_AUTO_PS, BITMAP_STA_PS, NULL,
- - true);
- - if (ret)
- - return -1;
- - }
- -
- if (drcs) {
- adapter->drcs_enabled = true;
- if (ISSUPP_DRCS_ENABLED(adapter->fw_cap_info))
- @@ -2395,18 +2383,6 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta, bool init)
- if (ret)
- return -1;
-
- - if (!disable_auto_ds && first_sta &&
- - priv->bss_type != MWIFIEX_BSS_TYPE_UAP) {
- - /* Enable auto deep sleep */
- - auto_ds.auto_ds = DEEP_SLEEP_ON;
- - auto_ds.idle_time = DEEP_SLEEP_IDLE_TIME;
- - ret = mwifiex_send_cmd(priv, HostCmd_CMD_802_11_PS_MODE_ENH,
- - EN_AUTO_PS, BITMAP_AUTO_DS,
- - &auto_ds, true);
- - if (ret)
- - return -1;
- - }
- -
- if (priv->bss_type != MWIFIEX_BSS_TYPE_UAP) {
- /* Send cmd to FW to enable/disable 11D function */
- state_11d = ENABLE_11D;
- --
- 2.26.0
|