Skip to content

Commit 206d41a

Browse files
committed
WiFi_Firmware_Driver: add ath10k support and clean logging
Extend firmware scan and driver checks to handle ath10k in addition to ath11k. Detect SoC from DT model and choose appropriate firmware path dynamically. Verify active ath10k/ath11k kernel modules via lsmod for stronger validation. Switch to log_info/log_fail/log_pass flow for consistent functestlib usage. Signed-off-by: Srikanth Muppandam <smuppand@qti.qualcomm.com>
1 parent 3f7165c commit 206d41a

File tree

1 file changed

+139
-31
lines changed
  • Runner/suites/Connectivity/WiFi/WiFi_Firmware_Driver

1 file changed

+139
-31
lines changed

Runner/suites/Connectivity/WiFi/WiFi_Firmware_Driver/run.sh

Lines changed: 139 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ if [ -z "$__INIT_ENV_LOADED" ]; then
2525
# shellcheck disable=SC1090
2626
. "$INIT_ENV"
2727
fi
28+
2829
# Always source functestlib.sh, using $TOOLS exported by init_env
2930
# shellcheck disable=SC1090,SC1091
3031
. "$TOOLS/functestlib.sh"
@@ -33,11 +34,18 @@ TESTNAME="WiFi_Firmware_Driver"
3334
test_path=$(find_test_case_by_name "$TESTNAME")
3435
cd "$test_path" || exit 1
3536

37+
RES_FILE="./${TESTNAME}.res"
38+
: >"$RES_FILE"
39+
3640
log_info "--------------------------------------------------------------------------"
3741
log_info "-------------------Starting $TESTNAME Testcase----------------------------"
3842
log_info "=== Test Initialization ==="
3943

40-
check_dependencies find grep modprobe lsmod cat
44+
if ! check_dependencies find grep modprobe lsmod cat stat; then
45+
log_skip "$TESTNAME SKIP - required tools (find/grep/modprobe/lsmod/cat/stat) missing"
46+
echo "$TESTNAME SKIP" >"$RES_FILE"
47+
exit 0
48+
fi
4149

4250
# Detect SoC from /proc/device-tree/model
4351
if [ -f /proc/device-tree/model ]; then
@@ -47,51 +55,151 @@ else
4755
fi
4856
log_info "Detected SoC model: $soc_model"
4957

50-
# Scan firmware
51-
log_info "Scanning for WiFi firmware under /lib/firmware/ath11k/..."
58+
# ---------------------------------------------------------------------------
59+
# Firmware detection: support ath11k (amss.bin / wpss.mbn) and ath10k (WCN3990)
60+
# ---------------------------------------------------------------------------
61+
log_info "Scanning for WiFi firmware (ath11k / ath10k)..."
62+
5263
fwfile=""
53-
if find /lib/firmware/ath11k/ -type f -name "amss.bin" -print -quit 2>/dev/null | grep -q .; then
54-
fwfile=$(find /lib/firmware/ath11k/ -type f -name "amss.bin" -print -quit 2>/dev/null)
55-
elif find /lib/firmware/ath11k/ -type f -name "wpss.mbn" -print -quit 2>/dev/null | grep -q .; then
56-
fwfile=$(find /lib/firmware/ath11k/ -type f -name "wpss.mbn" -print -quit 2>/dev/null)
64+
wifi_family=""
65+
66+
# Prefer ath11k if present (Lemans/Monaco/Kodiak type platforms)
67+
if [ -d /lib/firmware/ath11k ]; then
68+
if find /lib/firmware/ath11k/ -type f -name "amss.bin" -print -quit 2>/dev/null | grep -q .; then
69+
fwfile=$(find /lib/firmware/ath11k/ -type f -name "amss.bin" -print -quit 2>/dev/null)
70+
wifi_family="ath11k"
71+
elif find /lib/firmware/ath11k/ -type f -name "wpss.mbn" -print -quit 2>/dev/null | grep -q .; then
72+
fwfile=$(find /lib/firmware/ath11k/ -type f -name "wpss.mbn" -print -quit 2>/dev/null)
73+
wifi_family="ath11k"
74+
fi
5775
fi
5876

59-
if [ -z "$fwfile" ]; then
60-
log_skip_exit "$TESTNAME" "No WiFi firmware (amss.bin or wpss.mbn) found under /lib/firmware/ath11k/"
77+
# If no ath11k firmware found, try ath10k (e.g. WCN3990 on RB1/QCM2290)
78+
if [ -z "$fwfile" ] && [ -d /lib/firmware/ath10k ]; then
79+
# Look for wlan firmware or generic firmware-*.bin
80+
if find /lib/firmware/ath10k/ -type f -name "wlanmdsp.mbn" -print -quit 2>/dev/null | grep -q .; then
81+
fwfile=$(find /lib/firmware/ath10k/ -type f -name "wlanmdsp.mbn" -print -quit 2>/dev/null)
82+
wifi_family="ath10k"
83+
elif find /lib/firmware/ath10k/ -type f -name "firmware-*.bin" -print -quit 2>/dev/null | grep -q .; then
84+
fwfile=$(find /lib/firmware/ath10k/ -type f -name "firmware-*.bin" -print -quit 2>/dev/null)
85+
wifi_family="ath10k"
86+
fi
87+
fi
88+
89+
if [ -z "$fwfile" ] || [ -z "$wifi_family" ]; then
90+
log_skip "$TESTNAME SKIP - No ath11k/ath10k WiFi firmware found under /lib/firmware (ath11k or ath10k)"
91+
echo "$TESTNAME SKIP" >"$RES_FILE"
92+
exit 0
6193
fi
6294

6395
size=$(stat -c%s "$fwfile" 2>/dev/null)
6496
basename=$(basename "$fwfile")
97+
log_info "Detected WiFi firmware family: $wifi_family"
6598
log_info "Detected firmware [$basename]: $fwfile (size: $size bytes)"
6699

67-
case "$basename" in
68-
wpss.mbn)
69-
log_info "Platform using wpss.mbn firmware (e.g., Kodiak)"
70-
if validate_remoteproc_running "wpss"; then
71-
log_info "Remoteproc 'wpss' is active and validated."
72-
else
73-
log_fail_exit "$TESTNAME" "Remoteproc 'wpss' validation failed."
74-
fi
75-
log_info "No module load needed for wpss-based platform (e.g., Kodiak)."
100+
suite_rc=0
101+
102+
# ---------------------------------------------------------------------------
103+
# Family-specific handling (load / validate) – use log_* only, decide at end
104+
# ---------------------------------------------------------------------------
105+
case "$wifi_family" in
106+
ath11k)
107+
case "$basename" in
108+
wpss.mbn)
109+
log_info "Platform using wpss.mbn firmware (e.g., Kodiak - WPSS via remoteproc)"
110+
if validate_remoteproc_running "wpss"; then
111+
log_info "Remoteproc 'wpss' is active and validated."
112+
else
113+
log_fail "Remoteproc 'wpss' validation failed."
114+
suite_rc=1
115+
fi
116+
log_info "No ath11k_pci module load needed for wpss-based platform."
117+
;;
118+
amss.bin)
119+
log_info "amss.bin firmware detected (e.g., WCN6855 - Lemans/Monaco via ath11k_pci)"
120+
if ! modprobe ath11k_pci 2>/dev/null; then
121+
log_fail "Failed to load ath11k_pci module."
122+
suite_rc=1
123+
else
124+
log_info "ath11k_pci module loaded successfully."
125+
fi
126+
;;
127+
*)
128+
log_skip "$TESTNAME SKIP - Unsupported ath11k firmware type: $basename"
129+
echo "$TESTNAME SKIP" >"$RES_FILE"
130+
exit 0
131+
;;
132+
esac
76133
;;
77-
amss.bin)
78-
log_info "amss.bin firmware detected (e.g., WCN6855 - Lemans/Monaco)"
79-
if ! modprobe ath11k_pci 2>/dev/null; then
80-
log_fail_exit "$TESTNAME" "Failed to load ath11k_pci module."
134+
ath10k)
135+
log_info "ath10k firmware detected (e.g., WCN3990 on RB1/QCM2290)."
136+
# Ensure ath10k_core + one of the bus drivers (snoc/pci/sdio) are loaded
137+
if ! lsmod | grep -q '^ath10k_core\s'; then
138+
log_info "ath10k_core not loaded yet; attempting to load ath10k bus drivers..."
139+
bus_loaded=0
140+
for m in ath10k_snoc ath10k_pci ath10k_sdio; do
141+
if modprobe "$m" 2>/dev/null; then
142+
log_info "Loaded ath10k bus driver module: $m"
143+
bus_loaded=1
144+
break
145+
fi
146+
done
147+
if [ "$bus_loaded" -ne 1 ]; then
148+
log_fail "Failed to load any ath10k bus driver (ath10k_snoc/ath10k_pci/ath10k_sdio)."
149+
suite_rc=1
150+
fi
151+
else
152+
log_info "ath10k_core already loaded; skipping bus driver modprobe attempts."
81153
fi
82154
;;
83155
*)
84-
log_skip_exit "$TESTNAME" "Unsupported firmware type: $basename"
156+
log_skip "$TESTNAME SKIP - Unsupported WiFi family detected: $wifi_family"
157+
echo "$TESTNAME SKIP" >"$RES_FILE"
158+
exit 0
85159
;;
86160
esac
87161

88-
log_info "Checking active ath11k-related kernel modules via lsmod..."
89-
if lsmod | grep -Eq '^ath11k(_.*)?\s'; then
90-
lsmod | grep -E '^ath11k(_.*)?\s' | while read -r mod_line; do
91-
log_info " Module loaded: $mod_line"
92-
done
93-
else
94-
log_fail_exit "$TESTNAME" "No ath11k-related kernel module detected via lsmod"
162+
# ---------------------------------------------------------------------------
163+
# Module visibility checks (family-specific) – explicitly verify ath10k modules
164+
# ---------------------------------------------------------------------------
165+
if [ "$wifi_family" = "ath11k" ]; then
166+
log_info "Checking active ath11k-related kernel modules via lsmod..."
167+
if lsmod | grep -Eq '^ath11k(_.*)?\s'; then
168+
lsmod | grep -E '^ath11k(_.*)?\s' | while read -r mod_line; do
169+
log_info " Module loaded: $mod_line"
170+
done
171+
else
172+
log_fail "No ath11k-related kernel module detected via lsmod."
173+
suite_rc=1
174+
fi
175+
elif [ "$wifi_family" = "ath10k" ]; then
176+
log_info "Checking active ath10k-related kernel modules via lsmod..."
177+
if lsmod | grep -q '^ath10k_core\s'; then
178+
log_info " Core module loaded: ath10k_core"
179+
else
180+
log_fail "ath10k_core module is not loaded."
181+
suite_rc=1
182+
fi
183+
184+
if lsmod | grep -Eq '^ath10k_(snoc|pci|sdio)\s'; then
185+
lsmod | grep -E '^ath10k_(snoc|pci|sdio)\s' | while read -r mod_line; do
186+
log_info " Bus driver loaded: $mod_line"
187+
done
188+
else
189+
log_fail "No ath10k bus driver module (ath10k_snoc/ath10k_pci/ath10k_sdio) detected via lsmod."
190+
suite_rc=1
191+
fi
192+
fi
193+
194+
# ---------------------------------------------------------------------------
195+
# Final result
196+
# ---------------------------------------------------------------------------
197+
if [ "$suite_rc" -eq 0 ]; then
198+
log_pass "$TESTNAME: PASS - WiFi firmware and driver validation successful."
199+
echo "$TESTNAME PASS" >"$RES_FILE"
200+
exit 0
95201
fi
96202

97-
log_pass_exit "$TESTNAME" "WiFi firmware and driver validation successful."
203+
log_fail "$TESTNAME: FAIL - WiFi firmware/driver validation encountered errors."
204+
echo "$TESTNAME FAIL" >"$RES_FILE"
205+
exit 1

0 commit comments

Comments
 (0)