Skip to content

Commit

Permalink
Revert "mwifiex: pcie: add reset_wsid quirk for Surface 3"
Browse files Browse the repository at this point in the history
This reverts commit b09ad7f.
  • Loading branch information
qzed committed Nov 3, 2022
1 parent f461b05 commit 32815a5
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 100 deletions.
10 changes: 0 additions & 10 deletions drivers/net/wireless/marvell/mwifiex/pcie.c
Original file line number Diff line number Diff line change
Expand Up @@ -2993,16 +2993,6 @@ static void mwifiex_pcie_card_reset_work(struct mwifiex_adapter *adapter)
{
struct pcie_service_card *card = adapter->card;

/* On Surface 3, reset_wsid method removes then re-probes card by
* itself. So, need to place it here and skip performing any other
* reset-related works.
*/
if (card->quirks & QUIRK_FW_RST_WSID_S3) {
mwifiex_pcie_reset_wsid_quirk(card->dev);
/* skip performing any other reset-related works */
return;
}

/* We can't afford to wait here; remove() might be waiting on us. If we
* can't grab the device lock, maybe we'll get another chance later.
*/
Expand Down
83 changes: 0 additions & 83 deletions drivers/net/wireless/marvell/mwifiex/pcie_quirks.c
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
// SPDX-License-Identifier: GPL-2.0-only
// NXP Wireless LAN device driver: PCIE and platform specific quirks

#include <linux/acpi.h>
#include <linux/dmi.h>

#include "pcie_quirks.h"

/* For reset_wsid quirk */
#define ACPI_WSID_PATH "\\_SB.WSID"
#define WSID_REV 0x0
#define WSID_FUNC_WIFI_PWR_OFF 0x1
#define WSID_FUNC_WIFI_PWR_ON 0x2
/* WSID _DSM UUID: "534ea3bf-fcc2-4e7a-908f-a13978f0c7ef" */
static const guid_t wsid_dsm_guid =
GUID_INIT(0x534ea3bf, 0xfcc2, 0x4e7a,
0x90, 0x8f, 0xa1, 0x39, 0x78, 0xf0, 0xc7, 0xef);

/* quirk table based on DMI matching */
static const struct dmi_system_id mwifiex_quirk_table[] = {
{
Expand Down Expand Up @@ -92,14 +81,6 @@ static const struct dmi_system_id mwifiex_quirk_table[] = {
.driver_data = (void *)(QUIRK_FW_RST_D3COLD |
QUIRK_DO_FLR_ON_BRIDGE),
},
{
.ident = "Surface 3",
.matches = {
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Surface 3"),
},
.driver_data = (void *)QUIRK_FW_RST_WSID_S3,
},
{}
};

Expand All @@ -116,9 +97,6 @@ void mwifiex_initialize_quirks(struct pcie_service_card *card)
dev_info(&pdev->dev, "no quirks enabled\n");
if (card->quirks & QUIRK_FW_RST_D3COLD)
dev_info(&pdev->dev, "quirk reset_d3cold enabled\n");
if (card->quirks & QUIRK_FW_RST_WSID_S3)
dev_info(&pdev->dev,
"quirk reset_wsid for Surface 3 enabled\n");
if (card->quirks & QUIRK_DO_FLR_ON_BRIDGE)
dev_info(&pdev->dev, "quirk do_flr_on_bridge enabled\n");
}
Expand Down Expand Up @@ -177,64 +155,3 @@ int mwifiex_pcie_reset_d3cold_quirk(struct pci_dev *pdev)

return 0;
}

int mwifiex_pcie_reset_wsid_quirk(struct pci_dev *pdev)
{
acpi_handle handle;
union acpi_object *obj;
acpi_status status;

dev_info(&pdev->dev, "Using reset_wsid quirk to perform FW reset\n");

status = acpi_get_handle(NULL, ACPI_WSID_PATH, &handle);
if (ACPI_FAILURE(status)) {
dev_err(&pdev->dev, "No ACPI handle for path %s\n",
ACPI_WSID_PATH);
return -ENODEV;
}

if (!acpi_has_method(handle, "_DSM")) {
dev_err(&pdev->dev, "_DSM method not found\n");
return -ENODEV;
}

if (!acpi_check_dsm(handle, &wsid_dsm_guid,
WSID_REV, WSID_FUNC_WIFI_PWR_OFF)) {
dev_err(&pdev->dev,
"_DSM method doesn't support wifi power off func\n");
return -ENODEV;
}

if (!acpi_check_dsm(handle, &wsid_dsm_guid,
WSID_REV, WSID_FUNC_WIFI_PWR_ON)) {
dev_err(&pdev->dev,
"_DSM method doesn't support wifi power on func\n");
return -ENODEV;
}

/* card will be removed immediately after this call on Surface 3 */
dev_info(&pdev->dev, "turning wifi off...\n");
obj = acpi_evaluate_dsm(handle, &wsid_dsm_guid,
WSID_REV, WSID_FUNC_WIFI_PWR_OFF,
NULL);
if (!obj) {
dev_err(&pdev->dev,
"device _DSM execution failed for turning wifi off\n");
return -EIO;
}
ACPI_FREE(obj);

/* card will be re-probed immediately after this call on Surface 3 */
dev_info(&pdev->dev, "turning wifi on...\n");
obj = acpi_evaluate_dsm(handle, &wsid_dsm_guid,
WSID_REV, WSID_FUNC_WIFI_PWR_ON,
NULL);
if (!obj) {
dev_err(&pdev->dev,
"device _DSM execution failed for turning wifi on\n");
return -EIO;
}
ACPI_FREE(obj);

return 0;
}
8 changes: 1 addition & 7 deletions drivers/net/wireless/marvell/mwifiex/pcie_quirks.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@
#include "pcie.h"

#define QUIRK_FW_RST_D3COLD BIT(0)

/* Surface 3 and Surface Pro 3 have the same _DSM method but need to
* be handled differently. Currently, only S3 is supported.
*/
#define QUIRK_FW_RST_WSID_S3 BIT(1)
#define QUIRK_DO_FLR_ON_BRIDGE BIT(2)
#define QUIRK_DO_FLR_ON_BRIDGE BIT(1)

void mwifiex_initialize_quirks(struct pcie_service_card *card);
int mwifiex_pcie_reset_d3cold_quirk(struct pci_dev *pdev);
int mwifiex_pcie_reset_wsid_quirk(struct pci_dev *pdev);

0 comments on commit 32815a5

Please sign in to comment.