summaryrefslogtreecommitdiff
path: root/drivers/staging/wfx/hif_rx.c
diff options
context:
space:
mode:
authorJérôme Pouiller <jerome.pouiller@silabs.com>2020-04-27 15:40:20 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-04-28 14:14:27 +0200
commit1d52d29983e5daa18c441feed94259aaf03c582c (patch)
treefabbf6248f85e50f9436e03ac709bdb3a4a7b8f2 /drivers/staging/wfx/hif_rx.c
parent8e47df5fc4abd31522b92eddf59c2863e3c5abde (diff)
staging: wfx: add support for 'device too hot' indication
Device is able to detect a high temperature. In this case, the traffic is not allowed to be sent until the temperature decrease. This patch detects the warnings raised by the device and stop the traffic accordingly. It also add a delayed task as safeguard in case the chip would never send the indication that the temperature decrease. Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20200427134031.323403-7-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/wfx/hif_rx.c')
-rw-r--r--drivers/staging/wfx/hif_rx.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/staging/wfx/hif_rx.c b/drivers/staging/wfx/hif_rx.c
index a2ac6c098163..6de210139d8a 100644
--- a/drivers/staging/wfx/hif_rx.c
+++ b/drivers/staging/wfx/hif_rx.c
@@ -235,12 +235,20 @@ static int hif_suspend_resume_indication(struct wfx_dev *wdev,
struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface);
const struct hif_ind_suspend_resume_tx *body = buf;
- WARN_ON(!wvif);
- WARN(!body->suspend_resume_flags.bc_mc_only, "unsupported suspend/resume notification");
- if (body->suspend_resume_flags.resume)
- wfx_suspend_resume_mc(wvif, STA_NOTIFY_AWAKE);
- else
- wfx_suspend_resume_mc(wvif, STA_NOTIFY_SLEEP);
+ if (body->suspend_resume_flags.bc_mc_only) {
+ WARN_ON(!wvif);
+ if (body->suspend_resume_flags.resume)
+ wfx_suspend_resume_mc(wvif, STA_NOTIFY_AWAKE);
+ else
+ wfx_suspend_resume_mc(wvif, STA_NOTIFY_SLEEP);
+ } else {
+ WARN(body->peer_sta_set, "misunderstood indication");
+ WARN(hif->interface != 2, "misunderstood indication");
+ if (body->suspend_resume_flags.resume)
+ wfx_suspend_hot_dev(wdev, STA_NOTIFY_AWAKE);
+ else
+ wfx_suspend_hot_dev(wdev, STA_NOTIFY_SLEEP);
+ }
return 0;
}