Skip to content

Commit 2f833e8

Browse files
Baochen Qiangkvalo
authored andcommitted
Revert "wifi: ath11k: support hibernation"
This reverts commit 166a490. There are several reports that this commit breaks system suspend on some specific Lenovo platforms. Since there is no fix available, for now revert this commit to make suspend work again on those platforms. Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219196 Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2301921 Cc: <[email protected]> # 6.10.x: d3e154d: Revert "wifi: ath11k: restore country code during resume" Cc: <[email protected]> # 6.10.x Signed-off-by: Baochen Qiang <[email protected]> Acked-by: Jeff Johnson <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent d3e154d commit 2f833e8

File tree

8 files changed

+49
-139
lines changed

8 files changed

+49
-139
lines changed

drivers/net/wireless/ath/ath11k/ahb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ static int ath11k_ahb_power_up(struct ath11k_base *ab)
413413
return ret;
414414
}
415415

416-
static void ath11k_ahb_power_down(struct ath11k_base *ab, bool is_suspend)
416+
static void ath11k_ahb_power_down(struct ath11k_base *ab)
417417
{
418418
struct ath11k_ahb *ab_ahb = ath11k_ahb_priv(ab);
419419

@@ -1280,7 +1280,7 @@ static void ath11k_ahb_remove(struct platform_device *pdev)
12801280
struct ath11k_base *ab = platform_get_drvdata(pdev);
12811281

12821282
if (test_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags)) {
1283-
ath11k_ahb_power_down(ab, false);
1283+
ath11k_ahb_power_down(ab);
12841284
ath11k_debugfs_soc_destroy(ab);
12851285
ath11k_qmi_deinit_service(ab);
12861286
goto qmi_fail;

drivers/net/wireless/ath/ath11k/core.c

Lines changed: 32 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -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,105 +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

987938
int 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

961+
ath11k_hif_ce_irq_enable(ab);
962+
ath11k_hif_irq_enable(ab);
963+
1012964
ret = ath11k_dp_rx_pktlog_start(ab);
1013-
if (ret)
965+
if (ret) {
1014966
ath11k_warn(ab, "failed to start rx pktlog during resume: %d\n",
1015967
ret);
968+
return ret;
969+
}
1016970

1017-
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;
1018978
}
1019979
EXPORT_SYMBOL(ath11k_core_resume);
1020980

@@ -2109,8 +2069,6 @@ static void ath11k_core_restart(struct work_struct *work)
21092069

21102070
if (!ab->is_reset)
21112071
ath11k_core_post_reconfigure_recovery(ab);
2112-
2113-
complete(&ab->restart_completed);
21142072
}
21152073

21162074
static void ath11k_core_reset(struct work_struct *work)
@@ -2180,7 +2138,7 @@ static void ath11k_core_reset(struct work_struct *work)
21802138
ath11k_hif_irq_disable(ab);
21812139
ath11k_hif_ce_irq_disable(ab);
21822140

2183-
ath11k_hif_power_down(ab, false);
2141+
ath11k_hif_power_down(ab);
21842142
ath11k_hif_power_up(ab);
21852143

21862144
ath11k_dbg(ab, ATH11K_DBG_BOOT, "reset started\n");
@@ -2253,7 +2211,7 @@ void ath11k_core_deinit(struct ath11k_base *ab)
22532211

22542212
mutex_unlock(&ab->core_lock);
22552213

2256-
ath11k_hif_power_down(ab, false);
2214+
ath11k_hif_power_down(ab);
22572215
ath11k_mac_destroy(ab);
22582216
ath11k_core_soc_destroy(ab);
22592217
ath11k_fw_destroy(ab);
@@ -2306,7 +2264,6 @@ struct ath11k_base *ath11k_core_alloc(struct device *dev, size_t priv_size,
23062264
timer_setup(&ab->rx_replenish_retry, ath11k_ce_rx_replenish_retry, 0);
23072265
init_completion(&ab->htc_suspend);
23082266
init_completion(&ab->wow.wakeup_completed);
2309-
init_completion(&ab->restart_completed);
23102267

23112268
ab->dev = dev;
23122269
ab->hif.bus = bus;

drivers/net/wireless/ath/ath11k/core.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,8 +1036,6 @@ struct ath11k_base {
10361036
DECLARE_BITMAP(fw_features, ATH11K_FW_FEATURE_COUNT);
10371037
} fw;
10381038

1039-
struct completion restart_completed;
1040-
10411039
#ifdef CONFIG_NL80211_TESTMODE
10421040
struct {
10431041
u32 data_pos;
@@ -1237,10 +1235,8 @@ void ath11k_core_free_bdf(struct ath11k_base *ab, struct ath11k_board_data *bd);
12371235
int ath11k_core_check_dt(struct ath11k_base *ath11k);
12381236
int ath11k_core_check_smbios(struct ath11k_base *ab);
12391237
void ath11k_core_halt(struct ath11k *ar);
1240-
int ath11k_core_resume_early(struct ath11k_base *ab);
12411238
int ath11k_core_resume(struct ath11k_base *ab);
12421239
int ath11k_core_suspend(struct ath11k_base *ab);
1243-
int ath11k_core_suspend_late(struct ath11k_base *ab);
12441240
void ath11k_core_pre_reconfigure_recovery(struct ath11k_base *ab);
12451241
bool ath11k_core_coldboot_cal_support(struct ath11k_base *ab);
12461242

drivers/net/wireless/ath/ath11k/hif.h

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ struct ath11k_hif_ops {
1818
int (*start)(struct ath11k_base *ab);
1919
void (*stop)(struct ath11k_base *ab);
2020
int (*power_up)(struct ath11k_base *ab);
21-
void (*power_down)(struct ath11k_base *ab, bool is_suspend);
21+
void (*power_down)(struct ath11k_base *ab);
2222
int (*suspend)(struct ath11k_base *ab);
2323
int (*resume)(struct ath11k_base *ab);
2424
int (*map_service_to_pipe)(struct ath11k_base *ab, u16 service_id,
@@ -67,18 +67,12 @@ static inline void ath11k_hif_irq_disable(struct ath11k_base *ab)
6767

6868
static inline int ath11k_hif_power_up(struct ath11k_base *ab)
6969
{
70-
if (!ab->hif.ops->power_up)
71-
return -EOPNOTSUPP;
72-
7370
return ab->hif.ops->power_up(ab);
7471
}
7572

76-
static inline void ath11k_hif_power_down(struct ath11k_base *ab, bool is_suspend)
73+
static inline void ath11k_hif_power_down(struct ath11k_base *ab)
7774
{
78-
if (!ab->hif.ops->power_down)
79-
return;
80-
81-
ab->hif.ops->power_down(ab, is_suspend);
75+
ab->hif.ops->power_down(ab);
8276
}
8377

8478
static inline int ath11k_hif_suspend(struct ath11k_base *ab)

drivers/net/wireless/ath/ath11k/mhi.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -453,17 +453,9 @@ int ath11k_mhi_start(struct ath11k_pci *ab_pci)
453453
return 0;
454454
}
455455

456-
void ath11k_mhi_stop(struct ath11k_pci *ab_pci, bool is_suspend)
456+
void ath11k_mhi_stop(struct ath11k_pci *ab_pci)
457457
{
458-
/* During suspend we need to use mhi_power_down_keep_dev()
459-
* workaround, otherwise ath11k_core_resume() will timeout
460-
* during resume.
461-
*/
462-
if (is_suspend)
463-
mhi_power_down_keep_dev(ab_pci->mhi_ctrl, true);
464-
else
465-
mhi_power_down(ab_pci->mhi_ctrl, true);
466-
458+
mhi_power_down(ab_pci->mhi_ctrl, true);
467459
mhi_unprepare_after_power_down(ab_pci->mhi_ctrl);
468460
}
469461

drivers/net/wireless/ath/ath11k/mhi.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@
1818
#define MHICTRL_RESET_MASK 0x2
1919

2020
int ath11k_mhi_start(struct ath11k_pci *ar_pci);
21-
void ath11k_mhi_stop(struct ath11k_pci *ar_pci, bool is_suspend);
21+
void ath11k_mhi_stop(struct ath11k_pci *ar_pci);
2222
int ath11k_mhi_register(struct ath11k_pci *ar_pci);
2323
void ath11k_mhi_unregister(struct ath11k_pci *ar_pci);
2424
void ath11k_mhi_set_mhictrl_reset(struct ath11k_base *ab);
2525
void ath11k_mhi_clear_vector(struct ath11k_base *ab);
2626

2727
int ath11k_mhi_suspend(struct ath11k_pci *ar_pci);
2828
int ath11k_mhi_resume(struct ath11k_pci *ar_pci);
29+
2930
#endif

drivers/net/wireless/ath/ath11k/pci.c

Lines changed: 7 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ static int ath11k_pci_power_up(struct ath11k_base *ab)
638638
return 0;
639639
}
640640

641-
static void ath11k_pci_power_down(struct ath11k_base *ab, bool is_suspend)
641+
static void ath11k_pci_power_down(struct ath11k_base *ab)
642642
{
643643
struct ath11k_pci *ab_pci = ath11k_pci_priv(ab);
644644

@@ -649,7 +649,7 @@ static void ath11k_pci_power_down(struct ath11k_base *ab, bool is_suspend)
649649

650650
ath11k_pci_msi_disable(ab_pci);
651651

652-
ath11k_mhi_stop(ab_pci, is_suspend);
652+
ath11k_mhi_stop(ab_pci);
653653
clear_bit(ATH11K_FLAG_DEVICE_INIT_DONE, &ab->dev_flags);
654654
ath11k_pci_sw_reset(ab_pci->ab, false);
655655
}
@@ -970,7 +970,7 @@ static void ath11k_pci_remove(struct pci_dev *pdev)
970970
ath11k_pci_set_irq_affinity_hint(ab_pci, NULL);
971971

972972
if (test_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags)) {
973-
ath11k_pci_power_down(ab, false);
973+
ath11k_pci_power_down(ab);
974974
ath11k_debugfs_soc_destroy(ab);
975975
ath11k_qmi_deinit_service(ab);
976976
goto qmi_fail;
@@ -998,7 +998,7 @@ static void ath11k_pci_shutdown(struct pci_dev *pdev)
998998
struct ath11k_pci *ab_pci = ath11k_pci_priv(ab);
999999

10001000
ath11k_pci_set_irq_affinity_hint(ab_pci, NULL);
1001-
ath11k_pci_power_down(ab, false);
1001+
ath11k_pci_power_down(ab);
10021002
}
10031003

10041004
static __maybe_unused int ath11k_pci_pm_suspend(struct device *dev)
@@ -1035,39 +1035,9 @@ static __maybe_unused int ath11k_pci_pm_resume(struct device *dev)
10351035
return ret;
10361036
}
10371037

1038-
static __maybe_unused int ath11k_pci_pm_suspend_late(struct device *dev)
1039-
{
1040-
struct ath11k_base *ab = dev_get_drvdata(dev);
1041-
int ret;
1042-
1043-
ret = ath11k_core_suspend_late(ab);
1044-
if (ret)
1045-
ath11k_warn(ab, "failed to late suspend core: %d\n", ret);
1046-
1047-
/* Similar to ath11k_pci_pm_suspend(), we return success here
1048-
* even error happens, to allow system suspend/hibernation survive.
1049-
*/
1050-
return 0;
1051-
}
1052-
1053-
static __maybe_unused int ath11k_pci_pm_resume_early(struct device *dev)
1054-
{
1055-
struct ath11k_base *ab = dev_get_drvdata(dev);
1056-
int ret;
1057-
1058-
ret = ath11k_core_resume_early(ab);
1059-
if (ret)
1060-
ath11k_warn(ab, "failed to early resume core: %d\n", ret);
1061-
1062-
return ret;
1063-
}
1064-
1065-
static const struct dev_pm_ops __maybe_unused ath11k_pci_pm_ops = {
1066-
SET_SYSTEM_SLEEP_PM_OPS(ath11k_pci_pm_suspend,
1067-
ath11k_pci_pm_resume)
1068-
SET_LATE_SYSTEM_SLEEP_PM_OPS(ath11k_pci_pm_suspend_late,
1069-
ath11k_pci_pm_resume_early)
1070-
};
1038+
static SIMPLE_DEV_PM_OPS(ath11k_pci_pm_ops,
1039+
ath11k_pci_pm_suspend,
1040+
ath11k_pci_pm_resume);
10711041

10721042
static struct pci_driver ath11k_pci_driver = {
10731043
.name = "ath11k_pci",

drivers/net/wireless/ath/ath11k/qmi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2877,7 +2877,7 @@ int ath11k_qmi_fwreset_from_cold_boot(struct ath11k_base *ab)
28772877
}
28782878

28792879
/* reset the firmware */
2880-
ath11k_hif_power_down(ab, false);
2880+
ath11k_hif_power_down(ab);
28812881
ath11k_hif_power_up(ab);
28822882
ath11k_dbg(ab, ATH11K_DBG_QMI, "exit wait for cold boot done\n");
28832883
return 0;

0 commit comments

Comments
 (0)