wifi: rtw89: add dev_id_quirks to driver_info for per-device quirk control

Add a dev_id_quirks field to rtw89_driver_info so that per-device
(VID/PID) quirks can be expressed independently of chip-level
default_quirks. Apply the bitmap in rtw89_alloc_ieee80211_hw() so
both USB and PCI probes benefit automatically.

All existing driver_info structs initialize dev_id_quirks to 0;
no behavior change.

Signed-off-by: Johnson Tsai <wenjie.tsai@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260529075032.16807-2-pkshih@realtek.com
This commit is contained in:
Johnson Tsai 2026-05-29 15:50:31 +08:00 committed by Ping-Ke Shih
parent bf4a37f516
commit 7554f6602a
16 changed files with 25 additions and 8 deletions

View File

@ -7532,9 +7532,11 @@ EXPORT_SYMBOL(rtw89_core_unregister);
struct rtw89_dev *rtw89_alloc_ieee80211_hw(struct device *device,
u32 bus_data_size,
const struct rtw89_chip_info *chip,
const struct rtw89_chip_variant *variant)
const struct rtw89_driver_info *info)
{
const unsigned long *dev_id_quirks = &info->dev_id_quirks;
const struct rtw89_chip_variant *variant = info->variant;
const struct rtw89_chip_info *chip = info->chip;
struct rtw89_fw_info early_fw = {};
const struct firmware *firmware;
struct ieee80211_hw *hw;
@ -7600,6 +7602,9 @@ struct rtw89_dev *rtw89_alloc_ieee80211_hw(struct device *device,
rtwdev->fw.fw_format = fw_format;
rtwdev->support_mlo = support_mlo;
bitmap_or(rtwdev->quirks, rtwdev->quirks, dev_id_quirks,
NUM_OF_RTW89_QUIRKS);
rtw89_debug(rtwdev, RTW89_DBG_CHAN, "probe driver %s chanctx\n",
no_chanctx ? "without" : "with");
rtw89_debug(rtwdev, RTW89_DBG_CHAN, "probe driver %s MLO cap\n",

View File

@ -4803,6 +4803,7 @@ struct rtw89_driver_info {
const struct rtw89_chip_info *chip;
const struct rtw89_chip_variant *variant;
const struct dmi_system_id *quirks;
unsigned long dev_id_quirks; /* bitmap of rtw89_quirks */
union rtw89_bus_info bus;
};
@ -8129,8 +8130,7 @@ int rtw89_core_register(struct rtw89_dev *rtwdev);
void rtw89_core_unregister(struct rtw89_dev *rtwdev);
struct rtw89_dev *rtw89_alloc_ieee80211_hw(struct device *device,
u32 bus_data_size,
const struct rtw89_chip_info *chip,
const struct rtw89_chip_variant *variant);
const struct rtw89_driver_info *info);
void rtw89_free_ieee80211_hw(struct rtw89_dev *rtwdev);
u8 rtw89_acquire_mac_id(struct rtw89_dev *rtwdev);
void rtw89_release_mac_id(struct rtw89_dev *rtwdev, u8 mac_id);

View File

@ -4772,8 +4772,7 @@ int rtw89_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
info = (const struct rtw89_driver_info *)id->driver_data;
rtwdev = rtw89_alloc_ieee80211_hw(&pdev->dev,
sizeof(struct rtw89_pci),
info->chip, info->variant);
sizeof(struct rtw89_pci), info);
if (!rtwdev) {
dev_err(&pdev->dev, "failed to allocate hw\n");
return -ENOMEM;

View File

@ -73,6 +73,7 @@ static const struct rtw89_driver_info rtw89_8851be_info = {
.chip = &rtw8851b_chip_info,
.variant = NULL,
.quirks = NULL,
.dev_id_quirks = 0,
.bus = {
.pci = &rtw8851b_pci_info,
},

View File

@ -31,6 +31,7 @@ static const struct rtw89_driver_info rtw89_8851bu_info = {
.chip = &rtw8851b_chip_info,
.variant = NULL,
.quirks = NULL,
.dev_id_quirks = 0,
.bus = {
.usb = &rtw8851b_usb_info,
}

View File

@ -71,6 +71,7 @@ static const struct rtw89_driver_info rtw89_8852ae_info = {
.chip = &rtw8852a_chip_info,
.variant = NULL,
.quirks = NULL,
.dev_id_quirks = 0,
.bus = {
.pci = &rtw8852a_pci_info,
},

View File

@ -33,6 +33,7 @@ static const struct rtw89_driver_info rtw89_8852au_info = {
.chip = &rtw8852a_chip_info,
.variant = NULL,
.quirks = NULL,
.dev_id_quirks = 0,
.bus = {
.usb = &rtw8852a_usb_info,
}

View File

@ -73,6 +73,7 @@ static const struct rtw89_driver_info rtw89_8852be_info = {
.chip = &rtw8852b_chip_info,
.variant = NULL,
.quirks = NULL,
.dev_id_quirks = 0,
.bus = {
.pci = &rtw8852b_pci_info,
},

View File

@ -79,6 +79,7 @@ static const struct rtw89_driver_info rtw89_8852bte_info = {
.chip = &rtw8852bt_chip_info,
.variant = NULL,
.quirks = NULL,
.dev_id_quirks = 0,
.bus = {
.pci = &rtw8852bt_pci_info,
},

View File

@ -31,6 +31,7 @@ static const struct rtw89_driver_info rtw89_8852bu_info = {
.chip = &rtw8852b_chip_info,
.variant = NULL,
.quirks = NULL,
.dev_id_quirks = 0,
.bus = {
.usb = &rtw8852b_usb_info,
}

View File

@ -102,6 +102,7 @@ static const struct rtw89_driver_info rtw89_8852ce_info = {
.chip = &rtw8852c_chip_info,
.variant = NULL,
.quirks = rtw8852c_pci_quirks,
.dev_id_quirks = 0,
.bus = {
.pci = &rtw8852c_pci_info,
},

View File

@ -33,6 +33,7 @@ static const struct rtw89_driver_info rtw89_8852cu_info = {
.chip = &rtw8852c_chip_info,
.variant = NULL,
.quirks = NULL,
.dev_id_quirks = 0,
.bus = {
.usb = &rtw8852c_usb_info,
},

View File

@ -77,6 +77,7 @@ static const struct rtw89_driver_info rtw89_8922ae_info = {
.chip = &rtw8922a_chip_info,
.variant = NULL,
.quirks = NULL,
.dev_id_quirks = 0,
.bus = {
.pci = &rtw8922a_pci_info,
},
@ -86,6 +87,7 @@ static const struct rtw89_driver_info rtw89_8922ae_vs_info = {
.chip = &rtw8922a_chip_info,
.variant = &rtw8922ae_vs_variant,
.quirks = NULL,
.dev_id_quirks = 0,
.bus = {
.pci = &rtw8922a_pci_info,
},

View File

@ -32,6 +32,7 @@ static const struct rtw89_driver_info rtw89_8922au_info = {
.chip = &rtw8922a_chip_info,
.variant = NULL,
.quirks = NULL,
.dev_id_quirks = 0,
.bus = {
.usb = &rtw8922a_usb_info,
},

View File

@ -73,6 +73,7 @@ static const struct rtw89_driver_info rtw89_8922de_vs_info = {
.chip = &rtw8922d_chip_info,
.variant = &rtw8922de_vs_variant,
.quirks = NULL,
.dev_id_quirks = 0,
.bus = {
.pci = &rtw8922d_pci_info,
},
@ -82,6 +83,7 @@ static const struct rtw89_driver_info rtw89_8922de_info = {
.chip = &rtw8922d_chip_info,
.variant = NULL,
.quirks = NULL,
.dev_id_quirks = 0,
.bus = {
.pci = &rtw8922d_pci_info,
},

View File

@ -1161,8 +1161,7 @@ int rtw89_usb_probe(struct usb_interface *intf,
info = (const struct rtw89_driver_info *)id->driver_info;
rtwdev = rtw89_alloc_ieee80211_hw(&intf->dev,
sizeof(struct rtw89_usb),
info->chip, info->variant);
sizeof(struct rtw89_usb), info);
if (!rtwdev) {
dev_err(&intf->dev, "failed to allocate hw\n");
return -ENOMEM;