Skip to content
Snippets Groups Projects
Commit d8f70ad6 authored by Sowmiya Sree Elavalagan's avatar Sowmiya Sree Elavalagan Committed by Jeff Johnson
Browse files

wifi: ath12k: Power down userPD


Set the stop bit in SMEM to power down the userPD. Wait for stop-ack IRQ
to indicate power down completion. Release the userPD firmware using its
peripheral ID.

Tested-on: IPQ5332 hw1.0 AHB WLAN.WBE.1.3.1-00130-QCAHKSWPL_SILICONZ-1

Signed-off-by: default avatarSowmiya Sree Elavalagan <quic_ssreeela@quicinc.com>
Signed-off-by: default avatarRaj Kumar Bhagat <quic_rajkbhag@quicinc.com>
Reviewed-by: default avatarVasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
Link: https://patch.msgid.link/20250317204639.1864742-13-quic_rajkbhag@quicinc.com


Signed-off-by: default avatarJeff Johnson <jeff.johnson@oss.qualcomm.com>
parent ca3330d6
No related branches found
No related tags found
No related merge requests found
......@@ -463,6 +463,34 @@ static int ath12k_ahb_power_up(struct ath12k_base *ab)
return ret;
}
static void ath12k_ahb_power_down(struct ath12k_base *ab, bool is_suspend)
{
struct ath12k_ahb *ab_ahb = ath12k_ab_to_ahb(ab);
unsigned long time_left;
u32 pasid;
int ret;
qcom_smem_state_update_bits(ab_ahb->stop_state, BIT(ab_ahb->stop_bit),
BIT(ab_ahb->stop_bit));
time_left = wait_for_completion_timeout(&ab_ahb->userpd_stopped,
ATH12K_USERPD_STOP_TIMEOUT);
if (!time_left) {
ath12k_err(ab, "UserPD stop wait timed out\n");
return;
}
qcom_smem_state_update_bits(ab_ahb->stop_state, BIT(ab_ahb->stop_bit), 0);
pasid = (u32_encode_bits(ab_ahb->userpd_id, ATH12K_USERPD_ID_MASK)) |
ATH12K_AHB_UPD_SWID;
/* Release the firmware */
ret = qcom_scm_pas_shutdown(pasid);
if (ret)
ath12k_err(ab, "scm pas shutdown failed for userPD%d: %d\n",
ab_ahb->userpd_id, ret);
}
static void ath12k_ahb_init_qmi_ce_config(struct ath12k_base *ab)
{
struct ath12k_qmi_ce_cfg *cfg = &ab->qmi.ce_cfg;
......@@ -679,6 +707,7 @@ static const struct ath12k_hif_ops ath12k_ahb_hif_ops_ipq5332 = {
.irq_disable = ath12k_ahb_ext_irq_disable,
.map_service_to_pipe = ath12k_ahb_map_service_to_pipe,
.power_up = ath12k_ahb_power_up,
.power_down = ath12k_ahb_power_down,
};
static irqreturn_t ath12k_userpd_irq_handler(int irq, void *data)
......@@ -1095,6 +1124,7 @@ static void ath12k_ahb_remove(struct platform_device *pdev)
struct ath12k_base *ab = platform_get_drvdata(pdev);
if (test_bit(ATH12K_FLAG_QMI_FAIL, &ab->dev_flags)) {
ath12k_ahb_power_down(ab, false);
ath12k_qmi_deinit_service(ab);
goto qmi_fail;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment