1
0

0080-wifi-ath11k-add-support-default-regdb-while-searchin.patch 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. From 88ca89202f8e8afb5225eb5244d79cd67c15d744 Mon Sep 17 00:00:00 2001
  2. From: Wen Gong <quic_wgong@quicinc.com>
  3. Date: Fri, 26 May 2023 12:41:06 +0300
  4. Subject: [PATCH] wifi: ath11k: add support default regdb while searching
  5. board-2.bin for WCN6855
  6. Sometimes board-2.bin does not have the regdb data which matched the
  7. parameters such as vendor, device, subsystem-vendor, subsystem-device
  8. and etc. Add default regdb data with 'bus=%s' into board-2.bin for
  9. WCN6855, then ath11k use 'bus=pci' to search regdb data in board-2.bin
  10. for WCN6855.
  11. kernel: [ 122.515808] ath11k_pci 0000:03:00.0: boot using board name 'bus=pci,vendor=17cb,device=1103,subsystem-vendor=17cb,subsystem-device=3374,qmi-chip-id=2,qmi-board-id=262'
  12. kernel: [ 122.517240] ath11k_pci 0000:03:00.0: boot firmware request ath11k/WCN6855/hw2.0/board-2.bin size 6179564
  13. kernel: [ 122.517280] ath11k_pci 0000:03:00.0: failed to fetch regdb data for bus=pci,vendor=17cb,device=1103,subsystem-vendor=17cb,subsystem-device=3374,qmi-chip-id=2,qmi-board-id=262 from ath11k/WCN6855/hw2.0/board-2.bin
  14. kernel: [ 122.517464] ath11k_pci 0000:03:00.0: boot using board name 'bus=pci'
  15. kernel: [ 122.518901] ath11k_pci 0000:03:00.0: boot firmware request ath11k/WCN6855/hw2.0/board-2.bin size 6179564
  16. kernel: [ 122.518915] ath11k_pci 0000:03:00.0: board name
  17. kernel: [ 122.518917] ath11k_pci 0000:03:00.0: 00000000: 62 75 73 3d 70 63 69 bus=pci
  18. kernel: [ 122.518918] ath11k_pci 0000:03:00.0: boot found match regdb data for name 'bus=pci'
  19. kernel: [ 122.518920] ath11k_pci 0000:03:00.0: boot found regdb data for 'bus=pci'
  20. kernel: [ 122.518921] ath11k_pci 0000:03:00.0: fetched regdb
  21. Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3
  22. Signed-off-by: Wen Gong <quic_wgong@quicinc.com>
  23. Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
  24. Link: https://lore.kernel.org/r/20230517133959.8224-1-quic_wgong@quicinc.com
  25. ---
  26. drivers/net/wireless/ath/ath11k/core.c | 53 +++++++++++++++++++-------
  27. 1 file changed, 40 insertions(+), 13 deletions(-)
  28. --- a/drivers/net/wireless/ath/ath11k/core.c
  29. +++ b/drivers/net/wireless/ath/ath11k/core.c
  30. @@ -961,7 +961,8 @@ int ath11k_core_check_dt(struct ath11k_b
  31. }
  32. static int __ath11k_core_create_board_name(struct ath11k_base *ab, char *name,
  33. - size_t name_len, bool with_variant)
  34. + size_t name_len, bool with_variant,
  35. + bool bus_type_mode)
  36. {
  37. /* strlen(',variant=') + strlen(ab->qmi.target.bdf_ext) */
  38. char variant[9 + ATH11K_QMI_BDF_EXT_STR_LENGTH] = { 0 };
  39. @@ -972,15 +973,20 @@ static int __ath11k_core_create_board_na
  40. switch (ab->id.bdf_search) {
  41. case ATH11K_BDF_SEARCH_BUS_AND_BOARD:
  42. - scnprintf(name, name_len,
  43. - "bus=%s,vendor=%04x,device=%04x,subsystem-vendor=%04x,subsystem-device=%04x,qmi-chip-id=%d,qmi-board-id=%d%s",
  44. - ath11k_bus_str(ab->hif.bus),
  45. - ab->id.vendor, ab->id.device,
  46. - ab->id.subsystem_vendor,
  47. - ab->id.subsystem_device,
  48. - ab->qmi.target.chip_id,
  49. - ab->qmi.target.board_id,
  50. - variant);
  51. + if (bus_type_mode)
  52. + scnprintf(name, name_len,
  53. + "bus=%s",
  54. + ath11k_bus_str(ab->hif.bus));
  55. + else
  56. + scnprintf(name, name_len,
  57. + "bus=%s,vendor=%04x,device=%04x,subsystem-vendor=%04x,subsystem-device=%04x,qmi-chip-id=%d,qmi-board-id=%d%s",
  58. + ath11k_bus_str(ab->hif.bus),
  59. + ab->id.vendor, ab->id.device,
  60. + ab->id.subsystem_vendor,
  61. + ab->id.subsystem_device,
  62. + ab->qmi.target.chip_id,
  63. + ab->qmi.target.board_id,
  64. + variant);
  65. break;
  66. default:
  67. scnprintf(name, name_len,
  68. @@ -999,13 +1005,19 @@ static int __ath11k_core_create_board_na
  69. static int ath11k_core_create_board_name(struct ath11k_base *ab, char *name,
  70. size_t name_len)
  71. {
  72. - return __ath11k_core_create_board_name(ab, name, name_len, true);
  73. + return __ath11k_core_create_board_name(ab, name, name_len, true, false);
  74. }
  75. static int ath11k_core_create_fallback_board_name(struct ath11k_base *ab, char *name,
  76. size_t name_len)
  77. {
  78. - return __ath11k_core_create_board_name(ab, name, name_len, false);
  79. + return __ath11k_core_create_board_name(ab, name, name_len, false, false);
  80. +}
  81. +
  82. +static int ath11k_core_create_bus_type_board_name(struct ath11k_base *ab, char *name,
  83. + size_t name_len)
  84. +{
  85. + return __ath11k_core_create_board_name(ab, name, name_len, false, true);
  86. }
  87. const struct firmware *ath11k_core_firmware_request(struct ath11k_base *ab,
  88. @@ -1309,7 +1321,7 @@ success:
  89. int ath11k_core_fetch_regdb(struct ath11k_base *ab, struct ath11k_board_data *bd)
  90. {
  91. - char boardname[BOARD_NAME_SIZE];
  92. + char boardname[BOARD_NAME_SIZE], default_boardname[BOARD_NAME_SIZE];
  93. int ret;
  94. ret = ath11k_core_create_board_name(ab, boardname, BOARD_NAME_SIZE);
  95. @@ -1323,6 +1335,21 @@ int ath11k_core_fetch_regdb(struct ath11
  96. ATH11K_BD_IE_REGDB,
  97. ATH11K_BD_IE_REGDB_NAME,
  98. ATH11K_BD_IE_REGDB_DATA);
  99. + if (!ret)
  100. + goto exit;
  101. +
  102. + ret = ath11k_core_create_bus_type_board_name(ab, default_boardname,
  103. + BOARD_NAME_SIZE);
  104. + if (ret) {
  105. + ath11k_dbg(ab, ATH11K_DBG_BOOT,
  106. + "failed to create default board name for regdb: %d", ret);
  107. + goto exit;
  108. + }
  109. +
  110. + ret = ath11k_core_fetch_board_data_api_n(ab, bd, default_boardname,
  111. + ATH11K_BD_IE_REGDB,
  112. + ATH11K_BD_IE_REGDB_NAME,
  113. + ATH11K_BD_IE_REGDB_DATA);
  114. if (!ret)
  115. goto exit;