@@ -906,6 +906,12 @@ int ath11k_core_suspend(struct ath11k_base *ab)
906906 return ret ;
907907 }
908908
909+ ret = ath11k_wow_enable (ab );
910+ if (ret ) {
911+ ath11k_warn (ab , "failed to enable wow during suspend: %d\n" , ret );
912+ return ret ;
913+ }
914+
909915 ret = ath11k_dp_rx_pktlog_stop (ab , false);
910916 if (ret ) {
911917 ath11k_warn (ab , "failed to stop dp rx pktlog during suspend: %d\n" ,
@@ -916,115 +922,59 @@ int ath11k_core_suspend(struct ath11k_base *ab)
916922 ath11k_ce_stop_shadow_timers (ab );
917923 ath11k_dp_stop_shadow_timers (ab );
918924
919- /* PM framework skips suspend_late/resume_early callbacks
920- * if other devices report errors in their suspend callbacks.
921- * However ath11k_core_resume() would still be called because
922- * here we return success thus kernel put us on dpm_suspended_list.
923- * Since we won't go through a power down/up cycle, there is
924- * no chance to call complete(&ab->restart_completed) in
925- * ath11k_core_restart(), making ath11k_core_resume() timeout.
926- * So call it here to avoid this issue. This also works in case
927- * no error happens thus suspend_late/resume_early get called,
928- * because it will be reinitialized in ath11k_core_resume_early().
929- */
930- complete (& ab -> restart_completed );
931-
932- return 0 ;
933- }
934- EXPORT_SYMBOL (ath11k_core_suspend );
935-
936- int ath11k_core_suspend_late (struct ath11k_base * ab )
937- {
938- struct ath11k_pdev * pdev ;
939- struct ath11k * ar ;
940-
941- if (!ab -> hw_params .supports_suspend )
942- return - EOPNOTSUPP ;
943-
944- /* so far single_pdev_only chips have supports_suspend as true
945- * and only the first pdev is valid.
946- */
947- pdev = ath11k_core_get_single_pdev (ab );
948- ar = pdev -> ar ;
949- if (!ar || ar -> state != ATH11K_STATE_OFF )
950- return 0 ;
951-
952925 ath11k_hif_irq_disable (ab );
953926 ath11k_hif_ce_irq_disable (ab );
954927
955- ath11k_hif_power_down (ab , true);
928+ ret = ath11k_hif_suspend (ab );
929+ if (ret ) {
930+ ath11k_warn (ab , "failed to suspend hif: %d\n" , ret );
931+ return ret ;
932+ }
956933
957934 return 0 ;
958935}
959- EXPORT_SYMBOL (ath11k_core_suspend_late );
960-
961- int ath11k_core_resume_early (struct ath11k_base * ab )
962- {
963- int ret ;
964- struct ath11k_pdev * pdev ;
965- struct ath11k * ar ;
966-
967- if (!ab -> hw_params .supports_suspend )
968- return - EOPNOTSUPP ;
969-
970- /* so far single_pdev_only chips have supports_suspend as true
971- * and only the first pdev is valid.
972- */
973- pdev = ath11k_core_get_single_pdev (ab );
974- ar = pdev -> ar ;
975- if (!ar || ar -> state != ATH11K_STATE_OFF )
976- return 0 ;
977-
978- reinit_completion (& ab -> restart_completed );
979- ret = ath11k_hif_power_up (ab );
980- if (ret )
981- ath11k_warn (ab , "failed to power up hif during resume: %d\n" , ret );
982-
983- return ret ;
984- }
985- EXPORT_SYMBOL (ath11k_core_resume_early );
936+ EXPORT_SYMBOL (ath11k_core_suspend );
986937
987938int ath11k_core_resume (struct ath11k_base * ab )
988939{
989940 int ret ;
990941 struct ath11k_pdev * pdev ;
991942 struct ath11k * ar ;
992- long time_left ;
993943
994944 if (!ab -> hw_params .supports_suspend )
995945 return - EOPNOTSUPP ;
996946
997- /* so far single_pdev_only chips have supports_suspend as true
947+ /* so far signle_pdev_only chips have supports_suspend as true
998948 * and only the first pdev is valid.
999949 */
1000950 pdev = ath11k_core_get_single_pdev (ab );
1001951 ar = pdev -> ar ;
1002952 if (!ar || ar -> state != ATH11K_STATE_OFF )
1003953 return 0 ;
1004954
1005- time_left = wait_for_completion_timeout (& ab -> restart_completed ,
1006- ATH11K_RESET_TIMEOUT_HZ );
1007- if (time_left == 0 ) {
1008- ath11k_warn (ab , "timeout while waiting for restart complete" );
1009- return - ETIMEDOUT ;
955+ ret = ath11k_hif_resume (ab );
956+ if (ret ) {
957+ ath11k_warn (ab , "failed to resume hif during resume: %d\n" , ret );
958+ return ret ;
1010959 }
1011960
1012- if (ab -> hw_params .current_cc_support &&
1013- ar -> alpha2 [0 ] != 0 && ar -> alpha2 [1 ] != 0 ) {
1014- ret = ath11k_reg_set_cc (ar );
1015- if (ret ) {
1016- ath11k_warn (ab , "failed to set country code during resume: %d\n" ,
1017- ret );
1018- return ret ;
1019- }
1020- }
961+ ath11k_hif_ce_irq_enable (ab );
962+ ath11k_hif_irq_enable (ab );
1021963
1022964 ret = ath11k_dp_rx_pktlog_start (ab );
1023- if (ret )
965+ if (ret ) {
1024966 ath11k_warn (ab , "failed to start rx pktlog during resume: %d\n" ,
1025967 ret );
968+ return ret ;
969+ }
1026970
1027- return ret ;
971+ ret = ath11k_wow_wakeup (ab );
972+ if (ret ) {
973+ ath11k_warn (ab , "failed to wakeup wow during resume: %d\n" , ret );
974+ return ret ;
975+ }
976+
977+ return 0 ;
1028978}
1029979EXPORT_SYMBOL (ath11k_core_resume );
1030980
@@ -2119,8 +2069,6 @@ static void ath11k_core_restart(struct work_struct *work)
21192069
21202070 if (!ab -> is_reset )
21212071 ath11k_core_post_reconfigure_recovery (ab );
2122-
2123- complete (& ab -> restart_completed );
21242072}
21252073
21262074static void ath11k_core_reset (struct work_struct * work )
@@ -2190,7 +2138,7 @@ static void ath11k_core_reset(struct work_struct *work)
21902138 ath11k_hif_irq_disable (ab );
21912139 ath11k_hif_ce_irq_disable (ab );
21922140
2193- ath11k_hif_power_down (ab , false );
2141+ ath11k_hif_power_down (ab );
21942142 ath11k_hif_power_up (ab );
21952143
21962144 ath11k_dbg (ab , ATH11K_DBG_BOOT , "reset started\n" );
@@ -2263,7 +2211,7 @@ void ath11k_core_deinit(struct ath11k_base *ab)
22632211
22642212 mutex_unlock (& ab -> core_lock );
22652213
2266- ath11k_hif_power_down (ab , false );
2214+ ath11k_hif_power_down (ab );
22672215 ath11k_mac_destroy (ab );
22682216 ath11k_core_soc_destroy (ab );
22692217 ath11k_fw_destroy (ab );
@@ -2316,7 +2264,6 @@ struct ath11k_base *ath11k_core_alloc(struct device *dev, size_t priv_size,
23162264 timer_setup (& ab -> rx_replenish_retry , ath11k_ce_rx_replenish_retry , 0 );
23172265 init_completion (& ab -> htc_suspend );
23182266 init_completion (& ab -> wow .wakeup_completed );
2319- init_completion (& ab -> restart_completed );
23202267
23212268 ab -> dev = dev ;
23222269 ab -> hif .bus = bus ;
0 commit comments