Skip to content

Commit

Permalink
rtw88: add quirks to disable pci capabilities
Browse files Browse the repository at this point in the history
[ Upstream commit 956c6d4 ]

8821CE with ASPM cannot work properly on Protempo Ltd L116HTN6SPW. Add a
quirk to disable the cap.

The reporter describes the symptom is that this module (driver) causes
frequent freezes, randomly but usually within a few minutes of running
(thus very soon after boot): screen display remains frozen, no response
to either keyboard or mouse input. All I can do is to hold the power
button to power off, then reboot.

Reported-by: Paul Szabo <psz2036@gmail.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210607012254.6306-1-pkshih@realtek.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Ping-Ke Shih authored and gregkh committed Jul 19, 2021
1 parent a73056e commit 55ece34
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions drivers/net/wireless/realtek/rtw88/pci.c
Expand Up @@ -2,6 +2,7 @@
/* Copyright(c) 2018-2019 Realtek Corporation
*/

#include <linux/dmi.h>
#include <linux/module.h>
#include <linux/pci.h>
#include "main.h"
Expand Down Expand Up @@ -1598,6 +1599,36 @@ static void rtw_pci_napi_deinit(struct rtw_dev *rtwdev)
netif_napi_del(&rtwpci->napi);
}

enum rtw88_quirk_dis_pci_caps {
QUIRK_DIS_PCI_CAP_MSI,
QUIRK_DIS_PCI_CAP_ASPM,
};

static int disable_pci_caps(const struct dmi_system_id *dmi)
{
uintptr_t dis_caps = (uintptr_t)dmi->driver_data;

if (dis_caps & BIT(QUIRK_DIS_PCI_CAP_MSI))
rtw_disable_msi = true;
if (dis_caps & BIT(QUIRK_DIS_PCI_CAP_ASPM))
rtw_pci_disable_aspm = true;

return 1;
}

static const struct dmi_system_id rtw88_pci_quirks[] = {
{
.callback = disable_pci_caps,
.ident = "Protempo Ltd L116HTN6SPW",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Protempo Ltd"),
DMI_MATCH(DMI_PRODUCT_NAME, "L116HTN6SPW"),
},
.driver_data = (void *)BIT(QUIRK_DIS_PCI_CAP_ASPM),
},
{}
};

int rtw_pci_probe(struct pci_dev *pdev,
const struct pci_device_id *id)
{
Expand Down Expand Up @@ -1648,6 +1679,7 @@ int rtw_pci_probe(struct pci_dev *pdev,
goto err_destroy_pci;
}

dmi_check_system(rtw88_pci_quirks);
rtw_pci_phy_cfg(rtwdev);

ret = rtw_register_hw(rtwdev, hw);
Expand Down

0 comments on commit 55ece34

Please sign in to comment.