Lines Matching refs:ab_pci

196 static int ath12k_mhi_get_msi(struct ath12k_pci *ab_pci)  in ath12k_mhi_get_msi()  argument
198 struct ath12k_base *ab = ab_pci->ab; in ath12k_mhi_get_msi()
219 if (test_bit(ATH12K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) in ath12k_mhi_get_msi()
227 ab_pci->mhi_ctrl->irq = irq; in ath12k_mhi_get_msi()
228 ab_pci->mhi_ctrl->nr_irqs = num_vectors; in ath12k_mhi_get_msi()
272 struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); in ath12k_mhi_op_status_cb() local
282 if (ab_pci->mhi_pre_cb == MHI_CB_EE_RDDM) { in ath12k_mhi_op_status_cb()
295 ab_pci->mhi_pre_cb = cb; in ath12k_mhi_op_status_cb()
314 int ath12k_mhi_register(struct ath12k_pci *ab_pci) in ath12k_mhi_register() argument
316 struct ath12k_base *ab = ab_pci->ab; in ath12k_mhi_register()
326 ab_pci->mhi_pre_cb = MHI_CB_INVALID; in ath12k_mhi_register()
327 ab_pci->mhi_ctrl = mhi_ctrl; in ath12k_mhi_register()
366 ab_pci->amss_path, in ath12k_mhi_register()
367 sizeof(ab_pci->amss_path)); in ath12k_mhi_register()
368 mhi_ctrl->fw_image = ab_pci->amss_path; in ath12k_mhi_register()
372 ret = ath12k_mhi_get_msi(ab_pci); in ath12k_mhi_register()
378 if (!test_bit(ATH12K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) in ath12k_mhi_register()
402 ab_pci->mhi_ctrl = NULL; in ath12k_mhi_register()
406 void ath12k_mhi_unregister(struct ath12k_pci *ab_pci) in ath12k_mhi_unregister() argument
408 struct mhi_controller *mhi_ctrl = ab_pci->mhi_ctrl; in ath12k_mhi_unregister()
413 ab_pci->mhi_ctrl = NULL; in ath12k_mhi_unregister()
444 static void ath12k_mhi_set_state_bit(struct ath12k_pci *ab_pci, in ath12k_mhi_set_state_bit() argument
447 struct ath12k_base *ab = ab_pci->ab; in ath12k_mhi_set_state_bit()
451 set_bit(ATH12K_MHI_INIT, &ab_pci->mhi_state); in ath12k_mhi_set_state_bit()
454 clear_bit(ATH12K_MHI_INIT, &ab_pci->mhi_state); in ath12k_mhi_set_state_bit()
457 set_bit(ATH12K_MHI_POWER_ON, &ab_pci->mhi_state); in ath12k_mhi_set_state_bit()
462 clear_bit(ATH12K_MHI_POWER_ON, &ab_pci->mhi_state); in ath12k_mhi_set_state_bit()
463 clear_bit(ATH12K_MHI_TRIGGER_RDDM, &ab_pci->mhi_state); in ath12k_mhi_set_state_bit()
464 clear_bit(ATH12K_MHI_RDDM_DONE, &ab_pci->mhi_state); in ath12k_mhi_set_state_bit()
467 set_bit(ATH12K_MHI_SUSPEND, &ab_pci->mhi_state); in ath12k_mhi_set_state_bit()
470 clear_bit(ATH12K_MHI_SUSPEND, &ab_pci->mhi_state); in ath12k_mhi_set_state_bit()
473 set_bit(ATH12K_MHI_TRIGGER_RDDM, &ab_pci->mhi_state); in ath12k_mhi_set_state_bit()
476 set_bit(ATH12K_MHI_RDDM_DONE, &ab_pci->mhi_state); in ath12k_mhi_set_state_bit()
483 static int ath12k_mhi_check_state_bit(struct ath12k_pci *ab_pci, in ath12k_mhi_check_state_bit() argument
486 struct ath12k_base *ab = ab_pci->ab; in ath12k_mhi_check_state_bit()
490 if (!test_bit(ATH12K_MHI_INIT, &ab_pci->mhi_state)) in ath12k_mhi_check_state_bit()
495 if (test_bit(ATH12K_MHI_INIT, &ab_pci->mhi_state) && in ath12k_mhi_check_state_bit()
496 !test_bit(ATH12K_MHI_POWER_ON, &ab_pci->mhi_state)) in ath12k_mhi_check_state_bit()
500 if (test_bit(ATH12K_MHI_POWER_ON, &ab_pci->mhi_state)) in ath12k_mhi_check_state_bit()
506 if (test_bit(ATH12K_MHI_POWER_ON, &ab_pci->mhi_state) && in ath12k_mhi_check_state_bit()
507 !test_bit(ATH12K_MHI_SUSPEND, &ab_pci->mhi_state)) in ath12k_mhi_check_state_bit()
511 if (test_bit(ATH12K_MHI_SUSPEND, &ab_pci->mhi_state)) in ath12k_mhi_check_state_bit()
515 if (test_bit(ATH12K_MHI_POWER_ON, &ab_pci->mhi_state) && in ath12k_mhi_check_state_bit()
516 !test_bit(ATH12K_MHI_TRIGGER_RDDM, &ab_pci->mhi_state)) in ath12k_mhi_check_state_bit()
528 ab_pci->mhi_state); in ath12k_mhi_check_state_bit()
533 static int ath12k_mhi_set_state(struct ath12k_pci *ab_pci, in ath12k_mhi_set_state() argument
536 struct ath12k_base *ab = ab_pci->ab; in ath12k_mhi_set_state()
539 ret = ath12k_mhi_check_state_bit(ab_pci, mhi_state); in ath12k_mhi_set_state()
548 ret = mhi_prepare_for_power_up(ab_pci->mhi_ctrl); in ath12k_mhi_set_state()
551 mhi_unprepare_after_power_down(ab_pci->mhi_ctrl); in ath12k_mhi_set_state()
566 ret = mhi_sync_power_up(ab_pci->mhi_ctrl); in ath12k_mhi_set_state()
569 mhi_power_down(ab_pci->mhi_ctrl, true); in ath12k_mhi_set_state()
573 mhi_power_down_keep_dev(ab_pci->mhi_ctrl, true); in ath12k_mhi_set_state()
577 mhi_power_down(ab_pci->mhi_ctrl, false); in ath12k_mhi_set_state()
581 ret = mhi_pm_suspend(ab_pci->mhi_ctrl); in ath12k_mhi_set_state()
584 ret = mhi_pm_resume(ab_pci->mhi_ctrl); in ath12k_mhi_set_state()
587 ret = mhi_force_rddm_mode(ab_pci->mhi_ctrl); in ath12k_mhi_set_state()
599 ath12k_mhi_set_state_bit(ab_pci, mhi_state); in ath12k_mhi_set_state()
609 int ath12k_mhi_start(struct ath12k_pci *ab_pci) in ath12k_mhi_start() argument
613 ab_pci->mhi_ctrl->timeout_ms = MHI_TIMEOUT_DEFAULT_MS; in ath12k_mhi_start()
615 ret = ath12k_mhi_set_state(ab_pci, ATH12K_MHI_INIT); in ath12k_mhi_start()
619 ret = ath12k_mhi_set_state(ab_pci, ATH12K_MHI_POWER_ON); in ath12k_mhi_start()
629 void ath12k_mhi_stop(struct ath12k_pci *ab_pci, bool is_suspend) in ath12k_mhi_stop() argument
636 ath12k_mhi_set_state(ab_pci, ATH12K_MHI_POWER_OFF_KEEP_DEV); in ath12k_mhi_stop()
638 ath12k_mhi_set_state(ab_pci, ATH12K_MHI_POWER_OFF); in ath12k_mhi_stop()
640 ath12k_mhi_set_state(ab_pci, ATH12K_MHI_DEINIT); in ath12k_mhi_stop()
643 void ath12k_mhi_suspend(struct ath12k_pci *ab_pci) in ath12k_mhi_suspend() argument
645 ath12k_mhi_set_state(ab_pci, ATH12K_MHI_SUSPEND); in ath12k_mhi_suspend()
648 void ath12k_mhi_resume(struct ath12k_pci *ab_pci) in ath12k_mhi_resume() argument
650 ath12k_mhi_set_state(ab_pci, ATH12K_MHI_RESUME); in ath12k_mhi_resume()