From nobody Wed Dec 17 12:10:12 2025 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F0734221564; Fri, 21 Mar 2025 10:53:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742554422; cv=none; b=XzUinDPyLrKI7pkX7EHUJEtd0dnVuDzv4A8UoUYiIF/MERxjI28YoVexrPU5Pz+4pBvNbZvTuEvRFB/NIg7HBNzbadpjSl2mFljHDSsC53+9H0/tzPdHD8LW59F+3XK6txIiuCIrO8NzMxjHDXaUPSGj4xfFiYTDpkdIaEg+SeM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742554422; c=relaxed/simple; bh=6cW2EDin2ufhoDVLV/VH3KIo+VtQVL0L4L8EXZ4S4c4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=hFgGSRvmpPQvDggfgmZCOOoLZJwAg0nNwMflOfkkF84GepIxijsF5xGSnzG8MCX0gwCnmA1pu7DK+9LASVZTCqQQHw5+BitdIksV2yf/61pl5mU1MK6GOICMi/mf3GI7mZvmPnQdJGsExBwLLJcKvSTQEq77Hgi+0vSoDEmsYoA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=CZst6nkA; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="CZst6nkA" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 52LATEPG001604; Fri, 21 Mar 2025 10:53:32 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= SSYI4yQ7OWB3qFV/jwmuveKQNDHtXOMwkugQiM9HafA=; b=CZst6nkA5Waml0+M dnQHBq6orBNV7EHoK3P7/OVZpUwSWR/jedKApBK7M85B/3XdFqyF/bfmlzqtETol My+UYlISZNIf1GlYRNDzdLounT2VWh5gKh6JutEdaXVG4wG/ehKEf29SK3UQEM7I e5OwXSJPgqAV5vJ4t4qfhg4Jw+sGw7ku2xca7zPu7dtqZBms/22YMFKhh0GcR5dT K3xhi5YsHlcf1glZW+1ODqRyMEngO5yP0UxC5OMCf+lbVkHuk3ANjXc/nUYM5ewh 6LK5QYnSW+6jurKke/GpMpDgFOhgfg6dpaQbBzTXFLHUg5P6N+pikbD5w4F6Lkm2 biUdLw== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 45g3sf5nrg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Mar 2025 10:53:31 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA03.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 52LArUtu023865 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Mar 2025 10:53:30 GMT Received: from hu-rajkbhag-blr.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Fri, 21 Mar 2025 03:53:27 -0700 From: Raj Kumar Bhagat Date: Fri, 21 Mar 2025 16:22:47 +0530 Subject: [PATCH ath-next v12 10/13] wifi: ath12k: Register various userPD interrupts and save SMEM entries Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20250321-ath12k-ahb-v12-10-bb389ed76ae5@quicinc.com> References: <20250321-ath12k-ahb-v12-0-bb389ed76ae5@quicinc.com> In-Reply-To: <20250321-ath12k-ahb-v12-0-bb389ed76ae5@quicinc.com> To: Johannes Berg , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jeff Johnson CC: , , , , "Sowmiya Sree Elavalagan" , Vasanthakumar Thiagarajan , Raj Kumar Bhagat X-Mailer: b4 0.14.2 X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: kXk9QWahcIGg9XwSxpfUVLQDIHxF8ahK X-Proofpoint-ORIG-GUID: kXk9QWahcIGg9XwSxpfUVLQDIHxF8ahK X-Authority-Analysis: v=2.4 cv=R9IDGcRX c=1 sm=1 tr=0 ts=67dd452b cx=c_pps a=ouPCqIW2jiPt+lZRy3xVPw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=GEpy-HfZoHoA:10 a=IkcTkHD0fZMA:10 a=Vs1iUdzkB0EA:10 a=COk6AnOGAAAA:8 a=EUspDBNiAAAA:8 a=Hg3vuGafXZ3BrVT7pe8A:9 a=QEXdDO2ut3YA:10 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1093,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-21_04,2025-03-20_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 lowpriorityscore=0 bulkscore=0 spamscore=0 phishscore=0 adultscore=0 suspectscore=0 clxscore=1015 mlxscore=0 priorityscore=1501 malwarescore=0 mlxlogscore=999 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2503210080 From: Sowmiya Sree Elavalagan Q6 and ath12k driver communicates using SMEM and IRQs. Spawn interrupt is triggered once the userPD thread is spawned. Ready interrupts denotes userPD is completely powered up and ready. Stop-ack is to acknowledge the ath12k driver that userPD is stopped. Ath12k driver needs to set spawn bit in SMEM to instruct Q6 to spawn a userPD. Similarly stop bit is set when userPD needs to be stopped. Tested-on: IPQ5332 hw1.0 AHB WLAN.WBE.1.3.1-00130-QCAHKSWPL_SILICONZ-1 Signed-off-by: Sowmiya Sree Elavalagan Reviewed-by: Vasanthakumar Thiagarajan Signed-off-by: Raj Kumar Bhagat --- drivers/net/wireless/ath/ath12k/ahb.c | 79 +++++++++++++++++++++++++++++++= +++- drivers/net/wireless/ath/ath12k/ahb.h | 16 +++++++ drivers/net/wireless/ath/ath12k/hw.h | 1 + 3 files changed, 94 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/ahb.c b/drivers/net/wireless/a= th/ath12k/ahb.c index c08c2e6bc0d4a92b546189b0e5a2cc4738c50ea2..f55b0c00388311500e21fb8d7c6= 36d6aa7ba0321 100644 --- a/drivers/net/wireless/ath/ath12k/ahb.c +++ b/drivers/net/wireless/ath/ath12k/ahb.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "ahb.h" #include "debug.h" #include "hif.h" @@ -23,6 +24,11 @@ static const struct of_device_id ath12k_ahb_of_match[] = =3D { MODULE_DEVICE_TABLE(of, ath12k_ahb_of_match); =20 #define ATH12K_IRQ_CE0_OFFSET 4 +#define ATH12K_MAX_UPDS 1 +#define ATH12K_UPD_IRQ_WRD_LEN 18 +static const char ath12k_userpd_irq[][9] =3D {"spawn", + "ready", + "stop-ack"}; =20 static const char *irq_name[ATH12K_IRQ_NUM_MAX] =3D { "misc-pulse1", @@ -547,6 +553,72 @@ static const struct ath12k_hif_ops ath12k_ahb_hif_ops_= ipq5332 =3D { .map_service_to_pipe =3D ath12k_ahb_map_service_to_pipe, }; =20 +static irqreturn_t ath12k_userpd_irq_handler(int irq, void *data) +{ + struct ath12k_base *ab =3D data; + struct ath12k_ahb *ab_ahb =3D ath12k_ab_to_ahb(ab); + + if (irq =3D=3D ab_ahb->userpd_irq_num[ATH12K_USERPD_SPAWN_IRQ]) { + complete(&ab_ahb->userpd_spawned); + } else if (irq =3D=3D ab_ahb->userpd_irq_num[ATH12K_USERPD_READY_IRQ]) { + complete(&ab_ahb->userpd_ready); + } else if (irq =3D=3D ab_ahb->userpd_irq_num[ATH12K_USERPD_STOP_ACK_IRQ])= { + complete(&ab_ahb->userpd_stopped); + } else { + ath12k_err(ab, "Invalid userpd interrupt\n"); + return IRQ_NONE; + } + + return IRQ_HANDLED; +} + +static int ath12k_ahb_config_rproc_irq(struct ath12k_base *ab) +{ + struct ath12k_ahb *ab_ahb =3D ath12k_ab_to_ahb(ab); + int i, ret; + char *upd_irq_name; + + for (i =3D 0; i < ATH12K_USERPD_MAX_IRQ; i++) { + ab_ahb->userpd_irq_num[i] =3D platform_get_irq_byname(ab->pdev, + ath12k_userpd_irq[i]); + if (ab_ahb->userpd_irq_num[i] < 0) + return ab_ahb->userpd_irq_num[i]; + + upd_irq_name =3D devm_kzalloc(&ab->pdev->dev, ATH12K_UPD_IRQ_WRD_LEN, + GFP_KERNEL); + if (!upd_irq_name) + return -ENOMEM; + + scnprintf(upd_irq_name, ATH12K_UPD_IRQ_WRD_LEN, "UserPD%u-%s", + ab_ahb->userpd_id, ath12k_userpd_irq[i]); + ret =3D devm_request_threaded_irq(&ab->pdev->dev, ab_ahb->userpd_irq_num= [i], + NULL, ath12k_userpd_irq_handler, + IRQF_TRIGGER_RISING | IRQF_ONESHOT, + upd_irq_name, ab); + if (ret) + return dev_err_probe(&ab->pdev->dev, ret, + "Request %s irq failed: %d\n", + ath12k_userpd_irq[i], ret); + } + + ab_ahb->spawn_state =3D devm_qcom_smem_state_get(&ab->pdev->dev, "spawn", + &ab_ahb->spawn_bit); + if (IS_ERR(ab_ahb->spawn_state)) + return dev_err_probe(&ab->pdev->dev, PTR_ERR(ab_ahb->spawn_state), + "Failed to acquire spawn state\n"); + + ab_ahb->stop_state =3D devm_qcom_smem_state_get(&ab->pdev->dev, "stop", + &ab_ahb->stop_bit); + if (IS_ERR(ab_ahb->stop_state)) + return dev_err_probe(&ab->pdev->dev, PTR_ERR(ab_ahb->stop_state), + "Failed to acquire stop state\n"); + + init_completion(&ab_ahb->userpd_spawned); + init_completion(&ab_ahb->userpd_ready); + init_completion(&ab_ahb->userpd_stopped); + return 0; +} + static int ath12k_ahb_root_pd_state_notifier(struct notifier_block *nb, const unsigned long event, void *data) { @@ -659,7 +731,8 @@ static int ath12k_ahb_configure_rproc(struct ath12k_bas= e *ab) goto err_unreg_notifier; } } - return 0; + + return ath12k_ahb_config_rproc_irq(ab); =20 err_unreg_notifier: ath12k_ahb_unregister_rproc_notifier(ab); @@ -764,7 +837,7 @@ static int ath12k_ahb_probe(struct platform_device *pde= v) const struct ath12k_hif_ops *hif_ops; struct ath12k_ahb *ab_ahb; enum ath12k_hw_rev hw_rev; - u32 addr; + u32 addr, userpd_id; int ret; =20 ret =3D dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); @@ -782,6 +855,7 @@ static int ath12k_ahb_probe(struct platform_device *pde= v) switch (hw_rev) { case ATH12K_HW_IPQ5332_HW10: hif_ops =3D &ath12k_ahb_hif_ops_ipq5332; + userpd_id =3D ATH12K_IPQ5332_USERPD_ID; break; default: ret =3D -EOPNOTSUPP; @@ -794,6 +868,7 @@ static int ath12k_ahb_probe(struct platform_device *pde= v) platform_set_drvdata(pdev, ab); ab_ahb =3D ath12k_ab_to_ahb(ab); ab_ahb->ab =3D ab; + ab_ahb->userpd_id =3D userpd_id; =20 /* Set fixed_mem_region to true for platforms that support fixed memory * reservation from DT. If memory is reserved from DT for FW, ath12k driv= er diff --git a/drivers/net/wireless/ath/ath12k/ahb.h b/drivers/net/wireless/a= th/ath12k/ahb.h index 1105473917ceeda294b5e073fff875331b7b1d8b..b17e7693b31acaca8271d838fcb= a6b14684f37b6 100644 --- a/drivers/net/wireless/ath/ath12k/ahb.h +++ b/drivers/net/wireless/ath/ath12k/ahb.h @@ -25,6 +25,13 @@ enum ath12k_ahb_smp2p_msg_id { ATH12K_AHB_POWER_SAVE_EXIT, }; =20 +enum ath12k_ahb_userpd_irq { + ATH12K_USERPD_SPAWN_IRQ, + ATH12K_USERPD_READY_IRQ, + ATH12K_USERPD_STOP_ACK_IRQ, + ATH12K_USERPD_MAX_IRQ, +}; + struct ath12k_base; =20 struct ath12k_ahb { @@ -34,6 +41,15 @@ struct ath12k_ahb { struct completion rootpd_ready; struct notifier_block root_pd_nb; void *root_pd_notifier; + struct qcom_smem_state *spawn_state; + struct qcom_smem_state *stop_state; + struct completion userpd_spawned; + struct completion userpd_ready; + struct completion userpd_stopped; + u32 userpd_id; + u32 spawn_bit; + u32 stop_bit; + int userpd_irq_num[ATH12K_USERPD_MAX_IRQ]; }; =20 static inline struct ath12k_ahb *ath12k_ab_to_ahb(struct ath12k_base *ab) diff --git a/drivers/net/wireless/ath/ath12k/hw.h b/drivers/net/wireless/at= h/ath12k/hw.h index a4332588b1173f3ec10009747bfa6cad93e2a429..d4a2e47169d97436a2c7ca88e02= 04085258df61e 100644 --- a/drivers/net/wireless/ath/ath12k/hw.h +++ b/drivers/net/wireless/ath/ath12k/hw.h @@ -97,6 +97,7 @@ #define ATH12K_REGDB_FILE_NAME "regdb.bin" =20 #define ATH12K_PCIE_MAX_PAYLOAD_SIZE 128 +#define ATH12K_IPQ5332_USERPD_ID 1 =20 enum ath12k_hw_rate_cck { ATH12K_HW_RATE_CCK_LP_11M =3D 0, --=20 2.34.1