linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ath10k: support bus and device specific API 1 BDF selection
@ 2021-10-09 22:17 Robert Marko
  2021-10-14 11:54 ` Christian Lamparter
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Robert Marko @ 2021-10-09 22:17 UTC (permalink / raw)
  To: kvalo, davem, kuba, ath10k, linux-wireless, netdev, linux-kernel
  Cc: Robert Marko

Some ath10k IPQ40xx devices like the MikroTik hAP ac2 and ac3 require the
BDF-s to be extracted from the device storage instead of shipping packaged
API 2 BDF-s.

This is required as MikroTik has started shipping boards that require BDF-s
to be updated, as otherwise their WLAN performance really suffers.
This is however impossible as the devices that require this are release
under the same revision and its not possible to differentiate them from
devices using the older BDF-s.

In OpenWrt we are extracting the calibration data during runtime and we are
able to extract the BDF-s in the same manner, however we cannot package the
BDF-s to API 2 format on the fly and can only use API 1 to provide BDF-s on
the fly.
This is an issue as the ath10k driver explicitly looks only for the
board.bin file and not for something like board-bus-device.bin like it does
for pre-cal data.
Due to this we have no way of providing correct BDF-s on the fly, so lets
extend the ath10k driver to first look for BDF-s in the
board-bus-device.bin format, for example: board-ahb-a800000.wifi.bin
If that fails, look for the default board file name as defined previously.

Signed-off-by: Robert Marko <robimarko@gmail.com>
---
 drivers/net/wireless/ath/ath10k/core.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 2f9be182fbfb..20a448e099d8 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1182,6 +1182,7 @@ static int ath10k_fetch_cal_file(struct ath10k *ar)
 static int ath10k_core_fetch_board_data_api_1(struct ath10k *ar, int bd_ie_type)
 {
 	const struct firmware *fw;
+	char boardname[100];
 
 	if (bd_ie_type == ATH10K_BD_IE_BOARD) {
 		if (!ar->hw_params.fw.board) {
@@ -1189,9 +1190,16 @@ static int ath10k_core_fetch_board_data_api_1(struct ath10k *ar, int bd_ie_type)
 			return -EINVAL;
 		}
 
+		scnprintf(boardname, sizeof(boardname), "board-%s-%s.bin",
+			  ath10k_bus_str(ar->hif.bus), dev_name(ar->dev));
+
 		ar->normal_mode_fw.board = ath10k_fetch_fw_file(ar,
 								ar->hw_params.fw.dir,
-								ar->hw_params.fw.board);
+								boardname);
+		if (IS_ERR(ar->normal_mode_fw.board))
+			ar->normal_mode_fw.board = ath10k_fetch_fw_file(ar,
+									ar->hw_params.fw.dir,
+									ar->hw_params.fw.board);
 		if (IS_ERR(ar->normal_mode_fw.board))
 			return PTR_ERR(ar->normal_mode_fw.board);
 
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2022-05-06  6:20 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-09 22:17 [PATCH] ath10k: support bus and device specific API 1 BDF selection Robert Marko
2021-10-14 11:54 ` Christian Lamparter
2021-10-14 12:01   ` Robert Marko
2021-10-14 13:23     ` Christian Lamparter
2021-12-07 18:06 ` Kalle Valo
2021-12-07 18:09   ` Kalle Valo
2021-12-08 12:21   ` Robert Marko
2021-12-08 14:07     ` Christian Lamparter
2021-12-17 12:06       ` Robert Marko
2021-12-17 12:25         ` Thibaut
2022-02-02 18:49           ` Robert Marko
2022-02-16 13:38             ` Robert Marko
2022-02-16 21:19               ` Christian Lamparter
2022-02-16 21:55                 ` Thibaut
2022-05-03 15:58                   ` Robert Marko
2022-05-04  7:48                     ` Kalle Valo
2022-05-06  6:19 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).