From nobody Thu Apr 9 12:08:36 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 6BC353624B0 for ; Mon, 9 Mar 2026 06:51:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773039105; cv=none; b=cvpXzxmsm0+s5mgDXPHvG8Lkc6BkWe+5Ng/cOfVxqAJWa7JWSrFkrn3SNgIQA9rm69fDJ2i+e0Gs3tRK1lg3Umma5H7NKmAoM9UTxfgPTN3KBeszCG09WUWOSLQxfn+MBx/Ry6vXQZQ6cdHGOLdMKRnQ+4NsUNo6yInnJYJovrg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773039105; c=relaxed/simple; bh=8xebNSAbJUskVVac7rNorJvuDpnXHbFrlQJGj+Tdu08=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rNeVpVs0wSmaCr8sQEpzo29lFSPEUgkHK/O5lNbPdMUR9yUo93NsW3oJOUQ7OBjcSXUxCMpgDlQxntWGJ9A6uZBayzrVmIYM7h01opcxIYicYmsCkVoG0ceFabPMWfeJ7NFCoNmODXMO2amboxO/UQctz1bq2TcOkcyVbwI6zMs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=USv2pCQN; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=b7GAiNtu; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="USv2pCQN"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="b7GAiNtu" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 628JjBZ42609725 for ; Mon, 9 Mar 2026 06:51:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=IH7tu4cejEh a0Z5gHxKrQArAxI79sxkumwMn24DAosQ=; b=USv2pCQNKZ1FU0drBus7k88pVQD F87RcUk/74tOSD/V0K25R8kFlTs4uqJZqURK/iB6VSEpsA5cOugHzlhzRaJozsug 2RWJODEneFEgUnmqxAiyl7QjaUPAux8XIgpoWN6m4BdythyJOzaR69zLiVq5bhJA QTUAQwK90NYPlO8lHUw8GIBdIMZ57Yha6EdLdoQMPYZ7koXmmY/7t8KhYgHsiADd CBdyB4Ukz4f1vzoIxyb8045aPwkLBeeoNmf3v7M9OJHfBFtJbLDrxYc/IZP1gyK+ xpxk+I9s8RFx0PgWJrBYkTyxrUVuo36vgicgbFTERIudCHqal5e7LAYHftg== Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cr9qevhs3-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 09 Mar 2026 06:51:42 +0000 (GMT) Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-8cd8b37d4b2so367925785a.3 for ; Sun, 08 Mar 2026 23:51:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773039102; x=1773643902; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IH7tu4cejEha0Z5gHxKrQArAxI79sxkumwMn24DAosQ=; b=b7GAiNtuR76QQ2wPScWFX9zPSkq58wdsCaAwe8txsXhph3y3ezAdBOiY52Xj5VfCIa rt67VtR8IJRDrNabVfXMi0KN0Cp6EpvgPrml5xDL8NrdSDzoER3SzOalJuANJ4M9GoEA s34gH4Q+KhzW5DHYYzgzNXY4rihCToYfFUuNePgm6zuDV0ESSi2i9hVyrDxDg67PWm4N pTaKDxiNs6BdYhm3Kf0XtTqVEtWuNt+SXXSb8nRJhJ/47Hi9RjQSZWDlA9L85BTIxr1a 8r1inO7sb1W56NsDYFBHOlGaorm2UiATirAArxnUQfMsA57dQs972RaKQqDukGDobie2 Glfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773039102; x=1773643902; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=IH7tu4cejEha0Z5gHxKrQArAxI79sxkumwMn24DAosQ=; b=C9MGTkpgvFcpruzcVhSfTbHitTAmtBLhxsKjgf9C+SsBygxjnnLDgezZa9bAL79hOO mMbiEI60gRdvrWG+54ZGKfbUJlXNPl7GKLP/1eJmjtVCLEuoH/SxMK22mBvyI7eesQX4 ul36Jdd4QRt0fTk1y7sXP3W6JIAAqIMjJ3zYSm+E3Pd5k1tsV0Rw8669gK5KPBk9eDOw duEZxlPp1bt1/easGoAE6hJa2R9COmL+oytleucbOEj7srwSyh29cPL5LNwX12fyRxZi 3DgqITzTtrOKONQ8Lpt1HaMRffUOYr/0TZ95swSF1eDkE3jsLr+NCpkQSxJiq4yxVt7h wB4Q== X-Forwarded-Encrypted: i=1; AJvYcCViNqAGhDPz93Q2/CgbcRdIj5hkKiNPS68uO0+3VMSmSgvFWzjEq++ln48xEk38TWE4n2/B6xi50RHpZEU=@vger.kernel.org X-Gm-Message-State: AOJu0YwkM6OVBy1tNZ3iLy1WDajADMZXVjc3QwVZfcMgfNjfI2O0gLYG TXU/OJb8y4EVYClQ4iswsSbXIuAx/zZIsX3ohaMZIr/xXfo0V1lOE0lbrd+oYGmIjJwpuI2vsTd NWsVY2HD155NyN99xwOFXeK5+amGmUcj4ODVIqcI4vYaSCeRjPgp8J1XBTMbV9NZ4ces= X-Gm-Gg: ATEYQzxaQYcCeZJ3li4UxCGS/JgqHw+HYnNcBDQKRvt2kBmvgRPSmYoNgA2ZjL/gnRl wmKViQZ3EFNGUVKoENbPn9TQ4te0tcoao5ntWivlrrfzqWemivKTPg8TmyzjF8b6cK8ItWx3uPZ heBFgHBnzqfzhqpSdA2Dy/sVgP9el6gz5C5DGIHq6pJnEq1UCZzMBabHL6eJRusUbXaqD7oWZr0 JfnecZt6g68vnYw+EKj1FIXsl0JfYocgeGKRUSug6YxAnApwIzD+2HdvKIpGb6t02f0Em5S6IKF z6adBcgDIClmMZ6M0QNjLaiAZtWD+V0d67dP6tkJZ+dch1fkB48T836kKd1MIOcCP7C0zx3FEjU IahVlNYnWZPwFfoScZQtyk4AfSPuwRvPlhLzjz68VufYr7PiW65/RlxM= X-Received: by 2002:a05:620a:2a08:b0:8cd:8fe4:537b with SMTP id af79cd13be357-8cd8fe4584amr26010585a.37.1773039101806; Sun, 08 Mar 2026 23:51:41 -0700 (PDT) X-Received: by 2002:a05:620a:2a08:b0:8cd:8fe4:537b with SMTP id af79cd13be357-8cd8fe4584amr26009185a.37.1773039101369; Sun, 08 Mar 2026 23:51:41 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48529f01997sm80449975e9.14.2026.03.08.23.51.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Mar 2026 23:51:40 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: mohammad.rafi.shaik@oss.qualcomm.com, linux-sound@vger.kernel.org, lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, johan@kernel.org, dmitry.baryshkov@oss.qualcomm.com, konrad.dybcio@oss.qualcomm.com, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, mailingradian@gmail.com, Srinivas Kandagatla Subject: [PATCH v5 01/13] ASoC: qcom: q6apm: move component registration to unmanaged version Date: Mon, 9 Mar 2026 06:51:25 +0000 Message-ID: <20260309065137.949053-2-srinivas.kandagatla@oss.qualcomm.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260309065137.949053-1-srinivas.kandagatla@oss.qualcomm.com> References: <20260309065137.949053-1-srinivas.kandagatla@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: LyTdM--xhYyzQmJ7tuj6VqLXRSHboePA X-Proofpoint-GUID: LyTdM--xhYyzQmJ7tuj6VqLXRSHboePA X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA5MDA2MSBTYWx0ZWRfX6Sd/iTNbGYMh 39A+bhFP71Ziz2m88gXZEQ4R8h3c42SvhWkrqCCvXySQHEwB+WBxwqFr+0pdleAzYphzMB3v7zz cNGr76sFKrlw6zpwEA0nQPM07xfxVpGK3ZIDCnI8TQ9iqGDX4zpHsaEvqQ2Lpw6mctiyD+MIPqw V5w3deseNNbeBeZmvf8CJv2a+u5tVV8Ae4dKnuRdezdGpv4vh4w4+NZ7NbyNNmJkWVJ8tv/3bOY 15AMSEzKXc3T20N51Gt7P1LXwebm1F4LTL4bHeSueMZvSLBZ+TqviP9ZY4I6sb4CdDkq0wiunI7 SkPnbFndNeOMytpw5louzPtTI3MqRKXY3OaMNZfbvRGXs214oPkt0f0mOY4AAZ2ZmOqrKXHK4hA 9okAtDaG00imhZ/k5Wq47XAnNVqwoYSbnue5Gw1VK2CIi1oPmIZmKxlPhyFyBZ9oLop81dHS18j vnHaK8xI/JSpeXJOt7Q== X-Authority-Analysis: v=2.4 cv=dcqNHHXe c=1 sm=1 tr=0 ts=69ae6dfe cx=c_pps a=HLyN3IcIa5EE8TELMZ618Q==:117 a=ZsC4DHZuhs/kKio7QBcDoQ==:17 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=EUspDBNiAAAA:8 a=ZjLH_7kMUelE1Q3ziugA:9 a=bTQJ7kPSJx9SKPbeHEYW:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-09_02,2026-03-06_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 bulkscore=0 spamscore=0 lowpriorityscore=0 adultscore=0 clxscore=1015 impostorscore=0 malwarescore=0 priorityscore=1501 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603090061 Content-Type: text/plain; charset="utf-8" q6apm component registers dais dynamically from ASoC toplology, which are allocated using device managed version apis. Allocating both component and dynamic dais using managed version could lead to incorrect free ordering, dai will be freed while component still holding references to it. Fix this issue by moving component to unmanged version so that the dai pointers are only freeded after the component is removed. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D BUG: KASAN: slab-use-after-free in snd_soc_del_component_unlocked+0x3d4/0x4= 00 [snd_soc_core] Read of size 8 at addr ffff00084493a6e8 by task kworker/u48:0/3426 Tainted: [W]=3DWARN Hardware name: LENOVO 21N2ZC5PUS/21N2ZC5PUS, BIOS N42ET57W (1.31 ) 08/08/20= 24 Workqueue: pdr_notifier_wq pdr_notifier_work [pdr_interface] Call trace: show_stack+0x28/0x7c (C) dump_stack_lvl+0x60/0x80 print_report+0x160/0x4b4 kasan_report+0xac/0xfc __asan_report_load8_noabort+0x20/0x34 snd_soc_del_component_unlocked+0x3d4/0x400 [snd_soc_core] snd_soc_unregister_component_by_driver+0x50/0x88 [snd_soc_core] devm_component_release+0x30/0x5c [snd_soc_core] devres_release_all+0x13c/0x210 device_unbind_cleanup+0x20/0x190 device_release_driver_internal+0x350/0x468 device_release_driver+0x18/0x30 bus_remove_device+0x1a0/0x35c device_del+0x314/0x7f0 device_unregister+0x20/0xbc apr_remove_device+0x5c/0x7c [apr] device_for_each_child+0xd8/0x160 apr_pd_status+0x7c/0xa8 [apr] pdr_notifier_work+0x114/0x240 [pdr_interface] process_one_work+0x500/0xb70 worker_thread+0x630/0xfb0 kthread+0x370/0x6c0 ret_from_fork+0x10/0x20 Allocated by task 77: kasan_save_stack+0x40/0x68 kasan_save_track+0x20/0x40 kasan_save_alloc_info+0x44/0x58 __kasan_kmalloc+0xbc/0xdc __kmalloc_node_track_caller_noprof+0x1f4/0x620 devm_kmalloc+0x7c/0x1c8 snd_soc_register_dai+0x50/0x4f0 [snd_soc_core] soc_tplg_pcm_elems_load+0x55c/0x1eb8 [snd_soc_core] snd_soc_tplg_component_load+0x4f8/0xb60 [snd_soc_core] audioreach_tplg_init+0x124/0x1fc [snd_q6apm] q6apm_audio_probe+0x10/0x1c [snd_q6apm] snd_soc_component_probe+0x5c/0x118 [snd_soc_core] soc_probe_component+0x44c/0xaf0 [snd_soc_core] snd_soc_bind_card+0xad0/0x2370 [snd_soc_core] snd_soc_register_card+0x3b0/0x4c0 [snd_soc_core] devm_snd_soc_register_card+0x50/0xc8 [snd_soc_core] x1e80100_platform_probe+0x208/0x368 [snd_soc_x1e80100] platform_probe+0xc0/0x188 really_probe+0x188/0x804 __driver_probe_device+0x158/0x358 driver_probe_device+0x60/0x190 __device_attach_driver+0x16c/0x2a8 bus_for_each_drv+0x100/0x194 __device_attach+0x174/0x380 device_initial_probe+0x14/0x20 bus_probe_device+0x124/0x154 deferred_probe_work_func+0x140/0x220 process_one_work+0x500/0xb70 worker_thread+0x630/0xfb0 kthread+0x370/0x6c0 ret_from_fork+0x10/0x20 Freed by task 3426: kasan_save_stack+0x40/0x68 kasan_save_track+0x20/0x40 __kasan_save_free_info+0x4c/0x80 __kasan_slab_free+0x78/0xa0 kfree+0x100/0x4a4 devres_release_all+0x144/0x210 device_unbind_cleanup+0x20/0x190 device_release_driver_internal+0x350/0x468 device_release_driver+0x18/0x30 bus_remove_device+0x1a0/0x35c device_del+0x314/0x7f0 device_unregister+0x20/0xbc apr_remove_device+0x5c/0x7c [apr] device_for_each_child+0xd8/0x160 apr_pd_status+0x7c/0xa8 [apr] pdr_notifier_work+0x114/0x240 [pdr_interface] process_one_work+0x500/0xb70 worker_thread+0x630/0xfb0 kthread+0x370/0x6c0 ret_from_fork+0x10/0x20 Fixes: 5477518b8a0e ("ASoC: qdsp6: audioreach: add q6apm support") Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/qdsp6/q6apm.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sound/soc/qcom/qdsp6/q6apm.c b/sound/soc/qcom/qdsp6/q6apm.c index 44841fde3856..a4c662be52e0 100644 --- a/sound/soc/qcom/qdsp6/q6apm.c +++ b/sound/soc/qcom/qdsp6/q6apm.c @@ -746,7 +746,7 @@ static int apm_probe(gpr_device_t *gdev) =20 q6apm_get_apm_state(apm); =20 - ret =3D devm_snd_soc_register_component(dev, &q6apm_audio_component, NULL= , 0); + ret =3D snd_soc_register_component(dev, &q6apm_audio_component, NULL, 0); if (ret < 0) { dev_err(dev, "failed to register q6apm: %d\n", ret); return ret; @@ -755,6 +755,11 @@ static int apm_probe(gpr_device_t *gdev) return of_platform_populate(dev->of_node, NULL, NULL, dev); } =20 +static void apm_remove(gpr_device_t *gdev) +{ + snd_soc_unregister_component(&gdev->dev); +} + struct audioreach_module *q6apm_find_module_by_mid(struct q6apm_graph *gra= ph, uint32_t mid) { struct audioreach_graph_info *info =3D graph->info; @@ -819,6 +824,7 @@ MODULE_DEVICE_TABLE(of, apm_device_id); =20 static gpr_driver_t apm_driver =3D { .probe =3D apm_probe, + .remove =3D apm_remove, .gpr_callback =3D apm_callback, .driver =3D { .name =3D "qcom-apm", --=20 2.47.3 From nobody Thu Apr 9 12:08:36 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 BFE1C3624C6 for ; Mon, 9 Mar 2026 06:51:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773039106; cv=none; b=CmDPmBQHuWZxAT+ID2Fk2Vuyv4wPrLvIy5uCEATAdpdHZ9Tfl2BJ5Bv8KWki8P0w8SdAjqYf0c5anhlMim43YgLgcDxz/nu8VP4XdV1khjNBOb7zk6pCT3/LnDcEwYmpw/iHhAfg6MSC27MufyoUNwX14p+yu2iDThrxfdNu8bs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773039106; c=relaxed/simple; bh=fldykUob5Z2453rW/Bu+WyVup1MSOjtxkIDMh+tQ1tA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TZyzGApFQ418rgx83mXtRFvLCW4BCXUiftSCaQcNxuUDt4XLsu4Bt7/DWmStHGaCWTxd3APxQjeSSFgscaK+cBsxQGHIKTQKljd51Q+LxDY14joJQjC8pDaQMP0SAY0GdwfrvoA9ztC0u7dfW1akYQBaHQ0O5rC4E5nle2cONpM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=J7EJA/Gh; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=MfvXRfO3; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="J7EJA/Gh"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="MfvXRfO3" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 628IwrG12611534 for ; Mon, 9 Mar 2026 06:51:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=xEO2oGNAYFh ISLn7OT5Tnbx10tCrKXxJuovsEhU565g=; b=J7EJA/GhYJBktUzKojKzKwY++/C etPbAUN0zX+9c+khiCB02NGge53Poe7/4Let2AdzSqHetqV+BSacX8LjbCr0BbzL DX2NCRvbxMOxKjMrUXNsNKvBWdMBUiA+dhvT9Em2I31EvbJLu7rYz2sJaQfFFq/3 cBJt0Pdp9DiNn83xWLHw77/Wctbzkm/K0gGsxcoy9afa12jSSyohD0CSROIpK8EV TMA0UsRCb9ygjRz7lwJkk22QdFbYg9Wy388dTI1JIuWizn6PMm6r59+nK+eM74+j mP1vfZujhUvomuWCBQAE2dXjR47ZHVxyRAs7JCtEhB7PR+08zVmuDuh/iHg== Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4crc83c6vg-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 09 Mar 2026 06:51:44 +0000 (GMT) Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-8cd781c0d90so902672385a.1 for ; Sun, 08 Mar 2026 23:51:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773039103; x=1773643903; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xEO2oGNAYFhISLn7OT5Tnbx10tCrKXxJuovsEhU565g=; b=MfvXRfO3XANsx196vArNFI0PxHSDTf30d1MinX5STGu2wuzYm0/PY3nXh5BjGTX5aH ZdH4Zh0AMpiulaJAkNfBdDO/iXqbdgkb7PXfSY+E0wfnEov4v5NsJWr00KQy/cYwm+x9 2Gl2ZcKr6FyYlCdQ+owPEJrKu0H29BrCDs4mS1YyWdOOhV8sDjBt8ONux+OiaYM7Gir/ Jxx1QWkGNELITDzMI0yse7Hyfwys7P0yQYdTGS+MSvyk4sysLOE4z8GzFpQeqmQXLWS0 G5wyGMmGoteb6otOKB6zriYP0O+9WTc8saM99PyxEqw10ugtlsOQJuULgRReF4P/6ANf 19tA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773039103; x=1773643903; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=xEO2oGNAYFhISLn7OT5Tnbx10tCrKXxJuovsEhU565g=; b=rhbs49w/MZuf7H2+cNrukNvAmCiZiiOv7rAqxmnC8u0sXRAOsS7XKXSIUC9NnOqq6E sudF2atZgHRtl5EV2JJt0cvrsKYAWtDdVt0/5Vv7Z1FyJ2brkhNKF2wRLMlO8e1oqvd6 pxB/S3ykiZs/IfumjXLGOgYLmp+dwsg/lIGrpw/7Bj1AC5ViTcQtKzByVScPZwI50ajS ZMTLNfFd4Kl0MFnKoZZESZNJUtmYOYgEFKmh3flrybl0lfG4/xkKHMet0L6GTaOxnJ8s dxn7cR20J7BHTf4VcIB6T3tf0lLNk524R+t0bVEgV2+YwPMJRPezZBF9mk0iTO83sWFh T1SQ== X-Forwarded-Encrypted: i=1; AJvYcCX4cDpgAIs+V5dx1e/kzOHrlmF0/hDgvSEcAOh/duP8OsqLmk0EZtIbg41U2Yhc1p4ae1HFXSz6U5kz+jg=@vger.kernel.org X-Gm-Message-State: AOJu0YznTDhEulzDh4tKAFfJt0IkSZk/bJa268bWq6ogjHjXhXnMzu6Q Y7Ci2BdXPMruZz9gArxTIU5SxdV/XCor5ZwLxiYudhl8cGgmfSs4HYlsHT9eR+bq2Rx0qfKMLyc kwLLn+Rt2V+wOKKS3voX3DsHTlob5S/7jP4Z9vGPNpnXQ3ziXFrx72T0aKEG3XYjhpms= X-Gm-Gg: ATEYQzxSrdOcX4UPYsl6v0ckaHVpFNhl8l738Iz+Wzm8F2SWg2/upA2mlFZi9kHqTJh Oe/tDbF4e1L0IhEMUNmMuMAKRI4VVUV4t5Z7/3wXc8+kmJ3uY5VTWo0J+2NhIWnVnQ8ywHyN433 AEbm4PZZqMVbaRZHwLN94huot18Q0qxz4UIecuaRQAXxRqL6CmPg4rHbskz4feZtSxYHsg3IKDD cjcp6GB5emD8hY1shppCmzwbizlEGHMLsTufkmeTc/ftO4Z8ogfe3RyfeYOEM4RtQN+afHNvPI4 V+Bzxk1qgX4Q1aoLQ31FQvW1rGok1EfhPSXHKo5UWDZfQMpn4J9y07B70e4GjTb4nIiUCkrYHwb imxarfyXWePu4K4ZXr6Qk0KdcQx0YXaRjYtSroRf3K949vxr/Zn461Ks= X-Received: by 2002:a05:620a:1a95:b0:8cd:85a1:d136 with SMTP id af79cd13be357-8cd85a1d759mr317508585a.4.1773039103131; Sun, 08 Mar 2026 23:51:43 -0700 (PDT) X-Received: by 2002:a05:620a:1a95:b0:8cd:85a1:d136 with SMTP id af79cd13be357-8cd85a1d759mr317507585a.4.1773039102735; Sun, 08 Mar 2026 23:51:42 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48529f01997sm80449975e9.14.2026.03.08.23.51.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Mar 2026 23:51:42 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: mohammad.rafi.shaik@oss.qualcomm.com, linux-sound@vger.kernel.org, lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, johan@kernel.org, dmitry.baryshkov@oss.qualcomm.com, konrad.dybcio@oss.qualcomm.com, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, mailingradian@gmail.com, Srinivas Kandagatla Subject: [PATCH v5 02/13] ASoC: qcom: q6apm: remove child devices when apm is removed Date: Mon, 9 Mar 2026 06:51:26 +0000 Message-ID: <20260309065137.949053-3-srinivas.kandagatla@oss.qualcomm.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260309065137.949053-1-srinivas.kandagatla@oss.qualcomm.com> References: <20260309065137.949053-1-srinivas.kandagatla@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authority-Analysis: v=2.4 cv=R9UO2NRX c=1 sm=1 tr=0 ts=69ae6e00 cx=c_pps a=50t2pK5VMbmlHzFWWp8p/g==:117 a=ZsC4DHZuhs/kKio7QBcDoQ==:17 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=EUspDBNiAAAA:8 a=WbEMVPVtDBSXEMPt_8MA:9 a=IoWCM6iH3mJn3m4BftBB:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA5MDA2MSBTYWx0ZWRfXyha5M/eKN5Ui Hs1bRz/y7BBCOhXRckF5JGllff6Vw0mvvBh+Lomqo7bANAt/sDjk3MsC2bOKw3WxW9bZs/wVVhx uEsPGR5BlHZMnddyShtJnjsqK1IrVwEmiB5FZbiW/MUPO2KxiV1SE8Bg4B6A6sx4XSgE4Bmzanx OhBHi/8983geLZVGnQ0NxUPZieJf9QIXTfPEPomr/KEUHYh2sQG4ygUkH0OL8uQR+LXM1CHqE9j zpC1C+I/ePAPb+z4wMZzA2ZlV9eRhEtLRuEfQ/2lnkC3gzvb6sMtr4Qfc/Vr9+EOmxZr5F77CAO pok5Z0jFUdBHvaLEGaMvo5TNtUMsBI4nG1afpDtGMYAAJUdzOQ3Lrbqiv625nrmir8w4Rq1mOkg OIQLzUyHd4iV8wZK2aZ5G0J+SaOc87V6DfMRuEac9jmQ7Xgc8quzf5ZE0PRtDYpHy2D37Gzq5hF tkDQwL+Rl3aDhjBuEXg== X-Proofpoint-ORIG-GUID: ytQvW1UVbczPp5ZinQHMIf1o5zGc9HTe X-Proofpoint-GUID: ytQvW1UVbczPp5ZinQHMIf1o5zGc9HTe X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-09_02,2026-03-06_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 lowpriorityscore=0 phishscore=0 bulkscore=0 adultscore=0 priorityscore=1501 spamscore=0 malwarescore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603090061 Content-Type: text/plain; charset="utf-8" looks like q6apm driver does not remove the child driver q6apm-dai and q6apm-bedais when the this driver is removed. Fix this by using a manage version of of_platfom_populate. With this change when the dsp is shutdown all the devices associated with q6apm will now be removed. Fixes: 5477518b8a0e ("ASoC: qdsp6: audioreach: add q6apm support") Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/qdsp6/q6apm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/qcom/qdsp6/q6apm.c b/sound/soc/qcom/qdsp6/q6apm.c index a4c662be52e0..ebd5e3ac0366 100644 --- a/sound/soc/qcom/qdsp6/q6apm.c +++ b/sound/soc/qcom/qdsp6/q6apm.c @@ -752,7 +752,7 @@ static int apm_probe(gpr_device_t *gdev) return ret; } =20 - return of_platform_populate(dev->of_node, NULL, NULL, dev); + return devm_of_platform_populate(dev); } =20 static void apm_remove(gpr_device_t *gdev) --=20 2.47.3 From nobody Thu Apr 9 12:08:36 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 5169A363C58 for ; Mon, 9 Mar 2026 06:51:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773039107; cv=none; b=LAZSULPRoPrdzQDtpoRZLvT5Aj0oixygXYNkLoZMjRX6uxUTabFlxn/gdtewwvlGZ3YvlHYM6YjHP0spVQ3a5tnhOXTzGFGLxL2HV/0fcYCT/Fat4hYX9sz2NTdpE9wVf2An5pRnucle4jI6QbgKBc6eNwEKtWXao0dJGowwx0Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773039107; c=relaxed/simple; bh=6jShP5otc7Z/xglFZY5mqaUqDhEckaI1JOm+jwe6kcI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DfbxxHRrY9pbftEuXvBw5+PzHsJK1xmNZoD7cdgDT+9UmZdhglLaoHwbpmc+XLDbs/aKf2ZjRo6fSD5ji9ZOPvl4if9WkUB8BWmRuLBCI8jm9/UwuvqS1e1kOyNc5tEKkFz8cjqT4J+/E7/CA1awojmTVW3XcosiIPJ6NyOWmfs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=b/RFu8QE; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=XnmKcxMX; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="b/RFu8QE"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="XnmKcxMX" Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6295UIdT2631702 for ; Mon, 9 Mar 2026 06:51:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=xKWL+GAYqNp +tTujHQMkzR7HCGoYVVs3sPVjIKR0hiY=; b=b/RFu8QEUhQsfImzB+Sa8XC+Dd1 6oNJGDwefPGEG5xw5O423ro2suzPx60HSxzBhBnFYEwFBMj/lBNtlDkuDnd2Af/r /6kMe/vZ24jJIiQoDuDAzJhQiX4fHVhsTbw/egMmfKnxgNgeJR00I9HS3jo85qRy kDe268BsZwnNW0KFGuaYzGXeyRsVh2PND7c0tIEDrlw7IVj9LA6hddh5U7HkTmiy 7moq8VLR17IDhIXLrpbPN83y2iyuSKSqVJWMPfi3leXUoidQfMLg9+JMnbRt1vQl dSVlbDaejYJxc6d5Xt33nM2MrmQ5Gj3Vgy0XAV6La70DSLmvpdtX4U8cDRA== Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4crd6fc42y-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 09 Mar 2026 06:51:45 +0000 (GMT) Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-8cd81ce6fdcso1194725885a.3 for ; Sun, 08 Mar 2026 23:51:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773039105; x=1773643905; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xKWL+GAYqNp+tTujHQMkzR7HCGoYVVs3sPVjIKR0hiY=; b=XnmKcxMXjuxTLr9R2Q3VF6/qi9dq99XtwoIGHiAFiEI9GeT2UVRGpVr524wVkpvXik xbKQp6t0Cz+cdbwibFkKxp83glIeFW8Fw42Zfwcp888lRKDmMV13OqVITa8LpZdH7VtW Olg0QCzMIVScOa+ZHXeI5vGmtrNbY/+LIm3Lz3aUKlEzoML9h1DZIjeVLUQCkitQO0KX OstrQ7A73bQW/wKUoTT/618WmlDiYjwvdCesXPsefPru/Ywgp7OB0t0I7VZl8joO5cvV dSkOZN3bEO0jpVQk1Z9m6lCQ2e+Mf/UnKXuFzciDpqzPPY7Zg06Rmv3LDutipr7EQM9e HJLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773039105; x=1773643905; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=xKWL+GAYqNp+tTujHQMkzR7HCGoYVVs3sPVjIKR0hiY=; b=pSEyYRqvHFUurNZJ92HmY3cy/pvaUzycbmJk66kR2GIE4uD5AXckpcSeLTI7cZxyOG quk2OLAyxy5XGvbFGZQ4gIPy9re/9jccPVsvBe5OdFFYUremUtTFiz0wMpGZCXGzcmsh nTLPvYWhN0H4wYjzYV/c/Z4opVsueh0tjz5VBIr2eYVHi4RxQfwvxYSGOf4mLvjkMcGh Rp1vq8DUXucvmL4YUoKcDVCyN/jnXNb8RF9MUKLlzVOIKaxzXGkx/d/W+C+UXWkfperj LmdILG9MO+oadM3MrOZ2VJpK6sfmixj67BkC/vrlYLk8klJzSgoYIf3Zfm3+wyKMeocq p7Gw== X-Forwarded-Encrypted: i=1; AJvYcCVW+ajGqDiLRmE7Td26DK2/k2zMDf7a8iAYYZxBdGPtQHBGhmr8lL7plt/DW2SerGB5xzAeCZUC8hbrSfY=@vger.kernel.org X-Gm-Message-State: AOJu0Yxujbq4n3u7yXZJUocCsy/NCZe8TYHFVyPJKFImjHMtS6nBWspP cEz8Pj5jwUIBczpx+0gfRw6oSF5GHkoGoSn83MALJ7Z+RG342nWi32yu93Rv9Ke1zobQBytbAse bCtDTW6YQw8vNMGlg4aDxOkS8JfQ1NUx2RtskVJU0MziV6YTP2QBv+mkToKzA86s3sYA= X-Gm-Gg: ATEYQzwKbRrHvWzO3M9AH1KbcmWncYmptTHz/aPsSAVoxkXZ3R3lf48RQzH0y+sIc9x wZijuA7yZFQCRJTifx3L2tNAm09tTzKTBQl8kbKasJ5EZ69Q2qN9/xJaxiMQh/qcr2ExItmIgyc XETadFyhF+oGV2GkXeMNOfNzzWRv4jIrIILkqDNXWDJKy3C/55fBZtPCzuaMgDzfKq+wCjWILeV 2At4PPmTGJe3ZSbG4Gds+7N15tINiFj+TIa3thUOI8yQfdA+YkWaAvVDKCsmxWUuHAQnM3eT2xX YbbHn0ExQ20RJ7p7dxgl1njkHPgCXqv0UlMeuQ9RsdrVPpG+G5PWKJB5e3HLF1jo8CjA3PZ8mvw KHfD8oLjJXAdSn8I/IsD7tiizOLNA3QCA8jjsZz+AsVznrCMkYtD1GNk= X-Received: by 2002:a05:620a:c0b:b0:8cd:8142:b7e6 with SMTP id af79cd13be357-8cd8142c5d9mr413622785a.26.1773039104664; Sun, 08 Mar 2026 23:51:44 -0700 (PDT) X-Received: by 2002:a05:620a:c0b:b0:8cd:8142:b7e6 with SMTP id af79cd13be357-8cd8142c5d9mr413621485a.26.1773039104234; Sun, 08 Mar 2026 23:51:44 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48529f01997sm80449975e9.14.2026.03.08.23.51.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Mar 2026 23:51:43 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: mohammad.rafi.shaik@oss.qualcomm.com, linux-sound@vger.kernel.org, lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, johan@kernel.org, dmitry.baryshkov@oss.qualcomm.com, konrad.dybcio@oss.qualcomm.com, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, mailingradian@gmail.com, Srinivas Kandagatla Subject: [PATCH v5 03/13] ASoC: qcom: qdsp6: topology: check widget type before accessing data Date: Mon, 9 Mar 2026 06:51:27 +0000 Message-ID: <20260309065137.949053-4-srinivas.kandagatla@oss.qualcomm.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260309065137.949053-1-srinivas.kandagatla@oss.qualcomm.com> References: <20260309065137.949053-1-srinivas.kandagatla@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: f7vbThZmxYhCtwZF84MBc4koV2DFp5Sx X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA5MDA2MSBTYWx0ZWRfX1mmJNpN8VfO0 6DStdQfpL87CIcuRdPAFfp1hYbRwpCcHKbQMXLQtKoLfqUMX17RRuWvMZrfekteP9WC9iAmu+qX yhZW2zswCOPdRNkoFsDMYq2dXHHKTAKcMi6/0llogppNhbn7jiDnDnZ6D5jgcV+SHLxY6R7puMw VnrZJP5pbSKCn2fKX4wVvOYTJpRHtuBYKaykgjH4LA6lOqe3/iX4JLemwz05DiTLzTspVufRYGB dcwz/pgVeiyRtDETCaCZF/BpVwqKSl6q2Z7EWK+K5gvjQJP3XOxh1VCm9VS3Z/zKEKvhvRnJn5V XyspnAD8fiN/G/u4IYJ/8Zkr6TwUZyUgmCZlAjyoocixlgK9knvZ4Oj/mEaUC+VcNUGJOYCNtod bAFQyQhdH6tQXCbVN3fgUQcyLB2vMK86YcuT6M+lh2cMXRlufyGkOTyqc6ucVI7oXoS7FR0ZS6a fd6oaidHW/coGgrRhCw== X-Proofpoint-GUID: f7vbThZmxYhCtwZF84MBc4koV2DFp5Sx X-Authority-Analysis: v=2.4 cv=RP++3oi+ c=1 sm=1 tr=0 ts=69ae6e01 cx=c_pps a=hnmNkyzTK/kJ09Xio7VxxA==:117 a=ZsC4DHZuhs/kKio7QBcDoQ==:17 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=DJpcGTmdVt4CTyJn9g5Z:22 a=EUspDBNiAAAA:8 a=5HTw2GpdgXbBP0wXRk4A:9 a=PEH46H7Ffwr30OY-TuGO:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-09_02,2026-03-06_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 priorityscore=1501 malwarescore=0 spamscore=0 phishscore=0 clxscore=1015 bulkscore=0 lowpriorityscore=0 impostorscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603090061 Content-Type: text/plain; charset="utf-8" Check widget type before accessing the private data, as this could a virtual widget which is no associated with a dsp graph, container and module. Accessing witout check could lead to incorrect memory access. Fixes: 36ad9bf1d93d ("ASoC: qdsp6: audioreach: add topology support") Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/qdsp6/topology.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sound/soc/qcom/qdsp6/topology.c b/sound/soc/qcom/qdsp6/topolog= y.c index e732fac9b8ca..1f69fba6de26 100644 --- a/sound/soc/qcom/qdsp6/topology.c +++ b/sound/soc/qcom/qdsp6/topology.c @@ -952,9 +952,6 @@ static int audioreach_widget_unload(struct snd_soc_comp= onent *scomp, struct audioreach_container *cont; struct audioreach_module *mod; =20 - mod =3D dobj->private; - cont =3D mod->container; - if (w->id =3D=3D snd_soc_dapm_mixer) { /* virtual widget */ struct snd_ar_control *scontrol =3D dobj->private; @@ -963,6 +960,11 @@ static int audioreach_widget_unload(struct snd_soc_com= ponent *scomp, kfree(scontrol); return 0; } + mod =3D dobj->private; + if (!mod) + return 0; + + cont =3D mod->container; =20 mutex_lock(&apm->lock); idr_remove(&apm->modules_idr, mod->instance_id); --=20 2.47.3 From nobody Thu Apr 9 12:08:36 2026 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 B200B363C77 for ; Mon, 9 Mar 2026 06:51:47 +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=1773039109; cv=none; b=H05czv1TEcY4k9IBzRdswXZ1bgkbNFxyy4D003RQzimrdm0vAstndW/uJNXHx//Jf8yIlMMRscLQsuGXQJEROU4bHKlZ0hIfKivNC5LBAkhpS5q2bu2fZf2UuUBCX0QweE58SgDhZb5pp7Lfj46y9hmf1FZsY6AN38qp+NgYqoU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773039109; c=relaxed/simple; bh=KvhN5EIM3XXPaotrLaYPSuOdgBSYq4SNpSPqi8ZqfN8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EMt09cf5nyHV7Ut1l1ky6Po/gxNFEhmAKVPihc5byy2iNBGmCegURW7FfN4rEW0Oh5yS2KiNDTEmRg8Hj9eHESHKlejOsILO5iELcbZuATqwEoLvavEYMkTCh9cWAW6Aax1zgZlWH7rDagOAxyJYkNRVEsphXZEhLucEWLEj+JY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=cmFK+nWg; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=kpqAWjPF; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="cmFK+nWg"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="kpqAWjPF" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 628N0S3Q757228 for ; Mon, 9 Mar 2026 06:51:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=K4gYoo9JoJP OJ5mTuliJj+hphclVDgk4+5Zp53bnrEg=; b=cmFK+nWgaDRXEf7HW4kJDJoEKa0 1ycRV0TDgd+0gtsdmZ+4bfDhLlM3XRafP87CNKDp37kDvzXxu24zvDSFjtWqXNqK BjUQtCnXh2ehPKgN7XFpgnLO4XViA69vcuXfrjNbrdTyYl29KI+1dvKDq6iUhkQC AuccxYKMnwUbSkU1rEnD2Rzoq6BBQMEqm5VFRtwAtF6Ilwf5vVPpruEhPC0X1NmR poto8vkAFhAQdEFYP3UlkChMQY0qkTCFKmuBpwt5g5FmihfPSIK8ewurd2h4jED5 OXIgY1svOB20ZiovTNA4me17eYrdnQI3lPnY06yEq+g/lVokHKdz9o56REw== Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4crb14vbhg-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 09 Mar 2026 06:51:46 +0000 (GMT) Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-8cd722c1a69so1249113285a.0 for ; Sun, 08 Mar 2026 23:51:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773039106; x=1773643906; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=K4gYoo9JoJPOJ5mTuliJj+hphclVDgk4+5Zp53bnrEg=; b=kpqAWjPFG2FDzh+EOcuQSRskd6a1qNXs5qx0+50lBkXlkPavQm2JyMbKtyat712NaR Q1rA/G4O+lBfiBUP6MigCvrmctMKKtc+pCFKF+Pa/lMLdAcTYkFEDqrH52oHPT3ggCFl 5urxfo4QM6HbnBbyihLiJxTpRHpZTu3dGnOUkgj+zYFB9OP7SHsdWr8vC/IoqxoO80/8 I7VRUB9311qNJdOM1t065zCixOirUJ9hK5+mmBEb3ZjD7H1J0U//ojzjdo5bMbannm8w KgDbYPzs5EqISGiwJzTh602SUHE9qqQbYYJwDposkuXDHfQGB/PMr0+J00lv4ft7p7II Aquw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773039106; x=1773643906; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=K4gYoo9JoJPOJ5mTuliJj+hphclVDgk4+5Zp53bnrEg=; b=SXqXt8IDXXRhwnCiZHiIECh/S4A0krX9daxm1rafpPOTfXN6wUD7PhH6CvkFIAJQ1J aoZnQCvH/W9AE856UyW7mmLuTrr5EOPyHX3z214Td1qWUJMN7uI2hYG+UsztMeMgm0df fEr5Yx3nSk9wg5wQtvzVcQe+MpiwlgV5FISG6Zn+GNtXwofNDOkUHy5BCAksbc5qNjNH B4CdhDL/UOpS6SqqxOZhhug/rYGSgOrZZcmh2yNUyiKne/gJP9yYRYKIuz62doF96j7/ tPAL3tlgor3NFIds+PQVkr5lCxn2Jds0zTIyRIjzShM+ZgUQGGUR494YzApYCVJZQjXP PjjQ== X-Forwarded-Encrypted: i=1; AJvYcCVp5ZZKp+oZ7g2Idf6fU70QabFtXdTc625Xm/sT/E7tOjOkye8UVN8V8tNrO4NHp0e09nxsIuAqUPN2zqA=@vger.kernel.org X-Gm-Message-State: AOJu0Yz7eRveQLa0LHGfQj1jXT5xc8Jub90JwuiYuWrCO5bpXfc0AadL NYalPcdXADZ6iKQRa5u/e6UPGLAquz+CtvKkP5NLuX7cSXUOcptSGzCoRa+98srWl0PYo4TT9lW 9+uxcXKbbt9EFSsYUgHKtt6MwDH1vHp038aiC7yc4Ms298LGHmoJHjFEMVqchZ4ME/l8= X-Gm-Gg: ATEYQzzDS3MT4i2X4t2KYhijD2e21E9DfOhUboSE6ZCP8p8LFFyYvIZQfFo8TdoyfCB BS2+MdrVZCKWtyV4lt+cj2cXqp0pWAS4JculUCRyyPdEhjVnXs8SYt4LMiid3NFkPZSyttl1swH 3FdYitcOD2vv5BzewG4G0ikP9r2dLe9oiCziGRGryNEyI+SOV72/FUuWux9GAtd4fOxmqE8Gsvx oh2tWYNQljKhIfW7PcRreqFSKqFwnt2avY9kzgBNc9Rxk6Xx1gwdomqGo+91XLPrGqYAgaNuI4N 6cVcsiUMwcT/n+lm+MzgKsQyMuqVx3N0RedH55KqNesSDAGI1+dWFV8LbXN6vU//yJHWXE6rb5N 6QuYYUnj2iEOuTO5rxQBclWpBxzvm8tH8hNXXHhrJmzbTBdXB5jlGmW8= X-Received: by 2002:a05:620a:25cc:b0:8cb:52e0:15e8 with SMTP id af79cd13be357-8cd6d4a9f47mr1282177285a.76.1773039106244; Sun, 08 Mar 2026 23:51:46 -0700 (PDT) X-Received: by 2002:a05:620a:25cc:b0:8cb:52e0:15e8 with SMTP id af79cd13be357-8cd6d4a9f47mr1282175585a.76.1773039105857; Sun, 08 Mar 2026 23:51:45 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48529f01997sm80449975e9.14.2026.03.08.23.51.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Mar 2026 23:51:44 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: mohammad.rafi.shaik@oss.qualcomm.com, linux-sound@vger.kernel.org, lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, johan@kernel.org, dmitry.baryshkov@oss.qualcomm.com, konrad.dybcio@oss.qualcomm.com, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, mailingradian@gmail.com, Srinivas Kandagatla , Stable@vger.kernel.org Subject: [PATCH v5 04/13] ASoC: qcom: q6apm-lpass-dai: Fix multiple graph opens Date: Mon, 9 Mar 2026 06:51:28 +0000 Message-ID: <20260309065137.949053-5-srinivas.kandagatla@oss.qualcomm.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260309065137.949053-1-srinivas.kandagatla@oss.qualcomm.com> References: <20260309065137.949053-1-srinivas.kandagatla@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authority-Analysis: v=2.4 cv=IYSKmGqa c=1 sm=1 tr=0 ts=69ae6e02 cx=c_pps a=hnmNkyzTK/kJ09Xio7VxxA==:117 a=ZsC4DHZuhs/kKio7QBcDoQ==:17 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_glEPmIy2e8OvE2BGh3C:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=M_mAHeyD2EURj3i0m2kA:9 a=PEH46H7Ffwr30OY-TuGO:22 X-Proofpoint-GUID: YS9A_LYMv48pIeQ0-oHruq7yr2im5k7C X-Proofpoint-ORIG-GUID: YS9A_LYMv48pIeQ0-oHruq7yr2im5k7C X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA5MDA2MSBTYWx0ZWRfXwr9psQxjs6XS KBY/bZe3GYdgo1mS/uMBZuiiV16HFq2HKxtDHBMiFKlSlrphWaq83VVEN06Ntxgd3HMv19p8B7g HU3leJvrg5w8bFvHYzs/GXbFyCPjOo19hT+FolHoWJinqBzNvBxc6GySP2HlACZKwA+RcmQ9+Ko qS3zhA/69dqJ9Y8s0HbkL6wOrFgoYCUuFzXJblqk4PFU9+szFnjYkRLGD7C5xxFHE0Sznl+UaPE y2k42lTjKvWZgUzayc4NNNr0QlTCf/ovI1rvS6Tv7qYhDWxsKTWPn0lFNQDbIdaQRRnCD2qddr1 Vo06B2RkS5x03QJf5PUVeE8rt6BKNLAjArfH7srq8dVUduK8/IgO11Ove43ZC4d88bNpHitzFGE N+xRmMHr50x7J+UVFLtlBtYVTpK1F8tA8qsWHwmbVoTFBgY3IAOduZDpLNKwxdK8GoI3K0Xsd6d tjjMauoYg5T3f0aMruQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-09_02,2026-03-06_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 suspectscore=0 lowpriorityscore=0 spamscore=0 impostorscore=0 phishscore=0 clxscore=1015 priorityscore=1501 malwarescore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603090061 Content-Type: text/plain; charset="utf-8" As prepare can be called mulitple times, this can result in multiple graph opens for playback path. This will result in a memory leaks, fix this by adding a check before opening. Fixes: be1fae62cf25 ("ASoC: q6apm-lpass-dai: close graph on prepare errors") Cc: Stable@vger.kernel.org Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/qdsp6/q6apm-lpass-dais.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c b/sound/soc/qcom/qdsp6= /q6apm-lpass-dais.c index 528756f1332b..f68d4b4974f3 100644 --- a/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c +++ b/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c @@ -181,7 +181,7 @@ static int q6apm_lpass_dai_prepare(struct snd_pcm_subst= ream *substream, struct s * It is recommend to load DSP with source graph first and then sink * graph, so sequence for playback and capture will be different */ - if (substream->stream =3D=3D SNDRV_PCM_STREAM_PLAYBACK) { + if (substream->stream =3D=3D SNDRV_PCM_STREAM_PLAYBACK && dai_data->graph= [dai->id] =3D=3D NULL) { graph =3D q6apm_graph_open(dai->dev, NULL, dai->dev, graph_id); if (IS_ERR(graph)) { dev_err(dai->dev, "Failed to open graph (%d)\n", graph_id); --=20 2.47.3 From nobody Thu Apr 9 12:08:36 2026 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 6A88D3644D3 for ; Mon, 9 Mar 2026 06:51:49 +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=1773039110; cv=none; b=RouEbvTYTmzBqRXDSRyAskixT+cUgW/ePtG5+Pq51rhqwbgzmra1qDo5ZjI4kvdVWO2PRtPrs5ofwJTGmDE9UsTLBQJc5GRQdrYn0VqKvqvQL76vMuyHyZ47klnvd0HIPg5+HuhyB7nUPEHFubR2oOuu1DqfKPTEpAPiGpxAfIw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773039110; c=relaxed/simple; bh=AhoflfyPSEypIadA7rENraHqNcIi0OFcEnzEL9v8we8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cJk7YbfpsqjNR9v2fbTnsLHT2mzcnse5t4sxDWAL8khWlNIEfa5SXJPpS0MeKPQ6gUi+c2NQRZHQiuC/s5j6yaDi8CHyhuKV+u0qg2/2Wzzw5xQ4IQyMZY/KteyJoyLRjvx6SQH0ZqHFdGM0w7iYD764CkdzaBlHacbkCiyCVfs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=iBcKiFzu; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=aZDmKguH; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="iBcKiFzu"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="aZDmKguH" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 628Mxl003013568 for ; Mon, 9 Mar 2026 06:51:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=PS19lL6QwLa ikI1GyQO9iydtpc90HsQ6A4ACO7BE4wA=; b=iBcKiFzufATgRy1zoFZUpiklVX1 gM/lcFTu0FiYJV9KviNHHAsDawcynm3Z9nGlgCyStSF9pnf6m+gK060G2KG2Jpw8 s0ihg8zrNjyFIXgm7LFn9N0MABW8QjhjzIzJxvzEr1bRCrsl7+Tee00EGsA4hNnC dtP04U6bGsgR/hKhNEhI/B/Fz3lIzy6uIGA7d2A5QjEVKSvpz2TuVAJVQMZx4QMX /d5eYMTZ/iCegvUKnTf+QNsTDE8ktDyi7UvDZOBHKFN7ibU2x7RDoqgwH2f6Ukar zYh10Z0xdOIGradw1DWXyY0dLjmvTqRG4xAvJ2mETX5Yu4PaTnYgNFa88AQ== Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4crbkxv7ys-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 09 Mar 2026 06:51:48 +0000 (GMT) Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-8cd80c4965aso760054585a.1 for ; Sun, 08 Mar 2026 23:51:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773039108; x=1773643908; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PS19lL6QwLaikI1GyQO9iydtpc90HsQ6A4ACO7BE4wA=; b=aZDmKguHDK330XP+2Q/TSicIxzwjNP4meONO/B19zt6XKNIRUbGoOsjtr3tQMOgLtM 6BeWLw3Bh1IYYSsZqAKUsmQua+ObYNIAHXR87mlquMgmTrMyXwlECILaG/Lqv9dO9cJ/ LgKBkcWWn05VEUpV9jtvc8ZzrNWEBObq5FT9sSBisRMI+8Nt00hdTI64BYAfCu5VzF2I V7DiOzSMgqoSqYBwtNduhuO5gCZoIvaGJUx+n+IiVIqNi17uWVB25JXop/kxFwyPXbKq a3qQ/r0BnoSda3WY3Sy/kl45uiqdwCFYGCtSxaSfHPRXyM1wVpDkr9Wdh/NT93GBf+9F Ybmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773039108; x=1773643908; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=PS19lL6QwLaikI1GyQO9iydtpc90HsQ6A4ACO7BE4wA=; b=BExdY+tdPkjmjfW/eOo/WV+0s/yxUnuJZVmPm9BTKVwGpalE1XS03Te/rkzx/KbyVu ko4KKgNgzw1hHdNfpV3Sk8DcqZe02Aa/JSmHpegOWSIpe/C7CqZ73mUuz1b2WpeEpf7x yaxvAyRg47QSAH7tQnToccjb0pl5MP0ihZHCHIUUxAxDT7LMebjji1kjbCN8dmnlF0FK uKPxdURxaXgMQM9/TE4sK59wZfmsYB+qAZJ/ybAHwN/6442DmtVu5Z1kGPuGPGVZa66E b5WW+2VA0uOWxJcGMC6Qt35LYvMbXeyZz4D18yWm9pGjL3Z//AiAfbM1mVd2UUtUhqcj 70Kg== X-Forwarded-Encrypted: i=1; AJvYcCUJkEUiQaqdf6xDPvnI69Io9f0iXAcuvLeMIp2jElJe/6kh7LYJ1MMuiinlji2qYzWIhBfMVumSEpc5Io4=@vger.kernel.org X-Gm-Message-State: AOJu0Ywnwo6ijLMHvp4FxyNxtK5hZ7BLZRV73ECdJcEdsRE1CvsKUjjr a1ucS0I4IuBXkY4pWai8OHCnn9OTggQ6hhOhjYJvrzcKjDJyZl5gISf4Jmf6Vdy5pxuTJPhCFES uBozxZi5ybsvCkZdKvoHB+Wby40eC58f9QCuGKT2vpc6mO55YC0SBAVUCuSegQw7FGoc= X-Gm-Gg: ATEYQzyHJZMwS+HVNwVFpkyEZr7hAyrNw76n74x6y879ew1oJotwvs/d0gqU9QyIx1y 9MrR2BOdR6gHySKWmGBPAt0tY7DMupbkTelqr7YSs5fat2xta9O6g4FdYPIU0BoOosoCYhuyZG8 OyB4ZOnCTDuN9Ouyj4ZQzr/qPISqcYp8Np8sim827k2wFFpSqA2Lky3npy45eOb11PkaoOgqR16 Iod/QInbXfipUAkVMbICt6igRN4DnC9ockIP0zjZgqoxB1Qku4f4a9PYBnc2IbYOZLri2Y3lMPA WIkTTNjsW536wlyhfT03HLI7KJhNAuAe+ExkPRzUcDgeSWeeJ403G8bj9DCsug7knowlQ1Bdte0 IA+T8IoACCZQ+ENMw+MBHTcyYbtoowUwpa1RE2bT8qH14tW2hdJhEtrQ= X-Received: by 2002:a05:620a:4802:b0:8c9:ea68:3bb with SMTP id af79cd13be357-8cd63528271mr1556211385a.41.1773039107768; Sun, 08 Mar 2026 23:51:47 -0700 (PDT) X-Received: by 2002:a05:620a:4802:b0:8c9:ea68:3bb with SMTP id af79cd13be357-8cd63528271mr1556209885a.41.1773039107378; Sun, 08 Mar 2026 23:51:47 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48529f01997sm80449975e9.14.2026.03.08.23.51.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Mar 2026 23:51:46 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: mohammad.rafi.shaik@oss.qualcomm.com, linux-sound@vger.kernel.org, lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, johan@kernel.org, dmitry.baryshkov@oss.qualcomm.com, konrad.dybcio@oss.qualcomm.com, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, mailingradian@gmail.com, Srinivas Kandagatla , Stable@vger.kernel.org Subject: [PATCH v5 05/13] ASoC: qcom: q6apm-dai: reset queue ptr on trigger stop Date: Mon, 9 Mar 2026 06:51:29 +0000 Message-ID: <20260309065137.949053-6-srinivas.kandagatla@oss.qualcomm.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260309065137.949053-1-srinivas.kandagatla@oss.qualcomm.com> References: <20260309065137.949053-1-srinivas.kandagatla@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA5MDA2MSBTYWx0ZWRfXy6ZcuKYikszh +ilC+HoGYwB61iQVwM1b7rg+wMXQqh05bJ8gaB3DrJcYzd6kZfCbmVFIVZAiVWdFUAnSPjzQjIo m8zcLAreF6G4iBsIi+SpUCiWHudvCesKwwDD9+Ujwj/bBGG4mgMPiW5ZVKV/DhpEY6Pf/KPwN3Q Py32YY3FT12SYeTVy+y6IdZ2rqkAxnXE9yd/3J/fSyGPbYM7GpY5C0EIIOlTecdmXBiWROB3ggp DkDQS/oi7F7egMoLBPWwhEx55Ut1/xU9NaR2Lx7n9BlRaVriYRG66bSBdG5d3aOkb+i4mgxsbR4 42l4zmYKTFgM+cHD/QCfXCiBXNRQ4TFAmyI5W1wRFP+B+kOE2tob5Wy+WOLejjay3lXR+vHY/22 Sfh6wWwvElX9FZF2tPy2qmYwsBH3xAJ4E1Rkdu3VEz7wN888VWu5x/aTsIwAFSoADUl7YC4MU9L sVW6U0I+zPj+7y7pJGw== X-Proofpoint-ORIG-GUID: hEjixXIYR9x1csbKuASsvS7e0tumsGEG X-Proofpoint-GUID: hEjixXIYR9x1csbKuASsvS7e0tumsGEG X-Authority-Analysis: v=2.4 cv=LOprgZW9 c=1 sm=1 tr=0 ts=69ae6e04 cx=c_pps a=50t2pK5VMbmlHzFWWp8p/g==:117 a=ZsC4DHZuhs/kKio7QBcDoQ==:17 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=3WHJM1ZQz_JShphwDgj5:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=w9bA4Yi6UXS1dLCTJJEA:9 a=IoWCM6iH3mJn3m4BftBB:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-09_02,2026-03-06_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 suspectscore=0 clxscore=1015 malwarescore=0 adultscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603090061 Content-Type: text/plain; charset="utf-8" Reset queue pointer on SNDRV_PCM_TRIGGER_STOP event to be inline with resetting appl_ptr. Without this we will end up with a queue_ptr out of sync and driver could try to send data that is not ready yet. Fix this by resetting the queue_ptr. Fixes: 3d4a4411aa8bb ("ASoC: q6apm-dai: schedule all available frames to av= oid dsp under-runs") Cc: Stable@vger.kernel.org Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/qdsp6/q6apm-dai.c | 1 + sound/soc/qcom/qdsp6/q6apm.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/sound/soc/qcom/qdsp6/q6apm-dai.c b/sound/soc/qcom/qdsp6/q6apm-= dai.c index de3bdac3e791..3eff45b241c9 100644 --- a/sound/soc/qcom/qdsp6/q6apm-dai.c +++ b/sound/soc/qcom/qdsp6/q6apm-dai.c @@ -317,6 +317,7 @@ static int q6apm_dai_trigger(struct snd_soc_component *= component, case SNDRV_PCM_TRIGGER_STOP: /* TODO support be handled via SoftPause Module */ prtd->state =3D Q6APM_STREAM_STOPPED; + prtd->queue_ptr =3D 0; break; case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_PAUSE_PUSH: diff --git a/sound/soc/qcom/qdsp6/q6apm.c b/sound/soc/qcom/qdsp6/q6apm.c index ebd5e3ac0366..f190ad5e912a 100644 --- a/sound/soc/qcom/qdsp6/q6apm.c +++ b/sound/soc/qcom/qdsp6/q6apm.c @@ -215,6 +215,8 @@ int q6apm_map_memory_regions(struct q6apm_graph *graph,= unsigned int dir, phys_a =20 mutex_lock(&graph->lock); =20 + data->dsp_buf =3D 0; + if (data->buf) { mutex_unlock(&graph->lock); return 0; --=20 2.47.3 From nobody Thu Apr 9 12:08:36 2026 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 E0DDE36493B for ; Mon, 9 Mar 2026 06:51:50 +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=1773039112; cv=none; b=TkocsfTSSny4RUjcWdcmYj0p5QMfurBf8FWcBwd5kPJYlQzJ6Go1aUCyETC6G0edtIkHae/X0qYNm9ffZkzqkUKhDfiV1lZM9AXkg+c4RTBBBZAzwSz3XPW4ODay+pYHs51qgZnTnJZMxggmdCRftbba+CTEvMAwhg/icccXAkk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773039112; c=relaxed/simple; bh=Q0wXZHoOMoTB+T690k57Jhsb7Luaf4VYpMrf8ZeVddo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OBOAsfnH/r+uylPPSDGxhDjwxhPJ2rCeP+8+FWl1S7QoRM+VQtjwAz0XOo78iqchS786qePPkuNMheKgZWoQHHoTfu2zmqfMkZxe3oQDbFCZxA2syy1CzpqosP6NavbJshAn8bTJDlqUyxdo6a9GXdtMVqmTfjy/8EozHyBSKfs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=DoJ5xzgA; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=VKVwrhK+; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="DoJ5xzgA"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="VKVwrhK+" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 628N0pMx3015890 for ; Mon, 9 Mar 2026 06:51:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=7gKUJDT6xhi +yOTV04urRjKQi8RIrOI9pXL1mbTNlng=; b=DoJ5xzgARXDOCmbOBlyn/WqNXtI 9V1JHaflc/i2CQ+jXgNhBQ8dQpFq4DTWGEOfg8RGpjC8hFlx3HTDITBCAqA1yDT1 aI7GDhs7LqcYE3kA1UY6PO7KAch3PDgg6+2Ji6roMXobJNZyHBxPkDSFKxkBw4/s ZqsxfonH8KHh/BA5xfN/edQRbo5r+zgRnMhGpdV+5NTUolxdbdcz3Asr9ARz4DYO AZiyu0azcS54A580ip2LXswqY3w+2v9B5OS8iFluJjrhXsJqa3WW7cxDyjxpMka7 L0oSDx/3yNGF9afcRiNzHfVWNRNfdG0s3N3srTiuI9AXB84RyHjVviuJByA== Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4crbkxv803-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 09 Mar 2026 06:51:49 +0000 (GMT) Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-8cd83cfb36cso745329085a.3 for ; Sun, 08 Mar 2026 23:51:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773039109; x=1773643909; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7gKUJDT6xhi+yOTV04urRjKQi8RIrOI9pXL1mbTNlng=; b=VKVwrhK+MbxVr6hIDcDyVxpRAIfvoZvKB+ztWYDJsytyfX9BF8jPlbgy7yvH1jFcFy wkG2bAkZKEOIpe0sg05WPvlPa6xo6ghN82fHCkO44k/KOSIIImRt2LxnHADyF1rQ5B8a FDrWKBt1SlI+ToJfwEq2qj1PVdWA7LF18c2JLRyZyOz8CdPOUYjO8DFMfgoWgwcqqua0 0j7iWuy/c1vtR8MP5zCiHciNX/6SsYU28Sao1wYJ6w85Yu13qeREjPSb7V733NOLvdQJ 27nNlTs4uEt10GAPV0vO+8cHjlCkMfoLZcKgleH/3+tUS/ebppPAafoVkTWC/Ttc/l7J O6rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773039109; x=1773643909; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=7gKUJDT6xhi+yOTV04urRjKQi8RIrOI9pXL1mbTNlng=; b=aNPjbeEm18WBswb+rYwBtWkJVk2cqwtsNiNPnSsl5hQXNL3zA1YpbPcAp3uwpZq04E fWRo5Gq/aIhm2D3xipUWi1DrFXCvkD+oHI0CXw/dkNZaT6ND9LJfVHBtX2Z0MSWFkWFd gITg7PBpepPDc6q19zv4nxQns2S3efdDawIXq3UdbdtE+xe/k+qASxeHmj2mED0x4D8+ Zht256qv5yI6sIlTIglZIIjnoRVfaFoynDG9vosS1Kl2tb8UB2eFn4icgDzkuxnP1R3Y l/X47w2M6iECzIk7UWirGfayDUeyopL64BGE/f6xzhZwLgaZRvk6swQF/b3xJ0Xdzwxo 7XCA== X-Forwarded-Encrypted: i=1; AJvYcCV7Lg/LOuBAGiIztNnZmzcna+fZYUbW+pa2wg1tGNoSH9JbJVWgleCLD3uaz7zzveP5QXgvjR9xLT37Ic0=@vger.kernel.org X-Gm-Message-State: AOJu0Yyz1xsdmcAKWZSAoBfwrfxFjrxLUY6O8zKfKODaxaSX832SHr8S bU26OcJ5HYINH2kj78ZvjkMlySVKdczdMs8S26r5OE1M1EL5agyhcxIkFe/zRWBoYtMZMvKjuRL kkd1UVMButOUrw8y1s6ysZVNjbQBBcMGMzcGv3LRsuvaEjZ7quyjdsPl6tNhEsDi4haY= X-Gm-Gg: ATEYQzxUEXb1xFX8MyfpYUKY1kYKPM7wa41xv2iJx+VRwUxX+c+4AjKwj82lu5aGFlY eQambN6ubN4ouQkjPe8l3Nzcnd657lnBobAlfxPx0OZKZuf34wG4w/74LGZ8nJYeGzuuPn+fyvf KWAJfxGPeyO2YHpkVysvD+z7BPv4nx9GScoghefKwqabvd6Pfm5SM+3G4rPY8jRwpol4TaVYNSx j8w42ip3L5QsiSQnaqYq9u4i+fL/EadZ2b0rA9TEVqEEDGEtUyu+47uX3C+A7Y3q2yWCdTSc8lo qARsxCAY4wmxd2cOh51Ul780rdaFevF+vIxSiDu2yJuLPFjFWFFp1+Ze07QeQjId/9KwS+wb+M1 WCzsxjcCd+sqGTKaNMa7Enaj05vnhCBZCuI/1+9+6u+oVJFuv4/uLYS4= X-Received: by 2002:a05:620a:468a:b0:8cb:c897:6839 with SMTP id af79cd13be357-8cd6d36dc9dmr1387561785a.26.1773039109384; Sun, 08 Mar 2026 23:51:49 -0700 (PDT) X-Received: by 2002:a05:620a:468a:b0:8cb:c897:6839 with SMTP id af79cd13be357-8cd6d36dc9dmr1387560285a.26.1773039108933; Sun, 08 Mar 2026 23:51:48 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48529f01997sm80449975e9.14.2026.03.08.23.51.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Mar 2026 23:51:48 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: mohammad.rafi.shaik@oss.qualcomm.com, linux-sound@vger.kernel.org, lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, johan@kernel.org, dmitry.baryshkov@oss.qualcomm.com, konrad.dybcio@oss.qualcomm.com, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, mailingradian@gmail.com, Srinivas Kandagatla Subject: [PATCH v5 06/13] ASoC: dt-bindings: qcom: add LPASS LPI MI2S dai ids Date: Mon, 9 Mar 2026 06:51:30 +0000 Message-ID: <20260309065137.949053-7-srinivas.kandagatla@oss.qualcomm.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260309065137.949053-1-srinivas.kandagatla@oss.qualcomm.com> References: <20260309065137.949053-1-srinivas.kandagatla@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA5MDA2MSBTYWx0ZWRfX6SC0D6h09Zy5 aVcYYNiEn6g1ISxhdUX2zd5I/YBQYoEfng/4USfUoYjsclYU0VT9Deoe424CcmgSiGBiM95I/7p R3ErW9/IjyYXPjpDreKYb19M96FeC+RDHVweG+tVFFV2R3sHEGePcpk7IJrg5d8SyxVPmjQZtFR KGU+mRvp64B7+zYpLkYOVzrpM5INdJrzu2mCXG2Ha4AbUdG6lKNwA7T/CD0RrfG4+YLXXBeTdE9 5nn12T9qsnCR/wibLW8iDtJvv7rUPAUGk1S9ebJ8TcpU+psEVXf1LNjIMsnVJgadA1ly2oMGDVa +DC/H1mn6hR+LjKpCZAiSHYLb4QwyXwkb+Oa0ogrdpelNdxFnLCo9MJcy8lGbqREUIM4Hkx0hkv v+uu0ZhxI7ZeAvNgInV5zxdQmWF6F8VvzmrVHBSkn0bhzBeNcKCvjzOnux0o0eJ7kAmlW4Z97JW uTc6IVRzDZh7rz41v3g== X-Proofpoint-ORIG-GUID: RkIfoMxLt5PNQ_M5O4LNIFUFShvsNwJ1 X-Proofpoint-GUID: RkIfoMxLt5PNQ_M5O4LNIFUFShvsNwJ1 X-Authority-Analysis: v=2.4 cv=LOprgZW9 c=1 sm=1 tr=0 ts=69ae6e06 cx=c_pps a=hnmNkyzTK/kJ09Xio7VxxA==:117 a=ZsC4DHZuhs/kKio7QBcDoQ==:17 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=3WHJM1ZQz_JShphwDgj5:22 a=EUspDBNiAAAA:8 a=6P8UuP444nAwg2htitIA:9 a=PEH46H7Ffwr30OY-TuGO:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-09_02,2026-03-06_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 suspectscore=0 clxscore=1015 malwarescore=0 adultscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603090061 Content-Type: text/plain; charset="utf-8" Add new dai ids entries for LPASS LPI MI2S and SENARY MI2S audio lines. Co-developed-by: Mohammad Rafi Shaik Signed-off-by: Mohammad Rafi Shaik Signed-off-by: Srinivas Kandagatla Reviewed-by: Krzysztof Kozlowski --- .../bindings/sound/qcom,q6dsp-lpass-ports.yaml | 5 ++++- include/dt-bindings/sound/qcom,q6dsp-lpass-ports.h | 12 ++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/sound/qcom,q6dsp-lpass-ports= .yaml b/Documentation/devicetree/bindings/sound/qcom,q6dsp-lpass-ports.yaml index 08c618e7e428..2b27d6c8f58f 100644 --- a/Documentation/devicetree/bindings/sound/qcom,q6dsp-lpass-ports.yaml +++ b/Documentation/devicetree/bindings/sound/qcom,q6dsp-lpass-ports.yaml @@ -126,13 +126,16 @@ patternProperties: reg: contains: # MI2S DAI ID range PRIMARY_MI2S_RX - QUATERNARY_MI2S_TX a= nd - # QUINARY_MI2S_RX - QUINARY_MI2S_TX + # QUINARY_MI2S_RX - QUINARY_MI2S_TX and + # LPI_MI2S_RX_0 - SENARY_MI2S_TX items: oneOf: - minimum: 16 maximum: 23 - minimum: 127 maximum: 128 + - minimum: 137 + maximum: 148 then: required: - qcom,sd-lines diff --git a/include/dt-bindings/sound/qcom,q6dsp-lpass-ports.h b/include/d= t-bindings/sound/qcom,q6dsp-lpass-ports.h index 6d1ce7f5da51..45850f2d4342 100644 --- a/include/dt-bindings/sound/qcom,q6dsp-lpass-ports.h +++ b/include/dt-bindings/sound/qcom,q6dsp-lpass-ports.h @@ -140,6 +140,18 @@ #define DISPLAY_PORT_RX_6 134 #define DISPLAY_PORT_RX_7 135 #define USB_RX 136 +#define LPI_MI2S_RX_0 137 +#define LPI_MI2S_TX_0 138 +#define LPI_MI2S_RX_1 139 +#define LPI_MI2S_TX_1 140 +#define LPI_MI2S_RX_2 141 +#define LPI_MI2S_TX_2 142 +#define LPI_MI2S_RX_3 143 +#define LPI_MI2S_TX_3 144 +#define LPI_MI2S_RX_4 145 +#define LPI_MI2S_TX_4 146 +#define SENARY_MI2S_RX 147 +#define SENARY_MI2S_TX 148 =20 #define LPASS_CLK_ID_PRI_MI2S_IBIT 1 #define LPASS_CLK_ID_PRI_MI2S_EBIT 2 --=20 2.47.3 From nobody Thu Apr 9 12:08:36 2026 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 3464B363C6B for ; Mon, 9 Mar 2026 06:51:52 +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=1773039114; cv=none; b=GR4BbMwfSHvNQo2syyzAYYezyib6KyyKD7iKGQYaB91xpihlAaEvem6xUP3SnmYKquDb3EohzvYY/pV9O0IA3Cxn8BhYAFjBSGTnKeYZWtHphIeI63hkU0Welvq6+5aWMzWiY0ZLEhpYZoL51YmDHZ/RHq5bDExSZA6m7tKpf0M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773039114; c=relaxed/simple; bh=1AGWMMo+ZQ2MpMqgndQclqL9hoOIddPn00jRigW1KUQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=c2VueYcWBK2hmPvtvVik9Wskpi6OhFh+XBhlSvfUCd2vT1Pdi1Jdi4zGrPv15jNYRC3eIzJ/nWViKVKe7lqFee59mDqNeslEzLo9imb2TQGD95ernq3qlIS67dB0HyqKsWvl/d1ybNjibpKDf/HpPNNvx5V8uJdi/DAadKKtUUU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=g8L5DxLp; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=fk2jscVh; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="g8L5DxLp"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="fk2jscVh" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 628N0cLp2661676 for ; Mon, 9 Mar 2026 06:51:52 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=2UA23pg+dGV Ambwz2ppXfyVdk6xlbVmq70z85L7JFXQ=; b=g8L5DxLp5yKatlPFxlc6ckn+uMd taFLoGQTsXy6fI/v6KAM3DSmCdlEF05Rrei7QrC3hL+iTVQTjO/Z9ShkA0L3r6Fr k0aR9xDeeyC107AIkj/sWgcik21YCRKyo88/xIfhr4m1v0OTBBbzy1OcmltQ6HOr iE1cXtsNk8J+bBaGLo87ocNPhhrJ8lGarj2e8w9KnLgn34cO5FVGYHhOQOzNx70/ 1WVJRmG3FlDnZzZ6zdpc81Srt9pjd4QxG5uRZJtjhVOI2kvl5p2hnxmHwD47XmTU /PotlNbJwlH0VbeEMndmQnENs8sI+EdsHZzPG3zuLH090hM64GH6Uuj9IgA== Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cr9cpmgbk-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 09 Mar 2026 06:51:52 +0000 (GMT) Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-8cd77bc8186so1881876485a.0 for ; Sun, 08 Mar 2026 23:51:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773039111; x=1773643911; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2UA23pg+dGVAmbwz2ppXfyVdk6xlbVmq70z85L7JFXQ=; b=fk2jscVhaEFS8qLs6w9ZIo0MZNXBRDtUIXMIX2VzXYJdjwzRNn5v5LheQst7GI/XOy z5IJ61dseTxrGZYQcLgvwvEhSN3yHULN35dDaV6Gcyg/q7tq0puj+ygRDgtJ6qwkRJBV lquSnDAR74k5oPmM9Qsr5wGzJo3SbBju/KmiggeJH+TDXzbH3rSVASBrsnGrR2r57QSm p3l4GnKbEs5UbzAlns+eQ0WbozjT71W++mOC5RL0DhJfht89byD1Cu2qNmkO5OrnGAdi nu5QVWl0ERFlr8fmL+Pb7unX/Q+uykcDTbFS/5YPQv7DR9S2NtMciVDhlEl1j1x5hrk8 Zq5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773039111; x=1773643911; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=2UA23pg+dGVAmbwz2ppXfyVdk6xlbVmq70z85L7JFXQ=; b=djbkSAKMYAUCnosflEp3GLdKmX8O0tfJOyJL4mlRgp4dDRrmZT5mLLFE3FFj+CSa0M ErxCfuF7NGAVluPGAjjnZ9LRPmn0rqi2/24KV/lukHbNf5YyU3BC+SLdTsA0Ao9FZvq4 aB0esA3bPX3j/+/SXVWV/ZBmgykY2i6tdMe7Hperf7PWIzfLBfauSenP+VEs9qPiRvt4 JgO3pJj2ZT3A+dtjB1NMZWC3aXNwAlZXZiYcGIU00OaAzV3lEKDn/3FKh3Z3dAub3jEB rPKpCD4L8JVj03KSEfkF8EPOSjwHETtCU4JszLRB8/E94ZU/EBQUVcGUbrrayrjnyMs/ Jr2g== X-Forwarded-Encrypted: i=1; AJvYcCUszpFfciMZWLSG+RLjIoYg+piIQ9grcaC+N0mIH5lOH5AiZQZuyF9LMQadBaKY+mowhyFpAaqLBOhrYsQ=@vger.kernel.org X-Gm-Message-State: AOJu0YwJX2DSwNuYT9Et+sTymxjPVcITGF0yZi7ulp0/2mY1qArnSZek kOjY/dCmnO7gdnrWKqQb1ZadANhCouZ3Tbo7Zo+hR+lHAx8E1y5aNnj0AJEMD53LuQtsTgTuuuB IaxipnAR3JPnt4tZJ85cZe8pO1s4+mA4xlodEqodUIPQ9MiLBCoOtvBAwvP/0iJF5xGA= X-Gm-Gg: ATEYQzwHEjuLLLCFa7WKi+9r+T7ySljcbJu75Ri9jruUntFGhxY81jqam1QpdqVEa/d WmFBEpD7DGYRoTkghCYBDwImTBrk1V5+k1Dlyscd9uUZuw4y2InQ8ueZg/c0DgI/dMtBceRnvqr vC4RblVDf5BNzofo8pE/YfJc5a7E3BaJn/eUOkI0DroMLFEPpdN08zdfGUoL0bARx5FbVYMYe9z UO5ul5+ov/NTaBz0C3oFeIV3cknYWKFdwjI6/e/DO2loLVfLU/udn2WWFlcJCucO0/LG7TfGbi3 QIgn5UFWZzSxba3bdc606oI83tE4iAwKi++/suHycDlzKSg5LW5q4uo0pM4f2vZQJyazaK/REvN +ReLOpjGx0+MhxpY/OuGt2e3R9BZnt8paPEu9nBFClt8CD+gw1+y4mw8= X-Received: by 2002:a05:620a:1a8b:b0:8cd:88c7:9f96 with SMTP id af79cd13be357-8cd88c7a3dfmr333894585a.67.1773039111513; Sun, 08 Mar 2026 23:51:51 -0700 (PDT) X-Received: by 2002:a05:620a:1a8b:b0:8cd:88c7:9f96 with SMTP id af79cd13be357-8cd88c7a3dfmr333891985a.67.1773039111115; Sun, 08 Mar 2026 23:51:51 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48529f01997sm80449975e9.14.2026.03.08.23.51.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Mar 2026 23:51:49 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: mohammad.rafi.shaik@oss.qualcomm.com, linux-sound@vger.kernel.org, lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, johan@kernel.org, dmitry.baryshkov@oss.qualcomm.com, konrad.dybcio@oss.qualcomm.com, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, mailingradian@gmail.com, Srinivas Kandagatla Subject: [PATCH v5 07/13] ASoC: qcom: qdsp6: lpass-ports: add support for LPASS LPI MI2S dais Date: Mon, 9 Mar 2026 06:51:31 +0000 Message-ID: <20260309065137.949053-8-srinivas.kandagatla@oss.qualcomm.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260309065137.949053-1-srinivas.kandagatla@oss.qualcomm.com> References: <20260309065137.949053-1-srinivas.kandagatla@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA5MDA2MSBTYWx0ZWRfX2aqgFw4OEvwt sZSGnFfwqz1bvZV11l4zWqsiyoLBLqDB1uIaIg6xbb05tor7diTHt/CUYl6Wt5GoL9jBlSZ5YNi Y68C1GmfnxJf7EL0vFdt1w7CDlueMQ2gVJC010fmYA3xdCxuh06yoAfLtmByLMD9NregpxiqsVH uVKg8gihwVgA7K9ZCrLlVvxrwZiepm0jW5zBVsKGOlY8WTUYLBfDxrHzqulE9x8Z/lXOB6TlrVe jPl3gGYLDadVlF47ehvQ49JcGg6NdYjtqsp27oL7KWUH7Mzxm/4wlPU8blVC2cjr+r4zk9ld/PX dIRh+XNacXf2X6yepMtK1S6sp5EtUBWhF3Kr4nPS4gy0rkR0TWpwXHFrtjq0841l0kXM1j63PFu AzYn3nn/HXRpNJCYrhBRriLK2fDGVJEQgouvOQBAXUvkFYTY8Kqk2TlEqw8xRoGm+yTrjGk0Lt7 AfGVD6YP7nzvGs4qNfA== X-Proofpoint-ORIG-GUID: LWj2-uf-h1ocGOsJLWf_DB81FBalzUf9 X-Proofpoint-GUID: LWj2-uf-h1ocGOsJLWf_DB81FBalzUf9 X-Authority-Analysis: v=2.4 cv=e7sLiKp/ c=1 sm=1 tr=0 ts=69ae6e08 cx=c_pps a=HLyN3IcIa5EE8TELMZ618Q==:117 a=ZsC4DHZuhs/kKio7QBcDoQ==:17 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=rJkE3RaqiGZ5pbrm-msn:22 a=EUspDBNiAAAA:8 a=nvRDalaNTaWZAukup-IA:9 a=bTQJ7kPSJx9SKPbeHEYW:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-09_02,2026-03-06_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 lowpriorityscore=0 priorityscore=1501 adultscore=0 suspectscore=0 spamscore=0 bulkscore=0 impostorscore=0 malwarescore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603090061 Content-Type: text/plain; charset="utf-8" Add support for LPASS LPI MI2S dais in the dai-driver, these dais are used in Monaco based platform devices. Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/qdsp6/q6dsp-lpass-ports.c | 47 ++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/sound/soc/qcom/qdsp6/q6dsp-lpass-ports.c b/sound/soc/qcom/qdsp= 6/q6dsp-lpass-ports.c index 4eed54b071a5..d31388ed3ccf 100644 --- a/sound/soc/qcom/qdsp6/q6dsp-lpass-ports.c +++ b/sound/soc/qcom/qdsp6/q6dsp-lpass-ports.c @@ -96,6 +96,42 @@ .id =3D did, \ } =20 +#define Q6AFE_MI2S_RX_DAI(pre, did) { \ + .playback =3D { \ + .stream_name =3D pre" MI2S Playback", \ + .rates =3D SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\ + SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_48000 |\ + SNDRV_PCM_RATE_176400, \ + .formats =3D SNDRV_PCM_FMTBIT_S16_LE | \ + SNDRV_PCM_FMTBIT_S24_LE | \ + SNDRV_PCM_FMTBIT_S32_LE, \ + .channels_min =3D 1, \ + .channels_max =3D 8, \ + .rate_min =3D 8000, \ + .rate_max =3D 176400, \ + }, \ + .name =3D #did, \ + .id =3D did, \ + } + +#define Q6AFE_MI2S_TX_DAI(pre, did) { \ + .capture =3D { \ + .stream_name =3D pre" MI2S Capture", \ + .rates =3D SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\ + SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_48000 |\ + SNDRV_PCM_RATE_176400, \ + .formats =3D SNDRV_PCM_FMTBIT_S16_LE | \ + SNDRV_PCM_FMTBIT_S24_LE | \ + SNDRV_PCM_FMTBIT_S32_LE, \ + .channels_min =3D 1, \ + .channels_max =3D 8, \ + .rate_min =3D 8000, \ + .rate_max =3D 176400, \ + }, \ + .name =3D #did, \ + .id =3D did, \ + } + static struct snd_soc_dai_driver q6dsp_audio_fe_dais[] =3D { { .playback =3D { @@ -484,6 +520,16 @@ static struct snd_soc_dai_driver q6dsp_audio_fe_dais[]= =3D { .id =3D QUINARY_MI2S_TX, .name =3D "QUIN_MI2S_TX", }, + Q6AFE_MI2S_RX_DAI("LPI RX0", LPI_MI2S_RX_0), + Q6AFE_MI2S_RX_DAI("LPI RX1", LPI_MI2S_RX_1), + Q6AFE_MI2S_RX_DAI("LPI RX2", LPI_MI2S_RX_2), + Q6AFE_MI2S_RX_DAI("LPI RX3", LPI_MI2S_RX_3), + Q6AFE_MI2S_RX_DAI("LPI RX4", LPI_MI2S_RX_4), + Q6AFE_MI2S_TX_DAI("LPI TX0", LPI_MI2S_TX_0), + Q6AFE_MI2S_TX_DAI("LPI TX1", LPI_MI2S_TX_1), + Q6AFE_MI2S_TX_DAI("LPI TX2", LPI_MI2S_TX_2), + Q6AFE_MI2S_TX_DAI("LPI TX3", LPI_MI2S_TX_3), + Q6AFE_MI2S_TX_DAI("LPI TX4", LPI_MI2S_TX_4), Q6AFE_TDM_PB_DAI("Primary", 0, PRIMARY_TDM_RX_0), Q6AFE_TDM_PB_DAI("Primary", 1, PRIMARY_TDM_RX_1), Q6AFE_TDM_PB_DAI("Primary", 2, PRIMARY_TDM_RX_2), @@ -636,6 +682,7 @@ struct snd_soc_dai_driver *q6dsp_audio_ports_set_config= (struct device *dev, break; case QUINARY_MI2S_RX ... QUINARY_MI2S_TX: case PRIMARY_MI2S_RX ... QUATERNARY_MI2S_TX: + case LPI_MI2S_RX_0 ... LPI_MI2S_TX_4: q6dsp_audio_fe_dais[i].ops =3D cfg->q6i2s_ops; break; case PRIMARY_TDM_RX_0 ... QUINARY_TDM_TX_7: --=20 2.47.3 From nobody Thu Apr 9 12:08:36 2026 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 76B60364026 for ; Mon, 9 Mar 2026 06:51:54 +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=1773039116; cv=none; b=Ty1LZj8qFp2jbwAuva07VESHw+d7Hz8AZDUS0NlbfTHGItEZkKG0X76tZ+KqNhVGWhxFR/HU6ud28VERpy4c7m5Vf0NH4Ljpn8wQrHCeAqoB5UuUhJJP+FDTgnMC/kSVwRaCX1sHoDHpdof19yf1ustf+jhv+57n77jMAALTFIQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773039116; c=relaxed/simple; bh=nhF962DJ35ZnGtg1Nyn29ALPxXwZIXyRUxas4dLT8SI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rAqZkQJIQZoXtVX1x0nIciSDcPG65r4Dk6InB2eRnwDu1ynKTAG2j4gyS3PfH2fgqsV1nrjynrSD9tJWNuYTqel6KVlVQoVKKQEJSuVjQNbKWNKYWfJ6OWf79KdnUbNum8nQfduyZUwTmYfDrFKdfy8bXBfEk1N+k3sSDKqXfBM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=lW/VnAo5; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=WvP0tc2P; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="lW/VnAo5"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="WvP0tc2P" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6296hkSm3979487 for ; Mon, 9 Mar 2026 06:51:53 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=ZsyVHtwoLDk /xLA/rwLKIW8JVwySpk++YyIKH0BTOlA=; b=lW/VnAo5Hr0q6imX9TYhL5xMsck /HpKbCcMkEvJc97F8+kf/Ny2pvNOGkj+h1AkojpkbUvjPUBXOb9dP/GF0VIJoNlS rrtqPitUgAlQ1Vn3ERcnwkuRoZJIIb6c2E67F4LYu5ejOlcnjhg9Uw/RcmQXYTup ZQmDH0f2za/AFhUPyv48dBc4NgnqR0slYgTliPFrK6U1R1HWFZ641NHwIp+nfjvm mfk6Stg/cDJn+hKSu5XOfiW9TRWt27IbrsJx9AH/6nfTSRWajZCbBILEiGKOD3Ft HdruT758i/6ugV+imoJ0A2bqr28qfD6vm60C7RtbeZTE5/Vv2zc5kOlFTgg== Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4crb14vbj4-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 09 Mar 2026 06:51:53 +0000 (GMT) Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-8cd85e08fddso817544785a.1 for ; Sun, 08 Mar 2026 23:51:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773039113; x=1773643913; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZsyVHtwoLDk/xLA/rwLKIW8JVwySpk++YyIKH0BTOlA=; b=WvP0tc2PFHk0JgcIQ8BHohoUjqmdXEAEdQwv3dKEfSJt6ZNGsQ9xDk3hF1eqiyOJks rxgf+l0XZrncZ41mqWHBRl8bNyHor1HdEzwuwVOwVha2/ntYsC3q90BL4cJQ70lwTMrV inBvgW1LOy7O7dRe+/WRuYFKw3OjO+wl6WCCkfxxAQOYkavWrPwOPSJW1aCfOLViVVI0 VZzvWJm0R+hYKJ9bkWRV/bPqfc7+hpmSlqUqTJ2MtbriLwX8KnbdIhTa70FR5ll83dEo eZckQrEclb8uywN4QBX3Tb4ssGP1UxGYvnhABS8N2ihwQ/PZmChpjWHHSs3tq/wi2OSe xigw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773039113; x=1773643913; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ZsyVHtwoLDk/xLA/rwLKIW8JVwySpk++YyIKH0BTOlA=; b=cplEUMVbPwp68rGOb3f1pceGccDr45SMpMRm7qTBCMVP5tTe9a43zCj9kscKutGzku fIAkhcxJ0UTZJfL50Sf8Q6v3DL33UaIvkoGGsJ0UgJ5bTV80gLJeBeaWehvWmTPcLfRG wapYuB+Fd040WZAaMw4tNHW36bRa/I9/cOygWf753KO2V8V/VPKlbVTk9qmOA4ajPJla RcJ1cbxjIZRwFypgdAS3WGSYLSkYTAEygWHcBwIJHpX9TWLzDl2LUnLNxsWqQrdXzKaa fyuIRYX6nIQjHXMFgyE5IKFP1fjJhOoLIxIu3oxygc2wk22oesXddHTW/jj0BWds7l9z 7CXQ== X-Forwarded-Encrypted: i=1; AJvYcCWgGEZphhdVRzQnTtg90GYjf9rK+DeafCbEW5wzBmFyQfScqZ5iaG9+R+ZqQTC8Hx1f1KYuqsD6UVSn0EM=@vger.kernel.org X-Gm-Message-State: AOJu0YwJbwA5hKQa9lQmNVIkxcd+/VktkJM8h+SR2dq1H3tTkojcdm5r j7Np/lZAPqeZs01eMZNsnELPExCrEiElBMdJXq8NdhNaqQnSp0CWEb+J7q4PdJtNMi/Zbrs3k06 4rMRpqQT5wob8UKYY55LpW3oUUg+W3Cd2Rix5cvTV/Ai3ts/ZUBt4wYQZOUmPYE8yV38= X-Gm-Gg: ATEYQzylXKqyhK43eiAiADTQt7M069Vt86xpO/5YEOaSMpzcA8WjFkKu6pKHaU+U94Y FhGWf0FHXnOJT4xiK4rGf3ijer92D2CiW7NkGqWc6PG5TJPWKTU/yRKuRAOvUyMA4IGfLgq615P n0Nw7qpxkkly+d+8hxtUMitl7kES2fqg7LO9eMNMXs+X0hAmu8dtSTmsr51vcafpm1bRMuP7M5T AdlK8sQ4b5mq0mgwwk9SspMRX7eAsc+O8Mv/9/NvF/5zEf0gYffVGJeqFNAebuNKmH/zSp0xYB1 YC3Z4o+9cTRHH+BT45uUYzLZpMsc2CnRBFfF7waM9BJ/SEWZ7Bl1UAgDuKtsst4bZIveRMKUxaT v7M2gAqP0JilUc4gIUhloA0DC8sj6fzjqghEUorWbNrLaKVxbqov5vbY= X-Received: by 2002:a05:620a:4056:b0:8cb:4d9b:6b4d with SMTP id af79cd13be357-8cd6d3ea059mr1260359285a.10.1773039112848; Sun, 08 Mar 2026 23:51:52 -0700 (PDT) X-Received: by 2002:a05:620a:4056:b0:8cb:4d9b:6b4d with SMTP id af79cd13be357-8cd6d3ea059mr1260357485a.10.1773039112464; Sun, 08 Mar 2026 23:51:52 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48529f01997sm80449975e9.14.2026.03.08.23.51.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Mar 2026 23:51:51 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: mohammad.rafi.shaik@oss.qualcomm.com, linux-sound@vger.kernel.org, lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, johan@kernel.org, dmitry.baryshkov@oss.qualcomm.com, konrad.dybcio@oss.qualcomm.com, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, mailingradian@gmail.com, Srinivas Kandagatla Subject: [PATCH v5 08/13] ASoC: qcom: q6dsp: Add Senary MI2S audio interface support Date: Mon, 9 Mar 2026 06:51:32 +0000 Message-ID: <20260309065137.949053-9-srinivas.kandagatla@oss.qualcomm.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260309065137.949053-1-srinivas.kandagatla@oss.qualcomm.com> References: <20260309065137.949053-1-srinivas.kandagatla@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authority-Analysis: v=2.4 cv=IYSKmGqa c=1 sm=1 tr=0 ts=69ae6e09 cx=c_pps a=qKBjSQ1v91RyAK45QCPf5w==:117 a=ZsC4DHZuhs/kKio7QBcDoQ==:17 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_glEPmIy2e8OvE2BGh3C:22 a=EUspDBNiAAAA:8 a=aBFzMgE2VLA-TvnT3JMA:9 a=NFOGd7dJGGMPyQGDc5-O:22 X-Proofpoint-GUID: s-AEyCnUTE8DMtir0ur8HjnOqtqqV6U8 X-Proofpoint-ORIG-GUID: s-AEyCnUTE8DMtir0ur8HjnOqtqqV6U8 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA5MDA2MSBTYWx0ZWRfX4Tdhu5SPTJPi VsfD6u2CpfEsTCNeqKlKGXwQa/BOGQwGpmHUN86O7+9sVrSRxJLxNyJeVrBdgp9nEr2MbO/XUhb kNcs2nvWy3TlWSb5KBC0AIRIOudwjnka6skD+X8dIDxl4RSFjtXab/zOwk4c2ef68HuSYINd+ON 8YB5jGbeyNwPdsbJV3gZIBmDZsjb2rN8ZyN5//jncWF3IIRscvg8bow1sAHtHxUhmkCeT3HX1fr C24hN+drCL6DIwDrHLIIkN/uhG0K9zcPG1bATZ3OsMsm38HJzNAXq6dXr5VLCDtIQBpPKMKpi+o RmhlJYVlAMkuyCTheHCHdwgDCFO7WIbJchagfPKWNqxlM/WxaLSO+iBnFbWfbk7PfbbiRqi4uX0 eFQ+7fmSR8I98FjN8ddW/RJnFv+tastu9ufN7HsnXy/ZMc46qficYajmqoC8QSEgNWf6dfSL6e2 D4AO+9T0m6Bl6wMKJkw== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-09_02,2026-03-06_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 suspectscore=0 lowpriorityscore=0 spamscore=0 impostorscore=0 phishscore=0 clxscore=1015 priorityscore=1501 malwarescore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603090061 Content-Type: text/plain; charset="utf-8" From: Mohammad Rafi Shaik Introduces support for the Senary MI2S audio interface in the Qualcomm q6dsp. Add new AFE port IDs for Senary MI2S RX and TX and include the necessary mappings in the port configuration to allow audio routing over the Senary MI2S interface. Signed-off-by: Mohammad Rafi Shaik Signed-off-by: Srinivas Kandagatla Tested-by: Val Packett # sm7325-motorola-dubai --- sound/soc/qcom/qdsp6/q6afe-dai.c | 6 +++++ sound/soc/qcom/qdsp6/q6afe.c | 6 +++++ sound/soc/qcom/qdsp6/q6dsp-lpass-ports.c | 29 ++++++++++++++++++++++++ 3 files changed, 41 insertions(+) diff --git a/sound/soc/qcom/qdsp6/q6afe-dai.c b/sound/soc/qcom/qdsp6/q6afe-= dai.c index 0f47aadaabe1..a0d21034a626 100644 --- a/sound/soc/qcom/qdsp6/q6afe-dai.c +++ b/sound/soc/qcom/qdsp6/q6afe-dai.c @@ -409,6 +409,7 @@ static int q6afe_dai_prepare(struct snd_pcm_substream *= substream, q6afe_slim_port_prepare(dai_data->port[dai->id], &dai_data->port_config[dai->id].slim); break; + case SENARY_MI2S_RX ... SENARY_MI2S_TX: case QUINARY_MI2S_RX ... QUINARY_MI2S_TX: case PRIMARY_MI2S_RX ... QUATERNARY_MI2S_TX: rc =3D q6afe_i2s_port_prepare(dai_data->port[dai->id], @@ -540,6 +541,7 @@ static const struct snd_soc_dapm_route q6afe_dapm_route= s[] =3D { {"Tertiary MI2S Playback", NULL, "TERT_MI2S_RX"}, {"Quaternary MI2S Playback", NULL, "QUAT_MI2S_RX"}, {"Quinary MI2S Playback", NULL, "QUIN_MI2S_RX"}, + {"Senary MI2S Playback", NULL, "SEN_MI2S_RX"}, =20 {"Primary TDM0 Playback", NULL, "PRIMARY_TDM_RX_0"}, {"Primary TDM1 Playback", NULL, "PRIMARY_TDM_RX_1"}, @@ -636,6 +638,7 @@ static const struct snd_soc_dapm_route q6afe_dapm_route= s[] =3D { {"SEC_MI2S_TX", NULL, "Secondary MI2S Capture"}, {"QUAT_MI2S_TX", NULL, "Quaternary MI2S Capture"}, {"QUIN_MI2S_TX", NULL, "Quinary MI2S Capture"}, + {"SEN_MI2S_TX", NULL, "Senary MI2S Capture"}, =20 {"WSA_CODEC_DMA_RX_0 Playback", NULL, "WSA_CODEC_DMA_RX_0"}, {"WSA_CODEC_DMA_TX_0", NULL, "WSA_CODEC_DMA_TX_0 Capture"}, @@ -770,6 +773,8 @@ static const struct snd_soc_dapm_widget q6afe_dai_widge= ts[] =3D { SND_SOC_DAPM_AIF_OUT("SLIMBUS_4_TX", NULL, 0, SND_SOC_NOPM, 0, 0), SND_SOC_DAPM_AIF_OUT("SLIMBUS_5_TX", NULL, 0, SND_SOC_NOPM, 0, 0), SND_SOC_DAPM_AIF_OUT("SLIMBUS_6_TX", NULL, 0, SND_SOC_NOPM, 0, 0), + SND_SOC_DAPM_AIF_IN("SEN_MI2S_RX", NULL, 0, SND_SOC_NOPM, 0, 0), + SND_SOC_DAPM_AIF_OUT("SEN_MI2S_TX", NULL, 0, SND_SOC_NOPM, 0, 0), SND_SOC_DAPM_AIF_IN("QUIN_MI2S_RX", NULL, 0, SND_SOC_NOPM, 0, 0), SND_SOC_DAPM_AIF_OUT("QUIN_MI2S_TX", NULL, @@ -1037,6 +1042,7 @@ static void of_q6afe_parse_dai_data(struct device *de= v, =20 switch (id) { /* MI2S specific properties */ + case SENARY_MI2S_RX ... SENARY_MI2S_TX: case QUINARY_MI2S_RX ... QUINARY_MI2S_TX: case PRIMARY_MI2S_RX ... QUATERNARY_MI2S_TX: priv =3D &data->priv[id]; diff --git a/sound/soc/qcom/qdsp6/q6afe.c b/sound/soc/qcom/qdsp6/q6afe.c index 43d877322bae..7bd40e32f758 100644 --- a/sound/soc/qcom/qdsp6/q6afe.c +++ b/sound/soc/qcom/qdsp6/q6afe.c @@ -130,6 +130,8 @@ #define AFE_PORT_ID_QUATERNARY_MI2S_TX 0x1007 #define AFE_PORT_ID_QUINARY_MI2S_RX 0x1016 #define AFE_PORT_ID_QUINARY_MI2S_TX 0x1017 +#define AFE_PORT_ID_SENARY_MI2S_RX 0x1018 +#define AFE_PORT_ID_SENARY_MI2S_TX 0x1019 =20 /* Start of the range of port IDs for TDM devices. */ #define AFE_PORT_ID_TDM_PORT_RANGE_START 0x9000 @@ -718,6 +720,10 @@ static struct afe_port_map port_maps[AFE_PORT_MAX] =3D= { QUINARY_MI2S_RX, 1, 1}, [QUINARY_MI2S_TX] =3D { AFE_PORT_ID_QUINARY_MI2S_TX, QUINARY_MI2S_TX, 0, 1}, + [SENARY_MI2S_RX] =3D { AFE_PORT_ID_SENARY_MI2S_RX, + SENARY_MI2S_RX, 1, 1}, + [SENARY_MI2S_TX] =3D { AFE_PORT_ID_SENARY_MI2S_TX, + SENARY_MI2S_TX, 0, 1}, [PRIMARY_TDM_RX_0] =3D { AFE_PORT_ID_PRIMARY_TDM_RX, PRIMARY_TDM_RX_0, 1, 1}, [PRIMARY_TDM_TX_0] =3D { AFE_PORT_ID_PRIMARY_TDM_TX, diff --git a/sound/soc/qcom/qdsp6/q6dsp-lpass-ports.c b/sound/soc/qcom/qdsp= 6/q6dsp-lpass-ports.c index d31388ed3ccf..e5cd82f77b55 100644 --- a/sound/soc/qcom/qdsp6/q6dsp-lpass-ports.c +++ b/sound/soc/qcom/qdsp6/q6dsp-lpass-ports.c @@ -519,6 +519,34 @@ static struct snd_soc_dai_driver q6dsp_audio_fe_dais[]= =3D { }, .id =3D QUINARY_MI2S_TX, .name =3D "QUIN_MI2S_TX", + }, { + .playback =3D { + .stream_name =3D "Senary MI2S Playback", + .rates =3D SNDRV_PCM_RATE_8000_192000, + .formats =3D SNDRV_PCM_FMTBIT_S16_LE | + SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S32_LE, + .channels_min =3D 1, + .channels_max =3D 8, + .rate_min =3D 8000, + .rate_max =3D 192000, + }, + .id =3D SENARY_MI2S_RX, + .name =3D "SEN_MI2S_RX", + }, { + .capture =3D { + .stream_name =3D "Senary MI2S Capture", + .rates =3D SNDRV_PCM_RATE_8000_192000, + .formats =3D SNDRV_PCM_FMTBIT_S16_LE | + SNDRV_PCM_FMTBIT_S24_LE | + SNDRV_PCM_FMTBIT_S32_LE, + .channels_min =3D 1, + .channels_max =3D 8, + .rate_min =3D 8000, + .rate_max =3D 192000, + }, + .id =3D SENARY_MI2S_TX, + .name =3D "SEN_MI2S_TX", }, Q6AFE_MI2S_RX_DAI("LPI RX0", LPI_MI2S_RX_0), Q6AFE_MI2S_RX_DAI("LPI RX1", LPI_MI2S_RX_1), @@ -680,6 +708,7 @@ struct snd_soc_dai_driver *q6dsp_audio_ports_set_config= (struct device *dev, case SLIMBUS_0_RX ... SLIMBUS_6_TX: q6dsp_audio_fe_dais[i].ops =3D cfg->q6slim_ops; break; + case SENARY_MI2S_RX ... SENARY_MI2S_TX: case QUINARY_MI2S_RX ... QUINARY_MI2S_TX: case PRIMARY_MI2S_RX ... QUATERNARY_MI2S_TX: case LPI_MI2S_RX_0 ... LPI_MI2S_TX_4: --=20 2.47.3 From nobody Thu Apr 9 12:08:36 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 1A5D3366053 for ; Mon, 9 Mar 2026 06:51:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773039117; cv=none; b=GAZtoIb5T5Uby57OaOWrdit906RZqHx/uR0GMvg4KD/TOYqj0iWvk51rqFkqxmlJ/6+VZzd22pi5AglP24RgPv5PlLQTFDRDc/1snH4QqEUHHuVSUSFkdorHyy9sO60mVwin8V1rkLASyVDaH1RLr5Ak2rpFCJLzeEWGqwQxeDA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773039117; c=relaxed/simple; bh=CrLGv5edH+UZPIk9+prSCn/qT8iVjWiDSBnsGzRqcxE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=J+Wu28EMY5ADOG6/r9s9DsbwTHwszlzGGDrXkN4/sSwtJpkzmBT7NzudOeIJrepl2z3vvKeg0DmgqNV8XP+TtEQ4vo+AR6dIgjXqYrf/aFoEhRqr47VYOY86/bk2zw4fjADCzFOmYZAYifDVKdu7G+bT1crVBZXrXIjghb0UWxI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=XakMq7Bq; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=d5NszAVx; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="XakMq7Bq"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="d5NszAVx" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 628MLfe42920471 for ; Mon, 9 Mar 2026 06:51:55 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=aiejSc4X5A/ gorkmczOj6dnKqerAsQHN9lH+LChbOlI=; b=XakMq7BqCmC1gZPEOQ7zm7b79F/ 2VrsLN27za8MrpO7f83tVypuG/BBYQj8akbSGCXvfQH1VIjwe4cob2itf6hr52WV zZu4u0dNA5rcEs+x2i9O9sb9ezIrFqpkodyJnIZMJamSkkPvxz74053g5yNnT3lI qXkN5jmXGXe8huhPcn5vzAYNXWGmkZezB3UUrOwL8ZlLuhURXlVAuZgUZd6qCgOP gi+w82RKvz3tKKthOX8ZGRaQR2jqeGcnWEYf6W8Sohd1KYEx1EyF1JECk0HRoJ6W WkGMZzV2IiAqqRMz2vPtUZ8P47oPXaotjmh+slQ6HnrfGkvUf+j4gK7f1rg== Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cr9qevhsv-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 09 Mar 2026 06:51:55 +0000 (GMT) Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-8cd84943c76so583935685a.0 for ; Sun, 08 Mar 2026 23:51:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773039114; x=1773643914; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aiejSc4X5A/gorkmczOj6dnKqerAsQHN9lH+LChbOlI=; b=d5NszAVxs0IWtEik9sP+g+EI9nwy64XB+7P0xnt4tTeaa8L27Ylq5votEIAAiqE2TA v1majHdpO8iKNRK3bvyU520F0iXebqSw3r8oNfXyUVd3AvbEnbq1vIJvnoojwV2eDTPO rggxyU7+9ww3Yi9a1pRMpwki/MRm1fwSIt/4jKNnPhQKP/0m4VIvDRwv0S2LsUmezle7 m9qTf8vVK6FBN+5AXNgqx4akqj3JI1wyMGkciTwdzAO8Aig8dw87dhEYWGIdV4lWsfkp mMzpOzmJJulXTeP8iQbBBUIGLwPX/ydjDOMpXULQEyje2iFdWjc7Q2g055Tq9fxtA2z0 4KQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773039114; x=1773643914; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=aiejSc4X5A/gorkmczOj6dnKqerAsQHN9lH+LChbOlI=; b=xTHkf5LFrwZVnStQl/NirwrGTcdov1Uw26vPcLt09yiXD6TtYM7iyxiI8qCtkCdJxp VZK1KFXCROkhs6ObdZyrpZN5dwkk5t7S9B/B0oecg5WJz7lrIy/9nHX6PKoq9vWEHW5K 75+9NGajJWyazl1390SXmY92X4yzmn3NKkRXDi6gc0/Fqx2WRCYWlM0NEtkkh7eQOBVB GPYM18L3GLMvk9rGO0uGuOGbo3XCFKltImI2DOxg6aPvKrS2PX4WabVtRsY2pxdaPs8N ZAyuLR9Xj5ZcJ3cq4xwf/lFbW+e7nA9htCav/CEBYk5c2cZcVp2oxUojwkXMg2yiAHVC dSRA== X-Forwarded-Encrypted: i=1; AJvYcCWC7ikiThctL6RT0y0LscfOaSVGJEe2Xm42BeiIw0wDLEHlp+gKGJGDPuoy9grb9kjcb01FM30WvN9xlEA=@vger.kernel.org X-Gm-Message-State: AOJu0YyupuU4XPC9tOrIIGJ+Vp5jjLdVoXND14oBJLBcWcchI7lpP5Ln LhNhKD1nMMioQIvr7FdJ762MDmd9M7iz5WlEG6uxO9CT5FYtUaSMjh0mc2p5nUqxVVR79eVd94b vEEyDUqEdL+eqh5cwPEYXPhe+ktZ757UmsMdlOjWl7XBl2dvq4iBIaoDpC46/TuDYMwI= X-Gm-Gg: ATEYQzyI3h3KpvUYSeCs0He7SoTTZwswTO5E1gxFaf3EYcMHdJZ2XMATFv2E7ha+iP3 Q2AXOOjrCl5Mi/bP9nPCJLTeqXbXOTLl2Pv9O3xXR9BPYMV3eMZrYvweM6CwSdIoctODpdDFg+F 6sHUWH3l/Haa1WnMuayC7E+/RnminCmHk0JlVI1X8yTb4k0gsyy7m6P3p8VmMdoGQDUmKoZqudC 5WI0HhnrsQPTSLsFPKgNsns3JsocN6b3JrvKS4GCCf+vkY8QPibvqRsMj/3PgrVB01PG5kXLMVa hutQHcvedhrWoHCrEua0/QEzAT4ReFGgtquhovsAagb2xUPxvEK/0AuWucCqq+2DBTjJpqZ9Zw1 nYG+WUlnQPVRoaNQ+tbRbqkD6X5ukrullY5La5+acQhKjX4SEO43Dpys= X-Received: by 2002:a05:620a:4408:b0:8b2:e3c1:24b7 with SMTP id af79cd13be357-8cd634e8fe6mr1713297685a.29.1773039114491; Sun, 08 Mar 2026 23:51:54 -0700 (PDT) X-Received: by 2002:a05:620a:4408:b0:8b2:e3c1:24b7 with SMTP id af79cd13be357-8cd634e8fe6mr1713295285a.29.1773039113964; Sun, 08 Mar 2026 23:51:53 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48529f01997sm80449975e9.14.2026.03.08.23.51.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Mar 2026 23:51:53 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: mohammad.rafi.shaik@oss.qualcomm.com, linux-sound@vger.kernel.org, lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, johan@kernel.org, dmitry.baryshkov@oss.qualcomm.com, konrad.dybcio@oss.qualcomm.com, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, mailingradian@gmail.com, Srinivas Kandagatla Subject: [PATCH v5 09/13] ASoC: qcom: common: validate cpu dai id during parsing Date: Mon, 9 Mar 2026 06:51:33 +0000 Message-ID: <20260309065137.949053-10-srinivas.kandagatla@oss.qualcomm.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260309065137.949053-1-srinivas.kandagatla@oss.qualcomm.com> References: <20260309065137.949053-1-srinivas.kandagatla@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: hfhzFIMGxNaaUCcyesiru4T-0oE5_XL6 X-Proofpoint-GUID: hfhzFIMGxNaaUCcyesiru4T-0oE5_XL6 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA5MDA2MSBTYWx0ZWRfX6WSeD0qC6GJf EXGp1vsdzSV70i00fkK/vQ3N/kd+7XRYIHf6TtDM6IgSgnNH53xkhIQR4vdhk11OLdBxS4hlM3O e8Ogrl5mK1aZyU9hsnmsFt1IDZDVFWeNceWgWfIQDZw+uVxnqXGFZUoGuDlGew1gr5Q31lu56ME WnzQ0i+EjSd+FUZRjvVCVY1K+AYJIUYwA1jcWndU4rjqiwzBPoVUeF2rvPtp1afwo2BoB8R3t+W Q3fCtuEO828r65gzGCM9rtPfIqM2utXS+fTU8A6riuyLCKUFGDjy7vHH5c7BU4XlTWbcTnDNSBB lulenUlY+vqTM3dK9CtubGFj4RRfAkjqeqgHoaUhsLYxvwxo9mLH/KmsdwFMhKYZEZMunugOBMc O2JA6XqTgBacZSfyzLWfAA3zWYA4u1e4B4pdxsAQSgBXKUH0wxBQNrtOmgJHAoG2jMae9P2XVDP N1O2c9vlpTB8x2585fg== X-Authority-Analysis: v=2.4 cv=dcqNHHXe c=1 sm=1 tr=0 ts=69ae6e0b cx=c_pps a=50t2pK5VMbmlHzFWWp8p/g==:117 a=ZsC4DHZuhs/kKio7QBcDoQ==:17 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=EUspDBNiAAAA:8 a=FTFSxu1yF2iZ1NjiFwcA:9 a=IoWCM6iH3mJn3m4BftBB:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-09_02,2026-03-06_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 bulkscore=0 spamscore=0 lowpriorityscore=0 adultscore=0 clxscore=1015 impostorscore=0 malwarescore=0 priorityscore=1501 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603090061 Content-Type: text/plain; charset="utf-8" lpass ports numbers have been added but the afe/apm driver never got updated with new max port value that it uses to store dai specific data. There are more than one places these values are cached and always become out of sync. This will result in array out of bounds and weird driver behaviour. To catch such issues, first add a single place where we can define max port and second add a check in common parsing code which can error out before corrupting the memory with out of bounds array access. This should help both avoid and catch these type of mistakes in future. Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/common.c | 6 ++++++ sound/soc/qcom/common.h | 3 +++ sound/soc/qcom/lpass.h | 3 ++- sound/soc/qcom/qdsp6/q6afe.h | 3 ++- sound/soc/qcom/qdsp6/q6apm.h | 3 ++- 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/sound/soc/qcom/common.c b/sound/soc/qcom/common.c index 7ee60a58a336..cf1f3a767cee 100644 --- a/sound/soc/qcom/common.c +++ b/sound/soc/qcom/common.c @@ -120,6 +120,12 @@ int qcom_snd_parse_of(struct snd_soc_card *card) =20 link->id =3D args.args[0]; =20 + if (link->id >=3D LPASS_MAX_PORT) { + dev_err(dev, "%s: Invalid cpu dai id %d\n", link->name, link->id); + ret =3D -EINVAL; + goto err; + } + if (platform) { link->platforms->of_node =3D of_parse_phandle(platform, "sound-dai", diff --git a/sound/soc/qcom/common.h b/sound/soc/qcom/common.h index 1b8d3f90bffa..ee6662885593 100644 --- a/sound/soc/qcom/common.h +++ b/sound/soc/qcom/common.h @@ -4,8 +4,11 @@ #ifndef __QCOM_SND_COMMON_H__ #define __QCOM_SND_COMMON_H__ =20 +#include #include =20 +#define LPASS_MAX_PORT (SENARY_MI2S_TX + 1) + int qcom_snd_parse_of(struct snd_soc_card *card); int qcom_snd_wcd_jack_setup(struct snd_soc_pcm_runtime *rtd, struct snd_soc_jack *jack, bool *jack_setup); diff --git a/sound/soc/qcom/lpass.h b/sound/soc/qcom/lpass.h index de3ec6f594c1..68b71039b981 100644 --- a/sound/soc/qcom/lpass.h +++ b/sound/soc/qcom/lpass.h @@ -14,10 +14,11 @@ #include #include #include +#include "common.h" #include "lpass-hdmi.h" =20 #define LPASS_AHBIX_CLOCK_FREQUENCY 131072000 -#define LPASS_MAX_PORTS (DISPLAY_PORT_RX_7 + 1) +#define LPASS_MAX_PORTS (LPASS_MAX_PORT) #define LPASS_MAX_MI2S_PORTS (8) #define LPASS_MAX_DMA_CHANNELS (8) #define LPASS_MAX_HDMI_DMA_CHANNELS (4) diff --git a/sound/soc/qcom/qdsp6/q6afe.h b/sound/soc/qcom/qdsp6/q6afe.h index a29abe4ce436..0b8c3ec1315c 100644 --- a/sound/soc/qcom/qdsp6/q6afe.h +++ b/sound/soc/qcom/qdsp6/q6afe.h @@ -2,8 +2,9 @@ =20 #ifndef __Q6AFE_H__ #define __Q6AFE_H__ +#include "../common.h" =20 -#define AFE_PORT_MAX 137 +#define AFE_PORT_MAX (LPASS_MAX_PORT) =20 #define MSM_AFE_PORT_TYPE_RX 0 #define MSM_AFE_PORT_TYPE_TX 1 diff --git a/sound/soc/qcom/qdsp6/q6apm.h b/sound/soc/qcom/qdsp6/q6apm.h index 7ce08b401e31..5cf538397841 100644 --- a/sound/soc/qcom/qdsp6/q6apm.h +++ b/sound/soc/qcom/qdsp6/q6apm.h @@ -14,9 +14,10 @@ #include #include #include +#include "../common.h" #include "audioreach.h" =20 -#define APM_PORT_MAX 127 +#define APM_PORT_MAX LPASS_MAX_PORT #define APM_PORT_MAX_AUDIO_CHAN_CNT 8 #define PCM_CHANNEL_NULL 0 #define PCM_CHANNEL_FL 1 /* Front left channel. */ --=20 2.47.3 From nobody Thu Apr 9 12:08:36 2026 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 6C3203644A3 for ; Mon, 9 Mar 2026 06:51:57 +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=1773039118; cv=none; b=TiNcRHtI2AiCQHdjQrTBFCmgydz8epH1RhHr6xejEYbJjwAYDAM+Nklc5Ef/QXOcnETzEC68JZH5uaEq0+ImJdWCuMCsguL0bTDvDGObV9yfyps+nGG2SFKl6iiq8SMdopBkqaLqU1LW8nj9aoVddSByTwscSSlJS2gbqI9DSlU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773039118; c=relaxed/simple; bh=iafQmWDeFIqwxoTztlKqMCFwj+DaAdYsFKAlvo4MX7E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gRsG6eYeGnrwMIbKmZ6T8J/9w4372z8wdLUM57PwfiMn46tsygx9cYfn0lwz1PJdueLADVZhT5JipMIywu103z4J+dbv4RZGplGFaP7NuNmvUJC5LUx51xH/spu/vpEQ6YsVqy2GKrae0gTT13WFzNQMNU1Ow2cghBdnwx09SBQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=Mip+dyYr; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=PqZDGnib; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="Mip+dyYr"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="PqZDGnib" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 628N19aP2662904 for ; Mon, 9 Mar 2026 06:51:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=lh8JDFjF3Cp /56/LC7QnjRtBGIXDKJonxwqRjjyCPMo=; b=Mip+dyYrfP6k57L77mLOfimZZA+ 8Vs9P4O2J8G/5HAaihReWYlnb+3pPr4Me0+Cnm8twNACJgatK0SGH6UnSooAFc4D Hx3P5NzBD0Z2PyeXc5VwStbwwWAXFvJVMdvJ2VzwdYZTnNYTI5IUXroOPSLJHBEr bJ0HOC7FSoE9EwW3C2aSvZo2xq48coRE95U9Pim1RdCkLbovcAFR7vUUdvdHvaiz jYvKpygL44yL1ee402ofLVf8nKIwfudPmP2lazmyMMLHRuE9Kiycd7H3HH5gnRgH zLqwhV7N8ptmM9b3mFu8cNr5aeR0BOgIx1zwhtoMC12OsnB2mQulwikKQrw== Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cr9cpmgc5-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 09 Mar 2026 06:51:56 +0000 (GMT) Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-5033c483b76so792172401cf.1 for ; Sun, 08 Mar 2026 23:51:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773039116; x=1773643916; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lh8JDFjF3Cp/56/LC7QnjRtBGIXDKJonxwqRjjyCPMo=; b=PqZDGnibcShOo2/L8bcLzqyIifiuEJMRJk13ETrecbWuuS2vIPh9JihxrqyQCcnIfD qNgAhzG8lb4h6zDFXwHHfWS8M377jAYyfGWOF5Ifq7ehnby5Mqd5O9HoOXGx4fLcJM9N oiRqYeEMEfIEcuipz3ToLiH3q/zs5vTXtf65zNZrSx+zOJSbPxyUhxjyBSFL1p9akEzF hJmQSrmBMw3b//ZJpRUbiska1oI67svZ1sNXYD0KR3bOrC0lPEKkuRa48P0l6OJWc6+o WmkyZ7WwWeegn4vd5SiHvCvQJcaSrIbTJ1QIDl/6d7/+a24HohXYQkGAHqal9SqV53Ec +RPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773039116; x=1773643916; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=lh8JDFjF3Cp/56/LC7QnjRtBGIXDKJonxwqRjjyCPMo=; b=jDYajE0mOs+4QUvWmfljCb4g4bqayBVNNqTjJtEkVEyuQ90iuIrg+MGKBZD06hxSvX 1859EdTVCppoxfPGGIAWbmDjh7TLrDGFbM1MrDhQuTFEX3spOUYxztOrkJoorXXgA9zD 6qPjgTFQYtmvpIbDZUftSXDYwDcdWUd0hFeq1Kn/dNdEvTlrW8XC5jv35CiO62tSifQ+ 9N2c28fyG0sD73bqbHSYE9rUTGGDPM+NmOVeqrzaS7+88MExXJi5XgJ/7bub4mHgpRF2 AT2BRfFlurreIaCxR25sdFqB9fc9/2Sd9btIh8tbdfk+/tq1dMvyW6QvL9J7lAwCh1jK 7Vag== X-Forwarded-Encrypted: i=1; AJvYcCXbhz3836XXlE6dWN+/erCg1Rtc3u09oCshxGTeMM7Tp1IJe4a1h5UJ+JIRL9xHjGgC4OFepUPqJW2vKYw=@vger.kernel.org X-Gm-Message-State: AOJu0YyqrFHhEsSGVwuNX8PibQXOjw5eXhHqb2mMoJBKcd8WxDwXEUKp fXjp3wwtM40G1MoSvpOaVdntrwFw/VeYShaMb2o17lDaGsLrf4mobt9Ta99RnsUiD19sVUnl/VM 5Zx8/fIJhydbFwc/MEYzYZZKR3fCklWfWPhYIW5MsJ0UtH6YDDjykEEC3hdDMoUZxf0s= X-Gm-Gg: ATEYQzyVdLY1u8uJM+DE0WxjtHhCp6xAqnf6ILgleGc+vA73nWW8SO0gej9wr3PZris vNW95ApLszBgacNBJpm/JZKu1m0j4i0oydnK42ERqpgLPsmWE2ewFn0O1S/XDiunrE3NxxhTrQe tHMwcZ8VpQW9JEs/tF7AiNEB7pQGABqi6KtkrLkjvts3iXi3qRKzImcg763uQDM3A5FKxAmiypQ MU6QJQyaYOBpirSn+/3eQtSqXNpo36Z+EbCsoLvcyTpS2pgwUzv3Wftdle9w6mVL8lxq/j+TY+f jdW9OuS52Mq2DXEQLZrBJAPM1P/7y+8HrqvbvY/DBsjTxQaSDwaEduMTn7AL7ffcUpr1CbV8fBo xlqV90AIH4L1cjLtTSUr6Bt5Vb6cCBn07Ffa7uB++QRdR5qWICY/6Dwk= X-Received: by 2002:a05:620a:1375:b0:8cd:79aa:693a with SMTP id af79cd13be357-8cd79aa73a3mr572510785a.67.1773039115797; Sun, 08 Mar 2026 23:51:55 -0700 (PDT) X-Received: by 2002:a05:620a:1375:b0:8cd:79aa:693a with SMTP id af79cd13be357-8cd79aa73a3mr572509285a.67.1773039115331; Sun, 08 Mar 2026 23:51:55 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48529f01997sm80449975e9.14.2026.03.08.23.51.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Mar 2026 23:51:54 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: mohammad.rafi.shaik@oss.qualcomm.com, linux-sound@vger.kernel.org, lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, johan@kernel.org, dmitry.baryshkov@oss.qualcomm.com, konrad.dybcio@oss.qualcomm.com, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, mailingradian@gmail.com, Srinivas Kandagatla Subject: [PATCH v5 10/13] ASoC: qcom: qdapm-lpass-dai: correct the error message Date: Mon, 9 Mar 2026 06:51:34 +0000 Message-ID: <20260309065137.949053-11-srinivas.kandagatla@oss.qualcomm.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260309065137.949053-1-srinivas.kandagatla@oss.qualcomm.com> References: <20260309065137.949053-1-srinivas.kandagatla@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA5MDA2MSBTYWx0ZWRfX6dWA5XafuUH/ KsGo8qIpgFAOiRhEK/kKqJ5yRBTFRmx9Tk0pbt0QRxOKqVBmutvucBiVYPndXLhFGIL/3ItAlt+ MKKTb3Y51W7WgCY9jEMkMX+Amytjm1cHA1qL0f9tlY11OomJoUhua61+5DLvwrWVsc2enxycgTa 71kYW5hi+/TtevXlEn1+M1Qb3EQqTTkAnPrclsymBd669weSYXlSLCRHj4tlu/n65uU3XEMRm/H P2X8PuH3P105N+dGVYiap+6xk3T7hJZr1J8iqWgSrjHdBzJx9jQwaZtMtve5uQMuBAtbMQVMPcc 7R2s2lWHUM7FSIZvE/vvaMXwAMUby/Ky/AAA2GgwdlkgfWScEMEAnJgo4ibz2yWPiT9tIWItvvN mLL47nVzui5ACOqsCDTDSxPSFaToirxe1YHyc5Vs7MSmI5qKKuATwXtd/pFWlwLhod41aXl0w8o gd39mhi4caJnEz/cwMQ== X-Proofpoint-ORIG-GUID: lhbVkrU7Qk1YBjpqzJvJ8JJ5eg5xzyDP X-Proofpoint-GUID: lhbVkrU7Qk1YBjpqzJvJ8JJ5eg5xzyDP X-Authority-Analysis: v=2.4 cv=e7sLiKp/ c=1 sm=1 tr=0 ts=69ae6e0c cx=c_pps a=WeENfcodrlLV9YRTxbY/uA==:117 a=ZsC4DHZuhs/kKio7QBcDoQ==:17 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=rJkE3RaqiGZ5pbrm-msn:22 a=EUspDBNiAAAA:8 a=QkacBUY9L2qTTJrEq-kA:9 a=kacYvNCVWA4VmyqE58fU:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-09_02,2026-03-06_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 lowpriorityscore=0 priorityscore=1501 adultscore=0 suspectscore=0 spamscore=0 bulkscore=0 impostorscore=0 malwarescore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603090061 Content-Type: text/plain; charset="utf-8" Fix the error message to reflect the actual graph stop error instead of graph close error. Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/qdsp6/q6apm-lpass-dais.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c b/sound/soc/qcom/qdsp6= /q6apm-lpass-dais.c index f68d4b4974f3..472b2114c81e 100644 --- a/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c +++ b/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c @@ -150,7 +150,7 @@ static void q6apm_lpass_dai_shutdown(struct snd_pcm_sub= stream *substream, struct rc =3D q6apm_graph_stop(dai_data->graph[dai->id]); dai_data->is_port_started[dai->id] =3D false; if (rc < 0) - dev_err(dai->dev, "fail to close APM port (%d)\n", rc); + dev_err(dai->dev, "failed to stop APM port (%d)\n", rc); } =20 if (dai_data->graph[dai->id]) { --=20 2.47.3 From nobody Thu Apr 9 12:08:36 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 A0ED2367F42 for ; Mon, 9 Mar 2026 06:51:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773039122; cv=none; b=XQ+d1fPt9NQM42azfSg7sytGfgulZdyJkUJMUobGDcZCnkxI8wWChI4pB/pX0cuwEHwG+Zlif0ELoy/9GZH5Zx2mtlOwcwxTLhBjXcg2T0VAo9wY2WeD4zPDIKa6/J6ITcPclFhjlREDcYw4n8CovBveRWiKMJtiUP0X3ae74No= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773039122; c=relaxed/simple; bh=B8mb+C29aHmXpiZ0KkyuEWv+QuyMzs+RA8VA08jucnY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=S3HF0hPzRXD8l2mPxtQx3g3mjoAlisWSarKV7eybl6H9mzAgDOpRqFYeQqki+G+W2upwGniKcmFQocEpvOA0LLkHNlUIuv/V5bdU0rK93JK2zO9DJEBgD8MzugkU/x30uzRzDlqDrH0+0E9llEWu4hk0K3TIBsNzzog2MYCO3sQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=N2d/YJuB; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=ZcGvT+ee; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="N2d/YJuB"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="ZcGvT+ee" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 628Mnp7I2071120 for ; Mon, 9 Mar 2026 06:51:58 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=aC+um2a762g fpLWPhHdIhYlAN3YczWO4vgnfj1X+hyE=; b=N2d/YJuBs56jlxVkNwleuMJSaYK NgP8IuYQ5GQOaXC2SDLhxAbfE8NMx5/EJzpk+FACga9WJcLVEdP30fEUenug2equ 3hK8LwQze03kg7WqCQXlz2fOJAWJlAhT8ZstTjC11hb+ICYvSsmFI7+Mdt/nJ//9 y4wxsTJfPNJh9a6UIrlDPtRRuI3wnTJbvuUn2Q4utXsDswCxZFlArD2wjjU2rOgc f6ZaLKOh8q8gQo+uNS9Iq3E0epKgdiyqMiOURoqaKazeuAS1BeGVXnXGu27OMsrq OGOuuq5j6pK3b21anaL+Yiou7C/75mPNCKlNZgtTFw5Royp3kdIR1uth9SQ== Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4crda9c26w-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 09 Mar 2026 06:51:58 +0000 (GMT) Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-8cd7d66afceso876222185a.3 for ; Sun, 08 Mar 2026 23:51:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773039117; x=1773643917; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aC+um2a762gfpLWPhHdIhYlAN3YczWO4vgnfj1X+hyE=; b=ZcGvT+eeaatu/EkhxaWG68MDV/ZcidHRRK9rCnxszfqc9e/86+0Blu96DT8/Sl6Ocb PDoi2+G07PSEZhMy9A9SbnOktmg5zEz2StzhRquFNhXu4wncetTZAkHawa3OsdWZ83TG wHru3kybis+c5mxSP22UE0hna1v+JDrRHj/kTMg0CR2z22grCLQyEbfGG5p7DYjydeyh 7101ZrSD4XRgkBjPllJ2ydBpSxdI4VizW+a3KjSajn4ZpgLNH4/YD6JXkoaiRlGv8lc2 L4n+Auhpw1jSiCJCrIZTnqFx/voiLqGcJKcpPWRiNE3d/tztxX2yxa7yp9GzffIKuZUR AvYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773039117; x=1773643917; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=aC+um2a762gfpLWPhHdIhYlAN3YczWO4vgnfj1X+hyE=; b=Z978YIDtSv9bsfC5sItctmXCUhu20KSaRmGDJcA4BgZV9DygPPkf9WxYYRR4KylLVu JgBzFjNxjJklkyxCX3IhvSurOBoFE1Bqi+zxvt08ligPJDwegDjVAL7qGEMRLbTvzeLI I1htIaR+GzBf1J6RSIfkS0fTJzAH8JdhOpwUbd0UE5r9bIiR2+t2iIeZcg9J1lRzUEsX 1rRCS/Suiv1RDIu/2yCQ0Gpnn1iOLo385luk8g5IMO+Ci0Vp3zRG2VRWk/hzH5ZBFRmc m+r3sHz44B1mbDS/8+1fYeuUdvfZPChqg8LLvP1QYya7yiSeL5sIcMm3hkq2gBVSdkpx UGag== X-Forwarded-Encrypted: i=1; AJvYcCUQcswNXNiZFP6QKT0FaRj+wpA4Fv8z3egmQLbQ95QDTSYOLZ2/MKHmTfm1mZj4nozjlhPxG60NvlcQTrQ=@vger.kernel.org X-Gm-Message-State: AOJu0YzW441ndSkg69Z4oDn0Pl6tgjdY8ex5uVXSpamwuHayjC/bGfOA rfF5TJSjE7x5arlugIceoQh8vHGe8TB62+qiYE2+u8jdz+vUP0BQHWBsZvX8h96LyMuqde8LA7G 7UhzM/D24BT3aA7qTMj/D/yKqSIL61cRPVf9ImuK8AL3R8h14gIjW+LJ5tsGlEeEkq4Q= X-Gm-Gg: ATEYQzzeape5l1n77FWQeRd9laVfZIfeU3z20IIk4rRG0KLAiTfunR8x8VgTYECdlvD kNwgkl/8zavLrAeNXvWRm16jHqtHw7yWn9keo5Rpc/k190QQr4CGVmzIP9efpmzVVTckawjTZE2 UC3mX5sfm7pVsqLYbgNtI1EDgtpn16bdJMugfxWH+icnO1vTn97dCJUbD133DUsEcsVUJ0+/0My ee0dZyLHosEzeWJzz9OXf6kpAyFz1Kz/J8kSRCDOWMlcQMasxyuxU3YYL3UYLWnlXKqfG98nga2 pQnpCg10Yom1Hu5HXJ9znsV2ibIGI9txNMPRV0FB2UiZyh4op6hZpoqh0mIJuwctCUpysA4cJJa 350a/hfcuKZEiVHYpRoIbL0ytUm4tVeo77o5QNeTpRxqupvT3U1LHhXs= X-Received: by 2002:a05:620a:444f:b0:8cd:8cb8:6ff9 with SMTP id af79cd13be357-8cd8cb87302mr150324785a.34.1773039117228; Sun, 08 Mar 2026 23:51:57 -0700 (PDT) X-Received: by 2002:a05:620a:444f:b0:8cd:8cb8:6ff9 with SMTP id af79cd13be357-8cd8cb87302mr150322885a.34.1773039116846; Sun, 08 Mar 2026 23:51:56 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48529f01997sm80449975e9.14.2026.03.08.23.51.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Mar 2026 23:51:56 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: mohammad.rafi.shaik@oss.qualcomm.com, linux-sound@vger.kernel.org, lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, johan@kernel.org, dmitry.baryshkov@oss.qualcomm.com, konrad.dybcio@oss.qualcomm.com, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, mailingradian@gmail.com, Srinivas Kandagatla Subject: [PATCH v5 11/13] ASoC: qcom: q6apm-lpass-dai: move graph start to trigger Date: Mon, 9 Mar 2026 06:51:35 +0000 Message-ID: <20260309065137.949053-12-srinivas.kandagatla@oss.qualcomm.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260309065137.949053-1-srinivas.kandagatla@oss.qualcomm.com> References: <20260309065137.949053-1-srinivas.kandagatla@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA5MDA2MSBTYWx0ZWRfX/pyb96xZZT2D ydroNF89C1VclcpLlaHHHgnpJFvI7IQzxvZuS/l0a9ttkpWbINTTP4+zSm5a9Mxem7uIs2Z/bBe GxYmpmY7xTRLeTOjf9xtIkeNfz+fodhkhBxSzka7x10Xp7gJcSzsS01Jr7k1fF/VzM127HRhmd8 Z4I5gII0WD5U0JKQKRTKyiA//q2F9uwzwtkkPkLQoEiky30QPK9D1Kg3tUtUoptNOcVEBrwTeF8 u6CPt80SHPy+r9WegHtTzlFxqfWH+URfrSl6kswBkaSAXsSmrZAok6AE+dtgPnf8dc4hwmrU6vK rpE2vTrIRavRzWMnTruTnPWBvPEtBhj7bnPoKUrZZUgg6OREpitXLPFBaIvJ8z+pndIEk4oU4UL ekVmz0dw366UjfFm1HimaPFAz8A69N6H4vcnsZzuRQNX4k/WhH9cOx15FlolQ52kXToi59pecjL E+hZWvmQGVKBcoSr9dQ== X-Proofpoint-ORIG-GUID: LFsqDGpXvucPAw5Yb39lzXv2X6Yv-FiJ X-Authority-Analysis: v=2.4 cv=QZtrf8bv c=1 sm=1 tr=0 ts=69ae6e0e cx=c_pps a=50t2pK5VMbmlHzFWWp8p/g==:117 a=ZsC4DHZuhs/kKio7QBcDoQ==:17 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=YMgV9FUhrdKAYTUUvYB2:22 a=EUspDBNiAAAA:8 a=8udmP7N65bQo3KbB_RsA:9 a=IoWCM6iH3mJn3m4BftBB:22 X-Proofpoint-GUID: LFsqDGpXvucPAw5Yb39lzXv2X6Yv-FiJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-09_02,2026-03-06_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 clxscore=1015 bulkscore=0 priorityscore=1501 impostorscore=0 malwarescore=0 phishscore=0 spamscore=0 suspectscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603090061 Content-Type: text/plain; charset="utf-8" Start the graph at trigger callback. Staring the graph at prepare does not make sense as there is no data transfer at this point. Moving this to trigger will also help cope situation where pipewire is not happy if display port is not connected during start. Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/qdsp6/q6apm-lpass-dais.c | 40 +++++++++++++++++-------- 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c b/sound/soc/qcom/qdsp6= /q6apm-lpass-dais.c index 472b2114c81e..70e283671f43 100644 --- a/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c +++ b/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c @@ -159,6 +159,31 @@ static void q6apm_lpass_dai_shutdown(struct snd_pcm_su= bstream *substream, struct } } =20 +static int q6apm_lpass_dai_trigger(struct snd_pcm_substream *substream, in= t cmd, + struct snd_soc_dai *dai) +{ + struct q6apm_lpass_dai_data *dai_data =3D dev_get_drvdata(dai->dev); + int ret =3D 0; + + switch (cmd) { + case SNDRV_PCM_TRIGGER_START: + case SNDRV_PCM_TRIGGER_RESUME: + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: + if (!dai_data->is_port_started[dai->id]) { + ret =3D q6apm_graph_start(dai_data->graph[dai->id]); + if (ret < 0) + dev_err(dai->dev, "Failed to start APM port %d\n", dai->id); + else + dai_data->is_port_started[dai->id] =3D true; + } + break; + default: + break; + } + + return ret; +} + static int q6apm_lpass_dai_prepare(struct snd_pcm_substream *substream, st= ruct snd_soc_dai *dai) { struct q6apm_lpass_dai_data *dai_data =3D dev_get_drvdata(dai->dev); @@ -171,10 +196,6 @@ static int q6apm_lpass_dai_prepare(struct snd_pcm_subs= tream *substream, struct s q6apm_graph_stop(dai_data->graph[dai->id]); dai_data->is_port_started[dai->id] =3D false; =20 - if (substream->stream =3D=3D SNDRV_PCM_STREAM_PLAYBACK) { - q6apm_graph_close(dai_data->graph[dai->id]); - dai_data->graph[dai->id] =3D NULL; - } } =20 /** @@ -203,14 +224,6 @@ static int q6apm_lpass_dai_prepare(struct snd_pcm_subs= tream *substream, struct s dev_err(dai->dev, "Failed to prepare Graph %d\n", rc); goto err; } - - rc =3D q6apm_graph_start(dai_data->graph[dai->id]); - if (rc < 0) { - dev_err(dai->dev, "Failed to start APM port %d\n", dai->id); - goto err; - } - dai_data->is_port_started[dai->id] =3D true; - return 0; err: if (substream->stream =3D=3D SNDRV_PCM_STREAM_PLAYBACK) { @@ -254,6 +267,7 @@ static const struct snd_soc_dai_ops q6dma_ops =3D { .shutdown =3D q6apm_lpass_dai_shutdown, .set_channel_map =3D q6dma_set_channel_map, .hw_params =3D q6dma_hw_params, + .trigger =3D q6apm_lpass_dai_trigger, }; =20 static const struct snd_soc_dai_ops q6i2s_ops =3D { @@ -263,6 +277,7 @@ static const struct snd_soc_dai_ops q6i2s_ops =3D { .set_channel_map =3D q6dma_set_channel_map, .hw_params =3D q6dma_hw_params, .set_fmt =3D q6i2s_set_fmt, + .trigger =3D q6apm_lpass_dai_trigger, }; =20 static const struct snd_soc_dai_ops q6hdmi_ops =3D { @@ -271,6 +286,7 @@ static const struct snd_soc_dai_ops q6hdmi_ops =3D { .shutdown =3D q6apm_lpass_dai_shutdown, .hw_params =3D q6hdmi_hw_params, .set_fmt =3D q6i2s_set_fmt, + .trigger =3D q6apm_lpass_dai_trigger, }; =20 static const struct snd_soc_component_driver q6apm_lpass_dai_component =3D= { --=20 2.47.3 From nobody Thu Apr 9 12:08:36 2026 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 6DC97366DD9 for ; Mon, 9 Mar 2026 06:52:00 +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=1773039122; cv=none; b=VZAcXTR2HvJ7wG7i1Bm+knz+hPbrTkHODo8bu3RqVPUv2qiCp8HbarGrCTcRL4SPtpWnP8HF6Iu1hZVp+qHNLFj3+/3sk9zPU2hg8U/A/S7ZCT53vV2ftT6nkShoSOtm18JS2/6GbCjdSRjUH65/j9fNwNsa6BSizT3jL9AFwTY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773039122; c=relaxed/simple; bh=VyhmcmdCocO/mXPDB+OqytJYIreg7wlJAag5CLmUSxg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BAZcqeNi/L0p4E92+so4a+7ahvyM6CEG9UGLwo3BOoz/uNqZkKhfAyRl4OZvh7RlTRxBnDRQEqmQ+/pPtrOQ4YQmP/r+np7ybo3MzyhkNkq1HykgvmWsgGRVITkcKB4mkOTuNqJs/6DG0u7/0BcuDaDOH1a7ARkuWH5gD2rtOEo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=A025RYo2; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=BAZGx46G; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="A025RYo2"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="BAZGx46G" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 628LwwEk077317 for ; Mon, 9 Mar 2026 06:51:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=XJegSL9SyIW 8NkmReRK6OuDLMZtYbsuyhgigi3fazVM=; b=A025RYo20wiU44Z47IRq/8GebSp bogZwwLBMogFPxaQvJ89uGH7aWJ0MqmCBHqRln1dvFdA1cM1TQF+xSJ+49oPh1Tz bCvRN1lgETiYyZDTFU7PRIQRa/SRXsp/tBL9HH1TKW6pedWO9E50POb4A5gK7Meq Ei4KhxF0v72T6+0DNPdsfvoXdsR19WfTGwCAvIEx0W4waYV3Tcs8NdHcKdA2v83W xwnWFhZM2yKyKBzymD138yqmvmgrUnKWCoibfYlTo/zO8wyyoueU9ZparCILYP5+ mOt+mzb8O24+bCCbFf0afq8aQKMMa1qewesXfaD2BmEX3wMD4ppnxOcaJ2A== Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4crc3vc674-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 09 Mar 2026 06:51:59 +0000 (GMT) Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-899ee20dd34so580273446d6.3 for ; Sun, 08 Mar 2026 23:51:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773039119; x=1773643919; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XJegSL9SyIW8NkmReRK6OuDLMZtYbsuyhgigi3fazVM=; b=BAZGx46G63XSIqSEPicW9UVLazzF3iMTcygLGAYWAJhwvjBxQfjgqR4+uEDnAmYQAm KLnK+WVPmLSr4HA6UmArDst6NKgRq61WgLn2tXaS4MwiZ/Qsuyq0oInvkJuBaJcUsd7t E3QbmoQLiLcDNRbDR6HZY6oFZNk5RzedP1mPvU8pMBlFXv7Q1lmnlNe4Y6Muh5j+FfaM 4+SqjG0jIjTra1LicmdwnaObrw0pGLV+epNyKF2HuXfPaJGzeCWdvm9QuZ8PR6wwcFTl 7dsV3uhr5hAvcUoa5/p5rOyRBhoB0321PdoL14dG54G1vk7Z5C2xKaw2YVM+WU+FvVQV P5bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773039119; x=1773643919; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=XJegSL9SyIW8NkmReRK6OuDLMZtYbsuyhgigi3fazVM=; b=A34YLZ/4aUpZBGzpM8oAueaFTBZtfkB7JwwJhLUG3h9h21+Hq+MJxKymS3hRCxfLE2 9Q/n8ApaGAFHsBL7MACPNeK9cwpTEGcFyHYsUOPysMZwGdPtPEEGrli2og+cMTVHSLea ZXuWsi2/szG4C4WAWw5sxIxSqr5W/KOFLlzLolvSooctQX/HwWFejYCIj3+7I6VXlaza Zo1zrGCL0aJchRildV7jFrqd4gfTgpSxfhpgvI3eDWNIzPnLYehEPE0fxCbb4tPE27VM mxnP6nwiJTtzjpYXIJ0VnZDCIxVsJvJ/Y/fIaJmeb9zPCP7erSl94pY7V4pcwTs4UrlG uNJQ== X-Forwarded-Encrypted: i=1; AJvYcCUMsp1UTMYM9DvQP9oQB8cRltivR4xg2rXvIa52DnC5bGw5qjnzMQfofNvGXXFkQwIdKKyqNOLlQ+9iPGo=@vger.kernel.org X-Gm-Message-State: AOJu0YxMUjeLm3FToFEMWmVfSdA26UNpWc1BQUDe9/t/xwciHsoJgw8G es9ok77o6ZaAvB6cSoIwjjko/KYzzBSR+uzAuna35OSVzuOc40Cjcu6MP0WysFPYHJebXwvWzBn GAiPToU9tX2VfwlqO7SwEYY7j6TmR9JBtxEifkXwFE+39m1Gp/PdaWXc6yaRBxgc8mXE= X-Gm-Gg: ATEYQzyQZyMuoiMlFNuh/CEVXta58j71RSWjwwFj2kfhZONAG3J1f/vg43CPQ14QG+2 0dMua7dXvONQrDxTtmzzZXMgT217xVoaGlwxsOY023YDoR72F9iTJdHBSvflRpYcpq+Pbrn+zcg GCbHPwMtl18h4VqLjIQUYtCpgTwRL6JEVX88//EmQzeNxmmAsCACDJjBYrC02U+F+Tw2erasjnq AOzZyUK+ALR2GE/yWGLtb9wrvfh1p5EueD0ZZZoE0LXpXh8IsGpUpHd9nW/hFI4dU26NVRARA1O GxA2oeIoRIhDqhggCzxnScBwTji4thijxOwmJdFW2fTMXfeAK7BGPtXTRj1LEsMlIaNsnrNjwzc kyXM5lTVvrLqk2AAefUf7bLFalC6wPugwMWfXmxJwNUQB5HB6IwTIOh4= X-Received: by 2002:a05:620a:450f:b0:8cb:4cc2:c5d3 with SMTP id af79cd13be357-8cd6d52e388mr1248046185a.73.1773039118853; Sun, 08 Mar 2026 23:51:58 -0700 (PDT) X-Received: by 2002:a05:620a:450f:b0:8cb:4cc2:c5d3 with SMTP id af79cd13be357-8cd6d52e388mr1248043985a.73.1773039118374; Sun, 08 Mar 2026 23:51:58 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48529f01997sm80449975e9.14.2026.03.08.23.51.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Mar 2026 23:51:57 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: mohammad.rafi.shaik@oss.qualcomm.com, linux-sound@vger.kernel.org, lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, johan@kernel.org, dmitry.baryshkov@oss.qualcomm.com, konrad.dybcio@oss.qualcomm.com, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, mailingradian@gmail.com, Srinivas Kandagatla Subject: [PATCH v5 12/13] ASoC: qcom: qdsp6: remove search for module iid in hot path Date: Mon, 9 Mar 2026 06:51:36 +0000 Message-ID: <20260309065137.949053-13-srinivas.kandagatla@oss.qualcomm.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260309065137.949053-1-srinivas.kandagatla@oss.qualcomm.com> References: <20260309065137.949053-1-srinivas.kandagatla@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: 4LSWmxRiz2m4Ub5LqsHtWZiXbrpnQhvC X-Proofpoint-GUID: 4LSWmxRiz2m4Ub5LqsHtWZiXbrpnQhvC X-Authority-Analysis: v=2.4 cv=OOQqHCaB c=1 sm=1 tr=0 ts=69ae6e0f cx=c_pps a=oc9J++0uMp73DTRD5QyR2A==:117 a=ZsC4DHZuhs/kKio7QBcDoQ==:17 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=EUspDBNiAAAA:8 a=Ll4dbTg5roZnn8cDlSAA:9 a=iYH6xdkBrDN1Jqds4HTS:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA5MDA2MSBTYWx0ZWRfXwlbDwtYIzdHf 0Ym6ew+QLaMLqWc+zitNblM9gbPkxVfTlV6NzrB5gC8zYXuFyqTtaWAAp4FjfZd2kRGr3CFiIkw 3+R4N1lurS4s6TjcQ7SDlBMtcnRkbvwpaiRLYoIqmplEOyS0jZD6mJjPO42gxKrv3ACF6WD+AsK +ls7PLBZGzUkL9gBzYaLocb17h1RUSTXnY2pIxuHf/NpMArVdiHfK3Ns2dvRJOPdlenTXNpupYi fUZGt3au7xFvP92bUk6QPpQio5IVpQsBPyBikU5JqUgmJuhEBlkrg5Vr95N/yz/eWnyaz9Tqwqy VS9MGusUsdfZPKXj5Zl0gin18vyYxrAwI6lcoeAFzju0A5q2gaEBHH85w+W5wfjlyYV+ICZYiTQ TXDjRrtqrKJ/Eba5R4NRJqy5qXVyBibpQbZi69AE6dy78Ruw+ORA1cdwPLx73PS0WelBYNTqmxo sZle5tEAa58+zlUhGOw== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-09_02,2026-03-06_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 impostorscore=0 suspectscore=0 spamscore=0 malwarescore=0 bulkscore=0 clxscore=1015 phishscore=0 lowpriorityscore=0 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603090061 Content-Type: text/plain; charset="utf-8" Remove searching for Shared Memory module instance id on every read/write call, this is un-necessary if we can cache the shared memory module instance id per PCM graph. Add new member to graph struct to store shared memory module instance id to avoid searching for this in hot path. Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/qdsp6/q6apm-dai.c | 5 +++-- sound/soc/qcom/qdsp6/q6apm-lpass-dais.c | 4 ++-- sound/soc/qcom/qdsp6/q6apm.c | 14 +++++++++----- sound/soc/qcom/qdsp6/q6apm.h | 3 ++- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/sound/soc/qcom/qdsp6/q6apm-dai.c b/sound/soc/qcom/qdsp6/q6apm-= dai.c index 3eff45b241c9..bdd4cc458acd 100644 --- a/sound/soc/qcom/qdsp6/q6apm-dai.c +++ b/sound/soc/qcom/qdsp6/q6apm-dai.c @@ -355,7 +355,7 @@ static int q6apm_dai_open(struct snd_soc_component *com= ponent, =20 spin_lock_init(&prtd->lock); prtd->substream =3D substream; - prtd->graph =3D q6apm_graph_open(dev, event_handler, prtd, graph_id); + prtd->graph =3D q6apm_graph_open(dev, event_handler, prtd, graph_id, subs= tream->stream); if (IS_ERR(prtd->graph)) { dev_err(dev, "%s: Could not allocate memory\n", __func__); ret =3D PTR_ERR(prtd->graph); @@ -496,7 +496,8 @@ static int q6apm_dai_compr_open(struct snd_soc_componen= t *component, return -ENOMEM; =20 prtd->cstream =3D stream; - prtd->graph =3D q6apm_graph_open(dev, event_handler_compr, prtd, graph_id= ); + prtd->graph =3D q6apm_graph_open(dev, event_handler_compr, prtd, graph_id, + SNDRV_PCM_STREAM_PLAYBACK); if (IS_ERR(prtd->graph)) { ret =3D PTR_ERR(prtd->graph); kfree(prtd); diff --git a/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c b/sound/soc/qcom/qdsp6= /q6apm-lpass-dais.c index 70e283671f43..aceb2ac9bac8 100644 --- a/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c +++ b/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c @@ -203,7 +203,7 @@ static int q6apm_lpass_dai_prepare(struct snd_pcm_subst= ream *substream, struct s * graph, so sequence for playback and capture will be different */ if (substream->stream =3D=3D SNDRV_PCM_STREAM_PLAYBACK && dai_data->graph= [dai->id] =3D=3D NULL) { - graph =3D q6apm_graph_open(dai->dev, NULL, dai->dev, graph_id); + graph =3D q6apm_graph_open(dai->dev, NULL, dai->dev, graph_id, substream= ->stream); if (IS_ERR(graph)) { dev_err(dai->dev, "Failed to open graph (%d)\n", graph_id); rc =3D PTR_ERR(graph); @@ -240,7 +240,7 @@ static int q6apm_lpass_dai_startup(struct snd_pcm_subst= ream *substream, struct s int graph_id =3D dai->id; =20 if (substream->stream =3D=3D SNDRV_PCM_STREAM_CAPTURE) { - graph =3D q6apm_graph_open(dai->dev, NULL, dai->dev, graph_id); + graph =3D q6apm_graph_open(dai->dev, NULL, dai->dev, graph_id, substream= ->stream); if (IS_ERR(graph)) { dev_err(dai->dev, "Failed to open graph (%d)\n", graph_id); return PTR_ERR(graph); diff --git a/sound/soc/qcom/qdsp6/q6apm.c b/sound/soc/qcom/qdsp6/q6apm.c index f190ad5e912a..7ef6ae0b1759 100644 --- a/sound/soc/qcom/qdsp6/q6apm.c +++ b/sound/soc/qcom/qdsp6/q6apm.c @@ -411,12 +411,11 @@ int q6apm_write_async(struct q6apm_graph *graph, uint= 32_t len, uint32_t msw_ts, { struct apm_data_cmd_wr_sh_mem_ep_data_buffer_v2 *write_buffer; struct audio_buffer *ab; - int iid =3D q6apm_graph_get_rx_shmem_module_iid(graph); =20 struct gpr_pkt *pkt __free(kfree) =3D audioreach_alloc_pkt(sizeof(*write_= buffer), DATA_CMD_WR_SH_MEM_EP_DATA_BUFFER_V2, graph->rx_data.dsp_buf | (len << APM_WRITE_TOKEN_LEN_SHIFT), - graph->port->id, iid); + graph->port->id, graph->shm_iid); if (IS_ERR(pkt)) return PTR_ERR(pkt); =20 @@ -449,11 +448,10 @@ int q6apm_read(struct q6apm_graph *graph) struct data_cmd_rd_sh_mem_ep_data_buffer_v2 *read_buffer; struct audioreach_graph_data *port; struct audio_buffer *ab; - int iid =3D q6apm_graph_get_tx_shmem_module_iid(graph); =20 struct gpr_pkt *pkt __free(kfree) =3D audioreach_alloc_pkt(sizeof(*read_b= uffer), DATA_CMD_RD_SH_MEM_EP_DATA_BUFFER_V2, - graph->tx_data.dsp_buf, graph->port->id, iid); + graph->tx_data.dsp_buf, graph->port->id, graph->shm_iid); if (IS_ERR(pkt)) return PTR_ERR(pkt); =20 @@ -604,7 +602,7 @@ static int graph_callback(const struct gpr_resp_pkt *da= ta, void *priv, int op) } =20 struct q6apm_graph *q6apm_graph_open(struct device *dev, q6apm_cb cb, - void *priv, int graph_id) + void *priv, int graph_id, int dir) { struct q6apm *apm =3D dev_get_drvdata(dev->parent); struct audioreach_graph *ar_graph; @@ -631,6 +629,12 @@ struct q6apm_graph *q6apm_graph_open(struct device *de= v, q6apm_cb cb, graph->id =3D ar_graph->id; graph->dev =3D dev; =20 + if (dir =3D=3D SNDRV_PCM_STREAM_PLAYBACK) + graph->shm_iid =3D q6apm_graph_get_rx_shmem_module_iid(graph); + else + graph->shm_iid =3D q6apm_graph_get_tx_shmem_module_iid(graph); + + mutex_init(&graph->lock); init_waitqueue_head(&graph->cmd_wait); =20 diff --git a/sound/soc/qcom/qdsp6/q6apm.h b/sound/soc/qcom/qdsp6/q6apm.h index 5cf538397841..7c646ffcf956 100644 --- a/sound/soc/qcom/qdsp6/q6apm.h +++ b/sound/soc/qcom/qdsp6/q6apm.h @@ -99,6 +99,7 @@ struct q6apm_graph { void *priv; q6apm_cb cb; uint32_t id; + uint32_t shm_iid; struct device *dev; struct q6apm *apm; gpr_port_t *port; @@ -113,7 +114,7 @@ struct q6apm_graph { =20 /* Graph Operations */ struct q6apm_graph *q6apm_graph_open(struct device *dev, q6apm_cb cb, - void *priv, int graph_id); + void *priv, int graph_id, int dir); int q6apm_graph_close(struct q6apm_graph *graph); int q6apm_graph_prepare(struct q6apm_graph *graph); int q6apm_graph_start(struct q6apm_graph *graph); --=20 2.47.3 From nobody Thu Apr 9 12:08:36 2026 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 78B9F368264 for ; Mon, 9 Mar 2026 06:52:02 +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=1773039124; cv=none; b=UfKBzKcnva56t5QewL4ZFpNsJKFBZRI6XKTutd1o0ma9rEAkcsFy6/uzbStXGaaPAD/GBd5fkcmyakClRvpmUq0NuELK7TkjxbZfZRoFHPZE0/NcejchLBMKXD5Bdkj3bM8eE2KeExmg1LA0A2c5h1t5lNM9tJpeoAHWhwGk/Og= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773039124; c=relaxed/simple; bh=DvFP/wvaJ5CtBSK4QE/DhIGDUkVqOv8tT7vU0VUqQmU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gYKo+IDXgIIfmWGLTZvZ2CUuZ/pqH1eCSEpUjx5GrJnWHSCVoGlgHRJarSRbBleB129iH5VOOtXGH6C1ZNnAotbu0ssIlQdQGdkctLqOdmsw5dstjnqJV365XbxxwyhdaE7Mz+Wy8FPoMQIPCOZIvwPxmjvSTjCtUGM3DM9er40= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=AY8AsToY; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=U0PxOd1h; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="AY8AsToY"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="U0PxOd1h" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 628N0kBt2558622 for ; Mon, 9 Mar 2026 06:52:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=jvoT3l7ozYp q4t2jEp63vepOyrzL4M48KQbe9Tm5zvE=; b=AY8AsToY8uiA4Yw2LcKgnMfU7b7 5RBnUPU51prEmVYBZLUpCTD1OBZupFisXq+CRX9cXEDn4hxIr7fWvz2i5cTxhPxo Ea7sZGpctvOpy4HvnZ6WlOxBlvQKmA8g1S31Xa2VDVVsZ6Hsww8dYBfItkwZIISf L8GXbSvshuDW6a3KsY64H2evTeVvSq07fKHD1ZJX4aOBuGHa+UGA2gci4wMgyc3P Nig3ilUfQcB00yt5aPz0PUlqEXM7F2Zo0fpovZhym0GVz4dDQ1A5fcTjlZVFlkXU k5CjSeS3+gA1yZ5rlhc3x593XNSHkKLpSm1tm1IRuwnfNpNk2Au4P2MqyhQ== Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4crbbg48mv-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 09 Mar 2026 06:52:01 +0000 (GMT) Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-8cd7f6ac239so791646685a.2 for ; Sun, 08 Mar 2026 23:52:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773039121; x=1773643921; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jvoT3l7ozYpq4t2jEp63vepOyrzL4M48KQbe9Tm5zvE=; b=U0PxOd1h81HdfoRxTeS75Z87vD52FIm+DQYf7R/Jw7UGFu3QC287dIC1efF9cCmcR2 ary9BN/0dPKaj55X3OnnreWp13qoUPylvlMaEPBo4o5QIouei6vYYPU3dO97idgC/aS7 w5A0ZRKKbsKpPuBI2fcDsIlh8MOfQDWdK+qQJP7wsgRL3jM5yujv7prFIJfwVDLzUQ7r fPpWTn+q1nY64ZA5C3GuCf4fbEnoXDWO5FrofJF9ZMDHvzHmnHVfuk4CJGuBPADSNQb5 muXuIWX/nT5fFZw/mKSyTG+1oZCFbN98UaH/E4y7rSg6Fhr+wSNaN97DXkjJEK+Q6BWO 9Vyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773039121; x=1773643921; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=jvoT3l7ozYpq4t2jEp63vepOyrzL4M48KQbe9Tm5zvE=; b=lfI2Pr6GQcu5C10p1alhCuE3+F5FZOuh0ATeOo7gRm1Evj10ZVdxzF/3AMNbfbM4js U3vb3JMFHjLyl7csmbpa0gjvc3zIKHOSCQJ05gf+UOna5LDZSwhDdL5yE4ehVPr0pvnB BvBBvk9Z3nWKtLOvLlBUlMlPde/Mf0LskXzjQL9dcwdDVSjZtnBUdUioq+e39OJTJMSj SIYoDyotA43mgsPPPUFnbLFW14Ir4NrVxrCAPnJSUzyPwGBtxxf83VMpms00nx7ZBFaf cohCcIjbgCjlMPnHwotFG1uZ0jWVPiUU2bNtV/p6s4/pTH0OJEbq3ccoIdALpNtAkNzk 0Zug== X-Forwarded-Encrypted: i=1; AJvYcCUeIwkKYrmgZ2ny3l6ATwSrIgRfCeOFeg4EYlTceJHA93Dx6hr2VWMwzmklKwePkmCvccQRnO5ppX/dvPE=@vger.kernel.org X-Gm-Message-State: AOJu0YwBREdmrsFx8iErX8NzRGe49pWFXUl5Q21mM36aD4dzXIjOu7Du 3pzy/9GVE+KrBNq81f28HqYj7uxk+GgSuXTcMhqAFS3k3uq/Y6dE82UyEiQQAx3fTU/pyHFrZHG jdkjwO35S3p5FMbQljKEoHN42PEI4ImgzURDQYNthg161r8Y88iETVFej1tkPZ35j5Uo= X-Gm-Gg: ATEYQzy/Y836QSCjT8EDzlMiKlvRMHDs5h6SCq7By8LVhrQKa8uY9/LFkm0rtNz/h+z IFxmK93zkkqdr5SdPio41Rvx5idSDmPxH247vKXSIyKAFc/v4gqtO0JKBgaEwr6ZjBZu6ksGSkB 1rBS7Tsn9b2/ycQBUbuULbZxo+9V4tz6bKHWNx2foBXm2wWxZn7a53quJcDRM20FNFdtZ15APzl yBarVJlXTbl7WGdgZHpGkBf9eROfnMMKej7jMwDeaecP1POhrqoQndJykx6MDmH6+KrqC5UL16m 2/P/GWyRTkHLpqODNn0zlu8JAExrSHPqaF3SUl6YQA5wuwFAEQBOyl13q+XPlQFIjbHIZydqzJV xUbrDlFvwIaj/VOV/RsjzzEBzB0ULGdqi1AxS5IU2/Fwj6kMikhG3hrA= X-Received: by 2002:a05:620a:1711:b0:8cd:8fb7:7b13 with SMTP id af79cd13be357-8cd8fb77fc1mr31688385a.10.1773039120425; Sun, 08 Mar 2026 23:52:00 -0700 (PDT) X-Received: by 2002:a05:620a:1711:b0:8cd:8fb7:7b13 with SMTP id af79cd13be357-8cd8fb77fc1mr31686085a.10.1773039119826; Sun, 08 Mar 2026 23:51:59 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48529f01997sm80449975e9.14.2026.03.08.23.51.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Mar 2026 23:51:59 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: mohammad.rafi.shaik@oss.qualcomm.com, linux-sound@vger.kernel.org, lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, johan@kernel.org, dmitry.baryshkov@oss.qualcomm.com, konrad.dybcio@oss.qualcomm.com, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, mailingradian@gmail.com, Srinivas Kandagatla Subject: [PATCH v5 13/13] ASoC: qcom: q6apm: Add support for early buffer mapping on DSP Date: Mon, 9 Mar 2026 06:51:37 +0000 Message-ID: <20260309065137.949053-14-srinivas.kandagatla@oss.qualcomm.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260309065137.949053-1-srinivas.kandagatla@oss.qualcomm.com> References: <20260309065137.949053-1-srinivas.kandagatla@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: jKwvMmzdnHyDlrQLhOl8Dk0A803swa9C X-Proofpoint-ORIG-GUID: jKwvMmzdnHyDlrQLhOl8Dk0A803swa9C X-Authority-Analysis: v=2.4 cv=SumdKfO0 c=1 sm=1 tr=0 ts=69ae6e11 cx=c_pps a=HLyN3IcIa5EE8TELMZ618Q==:117 a=ZsC4DHZuhs/kKio7QBcDoQ==:17 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=ZpdpYltYx_vBUK5n70dp:22 a=EUspDBNiAAAA:8 a=Lmls0Cg-LgRrrh2KKlkA:9 a=bTQJ7kPSJx9SKPbeHEYW:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA5MDA2MSBTYWx0ZWRfX9iIRL1aCP18N UAHX6QRa/sTS31QTXipifmvLgo8KeYUDcwpV8pB3MgxyiAtObZtXSJqitqF8tDFaTa6JnL3j2l8 Q5otqT0vdKD7spGdl7+bFWQl4qWIFq0t75G4HkYMVQe0IM6mIMVOAi6AQrwYxW5IHxZ1HBYQ+gn Qfb7g2KIjKLDZBrJMEkGMIV1tJRBT2DdQIkxdP9iPy/Vt8i4EM53Usxms1gfnQTbQfWiQ08DuQu XC7IPX2noFrNsvEdjaVGokgOizjQS+vZ6cDee7FYgQF8PuiGTZ2dOeol7E1BVAszxwLcB4J4y7v 0E2CpUUTAHban9fVt22AZ3Fis/vVNnD0HNRTTh7F+8JGwDAHJp13be7k042Aiw6nmtpTjI3muhv ZnppP2UR7AFD+6I8aWB0afLD4K9eqL9f5HNzziTb+/iUzKY42WvY+xDT7wbE2GI5uamKa6Rkuem 3dguh4eESBfbGL/pvOQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-09_02,2026-03-06_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 priorityscore=1501 impostorscore=0 spamscore=0 adultscore=0 phishscore=0 lowpriorityscore=0 bulkscore=0 malwarescore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603090061 Content-Type: text/plain; charset="utf-8" Buffers are allocated on pcm_new and mapped in the dsp on every prepare call, which is inefficient and unnecessary. Add new functions q6apm_[un]map_memory_fixed_region to map it on to dsp only once after allocation. Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/qdsp6/audioreach.c | 60 ------------ sound/soc/qcom/qdsp6/audioreach.h | 5 +- sound/soc/qcom/qdsp6/q6apm-dai.c | 95 +++++++++++++++--- sound/soc/qcom/qdsp6/q6apm.c | 157 ++++++++++++++++++++---------- sound/soc/qcom/qdsp6/q6apm.h | 15 ++- 5 files changed, 203 insertions(+), 129 deletions(-) diff --git a/sound/soc/qcom/qdsp6/audioreach.c b/sound/soc/qcom/qdsp6/audio= reach.c index 241c3b4479c6..b2975eebab71 100644 --- a/sound/soc/qcom/qdsp6/audioreach.c +++ b/sound/soc/qcom/qdsp6/audioreach.c @@ -1396,66 +1396,6 @@ void audioreach_graph_free_buf(struct q6apm_graph *g= raph) } EXPORT_SYMBOL_GPL(audioreach_graph_free_buf); =20 -int audioreach_map_memory_regions(struct q6apm_graph *graph, unsigned int = dir, size_t period_sz, - unsigned int periods, bool is_contiguous) -{ - struct apm_shared_map_region_payload *mregions; - struct apm_cmd_shared_mem_map_regions *cmd; - uint32_t num_regions, buf_sz, payload_size; - struct audioreach_graph_data *data; - struct gpr_pkt *pkt __free(kfree) =3D NULL; - void *p; - int i; - - if (dir =3D=3D SNDRV_PCM_STREAM_PLAYBACK) - data =3D &graph->rx_data; - else - data =3D &graph->tx_data; - - if (is_contiguous) { - num_regions =3D 1; - buf_sz =3D period_sz * periods; - } else { - buf_sz =3D period_sz; - num_regions =3D periods; - } - - /* DSP expects size should be aligned to 4K */ - buf_sz =3D ALIGN(buf_sz, 4096); - - payload_size =3D sizeof(*cmd) + (sizeof(*mregions) * num_regions); - - pkt =3D audioreach_alloc_apm_pkt(payload_size, APM_CMD_SHARED_MEM_MAP_REG= IONS, dir, - graph->port->id); - if (IS_ERR(pkt)) - return PTR_ERR(pkt); - - p =3D (void *)pkt + GPR_HDR_SIZE; - cmd =3D p; - cmd->mem_pool_id =3D APM_MEMORY_MAP_SHMEM8_4K_POOL; - cmd->num_regions =3D num_regions; - - cmd->property_flag =3D 0x0; - - mregions =3D p + sizeof(*cmd); - - mutex_lock(&graph->lock); - - for (i =3D 0; i < num_regions; i++) { - struct audio_buffer *ab; - - ab =3D &data->buf[i]; - mregions->shm_addr_lsw =3D lower_32_bits(ab->phys); - mregions->shm_addr_msw =3D upper_32_bits(ab->phys); - mregions->mem_size_bytes =3D buf_sz; - ++mregions; - } - mutex_unlock(&graph->lock); - - return audioreach_graph_send_cmd_sync(graph, pkt, APM_CMD_RSP_SHARED_MEM_= MAP_REGIONS); -} -EXPORT_SYMBOL_GPL(audioreach_map_memory_regions); - int audioreach_shared_memory_send_eos(struct q6apm_graph *graph) { struct data_cmd_wr_sh_mem_ep_eos *eos; diff --git a/sound/soc/qcom/qdsp6/audioreach.h b/sound/soc/qcom/qdsp6/audio= reach.h index 89f172aab8c0..6ddc287f0fb4 100644 --- a/sound/soc/qcom/qdsp6/audioreach.h +++ b/sound/soc/qcom/qdsp6/audioreach.h @@ -722,6 +722,7 @@ struct audioreach_connection { =20 struct audioreach_graph_info { int id; + uint32_t mem_map_handle; uint32_t num_sub_graphs; struct list_head sg_list; /* DPCM connection from FE Graph to BE graph */ @@ -838,10 +839,6 @@ int audioreach_tplg_init(struct snd_soc_component *com= ponent); =20 /* Module specific */ void audioreach_graph_free_buf(struct q6apm_graph *graph); -int audioreach_map_memory_regions(struct q6apm_graph *graph, - unsigned int dir, size_t period_sz, - unsigned int periods, - bool is_contiguous); int audioreach_send_cmd_sync(struct device *dev, gpr_device_t *gdev, struc= t gpr_ibasic_rsp_result_t *result, struct mutex *cmd_lock, gpr_port_t *port, wait_queue_head_t *cmd_w= ait, struct gpr_pkt *pkt, uint32_t rsp_opcode); diff --git a/sound/soc/qcom/qdsp6/q6apm-dai.c b/sound/soc/qcom/qdsp6/q6apm-= dai.c index bdd4cc458acd..f4a9098fde10 100644 --- a/sound/soc/qcom/qdsp6/q6apm-dai.c +++ b/sound/soc/qcom/qdsp6/q6apm-dai.c @@ -228,11 +228,10 @@ static int q6apm_dai_prepare(struct snd_soc_component= *component, cfg.bit_width =3D prtd->bits_per_sample; cfg.fmt =3D SND_AUDIOCODEC_PCM; audioreach_set_default_channel_mapping(cfg.channel_map, runtime->channels= ); - if (prtd->state) { /* clear the previous setup if any */ q6apm_graph_stop(prtd->graph); - q6apm_unmap_memory_regions(prtd->graph, substream->stream); + q6apm_free_fragments(prtd->graph, substream->stream); } =20 prtd->pcm_count =3D snd_pcm_lib_period_bytes(substream); @@ -247,8 +246,8 @@ static int q6apm_dai_prepare(struct snd_soc_component *= component, if (ret < 0) dev_err(dev, "%s: CMD Format block failed\n", __func__); =20 - ret =3D q6apm_map_memory_regions(prtd->graph, substream->stream, prtd->ph= ys, - (prtd->pcm_size / prtd->periods), prtd->periods); + ret =3D q6apm_alloc_fragments(prtd->graph, substream->stream, prtd->phys, + (prtd->pcm_size / prtd->periods), prtd->periods); =20 if (ret < 0) { dev_err(dev, "Audio Start: Buffer Allocation failed rc =3D %d\n", ret); @@ -403,6 +402,8 @@ static int q6apm_dai_open(struct snd_soc_component *com= ponent, else prtd->phys =3D substream->dma_buffer.addr | (pdata->sid << 32); =20 + q6apm_set_memory_map_handle(prtd->graph, substream->stream); + return 0; err: kfree(prtd); @@ -416,9 +417,10 @@ static int q6apm_dai_close(struct snd_soc_component *c= omponent, struct snd_pcm_runtime *runtime =3D substream->runtime; struct q6apm_dai_rtd *prtd =3D runtime->private_data; =20 - if (prtd->state) { /* only stop graph that is started */ + if (prtd->state) { + /* only stop graph that is started */ q6apm_graph_stop(prtd->graph); - q6apm_unmap_memory_regions(prtd->graph, substream->stream); + q6apm_free_fragments(prtd->graph, substream->stream); } =20 q6apm_graph_close(prtd->graph); @@ -467,11 +469,80 @@ static int q6apm_dai_hw_params(struct snd_soc_compone= nt *component, return 0; } =20 +static int q6apm_dai_memory_map(struct snd_soc_component *component, + struct snd_pcm_substream *substream, int graph_id) +{ + struct q6apm_dai_data *pdata; + struct device *dev =3D component->dev; + phys_addr_t phys; + int ret; + + pdata =3D snd_soc_component_get_drvdata(component); + if (!pdata) { + dev_err(component->dev, "Drv data not found ..\n"); + return -EINVAL; + } + + if (pdata->sid < 0) + phys =3D substream->dma_buffer.addr; + else + phys =3D substream->dma_buffer.addr | (pdata->sid << 32); + + ret =3D q6apm_map_memory_fixed_region(dev, graph_id, phys, BUFFER_BYTES_M= AX); + if (ret < 0) + dev_err(dev, "Audio Start: Buffer Allocation failed rc =3D %d\n", ret); + + return ret; +} + static int q6apm_dai_pcm_new(struct snd_soc_component *component, struct s= nd_soc_pcm_runtime *rtd) { + struct snd_soc_dai *cpu_dai =3D snd_soc_rtd_to_cpu(rtd, 0); + struct snd_pcm *pcm =3D rtd->pcm; int size =3D BUFFER_BYTES_MAX; + int graph_id, ret; + struct snd_pcm_substream *substream; + + graph_id =3D cpu_dai->driver->id; =20 - return snd_pcm_set_fixed_buffer_all(rtd->pcm, SNDRV_DMA_TYPE_DEV, compone= nt->dev, size); + ret =3D snd_pcm_set_fixed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, component->= dev, size); + if (ret) + return ret; + + if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { + substream =3D pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; + ret =3D q6apm_dai_memory_map(component, substream, graph_id); + if (ret) + return ret; + } + + if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { + substream =3D pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; + q6apm_dai_memory_map(component, substream, graph_id); + if (ret) + return ret; + } + + return 0; +} + +static void q6apm_dai_pcm_destruct(struct snd_soc_component *component, st= ruct snd_pcm *pcm) +{ + struct snd_pcm_substream *substream; + struct snd_soc_pcm_runtime *soc_prtd; + struct snd_soc_dai *cpu_dai; + int graph_id; + + if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) + substream =3D pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; + else + substream =3D pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; + + soc_prtd =3D snd_soc_substream_to_rtd(substream); + cpu_dai =3D snd_soc_rtd_to_cpu(soc_prtd, 0); + + graph_id =3D cpu_dai->driver->id; + q6apm_unmap_memory_fixed_region(component->dev, graph_id); } =20 static int q6apm_dai_compr_open(struct snd_soc_component *component, @@ -530,7 +601,8 @@ static int q6apm_dai_compr_free(struct snd_soc_componen= t *component, struct q6apm_dai_rtd *prtd =3D runtime->private_data; =20 q6apm_graph_stop(prtd->graph); - q6apm_unmap_memory_regions(prtd->graph, SNDRV_PCM_STREAM_PLAYBACK); + q6apm_free_fragments(prtd->graph, SNDRV_PCM_STREAM_PLAYBACK); + q6apm_unmap_memory_fixed_region(component->dev, prtd->graph->id); q6apm_graph_close(prtd->graph); snd_dma_free_pages(&prtd->dma_buffer); prtd->graph =3D NULL; @@ -679,9 +751,9 @@ static int q6apm_dai_compr_set_params(struct snd_soc_co= mponent *component, if (ret) return ret; =20 - ret =3D q6apm_map_memory_regions(prtd->graph, SNDRV_PCM_STREAM_PLAYBACK, - prtd->phys, (prtd->pcm_size / prtd->periods), - prtd->periods); + ret =3D q6apm_alloc_fragments(prtd->graph, SNDRV_PCM_STREAM_PLAYBACK, + prtd->phys, (prtd->pcm_size / prtd->periods), + prtd->periods); if (ret < 0) return -ENOMEM; =20 @@ -834,6 +906,7 @@ static const struct snd_soc_component_driver q6apm_fe_d= ai_component =3D { .close =3D q6apm_dai_close, .prepare =3D q6apm_dai_prepare, .pcm_construct =3D q6apm_dai_pcm_new, + .pcm_destruct =3D q6apm_dai_pcm_destruct, .hw_params =3D q6apm_dai_hw_params, .pointer =3D q6apm_dai_pointer, .trigger =3D q6apm_dai_trigger, diff --git a/sound/soc/qcom/qdsp6/q6apm.c b/sound/soc/qcom/qdsp6/q6apm.c index 7ef6ae0b1759..286b3d2c589d 100644 --- a/sound/soc/qcom/qdsp6/q6apm.c +++ b/sound/soc/qcom/qdsp6/q6apm.c @@ -200,13 +200,59 @@ int q6apm_graph_media_format_shmem(struct q6apm_graph= *graph, } EXPORT_SYMBOL_GPL(q6apm_graph_media_format_shmem); =20 -int q6apm_map_memory_regions(struct q6apm_graph *graph, unsigned int dir, = phys_addr_t phys, - size_t period_sz, unsigned int periods) +void q6apm_set_memory_map_handle(struct q6apm_graph *graph, unsigned int d= ir) +{ + if (dir =3D=3D SNDRV_PCM_STREAM_PLAYBACK) + graph->rx_data.mem_map_handle =3D graph->info->mem_map_handle; + else + graph->tx_data.mem_map_handle =3D graph->info->mem_map_handle; +} +EXPORT_SYMBOL_GPL(q6apm_set_memory_map_handle); + +int q6apm_map_memory_fixed_region(struct device *dev, unsigned int graph_i= d, phys_addr_t phys, + size_t sz) +{ + struct audioreach_graph_info *info; + struct q6apm *apm =3D dev_get_drvdata(dev->parent); + struct apm_shared_map_region_payload *mregions; + struct apm_cmd_shared_mem_map_regions *cmd; + int payload_size =3D sizeof(*cmd) + (sizeof(*mregions)); + uint32_t buf_sz; + void *p; + struct gpr_pkt *pkt __free(kfree) =3D audioreach_alloc_apm_cmd_pkt(payloa= d_size, + APM_CMD_SHARED_MEM_MAP_REGIONS, graph_id); + if (IS_ERR(pkt)) + return PTR_ERR(pkt); + + info =3D idr_find(&apm->graph_info_idr, graph_id); + if (!info) + return -ENODEV; + + /* DSP expects size should be aligned to 4K */ + buf_sz =3D ALIGN(sz, 4096); + + p =3D (void *)pkt + GPR_HDR_SIZE; + cmd =3D p; + cmd->mem_pool_id =3D APM_MEMORY_MAP_SHMEM8_4K_POOL; + cmd->num_regions =3D 1; + cmd->property_flag =3D 0x0; + + mregions =3D p + sizeof(*cmd); + + mregions->shm_addr_lsw =3D lower_32_bits(phys); + mregions->shm_addr_msw =3D upper_32_bits(phys); + mregions->mem_size_bytes =3D buf_sz; + + return q6apm_send_cmd_sync(apm, pkt, APM_CMD_RSP_SHARED_MEM_MAP_REGIONS); +} +EXPORT_SYMBOL_GPL(q6apm_map_memory_fixed_region); + +int q6apm_alloc_fragments(struct q6apm_graph *graph, unsigned int dir, phy= s_addr_t phys, + size_t period_sz, unsigned int periods) { struct audioreach_graph_data *data; struct audio_buffer *buf; int cnt; - int rc; =20 if (dir =3D=3D SNDRV_PCM_STREAM_PLAYBACK) data =3D &graph->rx_data; @@ -248,21 +294,37 @@ int q6apm_map_memory_regions(struct q6apm_graph *grap= h, unsigned int dir, phys_a =20 mutex_unlock(&graph->lock); =20 - rc =3D audioreach_map_memory_regions(graph, dir, period_sz, periods, 1); - if (rc < 0) { - dev_err(graph->dev, "Memory_map_regions failed\n"); - audioreach_graph_free_buf(graph); - } - - return rc; + return 0; } -EXPORT_SYMBOL_GPL(q6apm_map_memory_regions); +EXPORT_SYMBOL_GPL(q6apm_alloc_fragments); =20 -int q6apm_unmap_memory_regions(struct q6apm_graph *graph, unsigned int dir) +int q6apm_unmap_memory_fixed_region(struct device *dev, unsigned int graph= _id) { struct apm_cmd_shared_mem_unmap_regions *cmd; + struct q6apm *apm =3D dev_get_drvdata(dev->parent); + struct audioreach_graph_info *info; + struct gpr_pkt *pkt __free(kfree) =3D audioreach_alloc_apm_cmd_pkt(sizeof= (*cmd), + APM_CMD_SHARED_MEM_UNMAP_REGIONS, graph_id); + if (IS_ERR(pkt)) + return PTR_ERR(pkt); + + info =3D idr_find(&apm->graph_info_idr, graph_id); + if (!info) + return -ENODEV; + + if (!info->mem_map_handle) + return 0; + + cmd =3D (void *)pkt + GPR_HDR_SIZE; + cmd->mem_map_handle =3D info->mem_map_handle; + + return q6apm_send_cmd_sync(apm, pkt, APM_CMD_SHARED_MEM_UNMAP_REGIONS); +} +EXPORT_SYMBOL_GPL(q6apm_unmap_memory_fixed_region); + +int q6apm_free_fragments(struct q6apm_graph *graph, unsigned int dir) +{ struct audioreach_graph_data *data; - int rc; =20 if (dir =3D=3D SNDRV_PCM_STREAM_PLAYBACK) data =3D &graph->rx_data; @@ -272,22 +334,11 @@ int q6apm_unmap_memory_regions(struct q6apm_graph *gr= aph, unsigned int dir) if (!data->mem_map_handle) return 0; =20 - struct gpr_pkt *pkt __free(kfree) =3D - audioreach_alloc_apm_pkt(sizeof(*cmd), APM_CMD_SHARED_MEM_UNMAP_REGIONS, - dir, graph->port->id); - if (IS_ERR(pkt)) - return PTR_ERR(pkt); - - cmd =3D (void *)pkt + GPR_HDR_SIZE; - cmd->mem_map_handle =3D data->mem_map_handle; - - rc =3D audioreach_graph_send_cmd_sync(graph, pkt, APM_CMD_SHARED_MEM_UNMA= P_REGIONS); - audioreach_graph_free_buf(graph); =20 - return rc; + return 0; } -EXPORT_SYMBOL_GPL(q6apm_unmap_memory_regions); +EXPORT_SYMBOL_GPL(q6apm_free_fragments); =20 int q6apm_remove_initial_silence(struct device *dev, struct q6apm_graph *g= raph, uint32_t samples) { @@ -494,7 +545,6 @@ static int graph_callback(const struct gpr_resp_pkt *da= ta, void *priv, int op) { struct data_cmd_rsp_rd_sh_mem_ep_data_buffer_done_v2 *rd_done; struct data_cmd_rsp_wr_sh_mem_ep_data_buffer_done_v2 *done; - struct apm_cmd_rsp_shared_mem_map_regions *rsp; const struct gpr_ibasic_rsp_result_t *result; struct q6apm_graph *graph =3D priv; const struct gpr_hdr *hdr =3D &data->hdr; @@ -529,18 +579,6 @@ static int graph_callback(const struct gpr_resp_pkt *d= ata, void *priv, int op) done->buf_addr_msw); } =20 - break; - case APM_CMD_RSP_SHARED_MEM_MAP_REGIONS: - graph->result.opcode =3D hdr->opcode; - graph->result.status =3D 0; - rsp =3D data->payload; - - if (hdr->token =3D=3D SNDRV_PCM_STREAM_PLAYBACK) - graph->rx_data.mem_map_handle =3D rsp->mem_map_handle; - else - graph->tx_data.mem_map_handle =3D rsp->mem_map_handle; - - wake_up(&graph->cmd_wait); break; case DATA_CMD_RSP_RD_SH_MEM_EP_DATA_BUFFER_V2: if (!graph->ar_graph) @@ -571,16 +609,6 @@ static int graph_callback(const struct gpr_resp_pkt *d= ata, void *priv, int op) break; case GPR_BASIC_RSP_RESULT: switch (result->opcode) { - case APM_CMD_SHARED_MEM_UNMAP_REGIONS: - graph->result.opcode =3D result->opcode; - graph->result.status =3D 0; - if (hdr->token =3D=3D SNDRV_PCM_STREAM_PLAYBACK) - graph->rx_data.mem_map_handle =3D 0; - else - graph->tx_data.mem_map_handle =3D 0; - - wake_up(&graph->cmd_wait); - break; case APM_CMD_SHARED_MEM_MAP_REGIONS: case DATA_CMD_WR_SH_MEM_EP_MEDIA_FORMAT: case APM_CMD_SET_CFG: @@ -778,7 +806,9 @@ struct audioreach_module *q6apm_find_module_by_mid(stru= ct q6apm_graph *graph, ui static int apm_callback(const struct gpr_resp_pkt *data, void *priv, int o= p) { gpr_device_t *gdev =3D priv; + struct audioreach_graph_info *info; struct q6apm *apm =3D dev_get_drvdata(&gdev->dev); + struct apm_cmd_rsp_shared_mem_map_regions *rsp; struct device *dev =3D &gdev->dev; struct gpr_ibasic_rsp_result_t *result; const struct gpr_hdr *hdr =3D &data->hdr; @@ -795,6 +825,7 @@ static int apm_callback(const struct gpr_resp_pkt *data= , void *priv, int op) break; case GPR_BASIC_RSP_RESULT: switch (result->opcode) { + case APM_CMD_SHARED_MEM_MAP_REGIONS: case APM_CMD_GRAPH_START: case APM_CMD_GRAPH_OPEN: case APM_CMD_GRAPH_PREPARE: @@ -809,10 +840,38 @@ static int apm_callback(const struct gpr_resp_pkt *da= ta, void *priv, int op) result->opcode); wake_up(&apm->wait); break; + case APM_CMD_SHARED_MEM_UNMAP_REGIONS: + apm->result.opcode =3D hdr->opcode; + apm->result.status =3D 0; + rsp =3D data->payload; + + info =3D idr_find(&apm->graph_info_idr, hdr->token); + if (info) + info->mem_map_handle =3D 0; + else + dev_err(dev, "Error (%d) Processing 0x%08x cmd\n", result->status, + result->opcode); + + wake_up(&apm->wait); + break; default: break; } break; + case APM_CMD_RSP_SHARED_MEM_MAP_REGIONS: + apm->result.opcode =3D hdr->opcode; + apm->result.status =3D 0; + rsp =3D data->payload; + + info =3D idr_find(&apm->graph_info_idr, hdr->token); + if (info) + info->mem_map_handle =3D rsp->mem_map_handle; + else + dev_err(dev, "Error (%d) Processing 0x%08x cmd\n", result->status, + result->opcode); + + wake_up(&apm->wait); + break; default: break; } diff --git a/sound/soc/qcom/qdsp6/q6apm.h b/sound/soc/qcom/qdsp6/q6apm.h index 7c646ffcf956..67acbf0ce178 100644 --- a/sound/soc/qcom/qdsp6/q6apm.h +++ b/sound/soc/qcom/qdsp6/q6apm.h @@ -134,11 +134,16 @@ int q6apm_write_async(struct q6apm_graph *graph, uint= 32_t len, uint32_t msw_ts, uint32_t lsw_ts, uint32_t wflags); =20 /* Memory Map related */ -int q6apm_map_memory_regions(struct q6apm_graph *graph, - unsigned int dir, phys_addr_t phys, - size_t period_sz, unsigned int periods); -int q6apm_unmap_memory_regions(struct q6apm_graph *graph, - unsigned int dir); +int q6apm_map_memory_fixed_region(struct device *dev, + unsigned int graph_id, phys_addr_t phys, + size_t sz); +void q6apm_set_memory_map_handle(struct q6apm_graph *graph, + unsigned int dir); +int q6apm_alloc_fragments(struct q6apm_graph *graph, + unsigned int dir, phys_addr_t phys, + size_t period_sz, unsigned int periods); +int q6apm_free_fragments(struct q6apm_graph *graph, unsigned int dir); +int q6apm_unmap_memory_fixed_region(struct device *dev, unsigned int graph= _id); /* Helpers */ int q6apm_send_cmd_sync(struct q6apm *apm, struct gpr_pkt *pkt, uint32_t rsp_opcode); --=20 2.47.3