• Home
  • Raw
  • Download

Lines Matching refs:ar

31 bool ath10k_tm_event_wmi(struct ath10k *ar, u32 cmd_id, struct sk_buff *skb)  in ath10k_tm_event_wmi()  argument
37 ath10k_dbg(ar, ATH10K_DBG_TESTMODE, in ath10k_tm_event_wmi()
41 ath10k_dbg_dump(ar, ATH10K_DBG_TESTMODE, NULL, "", skb->data, skb->len); in ath10k_tm_event_wmi()
43 spin_lock_bh(&ar->data_lock); in ath10k_tm_event_wmi()
45 if (!ar->testmode.utf_monitor) { in ath10k_tm_event_wmi()
56 nl_skb = cfg80211_testmode_alloc_event_skb(ar->hw->wiphy, in ath10k_tm_event_wmi()
60 ath10k_warn(ar, in ath10k_tm_event_wmi()
67 ath10k_warn(ar, in ath10k_tm_event_wmi()
76 ath10k_warn(ar, in ath10k_tm_event_wmi()
85 ath10k_warn(ar, in ath10k_tm_event_wmi()
95 spin_unlock_bh(&ar->data_lock); in ath10k_tm_event_wmi()
100 static int ath10k_tm_cmd_get_version(struct ath10k *ar, struct nlattr *tb[]) in ath10k_tm_cmd_get_version() argument
105 ath10k_dbg(ar, ATH10K_DBG_TESTMODE, in ath10k_tm_cmd_get_version()
110 skb = cfg80211_testmode_alloc_reply_skb(ar->hw->wiphy, in ath10k_tm_cmd_get_version()
130 ar->normal_mode_fw.fw_file.wmi_op_version); in ath10k_tm_cmd_get_version()
139 static int ath10k_tm_fetch_utf_firmware_api_1(struct ath10k *ar, in ath10k_tm_fetch_utf_firmware_api_1() argument
146 ar->hw_params.fw.dir, ATH10K_FW_UTF_FILE); in ath10k_tm_fetch_utf_firmware_api_1()
149 ret = firmware_request_nowarn(&fw_file->firmware, filename, ar->dev); in ath10k_tm_fetch_utf_firmware_api_1()
150 ath10k_dbg(ar, ATH10K_DBG_TESTMODE, "testmode fw request '%s': %d\n", in ath10k_tm_fetch_utf_firmware_api_1()
154 ath10k_warn(ar, "failed to retrieve utf firmware '%s': %d\n", in ath10k_tm_fetch_utf_firmware_api_1()
173 static int ath10k_tm_fetch_firmware(struct ath10k *ar) in ath10k_tm_fetch_firmware() argument
180 switch (ar->hif.bus) { in ath10k_tm_fetch_firmware()
184 ATH10K_FW_UTF_FILE_BASE, ath10k_bus_str(ar->hif.bus), in ath10k_tm_fetch_firmware()
193 ret = ath10k_core_fetch_firmware_api_n(ar, fw_name, in ath10k_tm_fetch_firmware()
194 &ar->testmode.utf_mode_fw.fw_file); in ath10k_tm_fetch_firmware()
196 ath10k_dbg(ar, ATH10K_DBG_TESTMODE, "testmode using fw utf api 2"); in ath10k_tm_fetch_firmware()
200 ret = ath10k_tm_fetch_utf_firmware_api_1(ar, &ar->testmode.utf_mode_fw.fw_file); in ath10k_tm_fetch_firmware()
202 ath10k_err(ar, "failed to fetch utf firmware binary: %d", ret); in ath10k_tm_fetch_firmware()
206 ath10k_dbg(ar, ATH10K_DBG_TESTMODE, "testmode using utf api 1"); in ath10k_tm_fetch_firmware()
209 utf_mode_fw = &ar->testmode.utf_mode_fw; in ath10k_tm_fetch_firmware()
214 utf_mode_fw->board_data = ar->normal_mode_fw.board_data; in ath10k_tm_fetch_firmware()
215 utf_mode_fw->board_len = ar->normal_mode_fw.board_len; in ath10k_tm_fetch_firmware()
218 ath10k_info(ar, "utf.bin didn't contain otp binary, taking it from the normal mode firmware"); in ath10k_tm_fetch_firmware()
219 utf_mode_fw->fw_file.otp_data = ar->normal_mode_fw.fw_file.otp_data; in ath10k_tm_fetch_firmware()
220 utf_mode_fw->fw_file.otp_len = ar->normal_mode_fw.fw_file.otp_len; in ath10k_tm_fetch_firmware()
226 static int ath10k_tm_cmd_utf_start(struct ath10k *ar, struct nlattr *tb[]) in ath10k_tm_cmd_utf_start() argument
231 ath10k_dbg(ar, ATH10K_DBG_TESTMODE, "testmode cmd utf start\n"); in ath10k_tm_cmd_utf_start()
233 mutex_lock(&ar->conf_mutex); in ath10k_tm_cmd_utf_start()
235 if (ar->state == ATH10K_STATE_UTF) { in ath10k_tm_cmd_utf_start()
241 if (ar->state != ATH10K_STATE_OFF) { in ath10k_tm_cmd_utf_start()
246 if (WARN_ON(ar->testmode.utf_mode_fw.fw_file.firmware != NULL)) { in ath10k_tm_cmd_utf_start()
252 ret = ath10k_tm_fetch_firmware(ar); in ath10k_tm_cmd_utf_start()
254 ath10k_err(ar, "failed to fetch UTF firmware: %d", ret); in ath10k_tm_cmd_utf_start()
258 if (ar->testmode.utf_mode_fw.fw_file.codeswap_data && in ath10k_tm_cmd_utf_start()
259 ar->testmode.utf_mode_fw.fw_file.codeswap_len) { in ath10k_tm_cmd_utf_start()
260 ret = ath10k_swap_code_seg_init(ar, in ath10k_tm_cmd_utf_start()
261 &ar->testmode.utf_mode_fw.fw_file); in ath10k_tm_cmd_utf_start()
263 ath10k_warn(ar, in ath10k_tm_cmd_utf_start()
270 spin_lock_bh(&ar->data_lock); in ath10k_tm_cmd_utf_start()
271 ar->testmode.utf_monitor = true; in ath10k_tm_cmd_utf_start()
272 spin_unlock_bh(&ar->data_lock); in ath10k_tm_cmd_utf_start()
274 ath10k_dbg(ar, ATH10K_DBG_TESTMODE, "testmode wmi version %d\n", in ath10k_tm_cmd_utf_start()
275 ar->testmode.utf_mode_fw.fw_file.wmi_op_version); in ath10k_tm_cmd_utf_start()
277 ret = ath10k_hif_power_up(ar, ATH10K_FIRMWARE_MODE_UTF); in ath10k_tm_cmd_utf_start()
279 ath10k_err(ar, "failed to power up hif (testmode): %d\n", ret); in ath10k_tm_cmd_utf_start()
280 ar->state = ATH10K_STATE_OFF; in ath10k_tm_cmd_utf_start()
284 ret = ath10k_core_start(ar, ATH10K_FIRMWARE_MODE_UTF, in ath10k_tm_cmd_utf_start()
285 &ar->testmode.utf_mode_fw); in ath10k_tm_cmd_utf_start()
287 ath10k_err(ar, "failed to start core (testmode): %d\n", ret); in ath10k_tm_cmd_utf_start()
288 ar->state = ATH10K_STATE_OFF; in ath10k_tm_cmd_utf_start()
292 ar->state = ATH10K_STATE_UTF; in ath10k_tm_cmd_utf_start()
294 if (strlen(ar->testmode.utf_mode_fw.fw_file.fw_version) > 0) in ath10k_tm_cmd_utf_start()
295 ver = ar->testmode.utf_mode_fw.fw_file.fw_version; in ath10k_tm_cmd_utf_start()
299 ath10k_info(ar, "UTF firmware %s started\n", ver); in ath10k_tm_cmd_utf_start()
301 mutex_unlock(&ar->conf_mutex); in ath10k_tm_cmd_utf_start()
306 ath10k_hif_power_down(ar); in ath10k_tm_cmd_utf_start()
309 if (ar->testmode.utf_mode_fw.fw_file.codeswap_data && in ath10k_tm_cmd_utf_start()
310 ar->testmode.utf_mode_fw.fw_file.codeswap_len) in ath10k_tm_cmd_utf_start()
311 ath10k_swap_code_seg_release(ar, in ath10k_tm_cmd_utf_start()
312 &ar->testmode.utf_mode_fw.fw_file); in ath10k_tm_cmd_utf_start()
314 release_firmware(ar->testmode.utf_mode_fw.fw_file.firmware); in ath10k_tm_cmd_utf_start()
315 ar->testmode.utf_mode_fw.fw_file.firmware = NULL; in ath10k_tm_cmd_utf_start()
318 mutex_unlock(&ar->conf_mutex); in ath10k_tm_cmd_utf_start()
323 static void __ath10k_tm_cmd_utf_stop(struct ath10k *ar) in __ath10k_tm_cmd_utf_stop() argument
325 lockdep_assert_held(&ar->conf_mutex); in __ath10k_tm_cmd_utf_stop()
327 ath10k_core_stop(ar); in __ath10k_tm_cmd_utf_stop()
328 ath10k_hif_power_down(ar); in __ath10k_tm_cmd_utf_stop()
330 spin_lock_bh(&ar->data_lock); in __ath10k_tm_cmd_utf_stop()
332 ar->testmode.utf_monitor = false; in __ath10k_tm_cmd_utf_stop()
334 spin_unlock_bh(&ar->data_lock); in __ath10k_tm_cmd_utf_stop()
336 if (ar->testmode.utf_mode_fw.fw_file.codeswap_data && in __ath10k_tm_cmd_utf_stop()
337 ar->testmode.utf_mode_fw.fw_file.codeswap_len) in __ath10k_tm_cmd_utf_stop()
338 ath10k_swap_code_seg_release(ar, in __ath10k_tm_cmd_utf_stop()
339 &ar->testmode.utf_mode_fw.fw_file); in __ath10k_tm_cmd_utf_stop()
341 release_firmware(ar->testmode.utf_mode_fw.fw_file.firmware); in __ath10k_tm_cmd_utf_stop()
342 ar->testmode.utf_mode_fw.fw_file.firmware = NULL; in __ath10k_tm_cmd_utf_stop()
344 ar->state = ATH10K_STATE_OFF; in __ath10k_tm_cmd_utf_stop()
347 static int ath10k_tm_cmd_utf_stop(struct ath10k *ar, struct nlattr *tb[]) in ath10k_tm_cmd_utf_stop() argument
351 ath10k_dbg(ar, ATH10K_DBG_TESTMODE, "testmode cmd utf stop\n"); in ath10k_tm_cmd_utf_stop()
353 mutex_lock(&ar->conf_mutex); in ath10k_tm_cmd_utf_stop()
355 if (ar->state != ATH10K_STATE_UTF) { in ath10k_tm_cmd_utf_stop()
360 __ath10k_tm_cmd_utf_stop(ar); in ath10k_tm_cmd_utf_stop()
364 ath10k_info(ar, "UTF firmware stopped\n"); in ath10k_tm_cmd_utf_stop()
367 mutex_unlock(&ar->conf_mutex); in ath10k_tm_cmd_utf_stop()
371 static int ath10k_tm_cmd_wmi(struct ath10k *ar, struct nlattr *tb[]) in ath10k_tm_cmd_wmi() argument
378 mutex_lock(&ar->conf_mutex); in ath10k_tm_cmd_wmi()
380 if (ar->state != ATH10K_STATE_UTF) { in ath10k_tm_cmd_wmi()
399 ath10k_dbg(ar, ATH10K_DBG_TESTMODE, in ath10k_tm_cmd_wmi()
403 ath10k_dbg_dump(ar, ATH10K_DBG_TESTMODE, NULL, "", buf, buf_len); in ath10k_tm_cmd_wmi()
405 skb = ath10k_wmi_alloc_skb(ar, buf_len); in ath10k_tm_cmd_wmi()
413 ret = ath10k_wmi_cmd_send(ar, skb, cmd_id); in ath10k_tm_cmd_wmi()
415 ath10k_warn(ar, "failed to transmit wmi command (testmode): %d\n", in ath10k_tm_cmd_wmi()
423 mutex_unlock(&ar->conf_mutex); in ath10k_tm_cmd_wmi()
430 struct ath10k *ar = hw->priv; in ath10k_tm_cmd() local
444 return ath10k_tm_cmd_get_version(ar, tb); in ath10k_tm_cmd()
446 return ath10k_tm_cmd_utf_start(ar, tb); in ath10k_tm_cmd()
448 return ath10k_tm_cmd_utf_stop(ar, tb); in ath10k_tm_cmd()
450 return ath10k_tm_cmd_wmi(ar, tb); in ath10k_tm_cmd()
456 void ath10k_testmode_destroy(struct ath10k *ar) in ath10k_testmode_destroy() argument
458 mutex_lock(&ar->conf_mutex); in ath10k_testmode_destroy()
460 if (ar->state != ATH10K_STATE_UTF) { in ath10k_testmode_destroy()
465 __ath10k_tm_cmd_utf_stop(ar); in ath10k_testmode_destroy()
468 mutex_unlock(&ar->conf_mutex); in ath10k_testmode_destroy()