[SRU][Jammy 6.8][Noble 6.8][PATCH 04/11] wifi: ath12k: support default regdb while searching board-2.bin for WCN7850
Werner Sembach
wse at tuxedocomputers.com
Wed Feb 12 14:51:08 UTC 2025
From: Baochen Qiang <quic_bqiang at quicinc.com>
Buglink: https://bugs.launchpad.net/bugs/2098104
Impact: This is a patchset the we (TUXEDO Computers) currently apply on top of the Ubuntu 6.8 kernel to make it run smoothly on all our devices. All patches apply smoothly to 6.8.
Fix: These are all patches already upstream, just not on the 6.8 branch, because they where upstreamed after that one was already EOL.
Testcase: We run this patchset for all our customers devices (we basically maintain our own OEM branch) so it is quite field testet. Besides that, whenever a new patch was added we did regression testing on a selection of devices.
Sometimes board-2.bin does not have the regdb data which matches the
parameters such as vendor, device, subsystem-vendor, subsystem-device
etc. Add default regdb data with only 'bus=%s' into board-2.bin for
WCN7850, then ath12k uses 'bus=pci' to search regdb data in board-2.bin
for WCN7850.
[ 46.114895] ath12k_pci 0000:03:00.0: boot using board name 'bus=pci,vendor=17cb,device=1107,subsystem-vendor=17cb,subsystem-device=3378,qmi-chip-id=2,qmi-board-id=260'
[ 46.118167] ath12k_pci 0000:03:00.0: boot firmware request ath12k/WCN7850/hw2.0/board-2.bin size 380280
[ 46.118173] ath12k_pci 0000:03:00.0: board name
[ 46.118176] ath12k_pci 0000:03:00.0: 00000000: 62 75 73 3d 70 63 69 bus=pci
[ 46.118179] ath12k_pci 0000:03:00.0: failed to fetch regdb data for bus=pci,vendor=17cb,device=1107,subsystem-vendor=17cb,subsystem-device=3378,qmi-chip-id=2,qmi-board-id=260 from ath12k/WCN7850/hw2.0/board-2.bin
[ 46.118239] ath12k_pci 0000:03:00.0: boot using board name 'bus=pci'
[ 46.119842] ath12k_pci 0000:03:00.0: boot firmware request ath12k/WCN7850/hw2.0/board-2.bin size 380280
[ 46.119847] ath12k_pci 0000:03:00.0: board name
[ 46.119849] ath12k_pci 0000:03:00.0: 00000000: 62 75 73 3d 70 63 69 bus=pci
[ 46.119852] ath12k_pci 0000:03:00.0: boot found match regdb data for name 'bus=pci'
[ 46.119855] ath12k_pci 0000:03:00.0: boot found regdb data for 'bus=pci'
[ 46.119857] ath12k_pci 0000:03:00.0: fetched regdb
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4
Signed-off-by: Baochen Qiang <quic_bqiang at quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo at quicinc.com>
Link: https://msgid.link/20231216060140.30611-6-quic_bqiang@quicinc.com
Signed-off-by: Werner Sembach <wse at tuxedocomputers.com>
---
drivers/net/wireless/ath/ath12k/core.c | 53 +++++++++++++++++++-------
1 file changed, 40 insertions(+), 13 deletions(-)
diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c
index b015f1ec52457..099b41d2da82b 100644
--- a/drivers/net/wireless/ath/ath12k/core.c
+++ b/drivers/net/wireless/ath/ath12k/core.c
@@ -106,7 +106,8 @@ int ath12k_core_resume(struct ath12k_base *ab)
}
static int __ath12k_core_create_board_name(struct ath12k_base *ab, char *name,
- size_t name_len, bool with_variant)
+ size_t name_len, bool with_variant,
+ bool bus_type_mode)
{
/* strlen(',variant=') + strlen(ab->qmi.target.bdf_ext) */
char variant[9 + ATH12K_QMI_BDF_EXT_STR_LENGTH] = { 0 };
@@ -117,15 +118,20 @@ static int __ath12k_core_create_board_name(struct ath12k_base *ab, char *name,
switch (ab->id.bdf_search) {
case ATH12K_BDF_SEARCH_BUS_AND_BOARD:
- scnprintf(name, name_len,
- "bus=%s,vendor=%04x,device=%04x,subsystem-vendor=%04x,subsystem-device=%04x,qmi-chip-id=%d,qmi-board-id=%d%s",
- ath12k_bus_str(ab->hif.bus),
- ab->id.vendor, ab->id.device,
- ab->id.subsystem_vendor,
- ab->id.subsystem_device,
- ab->qmi.target.chip_id,
- ab->qmi.target.board_id,
- variant);
+ if (bus_type_mode)
+ scnprintf(name, name_len,
+ "bus=%s",
+ ath12k_bus_str(ab->hif.bus));
+ else
+ scnprintf(name, name_len,
+ "bus=%s,vendor=%04x,device=%04x,subsystem-vendor=%04x,subsystem-device=%04x,qmi-chip-id=%d,qmi-board-id=%d%s",
+ ath12k_bus_str(ab->hif.bus),
+ ab->id.vendor, ab->id.device,
+ ab->id.subsystem_vendor,
+ ab->id.subsystem_device,
+ ab->qmi.target.chip_id,
+ ab->qmi.target.board_id,
+ variant);
break;
default:
scnprintf(name, name_len,
@@ -144,13 +150,19 @@ static int __ath12k_core_create_board_name(struct ath12k_base *ab, char *name,
static int ath12k_core_create_board_name(struct ath12k_base *ab, char *name,
size_t name_len)
{
- return __ath12k_core_create_board_name(ab, name, name_len, true);
+ return __ath12k_core_create_board_name(ab, name, name_len, true, false);
}
static int ath12k_core_create_fallback_board_name(struct ath12k_base *ab, char *name,
size_t name_len)
{
- return __ath12k_core_create_board_name(ab, name, name_len, false);
+ return __ath12k_core_create_board_name(ab, name, name_len, false, false);
+}
+
+static int ath12k_core_create_bus_type_board_name(struct ath12k_base *ab, char *name,
+ size_t name_len)
+{
+ return __ath12k_core_create_board_name(ab, name, name_len, false, true);
}
const struct firmware *ath12k_core_firmware_request(struct ath12k_base *ab,
@@ -454,7 +466,7 @@ int ath12k_core_fetch_bdf(struct ath12k_base *ab, struct ath12k_board_data *bd)
int ath12k_core_fetch_regdb(struct ath12k_base *ab, struct ath12k_board_data *bd)
{
- char boardname[BOARD_NAME_SIZE];
+ char boardname[BOARD_NAME_SIZE], default_boardname[BOARD_NAME_SIZE];
int ret;
ret = ath12k_core_create_board_name(ab, boardname, BOARD_NAME_SIZE);
@@ -471,6 +483,21 @@ int ath12k_core_fetch_regdb(struct ath12k_base *ab, struct ath12k_board_data *bd
if (!ret)
goto exit;
+ ret = ath12k_core_create_bus_type_board_name(ab, default_boardname,
+ BOARD_NAME_SIZE);
+ if (ret) {
+ ath12k_dbg(ab, ATH12K_DBG_BOOT,
+ "failed to create default board name for regdb: %d", ret);
+ goto exit;
+ }
+
+ ret = ath12k_core_fetch_board_data_api_n(ab, bd, default_boardname,
+ ATH12K_BD_IE_REGDB,
+ ATH12K_BD_IE_REGDB_NAME,
+ ATH12K_BD_IE_REGDB_DATA);
+ if (!ret)
+ goto exit;
+
ret = ath12k_core_fetch_board_data_api_1(ab, bd, ATH12K_REGDB_FILE_NAME);
if (ret)
ath12k_dbg(ab, ATH12K_DBG_BOOT, "failed to fetch %s from %s\n",
--
2.43.0
More information about the kernel-team
mailing list