2021-06-03 18:00:04 +00:00
|
|
|
From addb5afe5249eea71a4f922ea168614685a6c95d Mon Sep 17 00:00:00 2001
|
2021-03-09 19:41:01 +00:00
|
|
|
From: Maximilian Luz <luzmaximilian@gmail.com>
|
|
|
|
Date: Sat, 27 Feb 2021 00:45:52 +0100
|
|
|
|
Subject: [PATCH] ath10k: Add module parameters to override board files
|
|
|
|
|
|
|
|
Some Surface devices, specifically the Surface Go and AMD version of the
|
|
|
|
Surface Laptop 3 (wich both come with QCA6174 WiFi chips), work better
|
|
|
|
with a different board file, as it seems that the firmeware included
|
|
|
|
upstream is buggy.
|
|
|
|
|
|
|
|
As it is generally not a good idea to randomly overwrite files, let
|
|
|
|
alone doing so via packages, we add module parameters to override those
|
|
|
|
file names in the driver. This allows us to package/deploy the override
|
|
|
|
via a modprobe.d config.
|
|
|
|
|
|
|
|
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
|
2021-03-29 00:46:07 +00:00
|
|
|
Patchset: ath10k-firmware-override
|
2021-03-09 19:41:01 +00:00
|
|
|
---
|
|
|
|
drivers/net/wireless/ath/ath10k/core.c | 58 ++++++++++++++++++++++++++
|
|
|
|
1 file changed, 58 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
|
|
|
|
index 436eac342b62..c9028d59bfe2 100644
|
|
|
|
--- a/drivers/net/wireless/ath/ath10k/core.c
|
|
|
|
+++ b/drivers/net/wireless/ath/ath10k/core.c
|
|
|
|
@@ -41,6 +41,9 @@ static bool uart_print;
|
|
|
|
static bool skip_otp;
|
|
|
|
static bool rawmode;
|
|
|
|
|
|
|
|
+static char *override_board = "";
|
|
|
|
+static char *override_board2 = "";
|
|
|
|
+
|
|
|
|
unsigned long ath10k_coredump_mask = BIT(ATH10K_FW_CRASH_DUMP_REGISTERS) |
|
|
|
|
BIT(ATH10K_FW_CRASH_DUMP_CE_DATA);
|
|
|
|
|
|
|
|
@@ -52,6 +55,9 @@ module_param(skip_otp, bool, 0644);
|
|
|
|
module_param(rawmode, bool, 0644);
|
|
|
|
module_param_named(coredump_mask, ath10k_coredump_mask, ulong, 0444);
|
|
|
|
|
|
|
|
+module_param(override_board, charp, 0644);
|
|
|
|
+module_param(override_board2, charp, 0644);
|
|
|
|
+
|
|
|
|
MODULE_PARM_DESC(debug_mask, "Debugging mask");
|
|
|
|
MODULE_PARM_DESC(uart_print, "Uart target debugging");
|
|
|
|
MODULE_PARM_DESC(skip_otp, "Skip otp failure for calibration in testmode");
|
|
|
|
@@ -59,6 +65,9 @@ MODULE_PARM_DESC(cryptmode, "Crypto mode: 0-hardware, 1-software");
|
|
|
|
MODULE_PARM_DESC(rawmode, "Use raw 802.11 frame datapath");
|
|
|
|
MODULE_PARM_DESC(coredump_mask, "Bitfield of what to include in firmware crash file");
|
|
|
|
|
|
|
|
+MODULE_PARM_DESC(override_board, "Override for board.bin file");
|
|
|
|
+MODULE_PARM_DESC(override_board2, "Override for board-2.bin file");
|
|
|
|
+
|
|
|
|
static const struct ath10k_hw_params ath10k_hw_params_list[] = {
|
|
|
|
{
|
|
|
|
.id = QCA988X_HW_2_0_VERSION,
|
|
|
|
@@ -705,6 +714,42 @@ static int ath10k_init_configure_target(struct ath10k *ar)
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
+static const char *ath10k_override_board_fw_file(struct ath10k *ar,
|
|
|
|
+ const char *file)
|
|
|
|
+{
|
|
|
|
+ if (strcmp(file, "board.bin") == 0) {
|
|
|
|
+ if (strcmp(override_board, "") == 0)
|
|
|
|
+ return file;
|
|
|
|
+
|
|
|
|
+ if (strcmp(override_board, "none") == 0) {
|
|
|
|
+ dev_info(ar->dev, "firmware override: pretending 'board.bin' does not exist\n");
|
|
|
|
+ return NULL;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ dev_info(ar->dev, "firmware override: replacing 'board.bin' with '%s'\n",
|
|
|
|
+ override_board);
|
|
|
|
+
|
|
|
|
+ return override_board;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (strcmp(file, "board-2.bin") == 0) {
|
|
|
|
+ if (strcmp(override_board2, "") == 0)
|
|
|
|
+ return file;
|
|
|
|
+
|
|
|
|
+ if (strcmp(override_board2, "none") == 0) {
|
|
|
|
+ dev_info(ar->dev, "firmware override: pretending 'board-2.bin' does not exist\n");
|
|
|
|
+ return NULL;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ dev_info(ar->dev, "firmware override: replacing 'board-2.bin' with '%s'\n",
|
|
|
|
+ override_board2);
|
|
|
|
+
|
|
|
|
+ return override_board2;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return file;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
static const struct firmware *ath10k_fetch_fw_file(struct ath10k *ar,
|
|
|
|
const char *dir,
|
|
|
|
const char *file)
|
|
|
|
@@ -719,6 +764,19 @@ static const struct firmware *ath10k_fetch_fw_file(struct ath10k *ar,
|
|
|
|
if (dir == NULL)
|
|
|
|
dir = ".";
|
|
|
|
|
|
|
|
+ /* HACK: Override board.bin and board-2.bin files if specified.
|
|
|
|
+ *
|
|
|
|
+ * Some Surface devices perform better with a different board
|
|
|
|
+ * configuration. To this end, one would need to replace the board.bin
|
|
|
|
+ * file with the modified config and remove the board-2.bin file.
|
|
|
|
+ * Unfortunately, that's not a solution that we can easily package. So
|
|
|
|
+ * we add module options to perform these overrides here.
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ file = ath10k_override_board_fw_file(ar, file);
|
|
|
|
+ if (!file)
|
|
|
|
+ return ERR_PTR(-ENOENT);
|
|
|
|
+
|
|
|
|
snprintf(filename, sizeof(filename), "%s/%s", dir, file);
|
|
|
|
ret = firmware_request_nowarn(&fw, filename, ar->dev);
|
|
|
|
ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot fw request '%s': %d\n",
|
|
|
|
--
|
2021-04-07 01:20:56 +00:00
|
|
|
2.31.1
|
2021-03-09 19:41:01 +00:00
|
|
|
|