Lines Matching +full:no +full:- +full:reset +full:- +full:during +full:- +full:suspend

1 // SPDX-License-Identifier: ISC
4 * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
17 mutex_lock(&wil->vif_mutex); in wil_pm_wake_connected_net_queues()
19 struct wil6210_vif *vif = wil->vifs[i]; in wil_pm_wake_connected_net_queues()
21 if (vif && test_bit(wil_vif_fwconnected, vif->status)) in wil_pm_wake_connected_net_queues()
24 mutex_unlock(&wil->vif_mutex); in wil_pm_wake_connected_net_queues()
31 mutex_lock(&wil->vif_mutex); in wil_pm_stop_all_net_queues()
33 struct wil6210_vif *vif = wil->vifs[i]; in wil_pm_stop_all_net_queues()
38 mutex_unlock(&wil->vif_mutex); in wil_pm_stop_all_net_queues()
47 switch (wdev->iftype) { in wil_can_suspend_vif()
52 /* for STA-like interface, don't runtime suspend */ in wil_can_suspend_vif()
55 if (test_bit(wil_vif_fwconnecting, vif->status)) { in wil_can_suspend_vif()
56 wil_dbg_pm(wil, "Delay suspend when connecting\n"); in wil_can_suspend_vif()
60 wil_dbg_pm(wil, "STA-like interface\n"); in wil_can_suspend_vif()
64 /* AP-like interface - can't suspend */ in wil_can_suspend_vif()
66 wil_dbg_pm(wil, "AP-like interface\n"); in wil_can_suspend_vif()
77 wil->fw_capabilities); in wil_can_suspend()
83 wil_dbg_pm(wil, "Deny any suspend - %s mode\n", in wil_can_suspend()
85 rc = -EBUSY; in wil_can_suspend()
88 if (is_runtime && !wil->platform_ops.suspend) { in wil_can_suspend()
89 rc = -EBUSY; in wil_can_suspend()
93 mutex_lock(&wil->vif_mutex); in wil_can_suspend()
95 mutex_unlock(&wil->vif_mutex); in wil_can_suspend()
102 if (test_bit(wil_status_resetting, wil->status)) { in wil_can_suspend()
103 wil_dbg_pm(wil, "Delay suspend when resetting\n"); in wil_can_suspend()
104 rc = -EBUSY; in wil_can_suspend()
107 if (wil->recovery_state != fw_recovery_idle) { in wil_can_suspend()
108 wil_dbg_pm(wil, "Delay suspend during recovery\n"); in wil_can_suspend()
109 rc = -EBUSY; in wil_can_suspend()
114 mutex_lock(&wil->vif_mutex); in wil_can_suspend()
116 struct wil6210_vif *vif = wil->vifs[i]; in wil_can_suspend()
121 rc = -EBUSY; in wil_can_suspend()
122 mutex_unlock(&wil->vif_mutex); in wil_can_suspend()
126 mutex_unlock(&wil->vif_mutex); in wil_can_suspend()
130 is_runtime ? "runtime" : "system", rc ? "No" : "Yes", rc); in wil_can_suspend()
133 wil->suspend_stats.rejected_by_host++; in wil_can_suspend()
145 set_bit(wil_status_resuming, wil->status); in wil_resume_keep_radio_on()
146 clear_bit(wil_status_suspended, wil->status); in wil_resume_keep_radio_on()
150 wil6210_bus_request(wil, wil->bus_request_kbps_pre_suspend); in wil_resume_keep_radio_on()
175 set_bit(wil_status_suspended, wil->status); in wil_resume_keep_radio_on()
184 wil_dbg_pm(wil, "suspend keep radio on\n"); in wil_suspend_keep_radio_on()
187 rc = down_write_trylock(&wil->mem_lock); in wil_suspend_keep_radio_on()
192 wil->suspend_stats.rejected_by_host++; in wil_suspend_keep_radio_on()
193 return -EBUSY; in wil_suspend_keep_radio_on()
196 set_bit(wil_status_suspending, wil->status); in wil_suspend_keep_radio_on()
197 up_write(&wil->mem_lock); in wil_suspend_keep_radio_on()
202 wil_dbg_pm(wil, "Pending TX data, reject suspend\n"); in wil_suspend_keep_radio_on()
203 wil->suspend_stats.rejected_by_host++; in wil_suspend_keep_radio_on()
207 if (!wil->txrx_ops.is_rx_idle(wil)) { in wil_suspend_keep_radio_on()
208 wil_dbg_pm(wil, "Pending RX data, reject suspend\n"); in wil_suspend_keep_radio_on()
209 wil->suspend_stats.rejected_by_host++; in wil_suspend_keep_radio_on()
214 wil_dbg_pm(wil, "Pending WMI events, reject suspend\n"); in wil_suspend_keep_radio_on()
215 wil->suspend_stats.rejected_by_host++; in wil_suspend_keep_radio_on()
219 /* Send WMI suspend request to the device */ in wil_suspend_keep_radio_on()
222 wil_dbg_pm(wil, "wmi_suspend failed, reject suspend (%d)\n", in wil_suspend_keep_radio_on()
229 if (test_bit(wil_status_napi_en, wil->status)) { in wil_suspend_keep_radio_on()
230 while (!wil->txrx_ops.is_rx_idle(wil)) { in wil_suspend_keep_radio_on()
232 if (wil->txrx_ops.is_rx_idle(wil)) in wil_suspend_keep_radio_on()
235 "TO waiting for idle RX, suspend failed\n"); in wil_suspend_keep_radio_on()
236 wil->suspend_stats.r_on.failed_suspends++; in wil_suspend_keep_radio_on()
239 wil_dbg_ratelimited(wil, "rx vring is not empty -> NAPI\n"); in wil_suspend_keep_radio_on()
240 napi_synchronize(&wil->napi_rx); in wil_suspend_keep_radio_on()
245 /* In case of pending WMI events, reject the suspend in wil_suspend_keep_radio_on()
248 * approving the suspend. in wil_suspend_keep_radio_on()
251 wil_err(wil, "suspend failed due to pending WMI events\n"); in wil_suspend_keep_radio_on()
252 wil->suspend_stats.r_on.failed_suspends++; in wil_suspend_keep_radio_on()
258 /* Disable device reset on PERST */ in wil_suspend_keep_radio_on()
261 if (wil->platform_ops.suspend) { in wil_suspend_keep_radio_on()
262 rc = wil->platform_ops.suspend(wil->platform_handle, true); in wil_suspend_keep_radio_on()
264 wil_err(wil, "platform device failed to suspend (%d)\n", in wil_suspend_keep_radio_on()
266 wil->suspend_stats.r_on.failed_suspends++; in wil_suspend_keep_radio_on()
274 wil->bus_request_kbps_pre_suspend = wil->bus_request_kbps; in wil_suspend_keep_radio_on()
277 set_bit(wil_status_suspended, wil->status); in wil_suspend_keep_radio_on()
278 clear_bit(wil_status_suspending, wil->status); in wil_suspend_keep_radio_on()
283 set_bit(wil_status_resuming, wil->status); in wil_suspend_keep_radio_on()
284 clear_bit(wil_status_suspending, wil->status); in wil_suspend_keep_radio_on()
286 /* if resume succeeded, reject the suspend */ in wil_suspend_keep_radio_on()
288 rc = -EBUSY; in wil_suspend_keep_radio_on()
294 clear_bit(wil_status_suspending, wil->status); in wil_suspend_keep_radio_on()
296 return -EBUSY; in wil_suspend_keep_radio_on()
304 wil_dbg_pm(wil, "suspend radio off\n"); in wil_suspend_radio_off()
306 rc = down_write_trylock(&wil->mem_lock); in wil_suspend_radio_off()
311 wil->suspend_stats.rejected_by_host++; in wil_suspend_radio_off()
312 return -EBUSY; in wil_suspend_radio_off()
315 set_bit(wil_status_suspending, wil->status); in wil_suspend_radio_off()
316 up_write(&wil->mem_lock); in wil_suspend_radio_off()
319 mutex_lock(&wil->vif_mutex); in wil_suspend_radio_off()
321 mutex_unlock(&wil->vif_mutex); in wil_suspend_radio_off()
327 wil->suspend_stats.r_off.failed_suspends++; in wil_suspend_radio_off()
336 if (wil->platform_ops.suspend) { in wil_suspend_radio_off()
337 rc = wil->platform_ops.suspend(wil->platform_handle, false); in wil_suspend_radio_off()
340 wil->suspend_stats.r_off.failed_suspends++; in wil_suspend_radio_off()
345 set_bit(wil_status_suspended, wil->status); in wil_suspend_radio_off()
348 clear_bit(wil_status_suspending, wil->status); in wil_suspend_radio_off()
349 wil_dbg_pm(wil, "suspend radio off: %d\n", rc); in wil_suspend_radio_off()
362 * During open(), IFF_UP set after actual device method in wil_resume_radio_off()
366 mutex_lock(&wil->vif_mutex); in wil_resume_radio_off()
368 mutex_unlock(&wil->vif_mutex); in wil_resume_radio_off()
372 clear_bit(wil_status_suspended, wil->status); in wil_resume_radio_off()
381 wil_dbg_pm(wil, "suspend: %s\n", is_runtime ? "runtime" : "system"); in wil_suspend()
383 if (test_bit(wil_status_suspended, wil->status)) { in wil_suspend()
384 wil_dbg_pm(wil, "trying to suspend while suspended\n"); in wil_suspend()
393 wil_dbg_pm(wil, "suspend: %s => %d\n", in wil_suspend()
405 if (wil->platform_ops.resume) { in wil_resume()
406 rc = wil->platform_ops.resume(wil->platform_handle, in wil_resume()