From 98c6e363f0522ded02b06802f003f3c2f168e564 Mon Sep 17 00:00:00 2001 From: Markus Fritsche Date: Wed, 22 Apr 2026 12:17:56 +0200 Subject: [PATCH] bes2600: default STANDARD_FACTORY_EFUSE_FLAG off for PineTab2 factory.txt format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The shipped factory calibration file bes2600_factory.txt on PineTab2 (danctnix linux-firmware 0.3.5_2023.0209) contains 30 calibration fields: head (3), iq/xtal (3), 2.4G power 11n (5), 5G power 11n (15), bt (4). The file terminates with '%%\n' directly after edr_power. When STANDARD_FACTORY_EFUSE_FLAG is defined at compile time the driver assembles STANDARD_FACTORY with an extra select_efuse_flag section appended and expects 31 sscanf matches (FACTORY_MEMBER_NUM=31): __STANDARD_FACTORY + \"##select_efuse_flag\\nselect_efuse:%hx\\n\" + \"%%%%\\n\" The PineTab2 factory.txt has no select_efuse_flag section, so sscanf stops after field 30 and factory_parse() returns -1 with: bes2600_factory.txt parse fail read and check bes2600/bes2600_factory.txt error factory cali data get failed. This was latent until the preceding patch (use request_firmware() for factory.txt read) fixed the path bug that masked the parse failure. Default STANDARD_FACTORY_EFUSE_FLAG to n. The flag remains overridable at build time (make STANDARD_FACTORY_EFUSE_FLAG=y ...) for chips / firmware packages that do ship the select_efuse_flag section. Also: the wsm_save_factory_txt_to_mcu() prototype in wsm.h was inconsistently wrapped in a conditional that keyed on STANDARD_FACTORY_EFUSE_FLAG, but the function definition in wsm.c and the call site in sta.c are ungated. With the flag now defaulting to n, the gcc -Werror=missing-prototypes flag breaks the build. Drop the conditional wrapper around the prototype — the function exists and is used regardless of the factory-parse flag. Tested-on: PineTab2 (BES2600WM + RK3566) running linux-pinetab2 6.19.10-danctnix1-1. With the flag defaulted off, factory_parse() succeeds on the shipped factory.txt, factory_cali_data is populated, and dmesg no longer shows the parse-fail / read-and-check-error / factory-cali-data-get-failed sequence. Signed-off-by: Markus Fritsche --- bes2600/Makefile | 2 +- bes2600/wsm.h | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/bes2600/Makefile b/bes2600/Makefile index 788aee2..2dcba09 100644 --- a/bes2600/Makefile +++ b/bes2600/Makefile @@ -65,7 +65,7 @@ BES2600_DRV_VERSION := bes2600_0.3.5_2024.0116 ifeq ($(CONFIG_BES2600_CALIB_FROM_LINUX),y) FACTORY_CRC_CHECK ?= n -STANDARD_FACTORY_EFUSE_FLAG ?= y +STANDARD_FACTORY_EFUSE_FLAG ?= n FACTORY_PATH ?= bes2600/bes2600_factory.txt endif diff --git a/bes2600/wsm.h b/bes2600/wsm.h index 0673131..22845ac 100644 --- a/bes2600/wsm.h +++ b/bes2600/wsm.h @@ -2236,7 +2236,5 @@ int wsm_cpu_usage_cmd(struct bes2600_common *hw_priv); int wsm_wifi_status_cmd(struct bes2600_common *hw_priv, uint32_t status); -#if defined(STANDARD_FACTORY_EFUSE_FLAG) int wsm_save_factory_txt_to_mcu(struct bes2600_common *hw_priv, const u8 *data, int if_id, enum bes2600_rf_cmd_type cmd_type); -#endif #endif /* BES2600_HWIO_H_INCLUDED */