Skip to content

Commit e88b9ed

Browse files
author
Kalle Valo
committed
Merge tag 'ath-current-20240903' of git://git.kernel.org/pub/scm/linux/kernel/git/ath/ath
ath.git patches for v6.11-rc7 We have three patch which address two issues in the ath11k driver which should be addressed for 6.11-rc7: One patch fixes a NULL pointer dereference while parsing transmit power envelope (TPE) information, and the other two patches revert the hibernation support since it is interfering with suspend on some platforms. Note the cause of the suspend wakeups is still being investigated, and it is hoped this can be addressed and hibernation support can be restored in the near future.
2 parents 094513f + 2f833e8 commit e88b9ed

File tree

9 files changed

+49
-148
lines changed

9 files changed

+49
-148
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: 31 additions & 84 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,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

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

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
}
1029979
EXPORT_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

21262074
static 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;

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/mac.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7900,6 +7900,7 @@ static void ath11k_mac_parse_tx_pwr_env(struct ath11k *ar,
79007900
}
79017901

79027902
if (psd) {
7903+
arvif->reg_tpc_info.is_psd_power = true;
79037904
arvif->reg_tpc_info.num_pwr_levels = psd->count;
79047905

79057906
for (i = 0; i < arvif->reg_tpc_info.num_pwr_levels; i++) {

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)