Commit 8733d835 authored by Carl Huang's avatar Carl Huang Committed by Kalle Valo

ath11k: htc: implement suspend handling

When ath11k sends suspend command to firmware, firmware will
return suspend_complete events and add handlers for those.

Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1
Signed-off-by: default avatarCarl Huang <cjhuang@codeaurora.org>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/1607708150-21066-6-git-send-email-kvalo@codeaurora.org
parent d50370c9
...@@ -968,6 +968,8 @@ struct ath11k_base *ath11k_core_alloc(struct device *dev, size_t priv_size, ...@@ -968,6 +968,8 @@ struct ath11k_base *ath11k_core_alloc(struct device *dev, size_t priv_size,
init_waitqueue_head(&ab->qmi.cold_boot_waitq); init_waitqueue_head(&ab->qmi.cold_boot_waitq);
INIT_WORK(&ab->restart_work, ath11k_core_restart); INIT_WORK(&ab->restart_work, ath11k_core_restart);
timer_setup(&ab->rx_replenish_retry, ath11k_ce_rx_replenish_retry, 0); timer_setup(&ab->rx_replenish_retry, ath11k_ce_rx_replenish_retry, 0);
init_completion(&ab->htc_suspend);
ab->dev = dev; ab->dev = dev;
ab->bus_params = *bus_params; ab->bus_params = *bus_params;
ab->hif.bus = bus; ab->hif.bus = bus;
......
...@@ -186,6 +186,7 @@ enum ath11k_dev_flags { ...@@ -186,6 +186,7 @@ enum ath11k_dev_flags {
ATH11K_FLAG_UNREGISTERING, ATH11K_FLAG_UNREGISTERING,
ATH11K_FLAG_REGISTERED, ATH11K_FLAG_REGISTERED,
ATH11K_FLAG_QMI_FAIL, ATH11K_FLAG_QMI_FAIL,
ATH11K_FLAG_HTC_SUSPEND_COMPLETE,
}; };
enum ath11k_monitor_flags { enum ath11k_monitor_flags {
...@@ -732,6 +733,9 @@ struct ath11k_base { ...@@ -732,6 +733,9 @@ struct ath11k_base {
u32 num_db_cap; u32 num_db_cap;
struct timer_list mon_reap_timer; struct timer_list mon_reap_timer;
struct completion htc_suspend;
/* must be last */ /* must be last */
u8 drv_priv[0] __aligned(sizeof(void *)); u8 drv_priv[0] __aligned(sizeof(void *));
}; };
......
...@@ -231,6 +231,18 @@ static int ath11k_htc_process_trailer(struct ath11k_htc *htc, ...@@ -231,6 +231,18 @@ static int ath11k_htc_process_trailer(struct ath11k_htc *htc,
return status; return status;
} }
static void ath11k_htc_suspend_complete(struct ath11k_base *ab, bool ack)
{
ath11k_dbg(ab, ATH11K_DBG_BOOT, "boot suspend complete %d\n", ack);
if (ack)
set_bit(ATH11K_FLAG_HTC_SUSPEND_COMPLETE, &ab->dev_flags);
else
clear_bit(ATH11K_FLAG_HTC_SUSPEND_COMPLETE, &ab->dev_flags);
complete(&ab->htc_suspend);
}
void ath11k_htc_rx_completion_handler(struct ath11k_base *ab, void ath11k_htc_rx_completion_handler(struct ath11k_base *ab,
struct sk_buff *skb) struct sk_buff *skb)
{ {
...@@ -328,8 +340,17 @@ void ath11k_htc_rx_completion_handler(struct ath11k_base *ab, ...@@ -328,8 +340,17 @@ void ath11k_htc_rx_completion_handler(struct ath11k_base *ab,
complete(&htc->ctl_resp); complete(&htc->ctl_resp);
break; break;
case ATH11K_HTC_MSG_SEND_SUSPEND_COMPLETE:
ath11k_htc_suspend_complete(ab, true);
break;
case ATH11K_HTC_MSG_NACK_SUSPEND:
ath11k_htc_suspend_complete(ab, false);
break;
case ATH11K_HTC_MSG_WAKEUP_FROM_SUSPEND_ID:
break;
default: default:
ath11k_warn(ab, "ignoring unsolicited htc ep0 event\n"); ath11k_warn(ab, "ignoring unsolicited htc ep0 event %ld\n",
FIELD_GET(HTC_MSG_MESSAGEID, msg->msg_svc_id));
break; break;
} }
goto out; goto out;
......
...@@ -65,7 +65,9 @@ enum ath11k_htc_msg_id { ...@@ -65,7 +65,9 @@ enum ath11k_htc_msg_id {
ATH11K_HTC_MSG_CONNECT_SERVICE_RESP_ID = 3, ATH11K_HTC_MSG_CONNECT_SERVICE_RESP_ID = 3,
ATH11K_HTC_MSG_SETUP_COMPLETE_ID = 4, ATH11K_HTC_MSG_SETUP_COMPLETE_ID = 4,
ATH11K_HTC_MSG_SETUP_COMPLETE_EX_ID = 5, ATH11K_HTC_MSG_SETUP_COMPLETE_EX_ID = 5,
ATH11K_HTC_MSG_SEND_SUSPEND_COMPLETE = 6 ATH11K_HTC_MSG_SEND_SUSPEND_COMPLETE = 6,
ATH11K_HTC_MSG_NACK_SUSPEND = 7,
ATH11K_HTC_MSG_WAKEUP_FROM_SUSPEND_ID = 8,
}; };
enum ath11k_htc_version { enum ath11k_htc_version {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment