Lines Matching refs:scn

77 A_target_id_t hif_get_target_id(struct hif_softc *scn)  in hif_get_target_id()  argument
79 return scn->mem; in hif_get_target_id()
90 struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); in hif_get_targetdef() local
92 return scn->targetdef; in hif_get_targetdef()
100 struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); in hif_srng_init_phase() local
102 if (ce_srng_based(scn)) in hif_srng_init_phase()
103 hal_set_init_phase(scn->hal_soc, init_phase); in hif_srng_init_phase()
109 struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); in hif_srng_init_phase() local
111 hal_set_init_phase(scn->hal_soc, init_phase); in hif_srng_init_phase()
119 struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); in hif_shutdown_notifier_cb() local
121 scn->recovery = true; in hif_shutdown_notifier_cb()
142 struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); in hif_vote_link_down() local
144 QDF_BUG(scn); in hif_vote_link_down()
145 if (scn->linkstate_vote == 0) in hif_vote_link_down()
147 scn->linkstate_vote); in hif_vote_link_down()
149 scn->linkstate_vote--; in hif_vote_link_down()
150 hif_info("Down_linkstate_vote %d", scn->linkstate_vote); in hif_vote_link_down()
151 if (scn->linkstate_vote == 0) in hif_vote_link_down()
152 hif_bus_prevent_linkdown(scn, false); in hif_vote_link_down()
169 struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); in hif_vote_link_up() local
171 QDF_BUG(scn); in hif_vote_link_up()
172 scn->linkstate_vote++; in hif_vote_link_up()
173 hif_info("Up_linkstate_vote %d", scn->linkstate_vote); in hif_vote_link_up()
174 if (scn->linkstate_vote == 1) in hif_vote_link_up()
175 hif_bus_prevent_linkdown(scn, true); in hif_vote_link_up()
193 struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); in hif_can_suspend_link() local
195 QDF_BUG(scn); in hif_can_suspend_link()
196 return scn->linkstate_vote == 0; in hif_can_suspend_link()
248 bool hif_max_num_receives_reached(struct hif_softc *scn, unsigned int count) in hif_max_num_receives_reached() argument
250 if (QDF_IS_EPPING_ENABLED(hif_get_conparam(scn))) in hif_max_num_receives_reached()
280 struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); in hif_save_htc_htt_config_endpoint() local
282 if (!scn) { in hif_save_htc_htt_config_endpoint()
287 scn->htc_htt_tx_endpoint = htc_htt_tx_endpoint; in hif_save_htc_htt_config_endpoint()
520 void hif_get_hw_info(struct hif_opaque_softc *scn, u32 *version, u32 *revision, in hif_get_hw_info() argument
523 struct hif_target_info *info = hif_get_target_info_handle(scn); in hif_get_hw_info()
524 struct hif_softc *sc = HIF_GET_SOFTC(scn); in hif_get_hw_info()
542 struct hif_softc *scn = (struct hif_softc *)hif_handle; in hif_get_dev_ba() local
544 return scn->mem; in hif_get_dev_ba()
556 struct hif_softc *scn = (struct hif_softc *)hif_handle; in hif_get_dev_ba_ce() local
558 return scn->mem_ce; in hif_get_dev_ba_ce()
572 struct hif_softc *scn = (struct hif_softc *)hif_handle; in hif_get_dev_ba_pmm() local
574 return scn->mem_pmm_base; in hif_get_dev_ba_pmm()
581 struct hif_softc *scn = (struct hif_softc *)hif_handle; in hif_get_soc_version() local
583 return scn->target_info.soc_version; in hif_get_soc_version()
596 struct hif_softc *scn = (struct hif_softc *)hif_handle; in hif_get_dev_ba_cmem() local
598 return scn->mem_cmem; in hif_get_dev_ba_cmem()
604 void hif_runtime_prevent_linkdown(struct hif_softc *scn, bool is_get) in hif_runtime_prevent_linkdown() argument
607 qdf_runtime_pm_prevent_suspend(&scn->prevent_linkdown_lock); in hif_runtime_prevent_linkdown()
609 qdf_runtime_pm_allow_suspend(&scn->prevent_linkdown_lock); in hif_runtime_prevent_linkdown()
613 void hif_rtpm_lock_init(struct hif_softc *scn) in hif_rtpm_lock_init() argument
615 qdf_runtime_lock_init(&scn->prevent_linkdown_lock); in hif_rtpm_lock_init()
619 void hif_rtpm_lock_deinit(struct hif_softc *scn) in hif_rtpm_lock_deinit() argument
621 qdf_runtime_lock_deinit(&scn->prevent_linkdown_lock); in hif_rtpm_lock_deinit()
625 void hif_rtpm_lock_init(struct hif_softc *scn) in hif_rtpm_lock_init() argument
630 void hif_rtpm_lock_deinit(struct hif_softc *scn) in hif_rtpm_lock_deinit() argument
644 void hif_get_interrupt_threshold_cfg_from_psoc(struct hif_softc *scn, in hif_get_interrupt_threshold_cfg_from_psoc() argument
648 scn->ini_cfg.ce_status_ring_timer_threshold = in hif_get_interrupt_threshold_cfg_from_psoc()
651 scn->ini_cfg.ce_status_ring_batch_count_threshold = in hif_get_interrupt_threshold_cfg_from_psoc()
658 void hif_get_interrupt_threshold_cfg_from_psoc(struct hif_softc *scn, in hif_get_interrupt_threshold_cfg_from_psoc() argument
672 void hif_get_cfg_from_psoc(struct hif_softc *scn, in hif_get_cfg_from_psoc() argument
676 scn->ini_cfg.disable_wake_irq = in hif_get_cfg_from_psoc()
686 if (pld_is_one_msi(scn->qdf_dev->dev)) { in hif_get_cfg_from_psoc()
688 scn->ini_cfg.disable_wake_irq = true; in hif_get_cfg_from_psoc()
690 hif_get_interrupt_threshold_cfg_from_psoc(scn, psoc); in hif_get_cfg_from_psoc()
794 struct hif_softc *scn = context; in __hif_cpu_hotplug_notify() local
796 if (!scn) in __hif_cpu_hotplug_notify()
798 if (hif_is_driver_unloading(scn) || hif_is_recovery_in_progress(scn)) in __hif_cpu_hotplug_notify()
802 hif_config_irq_set_perf_affinity_hint(GET_HIF_OPAQUE_HDL(scn)); in __hif_cpu_hotplug_notify()
840 static void hif_cpuhp_register(struct hif_softc *scn) in hif_cpuhp_register() argument
842 if (!scn) { in hif_cpuhp_register()
846 qdf_cpuhp_register(&scn->cpuhp_event_handle, in hif_cpuhp_register()
847 scn, in hif_cpuhp_register()
852 static void hif_cpuhp_unregister(struct hif_softc *scn) in hif_cpuhp_unregister() argument
854 if (!scn) { in hif_cpuhp_unregister()
858 qdf_cpuhp_unregister(&scn->cpuhp_event_handle); in hif_cpuhp_unregister()
862 static void hif_cpuhp_register(struct hif_softc *scn) in hif_cpuhp_register() argument
866 static void hif_cpuhp_unregister(struct hif_softc *scn) in hif_cpuhp_unregister() argument
881 __hif_tasklet_latency(struct hif_softc *scn, bool from_timer, int idx) in __hif_tasklet_latency() argument
884 scn->latency_detect.tasklet_info[idx].sched_time; in __hif_tasklet_latency()
886 scn->latency_detect.tasklet_info[idx].exec_time; in __hif_tasklet_latency()
888 uint32_t threshold = scn->latency_detect.threshold; in __hif_tasklet_latency()
903 scn->latency_detect.timeout, in __hif_tasklet_latency()
923 hif_tasklet_latency_detect_enabled(struct hif_softc *scn, int idx) in hif_tasklet_latency_detect_enabled() argument
925 if (QDF_GLOBAL_MISSION_MODE != hif_get_conparam(scn)) in hif_tasklet_latency_detect_enabled()
928 if (!scn->latency_detect.enable_detection) in hif_tasklet_latency_detect_enabled()
932 !qdf_test_bit(idx, scn->latency_detect.tasklet_bmap)) in hif_tasklet_latency_detect_enabled()
938 void hif_tasklet_latency_record_exec(struct hif_softc *scn, int idx) in hif_tasklet_latency_record_exec() argument
940 if (!hif_tasklet_latency_detect_enabled(scn, idx)) in hif_tasklet_latency_record_exec()
952 if (!scn->latency_detect.tasklet_info[idx].sched_time) in hif_tasklet_latency_record_exec()
955 scn->latency_detect.tasklet_info[idx].exec_time = qdf_system_ticks(); in hif_tasklet_latency_record_exec()
956 __hif_tasklet_latency(scn, false, idx); in hif_tasklet_latency_record_exec()
959 void hif_tasklet_latency_record_sched(struct hif_softc *scn, int idx) in hif_tasklet_latency_record_sched() argument
961 if (!hif_tasklet_latency_detect_enabled(scn, idx)) in hif_tasklet_latency_record_sched()
964 scn->latency_detect.tasklet_info[idx].sched_cpuid = qdf_get_cpu(); in hif_tasklet_latency_record_sched()
965 scn->latency_detect.tasklet_info[idx].sched_time = qdf_system_ticks(); in hif_tasklet_latency_record_sched()
968 static inline void hif_credit_latency(struct hif_softc *scn, bool from_timer) in hif_credit_latency() argument
971 scn->latency_detect.credit_request_time; in hif_credit_latency()
972 qdf_time_t credit_report_time = scn->latency_detect.credit_report_time; in hif_credit_latency()
974 uint32_t threshold = scn->latency_detect.threshold; in hif_credit_latency()
991 scn->latency_detect.timeout, in hif_credit_latency()
1001 static inline void hif_tasklet_latency(struct hif_softc *scn, bool from_timer) in hif_tasklet_latency() argument
1006 if (!qdf_test_bit(i, scn->latency_detect.tasklet_bmap)) in hif_tasklet_latency()
1009 ret = __hif_tasklet_latency(scn, from_timer, i); in hif_tasklet_latency()
1024 void hif_check_detection_latency(struct hif_softc *scn, in hif_check_detection_latency() argument
1028 if (QDF_GLOBAL_MISSION_MODE != hif_get_conparam(scn)) in hif_check_detection_latency()
1031 if (!scn->latency_detect.enable_detection) in hif_check_detection_latency()
1035 hif_tasklet_latency(scn, from_timer); in hif_check_detection_latency()
1038 hif_credit_latency(scn, from_timer); in hif_check_detection_latency()
1043 struct hif_softc *scn = (struct hif_softc *)arg; in hif_latency_detect_timeout_handler() local
1046 struct hif_latency_detect *detect = &scn->latency_detect; in hif_latency_detect_timeout_handler()
1048 hif_check_detection_latency(scn, true, in hif_latency_detect_timeout_handler()
1080 static void hif_latency_detect_timer_init(struct hif_softc *scn) in hif_latency_detect_timer_init() argument
1082 scn->latency_detect.timeout = in hif_latency_detect_timer_init()
1084 scn->latency_detect.threshold = in hif_latency_detect_timer_init()
1088 scn->latency_detect.timeout, in hif_latency_detect_timer_init()
1089 scn->latency_detect.threshold); in hif_latency_detect_timer_init()
1091 scn->latency_detect.is_timer_started = false; in hif_latency_detect_timer_init()
1094 &scn->latency_detect.timer, in hif_latency_detect_timer_init()
1096 scn, in hif_latency_detect_timer_init()
1100 static void hif_latency_detect_timer_deinit(struct hif_softc *scn) in hif_latency_detect_timer_deinit() argument
1103 qdf_timer_free(&scn->latency_detect.timer); in hif_latency_detect_timer_deinit()
1106 static void hif_latency_detect_init(struct hif_softc *scn) in hif_latency_detect_init() argument
1111 if (QDF_GLOBAL_MISSION_MODE != hif_get_conparam(scn)) in hif_latency_detect_init()
1118 qdf_set_bit(i, scn->latency_detect.tasklet_bmap); in hif_latency_detect_init()
1121 hif_latency_detect_timer_init(scn); in hif_latency_detect_init()
1124 static void hif_latency_detect_deinit(struct hif_softc *scn) in hif_latency_detect_deinit() argument
1128 if (QDF_GLOBAL_MISSION_MODE != hif_get_conparam(scn)) in hif_latency_detect_deinit()
1131 hif_latency_detect_timer_deinit(scn); in hif_latency_detect_deinit()
1133 qdf_clear_bit(i, scn->latency_detect.tasklet_bmap); in hif_latency_detect_deinit()
1138 struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); in hif_latency_detect_timer_start() local
1140 if (QDF_GLOBAL_MISSION_MODE != hif_get_conparam(scn)) in hif_latency_detect_timer_start()
1144 if (scn->latency_detect.is_timer_started) { in hif_latency_detect_timer_start()
1149 qdf_timer_start(&scn->latency_detect.timer, in hif_latency_detect_timer_start()
1150 scn->latency_detect.timeout); in hif_latency_detect_timer_start()
1151 scn->latency_detect.is_timer_started = true; in hif_latency_detect_timer_start()
1156 struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); in hif_latency_detect_timer_stop() local
1158 if (QDF_GLOBAL_MISSION_MODE != hif_get_conparam(scn)) in hif_latency_detect_timer_stop()
1163 qdf_timer_sync_cancel(&scn->latency_detect.timer); in hif_latency_detect_timer_stop()
1164 scn->latency_detect.is_timer_started = false; in hif_latency_detect_timer_stop()
1171 struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); in hif_latency_detect_credit_record_time() local
1173 if (!scn) { in hif_latency_detect_credit_record_time()
1178 if (QDF_GLOBAL_MISSION_MODE != hif_get_conparam(scn)) in hif_latency_detect_credit_record_time()
1182 scn->latency_detect.credit_request_time = qdf_system_ticks(); in hif_latency_detect_credit_record_time()
1184 scn->latency_detect.credit_report_time = qdf_system_ticks(); in hif_latency_detect_credit_record_time()
1186 hif_check_detection_latency(scn, false, BIT(HIF_DETECT_CREDIT)); in hif_latency_detect_credit_record_time()
1191 struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); in hif_set_enable_detection() local
1193 if (!scn) { in hif_set_enable_detection()
1198 if (QDF_GLOBAL_MISSION_MODE != hif_get_conparam(scn)) in hif_set_enable_detection()
1201 scn->latency_detect.enable_detection = value; in hif_set_enable_detection()
1204 static inline void hif_latency_detect_init(struct hif_softc *scn) in hif_latency_detect_init() argument
1207 static inline void hif_latency_detect_deinit(struct hif_softc *scn) in hif_latency_detect_deinit() argument
1214 hif_affinity_mgr_init(struct hif_softc *scn, struct wlan_objmgr_psoc *psoc) in hif_affinity_mgr_init() argument
1219 scn->affinity_mgr_supported = in hif_affinity_mgr_init()
1223 hif_info("Affinity Manager supported: %d", scn->affinity_mgr_supported); in hif_affinity_mgr_init()
1225 if (!scn->affinity_mgr_supported) in hif_affinity_mgr_init()
1228 scn->time_threshold = AFFINITY_THRESHOLD; in hif_affinity_mgr_init()
1233 qdf_cpumask_copy(&scn->allowed_mask, &allowed_mask); in hif_affinity_mgr_init()
1237 hif_affinity_mgr_init(struct hif_softc *scn, struct wlan_objmgr_psoc *psoc) in hif_affinity_mgr_init() argument
1251 void hif_init_direct_link_rcv_pipe_num(struct hif_softc *scn) in hif_init_direct_link_rcv_pipe_num() argument
1253 scn->dl_recv_pipe_num = INVALID_PIPE_NO; in hif_init_direct_link_rcv_pipe_num()
1257 void hif_init_direct_link_rcv_pipe_num(struct hif_softc *scn) in hif_init_direct_link_rcv_pipe_num() argument
1268 struct hif_softc *scn; in hif_open() local
1277 scn = (struct hif_softc *)qdf_mem_malloc(bus_context_size); in hif_open()
1278 if (!scn) in hif_open()
1279 return GET_HIF_OPAQUE_HDL(scn); in hif_open()
1281 scn->qdf_dev = qdf_ctx; in hif_open()
1282 scn->hif_con_param = mode; in hif_open()
1283 qdf_atomic_init(&scn->active_tasklet_cnt); in hif_open()
1284 qdf_atomic_init(&scn->active_oom_work_cnt); in hif_open()
1286 qdf_atomic_init(&scn->active_grp_tasklet_cnt); in hif_open()
1287 qdf_atomic_init(&scn->link_suspended); in hif_open()
1288 qdf_atomic_init(&scn->tasklet_from_intr); in hif_open()
1289 hif_system_pm_set_state_on(GET_HIF_OPAQUE_HDL(scn)); in hif_open()
1290 qdf_mem_copy(&scn->callbacks, cbk, in hif_open()
1292 scn->bus_type = bus_type; in hif_open()
1294 hif_allow_ep_vote_access(GET_HIF_OPAQUE_HDL(scn)); in hif_open()
1295 hif_get_cfg_from_psoc(scn, psoc); in hif_open()
1297 hif_set_event_hist_mask(GET_HIF_OPAQUE_HDL(scn)); in hif_open()
1298 status = hif_bus_open(scn, bus_type); in hif_open()
1302 qdf_mem_free(scn); in hif_open()
1303 scn = NULL; in hif_open()
1307 hif_rtpm_lock_init(scn); in hif_open()
1309 hif_cpuhp_register(scn); in hif_open()
1310 hif_latency_detect_init(scn); in hif_open()
1311 hif_affinity_mgr_init(scn, psoc); in hif_open()
1312 hif_init_direct_link_rcv_pipe_num(scn); in hif_open()
1313 hif_ce_desc_history_log_register(scn); in hif_open()
1315 qdf_ssr_driver_dump_register_region("hif", scn, sizeof(*scn)); in hif_open()
1318 return GET_HIF_OPAQUE_HDL(scn); in hif_open()
1328 void hif_uninit_rri_on_ddr(struct hif_softc *scn) in hif_uninit_rri_on_ddr() argument
1330 if (scn->vaddr_rri_on_ddr) in hif_uninit_rri_on_ddr()
1331 qdf_mem_free_consistent(scn->qdf_dev, scn->qdf_dev->dev, in hif_uninit_rri_on_ddr()
1333 scn->vaddr_rri_on_ddr, in hif_uninit_rri_on_ddr()
1334 scn->paddr_rri_on_ddr, 0); in hif_uninit_rri_on_ddr()
1335 scn->vaddr_rri_on_ddr = NULL; in hif_uninit_rri_on_ddr()
1347 struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); in hif_close() local
1349 if (!scn) { in hif_close()
1357 hif_latency_detect_deinit(scn); in hif_close()
1359 if (scn->athdiag_procfs_inited) { in hif_close()
1361 scn->athdiag_procfs_inited = false; in hif_close()
1364 if (scn->target_info.hw_name) { in hif_close()
1365 char *hw_name = scn->target_info.hw_name; in hif_close()
1367 scn->target_info.hw_name = "ErrUnloading"; in hif_close()
1371 hif_uninit_rri_on_ddr(scn); in hif_close()
1372 hif_cleanup_static_buf_to_target(scn); in hif_close()
1373 hif_cpuhp_unregister(scn); in hif_close()
1374 hif_rtpm_lock_deinit(scn); in hif_close()
1376 hif_bus_close(scn); in hif_close()
1378 qdf_mem_free(scn); in hif_close()
1388 static inline int hif_get_num_active_grp_tasklets(struct hif_softc *scn) in hif_get_num_active_grp_tasklets() argument
1390 return qdf_atomic_read(&scn->active_grp_tasklet_cnt); in hif_get_num_active_grp_tasklets()
1407 static inline int hif_get_num_pending_work(struct hif_softc *scn) in hif_get_num_pending_work() argument
1409 return hal_get_reg_write_pending_work(scn->hal_soc); in hif_get_num_pending_work()
1412 static inline int hif_get_num_pending_work(struct hif_softc *scn) in hif_get_num_pending_work() argument
1414 return qdf_atomic_read(&scn->active_work_cnt); in hif_get_num_pending_work()
1418 static inline int hif_get_num_pending_work(struct hif_softc *scn) in hif_get_num_pending_work() argument
1424 QDF_STATUS hif_try_complete_tasks(struct hif_softc *scn) in hif_try_complete_tasks() argument
1429 while ((tasklet = hif_get_num_active_tasklets(scn)) || in hif_try_complete_tasks()
1430 (grp_tasklet = hif_get_num_active_grp_tasklets(scn)) || in hif_try_complete_tasks()
1431 (work = hif_get_num_pending_work(scn)) || in hif_try_complete_tasks()
1432 (oom_work = hif_get_num_active_oom_work(scn))) { in hif_try_complete_tasks()
1463 struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); in hif_try_complete_dp_tasks() local
1467 while ((grp_tasklet = hif_get_num_active_grp_tasklets(scn)) || in hif_try_complete_dp_tasks()
1468 (work = hif_get_num_pending_work(scn))) { in hif_try_complete_dp_tasks()
1486 void hif_reg_window_write(struct hif_softc *scn, uint32_t offset, in hif_reg_window_write() argument
1489 hal_write32_mb(scn->hal_soc, offset, value); in hif_reg_window_write()
1492 uint32_t hif_reg_window_read(struct hif_softc *scn, uint32_t offset) in hif_reg_window_read() argument
1494 return hal_read32_mb(scn->hal_soc, offset); in hif_reg_window_read()
1501 struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); in hif_try_prevent_ep_vote_access() local
1506 qdf_atomic_set(&scn->dp_ep_vote_access, in hif_try_prevent_ep_vote_access()
1508 qdf_atomic_set(&scn->ep_vote_access, in hif_try_prevent_ep_vote_access()
1511 while ((work = hif_get_num_pending_work(scn))) { in hif_try_prevent_ep_vote_access()
1513 qdf_atomic_set(&scn->dp_ep_vote_access, in hif_try_prevent_ep_vote_access()
1515 qdf_atomic_set(&scn->ep_vote_access, in hif_try_prevent_ep_vote_access()
1523 if (pld_is_pci_ep_awake(scn->qdf_dev->dev) == -ENOTSUPP) in hif_try_prevent_ep_vote_access()
1526 while (pld_is_pci_ep_awake(scn->qdf_dev->dev)) { in hif_try_prevent_ep_vote_access()
1539 struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); in hif_set_ep_intermediate_vote_access() local
1542 vote_access = qdf_atomic_read(&scn->ep_vote_access); in hif_set_ep_intermediate_vote_access()
1551 qdf_atomic_set(&scn->ep_vote_access, in hif_set_ep_intermediate_vote_access()
1557 struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); in hif_allow_ep_vote_access() local
1559 qdf_atomic_set(&scn->dp_ep_vote_access, in hif_allow_ep_vote_access()
1561 qdf_atomic_set(&scn->ep_vote_access, in hif_allow_ep_vote_access()
1568 struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); in hif_set_ep_vote_access() local
1571 qdf_atomic_set(&scn->dp_ep_vote_access, access); in hif_set_ep_vote_access()
1573 qdf_atomic_set(&scn->ep_vote_access, access); in hif_set_ep_vote_access()
1579 struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); in hif_get_ep_vote_access() local
1582 return qdf_atomic_read(&scn->dp_ep_vote_access); in hif_get_ep_vote_access()
1584 return qdf_atomic_read(&scn->ep_vote_access); in hif_get_ep_vote_access()
1603 struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); in hif_print_reg_write_stats() local
1608 hist = scn->wstats.sched_delay; in hif_print_reg_write_stats()
1610 qdf_atomic_read(&scn->wstats.enqueues), in hif_print_reg_write_stats()
1611 scn->wstats.dequeues, in hif_print_reg_write_stats()
1612 qdf_atomic_read(&scn->wstats.coalesces), in hif_print_reg_write_stats()
1613 qdf_atomic_read(&scn->wstats.direct), in hif_print_reg_write_stats()
1614 qdf_atomic_read(&scn->wstats.q_depth), in hif_print_reg_write_stats()
1615 scn->wstats.max_q_depth, in hif_print_reg_write_stats()
1621 for (i = 0; i < scn->ce_count; i++) { in hif_print_reg_write_stats()
1622 ce_state = scn->ce_id_to_state[i]; in hif_print_reg_write_stats()
1640 static inline bool hif_is_reg_write_tput_level_high(struct hif_softc *scn) in hif_is_reg_write_tput_level_high() argument
1642 int bw_level = hif_get_bandwidth_level(GET_HIF_OPAQUE_HDL(scn)); in hif_is_reg_write_tput_level_high()
1654 static inline void hif_reg_write_fill_sched_delay_hist(struct hif_softc *scn, in hif_reg_write_fill_sched_delay_hist() argument
1659 hist = scn->wstats.sched_delay; in hif_reg_write_fill_sched_delay_hist()
1679 hif_process_reg_write_q_elem(struct hif_softc *scn, in hif_process_reg_write_q_elem() argument
1692 hal_write32_mb(scn->hal_soc, ce_state->ce_wrt_idx_offset, in hif_process_reg_write_q_elem()
1697 hal_write32_mb(scn->hal_soc, ce_state->ce_wrt_idx_offset, in hif_process_reg_write_q_elem()
1721 struct hif_softc *scn = arg; in hif_reg_write_work() local
1729 q_elem = &scn->reg_write_queue[scn->read_idx]; in hif_reg_write_work()
1738 q_depth = qdf_atomic_read(&scn->wstats.q_depth); in hif_reg_write_work()
1739 if (q_depth > scn->wstats.max_q_depth) in hif_reg_write_work()
1740 scn->wstats.max_q_depth = q_depth; in hif_reg_write_work()
1742 if (hif_prevent_link_low_power_states(GET_HIF_OPAQUE_HDL(scn))) { in hif_reg_write_work()
1743 scn->wstats.prevent_l1_fails++; in hif_reg_write_work()
1758 hif_reg_write_fill_sched_delay_hist(scn, delta_us); in hif_reg_write_work()
1760 scn->wstats.dequeues++; in hif_reg_write_work()
1761 qdf_atomic_dec(&scn->wstats.q_depth); in hif_reg_write_work()
1763 write_val = hif_process_reg_write_q_elem(scn, q_elem); in hif_reg_write_work()
1765 scn->read_idx, ring_id, offset, write_val); in hif_reg_write_work()
1772 scn->read_idx = (scn->read_idx + 1) & in hif_reg_write_work()
1774 q_elem = &scn->reg_write_queue[scn->read_idx]; in hif_reg_write_work()
1777 hif_allow_link_low_power_states(GET_HIF_OPAQUE_HDL(scn)); in hif_reg_write_work()
1789 qdf_atomic_sub(num_processed, &scn->active_work_cnt); in hif_reg_write_work()
1801 static void hif_delayed_reg_write_deinit(struct hif_softc *scn) in hif_delayed_reg_write_deinit() argument
1803 qdf_flush_work(&scn->reg_write_work); in hif_delayed_reg_write_deinit()
1804 qdf_disable_work(&scn->reg_write_work); in hif_delayed_reg_write_deinit()
1805 qdf_flush_workqueue(0, scn->reg_write_wq); in hif_delayed_reg_write_deinit()
1806 qdf_destroy_workqueue(0, scn->reg_write_wq); in hif_delayed_reg_write_deinit()
1807 qdf_mem_free(scn->reg_write_queue); in hif_delayed_reg_write_deinit()
1818 static QDF_STATUS hif_delayed_reg_write_init(struct hif_softc *scn) in hif_delayed_reg_write_init() argument
1820 qdf_atomic_init(&scn->active_work_cnt); in hif_delayed_reg_write_init()
1821 scn->reg_write_wq = in hif_delayed_reg_write_init()
1823 qdf_create_work(0, &scn->reg_write_work, hif_reg_write_work, scn); in hif_delayed_reg_write_init()
1824 scn->reg_write_queue = qdf_mem_malloc(HIF_REG_WRITE_QUEUE_LEN * in hif_delayed_reg_write_init()
1825 sizeof(*scn->reg_write_queue)); in hif_delayed_reg_write_init()
1826 if (!scn->reg_write_queue) { in hif_delayed_reg_write_init()
1833 scn->read_idx = 0; in hif_delayed_reg_write_init()
1834 qdf_atomic_set(&scn->write_idx, -1); in hif_delayed_reg_write_init()
1839 static void hif_reg_write_enqueue(struct hif_softc *scn, in hif_reg_write_enqueue() argument
1849 qdf_atomic_inc(&scn->wstats.coalesces); in hif_reg_write_enqueue()
1854 write_idx = qdf_atomic_inc_return(&scn->write_idx); in hif_reg_write_enqueue()
1857 q_elem = &scn->reg_write_queue[write_idx]; in hif_reg_write_enqueue()
1864 qdf_atomic_inc(&scn->wstats.enqueues); in hif_reg_write_enqueue()
1867 qdf_atomic_inc(&scn->wstats.q_depth); in hif_reg_write_enqueue()
1895 qdf_atomic_inc(&scn->active_work_cnt); in hif_reg_write_enqueue()
1900 qdf_queue_work(scn->qdf_dev, scn->reg_write_wq, in hif_reg_write_enqueue()
1901 &scn->reg_write_work); in hif_reg_write_enqueue()
1904 void hif_delayed_reg_write(struct hif_softc *scn, uint32_t ctrl_addr, in hif_delayed_reg_write() argument
1910 ce_state = scn->ce_id_to_state[ce_id]; in hif_delayed_reg_write()
1913 hif_reg_write_enqueue(scn, ce_state, val); in hif_delayed_reg_write()
1917 if (hif_is_reg_write_tput_level_high(scn) || in hif_delayed_reg_write()
1918 (PLD_MHI_STATE_L0 == pld_get_mhi_state(scn->qdf_dev->dev))) { in hif_delayed_reg_write()
1919 hal_write32_mb(scn->hal_soc, ce_state->ce_wrt_idx_offset, val); in hif_delayed_reg_write()
1920 qdf_atomic_inc(&scn->wstats.direct); in hif_delayed_reg_write()
1923 hif_reg_write_enqueue(scn, ce_state, val); in hif_delayed_reg_write()
1927 static inline QDF_STATUS hif_delayed_reg_write_init(struct hif_softc *scn) in hif_delayed_reg_write_init() argument
1932 static inline void hif_delayed_reg_write_deinit(struct hif_softc *scn) in hif_delayed_reg_write_deinit() argument
1938 static QDF_STATUS hif_hal_attach(struct hif_softc *scn) in hif_hal_attach() argument
1940 scn->hal_soc = hal_attach(hif_softc_to_hif_opaque_softc(scn), in hif_hal_attach()
1941 scn->qdf_dev); in hif_hal_attach()
1942 if (!scn->hal_soc) in hif_hal_attach()
1948 static QDF_STATUS hif_hal_detach(struct hif_softc *scn) in hif_hal_detach() argument
1950 hal_detach(scn->hal_soc); in hif_hal_detach()
1951 scn->hal_soc = NULL; in hif_hal_detach()
1961 static QDF_STATUS hif_hal_attach(struct hif_softc *scn) in hif_hal_attach() argument
1963 if (ce_srng_based(scn)) { in hif_hal_attach()
1964 scn->hal_soc = hal_attach( in hif_hal_attach()
1965 hif_softc_to_hif_opaque_softc(scn), in hif_hal_attach()
1966 scn->qdf_dev); in hif_hal_attach()
1967 if (!scn->hal_soc) in hif_hal_attach()
1974 static QDF_STATUS hif_hal_detach(struct hif_softc *scn) in hif_hal_detach() argument
1976 if (ce_srng_based(scn)) { in hif_hal_detach()
1977 hal_detach(scn->hal_soc); in hif_hal_detach()
1978 scn->hal_soc = NULL; in hif_hal_detach()
1984 static QDF_STATUS hif_hal_attach(struct hif_softc *scn) in hif_hal_attach() argument
1989 static QDF_STATUS hif_hal_detach(struct hif_softc *scn) in hif_hal_detach() argument
2035 struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); in hif_enable() local
2037 if (!scn) { in hif_enable()
2042 status = hif_enable_bus(scn, dev, bdev, bid, type); in hif_enable()
2048 status = hif_hal_attach(scn); in hif_enable()
2054 if (hif_delayed_reg_write_init(scn) != QDF_STATUS_SUCCESS) { in hif_enable()
2059 if (hif_bus_configure(scn)) { in hif_enable()
2065 hif_ut_suspend_init(scn); in hif_enable()
2066 hif_register_recovery_notifier(scn); in hif_enable()
2077 scn->hif_init_done = true; in hif_enable()
2084 hif_hal_detach(scn); in hif_enable()
2086 hif_disable_bus(scn); in hif_enable()
2092 struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); in hif_disable() local
2094 if (!scn) in hif_disable()
2097 hif_delayed_reg_write_deinit(scn); in hif_disable()
2101 hif_unregister_recovery_notifier(scn); in hif_disable()
2103 hif_nointrs(scn); in hif_disable()
2104 if (scn->hif_init_done == false) in hif_disable()
2109 hif_hal_detach(scn); in hif_disable()
2111 hif_disable_bus(scn); in hif_disable()
2113 hif_wlan_disable(scn); in hif_disable()
2115 scn->notice_send = false; in hif_disable()
2123 struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); in hif_enable_ce_latency_stats() local
2125 if (!scn) in hif_enable_ce_latency_stats()
2128 scn->ce_latency_stats = val; in hif_enable_ce_latency_stats()
2154 struct hif_opaque_softc *scn = hif_ctx; in hif_crash_shutdown_dump_bus_register() local
2156 if (hif_check_soc_status(scn)) in hif_crash_shutdown_dump_bus_register()
2159 if (hif_dump_registers(scn)) in hif_crash_shutdown_dump_bus_register()
2174 struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); in hif_crash_shutdown() local
2179 if (scn->bus_type == QDF_BUS_TYPE_SNOC) { in hif_crash_shutdown()
2180 hif_warn("RAM dump disabled for bustype %d", scn->bus_type); in hif_crash_shutdown()
2184 if (TARGET_STATUS_RESET == scn->target_status) { in hif_crash_shutdown()
2189 if (hif_is_load_or_unload_in_progress(scn)) { in hif_crash_shutdown()
2219 int hif_check_fw_reg(struct hif_opaque_softc *scn) in hif_check_fw_reg() argument
2232 void hif_read_phy_mem_base(struct hif_softc *scn, qdf_dma_addr_t *phy_mem_base) in hif_read_phy_mem_base() argument
2234 *phy_mem_base = scn->mem_pa; in hif_read_phy_mem_base()
2468 struct hif_softc *scn = HIF_GET_SOFTC(hif_hdl); in hif_get_bus_type() local
2470 return scn->bus_type; in hif_get_bus_type()
2511 void hif_offld_flush_cb_register(struct hif_opaque_softc *scn, in hif_offld_flush_cb_register() argument
2514 if (hif_napi_enabled(scn, -1)) in hif_offld_flush_cb_register()
2515 hif_napi_rx_offld_flush_cb_register(scn, offld_flush_handler); in hif_offld_flush_cb_register()
2521 void hif_offld_flush_cb_deregister(struct hif_opaque_softc *scn) in hif_offld_flush_cb_deregister() argument
2523 if (hif_napi_enabled(scn, -1)) in hif_offld_flush_cb_deregister()
2524 hif_napi_rx_offld_flush_cb_deregister(scn); in hif_offld_flush_cb_deregister()
2575 struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); in hif_get_target_status() local
2577 return scn->target_status; in hif_get_target_status()
2591 struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); in hif_set_target_status() local
2593 scn->target_status = status; in hif_set_target_status()
2606 struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); in hif_init_ini_config() local
2608 qdf_mem_copy(&scn->hif_config, cfg, sizeof(struct hif_config_info)); in hif_init_ini_config()
2617 uint32_t hif_get_conparam(struct hif_softc *scn) in hif_get_conparam() argument
2619 if (!scn) in hif_get_conparam()
2622 return scn->hif_con_param; in hif_get_conparam()
2632 struct hif_softc *scn) in hif_get_callbacks_handle() argument
2634 return &scn->callbacks; in hif_get_callbacks_handle()
2643 bool hif_is_driver_unloading(struct hif_softc *scn) in hif_is_driver_unloading() argument
2645 struct hif_driver_state_callbacks *cbk = hif_get_callbacks_handle(scn); in hif_is_driver_unloading()
2660 bool hif_is_load_or_unload_in_progress(struct hif_softc *scn) in hif_is_load_or_unload_in_progress() argument
2662 struct hif_driver_state_callbacks *cbk = hif_get_callbacks_handle(scn); in hif_is_load_or_unload_in_progress()
2677 bool hif_is_recovery_in_progress(struct hif_softc *scn) in hif_is_recovery_in_progress() argument
2679 struct hif_driver_state_callbacks *cbk = hif_get_callbacks_handle(scn); in hif_is_recovery_in_progress()
2703 struct hif_softc *scn = HIF_GET_SOFTC(osc); in hif_update_pipe_callback() local
2704 struct HIF_CE_state *hif_state = HIF_GET_CE_STATE(scn); in hif_update_pipe_callback()
2725 bool hif_is_target_ready(struct hif_softc *scn) in hif_is_target_ready() argument
2727 struct hif_driver_state_callbacks *cbk = hif_get_callbacks_handle(scn); in hif_is_target_ready()
2742 struct hif_softc *scn = HIF_GET_SOFTC(hif_handle); in hif_get_bandwidth_level() local
2743 struct hif_driver_state_callbacks *cbk = hif_get_callbacks_handle(scn); in hif_get_bandwidth_level()
2754 void *hif_mem_alloc_consistent_unaligned(struct hif_softc *scn, in hif_mem_alloc_consistent_unaligned() argument
2762 hif_get_callbacks_handle(scn); in hif_mem_alloc_consistent_unaligned()
2775 vaddr = qdf_mem_alloc_consistent(scn->qdf_dev, in hif_mem_alloc_consistent_unaligned()
2776 scn->qdf_dev->dev, in hif_mem_alloc_consistent_unaligned()
2787 void hif_mem_free_consistent_unaligned(struct hif_softc *scn, in hif_mem_free_consistent_unaligned() argument
2795 hif_get_callbacks_handle(scn); in hif_mem_free_consistent_unaligned()
2805 qdf_mem_free_consistent(scn->qdf_dev, scn->qdf_dev->dev, in hif_mem_free_consistent_unaligned()
2810 void hif_prealloc_get_multi_pages(struct hif_softc *scn, uint32_t desc_type, in hif_prealloc_get_multi_pages() argument
2816 hif_get_callbacks_handle(scn); in hif_prealloc_get_multi_pages()
2823 qdf_mem_multi_pages_alloc(scn->qdf_dev, pages, in hif_prealloc_get_multi_pages()
2827 void hif_prealloc_put_multi_pages(struct hif_softc *scn, uint32_t desc_type, in hif_prealloc_put_multi_pages() argument
2832 hif_get_callbacks_handle(scn); in hif_prealloc_put_multi_pages()
2839 qdf_mem_multi_pages_free(scn->qdf_dev, pages, 0, in hif_prealloc_put_multi_pages()
2921 struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); in hif_reg_write() local
2923 hif_write32_mb(scn, scn->mem + offset, value); in hif_reg_write()
2939 struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); in hif_reg_read() local
2941 return hif_read32_mb(scn, scn->mem + offset); in hif_reg_read()
2951 void hif_ramdump_handler(struct hif_opaque_softc *scn) in hif_ramdump_handler() argument
2953 if (hif_get_bus_type(scn) == QDF_BUS_TYPE_USB) in hif_ramdump_handler()
2954 hif_usb_ramdump_handler(scn); in hif_ramdump_handler()
2959 struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); in hif_pm_get_wake_irq_type() local
2961 return scn->wake_irq_type; in hif_pm_get_wake_irq_type()
2966 struct hif_softc *scn = context; in hif_wake_interrupt_handler() local
2973 if (scn->initial_wakeup_cb) in hif_wake_interrupt_handler()
2974 scn->initial_wakeup_cb(scn->initial_wakeup_priv); in hif_wake_interrupt_handler()
2976 if (hif_is_ut_suspended(scn)) in hif_wake_interrupt_handler()
2977 hif_ut_fw_resume(scn); in hif_wake_interrupt_handler()
2988 struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); in hif_set_initial_wakeup_cb() local
2990 scn->initial_wakeup_cb = callback; in hif_set_initial_wakeup_cb()
2991 scn->initial_wakeup_priv = priv; in hif_set_initial_wakeup_cb()
3079 hif_audio_cpu_affinity_allowed(struct hif_softc *scn, in hif_audio_cpu_affinity_allowed() argument
3087 < scn->time_threshold)) in hif_audio_cpu_affinity_allowed()
3107 hif_affinity_mgr_check_update_mask(struct hif_softc *scn, in hif_affinity_mgr_check_update_mask() argument
3159 if (!(hif_audio_cpu_affinity_allowed(scn, cfg, audio_taken_cpu, in hif_affinity_mgr_check_update_mask()
3165 qdf_cpumask_and(&allowed_mask, &scn->allowed_mask, &audio_taken_cpu); in hif_affinity_mgr_check_update_mask()
3184 hif_check_and_affine_irq(struct hif_softc *scn, struct hif_cpu_affinity *cfg, in hif_check_and_affine_irq() argument
3190 status = hif_affinity_mgr_check_update_mask(scn, cfg, in hif_check_and_affine_irq()
3207 if (hif_audio_cpu_affinity_allowed(scn, cfg, in hif_check_and_affine_irq()
3221 void hif_affinity_mgr_affine_irq(struct hif_softc *scn) in hif_affinity_mgr_affine_irq() argument
3235 if (!scn->affinity_mgr_supported) in hif_affinity_mgr_affine_irq()
3242 ce_sc = HIF_GET_CE_STATE(scn); in hif_affinity_mgr_affine_irq()
3244 for (ce_id = 0; ce_id < scn->ce_count; ce_id++) { in hif_affinity_mgr_affine_irq()
3247 cfg = &scn->ce_irq_cpu_mask[ce_id]; in hif_affinity_mgr_affine_irq()
3250 hif_check_and_affine_irq(scn, cfg, audio_taken_cpu, in hif_affinity_mgr_affine_irq()
3256 hif_state = HIF_GET_CE_STATE(scn); in hif_affinity_mgr_affine_irq()
3260 cfg = &scn->irq_cpu_mask[hif_ext_group->grp_id][j]; in hif_affinity_mgr_affine_irq()
3263 hif_check_and_affine_irq(scn, cfg, audio_taken_cpu, in hif_affinity_mgr_affine_irq()
3279 hif_affinity_mgr_set_irq_affinity(struct hif_softc *scn, uint32_t irq, in hif_affinity_mgr_set_irq_affinity() argument
3291 mask_updated = hif_affinity_mgr_check_update_mask(scn, cfg, in hif_affinity_mgr_set_irq_affinity()
3301 if (hif_audio_cpu_affinity_allowed(scn, cfg, in hif_affinity_mgr_set_irq_affinity()
3318 hif_affinity_mgr_set_qrg_irq_affinity(struct hif_softc *scn, uint32_t irq, in hif_affinity_mgr_set_qrg_irq_affinity() argument
3324 if (!scn->affinity_mgr_supported) in hif_affinity_mgr_set_qrg_irq_affinity()
3327 cfg = &scn->irq_cpu_mask[grp_id][irq_index]; in hif_affinity_mgr_set_qrg_irq_affinity()
3328 return hif_affinity_mgr_set_irq_affinity(scn, irq, cfg, cpu_mask); in hif_affinity_mgr_set_qrg_irq_affinity()
3332 hif_affinity_mgr_set_ce_irq_affinity(struct hif_softc *scn, uint32_t irq, in hif_affinity_mgr_set_ce_irq_affinity() argument
3337 if (!scn->affinity_mgr_supported) in hif_affinity_mgr_set_ce_irq_affinity()
3340 cfg = &scn->ce_irq_cpu_mask[ce_id]; in hif_affinity_mgr_set_ce_irq_affinity()
3341 return hif_affinity_mgr_set_irq_affinity(scn, irq, cfg, cpu_mask); in hif_affinity_mgr_set_ce_irq_affinity()
3345 hif_affinity_mgr_init_ce_irq(struct hif_softc *scn, int id, int irq) in hif_affinity_mgr_init_ce_irq() argument
3351 if (!scn->affinity_mgr_supported) in hif_affinity_mgr_init_ce_irq()
3360 cfg = &scn->ce_irq_cpu_mask[id]; in hif_affinity_mgr_init_ce_irq()
3370 hif_affinity_mgr_init_grp_irq(struct hif_softc *scn, int grp_id, in hif_affinity_mgr_init_grp_irq() argument
3377 if (!scn->affinity_mgr_supported) in hif_affinity_mgr_init_grp_irq()
3386 cfg = &scn->irq_cpu_mask[grp_id][irq_num]; in hif_affinity_mgr_init_grp_irq()
3401 struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx); in hif_config_irq_set_perf_affinity_hint() local
3403 hif_config_irq_affinity(scn); in hif_config_irq_set_perf_affinity_hint()