From nobody Thu Apr 9 17:23: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 7D67B38B7AC for ; Fri, 6 Mar 2026 12:22:03 +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=1772799728; cv=none; b=KdYIGMZYRryBj+8CNCa8duJvB/Aq/Fs+iasUCfl5nNssEYlNp8OJ4oBE8f6Cd2vZHXmxPGQN8E6NmZdNMUnRPErDxDgF0J3DKQ3D/6LrVHMmkAxBvTPabJibHCufXychcrjYSo1XKiWZO+eDRbx1h39cK+VT1y2fbFSfQCfznHM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772799728; c=relaxed/simple; bh=8xebNSAbJUskVVac7rNorJvuDpnXHbFrlQJGj+Tdu08=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=q6e5uVJDAkH6mjXuLACl+mAwjvFpI0FQS3TblbU0zY/nOtEl5PisgajGc/z2umTmdzEK38rOkHT/6Cq8M9ygWX3bEUvafQP6hsdBg3tt6Jq+a+BbQqLhmz39AXlNWeDCzVEsJqbXT65puK7N4QobN/7G8Jt01bgDa49scvaDsnk= 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=DCqSTxW1; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=jkf6iktT; 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="DCqSTxW1"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="jkf6iktT" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 626Bag3K4185912 for ; Fri, 6 Mar 2026 12:22: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=IH7tu4cejEh a0Z5gHxKrQArAxI79sxkumwMn24DAosQ=; b=DCqSTxW1NYnw8P4PQ9uOeLVhvze Cwm190LF9q67ZhRd1baP+n3G45DKAzghJKSL+y5zLUYKVqoHV1P55uLCqo/RzhH0 fVXkKvSlyytVknwroFu7yAihsYvIM34vE7n//Pm1JGEfUkbpFiew2QnfI6hleqPJ 9tsQzli8XRinRjcxlUW8SS9K1UrOSzliL/rjVdDa7xnHNErFx/3nmtD2EXn8zFmB 8TkYDaBb3s5uNhowSQHnuifGvqQKv/w0/Xro+LtpafmitRIXvRfhwswpKGJU8Xer PvqxO/D6C8/iMTxAYl4Pi+jNVWa9K/6aWRa3vf3nUwsZhRgtp4w8HsKIvrg== Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cqruk9a88-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 06 Mar 2026 12:22:01 +0000 (GMT) Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-899ea295601so96298336d6.1 for ; Fri, 06 Mar 2026 04:22:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1772799721; x=1773404521; 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=jkf6iktTOP3gM7CMiqW129B2pvHq6+Bja/9UPvU6HdQGm5uHpzujmTa3RR0+d4wsYM PJrblEwYMHOX6jRm19cYZXw6fxc3Fqhcp1ux3nJDXlzzRpKOSPdK8zz3W3tyUwMsLqx0 rPid2DKkf8JS16CG9O3eo3J5r2rMlU1ORMv+oYGzpMX0ov+7GNb4MNkC0Yp63MoyAuMw sLqVPuegVjf5nWhi0Mu986ot0RL4+CGIyOAquUR2vWV8IHMNEORTsxSJZlOk1MxGZx49 /fulXpnCt2lzScCIMvLyjXFiv1WLA7ekqLX/0Nm0UbzDOCiau2N0unt8akjhlkz1fXJY 358Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772799721; x=1773404521; 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=jVrn+UcK5c2/mBMUVw4J7RCJ8AVsYQm8t7oV7BrhuAC2e7xPkbB0ZISPp/BxtldL8W 38rs1J8+eVdul3c7Q1CWxRa4KYQek5zBiqHWmPHXGFGOVbXo7wFITgckhGpwyIZk34FU 3c+w8n9WLpM16eoxLcpBLBjrySn3Rn3yAnRaLS/Hr4bAPR9nu1btff9PycjQhvkojzDK Qsc44QBlYT3aZrdDu8o/yNwb4iuirGla50jvcPPCFeNj89DxGNNE+GHEbXwtW0Jd7AaY qU5ynKuZ6WhO6kosnsmg1HKG7/Ls0Jr0JMRJZYy8i27Ujv2GpXIUDVxCPm+JADNr8itC CQNw== X-Forwarded-Encrypted: i=1; AJvYcCUbe8dRQfIu4R+UWb9s0rP3T/TPqq60MJ9mmUwrGOD67gM5grC6HUnXfxAfsq3dfsLc2mMhqYPDZGb+YDg=@vger.kernel.org X-Gm-Message-State: AOJu0YwTEDc1XLU9+S/xLQYr55ajumxF7FZHYUUaJ9UviBRN7Zha1YXD 8g4tF8fDmx7Dr98bYUb4WebLdu2Wtsi6hEv9TMI0HmRaSeeJMfTpsaRGRn4X5hLsGQe4TvGbFHS DJ9LJ9RskJ2l9f6BH8wz8MbwcgC06CLqbUo6yY5oLu9CY7XAUVUTcD2r7+X9gzJCitnE= X-Gm-Gg: ATEYQzxEJU3hfwkm3A/SfDI14yja/Pb7lrGLshhbx6LCnRzU9RSm6qt3+Vz3FVGH7wZ uQRqfBFY2fJOYwEqYSDLpY74tNrwAdKwsp1ZjHTc3+dkhDqpEsxGxCxR+ZWWs14rcihUQxV1F7S zOqO9/EowqrdGsaatEx/0L8KRx01BwQ9CkqO3h+Z/cC6D12b3RTdzlXhsqvkxt8l5Z49Awja2JS OcV2OvE61SS605pqMXGywRxuPBzvgTJ/d/PvQmN27nZFMN5utFtpzW5pmXE6dTEFfdUEHxnZIPP dw19qBwBxzGquCD5agaqniXOtGz1xMPzQiplnyXpo8vKuU/JlZ3frMnWiKS/9WS1khgZjSMaLz/ 9EDT1i5FyugG+1zjmcqxMAhOzGoMN45U3iofVbtWXjHjr4JyXhlOP0VU= X-Received: by 2002:a05:6214:4014:b0:89a:3c4:5159 with SMTP id 6a1803df08f44-89a30a185b6mr21352536d6.7.1772799720821; Fri, 06 Mar 2026 04:22:00 -0800 (PST) X-Received: by 2002:a05:6214:4014:b0:89a:3c4:5159 with SMTP id 6a1803df08f44-89a30a185b6mr21352086d6.7.1772799720359; Fri, 06 Mar 2026 04:22:00 -0800 (PST) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4851fa87e56sm111972395e9.0.2026.03.06.04.21.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2026 04:21:59 -0800 (PST) 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 v4 01/13] ASoC: qcom: q6apm: move component registration to unmanaged version Date: Fri, 6 Mar 2026 12:21:03 +0000 Message-ID: <20260306122115.509705-2-srinivas.kandagatla@oss.qualcomm.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260306122115.509705-1-srinivas.kandagatla@oss.qualcomm.com> References: <20260306122115.509705-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: AW1haW4tMjYwMzA2MDExNyBTYWx0ZWRfX894TExYzz63u H8RbO2Vslwi//09Ef+1faNGfRK7SBdB4IqL/JDpV3tEQUY0NvlRfyodXeKuBgw27Vx+pIoDLs0B d4fg4I6ZARKLU7NDX4oaQCLIp4ntOJYwE/X7HEKi3Thfw14zl/8/ZRQMEEBkW6gZQSZq8rloHZM d/86o3xhC+rahtvaL0lZGa568vvVpP+/hjX7vGQJPyz9ZQqsRP5C7l1n0XEje1f5HKcMNSBIq4m wZdK24CfsMkBR1rtJ5PhtdBB96bZaWGAQHeYvzsqekJkhspjzEUwyngiWTX1mqCiWUyd/C9K+8i 8khxOdAIs4MSzkOg3S2yhP4a8aYjLo7pc11M1Zb5QRHeM5WN4io8Z0GaQtTCxrirqvxGpRkELsp gjj0WUwLmWUo5e0jnGJzML2D8RQylU7is1l5mkhqS5Z0wxCR7fmsiIJ0A1Qt7IadutIb6HZMTnz l2HMUW/i5DlgJUtMOXg== X-Proofpoint-ORIG-GUID: -a7vl3pir-FTO3xBu7zELTffEttz098W X-Authority-Analysis: v=2.4 cv=DvZbOW/+ c=1 sm=1 tr=0 ts=69aac6e9 cx=c_pps a=7E5Bxpl4vBhpaufnMqZlrw==:117 a=ZsC4DHZuhs/kKio7QBcDoQ==:17 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=EUspDBNiAAAA:8 a=ZjLH_7kMUelE1Q3ziugA:9 a=pJ04lnu7RYOZP9TFuWaZ:22 X-Proofpoint-GUID: -a7vl3pir-FTO3xBu7zELTffEttz098W 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-06_04,2026-03-06_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 impostorscore=0 malwarescore=0 bulkscore=0 adultscore=0 suspectscore=0 clxscore=1015 phishscore=0 priorityscore=1501 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603060117 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 17:23: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 E2E4F38F25B for ; Fri, 6 Mar 2026 12:22:03 +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=1772799728; cv=none; b=SHfu5lVb+bZBwPDzzcWCzUIbMt8bn6tWWJ32uKK5S3mDNJ5Zf9JtylPkiDkkBxypsu0OjRAfMgK7ag+EYbi0wM6Xx5NIaB8c1l4ndJ9RIeZtUfao2cGDxqeYw2V28bP4birPdBZkKU/+ZF/Q62XaY0YihXAaIxEYqQ1rUJaZq0M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772799728; c=relaxed/simple; bh=fldykUob5Z2453rW/Bu+WyVup1MSOjtxkIDMh+tQ1tA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=d9TO1V/+fB/hf/H0nCrY7DH6PeiqXml2S1YEm32N5ZqfmpT/Y9WQTcuJANg2TO9N5IlqbHYr2KXoabAUo8WhDSQk3i0ifxMYFthEtdbLq3DstYuoVvDV0SkaxvOHzQOLW8DaDV1I8N30EvKJG7GhiNNfqwJkUyLpMdQ4XS706jo= 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=CQ/QcREN; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Q/4yHYSn; 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="CQ/QcREN"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Q/4yHYSn" Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 626Bb3jc629054 for ; Fri, 6 Mar 2026 12:22:03 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=CQ/QcRENr2KS6gpMWhsW0hjCLO8 bQSLFhTz4p8mQLjs/mGDMqd7wVbIZgreE94hxjOHS6vlxEqoMuDWhaUcnSKLFo+Z XWicrKgrQXnBGCsAP2kzduEov+jNc/NdDB7ZPDT0WvFsezXtvhcO5qG+ss7Ex4t1 r0Mi5CTpGe6LP79kjqwlm7X186g/aewvqOJJxNrcoyJatXXX1XglgAVZ/tC5NZX/ Sivx+lEtXai46Y16FZgHbGBtnkvVaRmCWKo1Y0Di3SewiubP51Xoq/juZ6iw2lF+ XQNaDIosh9FfRAmKCxYxyuQH4qJfoysQUD1LYVsw66w0Nk5V5SDQNXZIS5g== 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 4cqj4sam5m-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 06 Mar 2026 12:22:02 +0000 (GMT) Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-8cb3a129cd2so5848974885a.0 for ; Fri, 06 Mar 2026 04:22:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1772799722; x=1773404522; 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=Q/4yHYSnkkhFCf+gPNcu2rQoZBeZ1Fa63d7vJixFexw/Wq/LkZTvEshCCab9RQonq8 YEfOUDVCjOQkALKAef63b/OCBwo3Yib3H3oq7n7plnPr+eFgE5GpgPorJKHnWDrxlm0F hKpUEzuxiBElXefB+iRqeeARBvZwGmwWyolhulyQOIXRFD9EOE4gd415Zl7iqMZAQ1RQ Y+qyoBvw/0YZ1377foeH46kdtb9qGMjlZeAxliRNKp+Avtefo5W6CdX5MiFGSggg5gZ2 8Xm8V1H2qQnaL9c89QTTb5EgLi6xKFbItv4Gmc7QJfL0P8+6pufed79EtkSnlecM1uOo v4Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772799722; x=1773404522; 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=EUp1nbQnRpTRTHREEdQCtt+3Kf2vI1RF1XxT9H5F+5gRpLn5+H5E9vY0m8LbU/TX1i 9vx4G356CThV2/rC7MlFs69HpoTQ7jTMpEdVsh1EzuhFvF66xspclz0fjXMqShXKia0k MYTnH1dE4TI/pr3iFYumZ2KLGqUeAC7VloG6gOiRo3vHCOIow9Xao+jTjZ1H/mjsqYGj nWvabOcJXmfhyljmz+0ihSesd00FhqWfRJPY8DfwjbUnBQf8LUa/WCFv3izaO18KFIID j20w39Yvvq5j+RhkYMBBOie0rG2PYDPkQUrhSs/hfhzRYRvwQja+e/c0B4hfQhK82RuM a5jg== X-Forwarded-Encrypted: i=1; AJvYcCU6lZdmspk0NZDouj9QB4Md4q2IbrTmcF8BAruzkrbIQdggwBAKl3R+MTq7ko4B1flWp+LwaEivM7AqnYs=@vger.kernel.org X-Gm-Message-State: AOJu0YyBqbjP2jCVm75n+2R0vnXavEYHqFEaEh5jnrJOj8Uop9lqOuHC hfvHxOmE7S3UBzr8BEw1f3tYQ/jTLREQ5Mt+FmQXq9svc03OCjmpb/x7c1OVB9Sos0/6qWd7Few wrMkisdJOQi18FMUQAXEATPBeXM2BrORM+rkusNE4jwKIjeZheGDb0fcoDODzdtWyJ7o= X-Gm-Gg: ATEYQzzx8LMUPYeKiav/V3FuOBlT8IX+QX7elJGtz3WeF3SlrIcipx4IWS0h9+Nj68r o4J4TD1PqC5BB1e92QjFxr07k+5oibWXgQyk4ABJvk1hPKEegs0yNyHZ0VkCst5Zww/Ar6wpWH3 za0dya7AAyFOdJh2CxS7xytBfrWk3qhDcnL1IXbQpNfpsmh/8ec9RhhhTwC6cWeF5V+rhncM2ln rwO/lz0fI7rb877zInPD75XNGUvyNu1RNxP1aanT2zMI5RfXUkGKi5+GcA45Prrmxz1SlmslGfi WjqaHgqDCoOHmPqWf4X9qdu0gvEXCsWIqwL/GN3R3bQQCeKaaQ/i0oFz+H1JqwwUX0+vMD+rKPf cVXSMRcA1F1GvmFgdPGil/iJJEVRh+TYWbwFJ34vo6u1qEmIIUoGSo+s= X-Received: by 2002:a05:620a:4108:b0:8c7:1271:f336 with SMTP id af79cd13be357-8cd6340948fmr651648485a.2.1772799722080; Fri, 06 Mar 2026 04:22:02 -0800 (PST) X-Received: by 2002:a05:620a:4108:b0:8c7:1271:f336 with SMTP id af79cd13be357-8cd6340948fmr651644885a.2.1772799721635; Fri, 06 Mar 2026 04:22:01 -0800 (PST) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4851fa87e56sm111972395e9.0.2026.03.06.04.22.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2026 04:22:00 -0800 (PST) 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 v4 02/13] ASoC: qcom: q6apm: remove child devices when apm is removed Date: Fri, 6 Mar 2026 12:21:04 +0000 Message-ID: <20260306122115.509705-3-srinivas.kandagatla@oss.qualcomm.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260306122115.509705-1-srinivas.kandagatla@oss.qualcomm.com> References: <20260306122115.509705-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: AW1haW4tMjYwMzA2MDExNyBTYWx0ZWRfX4Nw6k3npt+bx QPNF6nbLflz6jAOF9GIR/gp7nyN98yHujRPIEBFeC/kFm10l0Ubp5B4JtT/1YfNQMVEiLQPGgon xIe8fVbPgFnYmYmzNAaqaCsMdcKZY8UASvXCcgzLzb1UD+1ewDZONXigGw4G2dmKBTfuwdlptcv W0CeZpkD0GI8I9IGMYqXd2yGHMuVXzsO4TO3+eLlLcYAkki11NXqxVI3xPZmEaxBnPVHMcBcXhc 733NlOOPIGoukp1TFBufONojLj+3yvjkcxxGn9dC0rkjOXocGQA8XWX0R8wF2yBTl7PDfedN+yJ 6CFzLXTxvDTdyROEWOBaADu7lej0qja7QaN1HJnpRFlNDMNml/JNZobS2Q9A0YYz8GgIMp7qvwA 7UtqscoCW/fi3yT+ffGpnsWVrFCrYQgqrtbOQEj5lar2RmOrXYtasBgeYiLbGEjY/pRnQY4OVeq JztpTSgx7d/L9G0MjVA== X-Proofpoint-ORIG-GUID: jB4RdIAsPrKD5VR7OjafD-dW8R5Xh4fo X-Proofpoint-GUID: jB4RdIAsPrKD5VR7OjafD-dW8R5Xh4fo X-Authority-Analysis: v=2.4 cv=T8uBjvKQ c=1 sm=1 tr=0 ts=69aac6eb 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=Um2Pa8k9VHT-vaBCBUpS:22 a=EUspDBNiAAAA:8 a=WbEMVPVtDBSXEMPt_8MA: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-06_04,2026-03-06_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 phishscore=0 lowpriorityscore=0 adultscore=0 spamscore=0 impostorscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603060117 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 17:23: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 83B1238F93D for ; Fri, 6 Mar 2026 12:22:05 +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=1772799732; cv=none; b=EJFjisuxjLxTcIJXUkBGB/qkx8dgwS8frwzGt55Sjlbku+9epT2xWVg2tJUgxJwsXY2re9sFKucjupQb6Cl8GBFSPwtY9yBAm/+X/bnDRr+dJ/A7x017Y5cZRnqfmQzNLwsFpHfT2Xx03xHUbNyBzswOeqWiTEAX8fuUZd0ByMc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772799732; c=relaxed/simple; bh=6jShP5otc7Z/xglFZY5mqaUqDhEckaI1JOm+jwe6kcI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DthMmR/8FV1njo4W1APsc05JkH1Iifyg8wYZDnkNM2X//1av+o063iu+YpYjXONkWjcHVT4MmDWUwSd1wXSi90potpQqJcx4KcCWrFU3y0Q8YJHPdGaBu7owTJ3mkxXg6oL/7Bz/ZpWVzs1gJJOJXX2dSpK3XOL2Uuw4R6XZ744= 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=fwUHlBx5; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=iPU75X/q; 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="fwUHlBx5"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="iPU75X/q" 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 626BauSP864945 for ; Fri, 6 Mar 2026 12:22:04 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=fwUHlBx5Up/NCWMRPmiMRow97nW 6NwmwsX87GzBm2jr4Fm8IwkbYkUcShqcGpq0Wf16LabS0y0hFq8o3d2S+Qk2Tfig Szo4u2A9mKyO3x+nFGaat8FC4S6JSVNEHkUPxUPJTrYJvudTurH4CsczbVZ7ZSYd x8L92BHrmpEIJDkoqhhDX2bxUC16kf/ssGd3J8q4kQ3RBJhLnQGvUfvRtDXVxWia lzc6+jLpFUaJMa/HUj3rAHBd25CqnIJ/Oum0rozLfuEVt3Szx5F6uNCYRf+FVSe6 /3deDb4zyLEDxwn8lWeiNQviRYotEuZ+1Fa1Fk7RMdoT0FDUXeYNDLO4v/g== 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 4cqrf5sc7e-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 06 Mar 2026 12:22:03 +0000 (GMT) Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-8c70ef98116so6029542185a.1 for ; Fri, 06 Mar 2026 04:22:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1772799723; x=1773404523; 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=iPU75X/qUDdg94+sqBZ4xw9yIWI3mBv3YMKQvNOtKSAyJtfhjGVLw7cYp3O65u/9JD pIylQxbAfMRD+J1GPYNQvIBq8Jqgwc0xdN68MYKPJf+LjaYSFjMSFn4gS7e8NrhwnJSC 7XXmMCBLUcQtZU6j3QnNLQuutHcJtBJcaL+CBn7fHE2C+WVcOJtaBoQ1NrwOomjdSvfN OeNaNBfh4XraqMzB8lrXNLtY+BeBVbHv/T1aQsBYIKL+0EXBlNmOwi6foWUWMSnv5QWG xptbI1To5exTCvm/Y2ViQbr3xU/gihMQQxhPULOpJCURD1ta6FDtJCzg2ya33pZEt/tw Z0UQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772799723; x=1773404523; 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=APBg+DHIZb5cFrvsiuKXfuBRLSHhCWRcJT/gvRRW3J1oxrb3aU2f3RmElggsfEziqk Yk3LOTwfjzcXySsJWoEjaIfNEPEgOq3kfLTnn1bDVSiBF76CKQtyswdkLcVi3sxKvKwI BXAkOjchVVHd8EbTEMJ4YFaICIleUSAy3GUDIORQpbftoYolRNtbNeCmcRlfbtk3Cqcc QiKDGLPYbxtXSUSeIJm04QdV8CqGqCqRRG5RIEFGtHG51tbSftlIhC89lTPmF2ZBblhp wo2kXuuzXSughXIBujREt7uQDOP71gMzMa9GLH7bmp6DjUxZcwPdZSg4NOlBg3VGWFFN 3xVA== X-Forwarded-Encrypted: i=1; AJvYcCWSFC/N1/ac9X59PlXxRwOWqRyKlwDEz7gcposvENXI+5mQCWbIhRipQ7O8KbTUr6Qz02MHqOkAN4MIr/E=@vger.kernel.org X-Gm-Message-State: AOJu0YzTuC9c3Sp13FICmjU1RZKe+JKYTEmfflTLzurrOViZnhlziVTo LbBa4pvwiVNkzsqSuB/lKDIave6hV0KwjU9t34fp/tFu6aiqDW8vRAFLPqp9I/SDxRV9a2iBI6m 6iZmR641Q42/LDWSrWMjzUEWp7yYrEemoX4EKIS9L9m6DpkcpXhy7u01bzb/irpvBnRk= X-Gm-Gg: ATEYQzyIXaOs+JtsFO6Dpie6nnGeCi/OBk7T/F70zLS2gVBwEHoF1zZrzoB4Xal52F4 ZqTsBIuCgrFZCnoOV3L6U7ZfM1A7kCYzLFguiB9/ysdBNPDAQ0KDuBl8jM2vBa+wZeJTMZZ/p0Z DdYmg+nPRON5s4lqT7mYcPr3xuJqIaI3x8pMp/wsAkwv/axOAfXMxHSqHmA4zCmWxcMgaqMuyXX 9c0ifm4xECodbnosOMgVb2tLbo2Jpcfu4PNIdlK979o6WMfQEJ5bdVTcA2ODyvQwWf1kga0rY8Z P5L3wq/agwskVpdjTcC4moQJnNTcWOMe7+CAKrXsn1hPzz7DOBQd6BaTaVOjUPtwKFjShbtQqTT 6lLrx9+QcjNX1NRutvnLqe5Jom8teg45hoQ6jbYD7m/uuOpX1Fd429sE= X-Received: by 2002:a05:620a:7115:b0:8c5:22b2:8b4a with SMTP id af79cd13be357-8cd6d40d21emr227967285a.16.1772799723408; Fri, 06 Mar 2026 04:22:03 -0800 (PST) X-Received: by 2002:a05:620a:7115:b0:8c5:22b2:8b4a with SMTP id af79cd13be357-8cd6d40d21emr227964185a.16.1772799722936; Fri, 06 Mar 2026 04:22:02 -0800 (PST) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4851fa87e56sm111972395e9.0.2026.03.06.04.22.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2026 04:22:02 -0800 (PST) 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 v4 03/13] ASoC: qcom: qdsp6: topology: check widget type before accessing data Date: Fri, 6 Mar 2026 12:21:05 +0000 Message-ID: <20260306122115.509705-4-srinivas.kandagatla@oss.qualcomm.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260306122115.509705-1-srinivas.kandagatla@oss.qualcomm.com> References: <20260306122115.509705-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: qvQP08qpUTvvQ6VE3qV6nIJtei__vynG X-Proofpoint-GUID: qvQP08qpUTvvQ6VE3qV6nIJtei__vynG X-Authority-Analysis: v=2.4 cv=L+oQguT8 c=1 sm=1 tr=0 ts=69aac6ec 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=gowsoOTTUOVcmtlkKump:22 a=EUspDBNiAAAA:8 a=5HTw2GpdgXbBP0wXRk4A:9 a=PEH46H7Ffwr30OY-TuGO:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA2MDExNyBTYWx0ZWRfX3C6a/EPSwMH9 KA862Gl2XdZiTXHcQzZHDezwzjRhD1rr/Zv5B0VXDb03aR8WeFKajQKhGHxA9mnd0ZdY7JZVEXM WLGbl09JwgVZMDtnuslqzY+5PTnCWJecjcsksj0hjn1mnp1vf19DMudzHG8kZWiwS9K/OXfT7FF 41G4Uv4hucApMqkqPK7fej0nf/ukEfjImI4TlzM65yYz2z9gglw1S+6F3uzs7BS2QtTKTNMwW1X mfWE6acgzYu8lvZ3uryjt5qngo3UZWZxk+zAtqvSWiCZ1k+TCcWVrriPbTO8BkelzK3uBQarFn8 nPGYcq0zCsb9/vwcaQ3CY+j/UZcQxjd4KbAMfXiIt1hSbS36vAVTwYm315J+1/nJ/7YvAIWnE7O 6vGASoUfEop7c5rZuIqZdxedaqgS5fwYsRLcrmB0HWB94D6cZ2UUql41d4Ckf647FG8Y+zPWzYA uKWBzvdrY4BMlrPzzsA== 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-06_04,2026-03-06_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 suspectscore=0 adultscore=0 bulkscore=0 priorityscore=1501 phishscore=0 impostorscore=0 lowpriorityscore=0 spamscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603060117 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 17:23: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 BA3C438E5C9 for ; Fri, 6 Mar 2026 12:22:06 +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=1772799732; cv=none; b=cavgp33rhD/N8j+MCBujMSvp0iugIUOIq1eZPwTfxIrdPqz44h8XHKdWEkYc6PRM6t05YWCf1hYdQmVnqYgoADn86D/YpXI91HnGbmdN9cE+4jihJJ+Yx5j1xPR0ShgrzZd/Og7xK2jDSMTB1P5sO5Kelds34+MMh/BaNqyKivE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772799732; c=relaxed/simple; bh=KvhN5EIM3XXPaotrLaYPSuOdgBSYq4SNpSPqi8ZqfN8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fy0cjR4DRkHaX8Cckr2KZ+cuGjlF8BrS3qhzKjQ6goN85sNMv8vD9L67rOx7JIT7I8aPVO8OFRQmND5KoXCvlapvP2dVk0Si0DoleURcZJw4YHTYSNhxt7kqDqX1vsgBGm0F9qz9fAf5qnQLPSivjI135/+JTJNN0/sjs0JUBK8= 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=P76SvNFs; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Pb27lQig; 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="P76SvNFs"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Pb27lQig" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 626BbN8r2022828 for ; Fri, 6 Mar 2026 12:22:06 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=P76SvNFsuij9ZEa/4BmQF7denLn q/n5YvrZcQ1DypSC4YOtgDhpsUHc8TahtJwm7ZU+p1RJ5Xv6mWgj84yZLydire8w EU06roC5QanSFtAuyb4L2vylyBZeyqWquhqFoc0XxyQC5fhRv/OYWbq6xzvMPzU7 JDs60aY9DbUBeXKL1fdN12E+LAC3J3gVlXmcftvVQ2oLdQgpASV/YwHovTDKVg/w FlrLvM3chwmL14COPULPre9rOjzu9JyY0ogDBdDRXKCvgJUftYtK4ebtSbR1Y87T 3R7LsnnV/uDNj1uTh+ZOcNQi9pEy4b7+b1mmyQm+MD3xn9Q8yjbZdsnGs5w== 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 4cqfg6b3kj-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 06 Mar 2026 12:22:05 +0000 (GMT) Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-8c711251ac5so5061871885a.1 for ; Fri, 06 Mar 2026 04:22:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1772799725; x=1773404525; 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=Pb27lQigYpwr0mDY5+7fEaXdEjundDGN1KOL6Fl4GAqfVytZcSztXEdX3uxKhi0a2w 1bi3ffXweX60nM/wGEX0kV3fh0uaOXOsTWHbHgvvKXQBMx6Pl9p/kNMQjwgpXvXpm4eS r7NkjbxzOLiW/qDl4jTqRnv944PJVBc/AsP2H/9LMIJbg7HsTfMV799FKVwd/HH/VKdz A+fhnXTBmjeuo/RGGseV7VRsLF/FexEGzX5H6wrY8yJc/J9tj3OMWtpvS9rMYY6o/kuo wrM9xAvbbhK+iRw6WM4R9uvBUpopX70wfS9hlqvTR88IMyVdufw2YPtHgapNTwpKG+vH /4cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772799725; x=1773404525; 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=HFXGKZK61ypdTnbVap3I5rNKNviw6SATuDtko1JJM31Mdv4IuEsoWcZuhVBjGmxYux 117eQhccgQ0MneZ0XUS8CTsgCHClucKckd+bZA/gJZzpHQK3ERiabvVVWhbwIpTQLSYc PZXn3XdH/6vC9UU4GipZMd3TKMWMNKhhn973s+etqd/FpUfTEUCAixOd6yLYiYRzkDEK uR52Yn24Z0i2gXh8pkyFDGSE6RO0lBMWYSS8vtkTQQwAuKRkAmBLojwRlmny3cjUBptD t1Z2On+uXstHdsChG7w1gypE074/c7FlC6YFfeO4XF7iLjEYTvQSOoAIMLZ9RKsY/6Xx uoyg== X-Forwarded-Encrypted: i=1; AJvYcCWhe2KvLHTsH3QaU/lnTPH118hK3x2980yPVNDTgP2dASeCQ7A4/gwwm5oJGCV4+L89bcJ0QWSIHn6NLl8=@vger.kernel.org X-Gm-Message-State: AOJu0YyhlHB9eIRC/lMZxobtSgqQrC0UzTlI2a5/bmkgSBGFfVubE+gb I1/s9w2zNtj36X8324W4rnN7NKrzLk2Z4fHfzXBw19hTstducLh6QTp6z8Y9Es6n/4bsGDoXVsX 0HLHHBAkxlsKVh83HifdSCT3oVjQRDJtHR2pWc64esEQZ3+4SivOrAIzBAWTteGU7p1Y= X-Gm-Gg: ATEYQzyj/QAO2E8WHmimKGOdkamDM9dB7NyJAv2s2RirMyDHrNYFGHCCeAhXsnGTNcR LRUIf5g9wxUJ366h7n0bnfbrTr9sHraznOetsehIA2gkrwxPa1I0U7R+ZLEygVeyDh1R9qHnbwf jU6hwlTdHNRxnPBvh3FfxSa08at6ag+aPZ9yj4aHFF5s0Sak/55p/dubIQaRrnCL3w37qwLjhp/ hvdcvtMZi+a3hq3QLn61lSKMtNgdAFN9dmcq506J3zMqrYJ2A2AqNx70UAOJlHnZRcAMRrJkz6R oZJri8ATU/LpRNfQQjOitdOwl8CDe224g5EYJOpjtbaaEF4RrboXteAI8gbUerhEsAFgLpnigai +1Mi8ot2sbAQAoTX9aY3Wb/S2YrWNyIvj72ai4W/fPomFFm3RUtYWniA= X-Received: by 2002:a05:620a:4588:b0:8c7:7a3:501c with SMTP id af79cd13be357-8cd6d4285famr205931985a.52.1772799725027; Fri, 06 Mar 2026 04:22:05 -0800 (PST) X-Received: by 2002:a05:620a:4588:b0:8c7:7a3:501c with SMTP id af79cd13be357-8cd6d4285famr205927985a.52.1772799724551; Fri, 06 Mar 2026 04:22:04 -0800 (PST) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4851fa87e56sm111972395e9.0.2026.03.06.04.22.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2026 04:22:03 -0800 (PST) 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 v4 04/13] ASoC: qcom: q6apm-lpass-dai: Fix multiple graph opens Date: Fri, 6 Mar 2026 12:21:06 +0000 Message-ID: <20260306122115.509705-5-srinivas.kandagatla@oss.qualcomm.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260306122115.509705-1-srinivas.kandagatla@oss.qualcomm.com> References: <20260306122115.509705-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: DmKZgpbA-PbkGAk1JrxVSUzWosELFR2E X-Proofpoint-ORIG-GUID: DmKZgpbA-PbkGAk1JrxVSUzWosELFR2E X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA2MDExNyBTYWx0ZWRfX5CD7+wOXM3ja 6SzzpyuUobAHNZjZ/WENhTB/FyaduspilQNPNifcgPaAxYKX9hUlG715Edm7Jip+4oO4+A8JTDA B8OROcBSDDrPXc3bZ9ftfxlAnfM/l7nxbHu0kHayoXlDSrFeEuf5VuKS0+O+nP3pXIhMVe1oeg3 BxaHxRpNNwlCO2F5gdIouRaYg1vNqD3xQE6SytzNlmxmmk7F3FXWrfKbGKSKmdcGPNqtvmXVSA/ 2EWRKhA7jT6fzhv+ry/JUKZ2CIrQIr0RzWACascI3e6eXrXAoXdyzTbqtrHkXFM+YC8rNYt/lfp 7FrUmkox3Zd6QonqiZCUHNNPThKfr/5DOttOdSXfPd7ignT2N2H5j/Y8CQTga0UPwHV2DLY6cBK 0MjnbY0VEk8D3G8/chry/4Jl/E8udsMBqGu4lm8eFEdv/Kx65J1dKQbdDM9OAQ90ZKhIH5bgD6Z G5gXKHbeKUl84sOAEFA== X-Authority-Analysis: v=2.4 cv=XKg9iAhE c=1 sm=1 tr=0 ts=69aac6ee 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=_K5XuSEh1TEqbUxoQ0s3:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=M_mAHeyD2EURj3i0m2kA: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-06_04,2026-03-06_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 clxscore=1015 priorityscore=1501 phishscore=0 malwarescore=0 spamscore=0 lowpriorityscore=0 impostorscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603060117 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 17:23: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 31C9F37C114 for ; Fri, 6 Mar 2026 12:22:08 +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=1772799734; cv=none; b=asFsTcFxnHaFoJ4uEPmVDcbPK7TqKLaCxoAXKs/ZMuU0dAm/Isb9f6X0qOBAlOt4bwnpr0v4SrFTwhRtOM6uE7MjvTm5OK+49y29Wasb6ZoYGNKaFEJswKcemI5h1/E2GS3fD+EMgGhKRNyis4qrJ/rRor4ZvA5Fu+MeKRVfigk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772799734; c=relaxed/simple; bh=AhoflfyPSEypIadA7rENraHqNcIi0OFcEnzEL9v8we8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KoPfNYCQYign/jcVNTWinN4CYYwWBe4U6uGPZWOPEEZ3zHOkV82voGrhQEeUDD22pxrNd2WFDout8ulPks7Ul11wKIejLsshuQc4GUJypo4esffC0/bff/B0F4vMUp5R1kiQRY0/YWXVTrS9VANKONxWJva/YbS7VqEKMxjS//c= 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=VYETanTp; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=OHrddHAo; 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="VYETanTp"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="OHrddHAo" 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 626BbKTe3257100 for ; Fri, 6 Mar 2026 12:22:07 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=VYETanTpP9TKbfw8VB9Q1wzGu2f 81uLF3VdflICc8WVRkd1rvVwhCU0iaAZSYRe+unDyhiY3uBXgaTw5T5a6xGtJu5o v0Cosrptta2XIYPalxG6L631WHKhnC+6i5f3jf4M/HFrTK6eQyI3ORYhStO101MW q1rdH4DQTZumHS1d80YmIz9musaIzLNRee6uOzHdX1ntq6fwzriEOD+IKTNZsMEZ oqzgAHxwSA/efwk8DSGikwhsP85ee3oEznxbDFq+IJCdGc4X4ZcY4PuWgz3vKIyw lFoAhp4rZSZRfBmQiQln8Iy/59MOPQ2hTgohXfXGBXtBDfuYKLiLSHJAksA== 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 4cqg09u1y0-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 06 Mar 2026 12:22:07 +0000 (GMT) Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-8cb3a2eb984so6320234685a.0 for ; Fri, 06 Mar 2026 04:22:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1772799726; x=1773404526; 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=OHrddHAo83B86rMGxrGrGa2eUuvzQmYMnxpA361W5V7qoTwTz2v/nJIov1Xc3vnnJ4 hAQvodmRq610hxRuQR7b1SiuW3qNLBtvMt2xypB0DIoTYFhqWt70wYma9hE0Xt8/HKKH 2vFu72LndCOXlUPTO6XeDMfEsPpR4MPbiy/e1t7oX8tFwn3vm59yZqDm9sl4ZdV7bkSj lw8hVar/XoDITX9upja7IWfWFiBAKyQsOW/87JycuLn/Ku5SvIh2mXq6P50CGRPUbkQB 90DJ+tH+Reyo8IARq93H8yoSAmG/rTmoHnHZiKb9THd/7nssiaVuRuEg04sZa4T1xwYn s5Aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772799726; x=1773404526; 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=iPRkIWW+FiXerMDy9fnmFPJSrtnGiHfyH0H+cUPTBU1Q24mGparnwFuIziWLnqOX7d m803HaPYq5+fO+NhfGWU4EXxd468pnlw/BJ3jc9JkioyBN/0yvHZXUD3xcP+b4S+Fawc ygf98zHgo9NNFntr/AaNf53Vy0sl6bkASKgHzBZDOW6ONQyHaiTQ5h76YGBeGsFMmeRi LMFgRIuQEHn+Hg4AV3DiQZsNrhqXjnJqoWyRoAPQDP17dD4/fVuEE2/EytyxTLd4l8xs TYWWEy/MgFiwlIVHDRUhUoA86po7TK1VadHXN28F5DYqlrzCAHs2FtiAP/+8o2MqffFm c4mA== X-Forwarded-Encrypted: i=1; AJvYcCWiIBtBb3lVirb4fOg75mJpss9SZTavH7gbj33TVqUlghO0GlDjNE51PNI3xJPUlGilOn6OouJjwnSTgX8=@vger.kernel.org X-Gm-Message-State: AOJu0YxnLSE1pXTzUCTa6Sc9IdlcfblFAp/7CKkU8LlT1YUFJJ7QAx1J AcENJogQXvBbRCPGRY8N/87WigEGyAz+/LmDhXfy810kH6rVStZHMB+N8Xx7tWMhjpupqkbc12Z XpVU2jUdQmN4og+8Ti2d4FFgYOHVmoEJgQSNXT+ZCrDy0RJs91ZKuRr3ZgiTcrbYWRRQ= X-Gm-Gg: ATEYQzxvVQud6mOlB+54LMiazFYrJZ75wShzZOscF9Th4HvGeiirZNY2GoM88Y4YlPZ 8D+KE6a2EZLR68RWYnB/RgYj9alvtjfgTUTYFngPFcI9hUjFmhkezYYnCJFNgLvAeWe3Y/4Rhzm wYHBwL93hxcPO2bYx+cvtL98MGsIJwTSfVRn3MC/fPU84K2li9U8aUjWRPzUjy2KOdUAGKCSHRa FWbvgY3CQ3v4we4Bh/af8tdoxtlmuy5GPlP0UpBaEsu0Ywdh7JWk5lLguNNfdCgMf6l6w0HVJSW BZSjeQmsDAKHmAg9DylrpcBc6xzdpgf+gO3h7nPes1WzDpcot1eK/lCzbw1D9gTVfk4TNI3JHOg fOkly+M7OqWtp3pfS2kIlbrDvl6FULpgoUBddERWGm3e3lYBr6+YM6UI= X-Received: by 2002:a05:620a:d8a:b0:8c6:b247:4c with SMTP id af79cd13be357-8cd6d3ecdeemr229073585a.2.1772799726350; Fri, 06 Mar 2026 04:22:06 -0800 (PST) X-Received: by 2002:a05:620a:d8a:b0:8c6:b247:4c with SMTP id af79cd13be357-8cd6d3ecdeemr229069585a.2.1772799725934; Fri, 06 Mar 2026 04:22:05 -0800 (PST) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4851fa87e56sm111972395e9.0.2026.03.06.04.22.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2026 04:22:05 -0800 (PST) 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 v4 05/13] ASoC: qcom: q6apm-dai: reset queue ptr on trigger stop Date: Fri, 6 Mar 2026 12:21:07 +0000 Message-ID: <20260306122115.509705-6-srinivas.kandagatla@oss.qualcomm.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260306122115.509705-1-srinivas.kandagatla@oss.qualcomm.com> References: <20260306122115.509705-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: yku7s1ZOeP2jnARj-UgjrXTTRcOwRaC1 X-Authority-Analysis: v=2.4 cv=b/u/I9Gx c=1 sm=1 tr=0 ts=69aac6ef 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=YMgV9FUhrdKAYTUUvYB2:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=w9bA4Yi6UXS1dLCTJJEA:9 a=bTQJ7kPSJx9SKPbeHEYW:22 X-Proofpoint-GUID: yku7s1ZOeP2jnARj-UgjrXTTRcOwRaC1 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA2MDExNyBTYWx0ZWRfX1ttNe+LnW9JK A+/loqwvhDcuBxUY2SQi8Q26Ntz4kv+2QpRIOMyt4tQYtqw+/SVHXGmtSA4vrxArLOhYzmBhH5O POqrYBl0KusFmPXZ5qXNvEGHngGSt7oAtzgS82//Miw8cIBtkOw8eD/9k0F9VYZOSOqUPp1Vusq BntHJd0xGyc11WPN4I+YkHomc4N88Ng3SsxSy4OUjNX+/7p3w0XroEjNWJvwQUW6xYyhFN2lITD PfP/zInLqpB5CURm/esKVHKp2p9pxGeXRDmcoRsdCTZKB6tNAyKwxqzSm6vshYo23if4JfYR/iI krq31Z28dTxOlxWdQdKgOBmJX9xPIkpHoUig6+RjOsPBs9jo1ahra+jjxVlaWRFWJ/5z6Z6sVcL JNJ3aMw5MUAPwF2aXvvvsFdlMb9um91KJYGm9bb6XkAEa2rPlfDH9aXtgXsIeVB3fg3RQSsXRJq 6+JspSkjgwPywR8MWHw== 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-06_04,2026-03-06_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 impostorscore=0 lowpriorityscore=0 malwarescore=0 bulkscore=0 adultscore=0 clxscore=1015 phishscore=0 priorityscore=1501 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603060117 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 17:23: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 E98C7391503 for ; Fri, 6 Mar 2026 12:22:09 +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=1772799737; cv=none; b=l2aCHg04la2hV5w4xSN1FLbVCxMzaVbPdADzQUqAjUu0yUvg+GB3iXhGOoovULIvOQcI3O5pEGkQJaillEbtc8UcbYCHaXoIEB2f0FH6gahE/nTQec7EAXejpuODWRXgEHrF01N4odWs83NCcdm/hfCiuhPbYNt3WH+HMTmXAgE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772799737; c=relaxed/simple; bh=VGST5Brah17d1wPyKLpwY5Hj5+A6sMXNTyNGXYgoTDQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=egyhTz4+0G175/70thvgOvZBlj0Vz6ZN0tXRqgVXB2gbHS9+YurzokRg42h85zLqeZURiKoh2J9sx+Jxq+/DopnpRcgGuKH8DjEaeZRcKQx2kx4W9/LVciaFEtezO6lNtF9cH+CitHLORadzwAFUDKDHlrYA8ySwWsjtCL1Z9+Q= 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=IQyxH/pI; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=UmKXA0QL; 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="IQyxH/pI"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="UmKXA0QL" 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 626Bb8Os1189151 for ; Fri, 6 Mar 2026 12:22:09 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=118jvOZ59eK ci70KA7rIqIZSiuUuG3oFP4GJ6waca7I=; b=IQyxH/pIW1cMfvWxfjrN7eWq2PO hcOCVBVsuuC0MpgHr8qXaxzpewGxWebP26xtVZlkRwKM2Bh+GY0TkmpLkKU1VhwY mILJBqtwkEUruoji84BycgI+Xm/09KO/VxnYqfcFWHJASdGGq3G4PFmfjXW6ZKjH K65feqeNPYrXuBMP8EBVTeE406NZQjU0pWVAQfvvFmNpSgMNh/Vt/+IKqs+Rkcbp CNAV9V206ePC4YOVvcg+h6pyNnhwPOS8o09bwQmAZnkIb1HODdGiMQByayLThXVJ UR/+kX25r+ub1NlzJJ2W8Veo0L2Mq6C8s2NM+faTdN85KdGriW1OXzKlrmA== 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 4cqx14g5ej-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 06 Mar 2026 12:22:08 +0000 (GMT) Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-8cb4817f3c8so4538235585a.3 for ; Fri, 06 Mar 2026 04:22:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1772799728; x=1773404528; 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=118jvOZ59eKci70KA7rIqIZSiuUuG3oFP4GJ6waca7I=; b=UmKXA0QL1YOx5PtCLb29JW5skfLlcP4eoT1zdYulG2dxzUeg1cBvNpTGTae/PwP3yC CpvEwjW//KfNjFAloDB3PvXsrIlqs8BT7HUjf6KYM4pMlzQRmrmw/+ntUacgTjT9raxz fDYlQXlj1BF5IfY+FoI9oBEs0uBthL887nGW1H8lg7ISgqfQtf87izbCEOjCIbu5N/to bI4yJhXrUC6TAndWCjFg0xZzyEsYAKel8AfEeVruAk3NUihgLm+uw+Nuy9M6PZc0qG+O bAqAzz+zFJHTD3D20L4ERmBRaY+3Bd7NQje44VvbEw43B4jV2lUDdVNj/ZG+S8vUL+rJ EgUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772799728; x=1773404528; 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=118jvOZ59eKci70KA7rIqIZSiuUuG3oFP4GJ6waca7I=; b=ekHh1J1bSpqbk5OEuCD78DTwqKuBgDIDPcUUll9gT0FdO0LK7sEb0glKlMDo/TbjN/ LpIcN5Yy5so+gOFzEVRyHK0ULZIqf7s2M307sVslOlZxEjt6jQF36VqeXnklYrhJEG6i xuFPdkuJXHAThNGNs3WAR+P1ukiw7Hx5TdPBjBdTgJwTWO5a2hXOXrFb3/poA4mocdu5 hby/TToChkpPvvUiRWV/balRYY0hGw/SMvz8xgt+EnN29OCHYp9C5DzGHBu0JS5J3Jmc kLL3WGPqyhuGIsj6vPER7T/pRxFWnegJ/Of9J45w3LMYusrzJQ2qBFQ54m6EMx5QfEvP uRdQ== X-Forwarded-Encrypted: i=1; AJvYcCWkYTOOqz70Zj2CtZir6ZC+Mp7BzPvb4sMn/xAhGnzQDfikPZreb+0+0HXqiMxdGCQIc7ddQrmICWZCZ48=@vger.kernel.org X-Gm-Message-State: AOJu0YwSY2uiUzuu4wDRKakyfkVQ5bdFHVs6E5y/HThojrTRjzLp9P1b fqmz/43oW+TV8lSPhc3pcMyoTXyOzrbza/0dPSEyewV+r/HaFN9X01b9PtUKRuE4CUotKfbmnH0 SGfk3WKJn0BKiokaWPvlrw8zdS8BOWWAuQ3vfXA03kVxHBoHI6vvGHTCPfkR8IC6P1u0= X-Gm-Gg: ATEYQzy3e7R42SMSKlrWlKr9Vj01aoPGTUzWBHaPxd4vD8Rf0O6oYOcTztd+/Gdvkcb dv5evrRRfzaF4t/0atSohR1x2boNwJGZBuCNVNpCCXDlmd2EjJ9UPaIt5O3zkSWpZ21CirKemk8 WI9Fu1FGyPdsWdYdpwWRRFMfh7EGAWzDlUl1/G1wDDNICzOCcK64DzS0ZKxBnRmY4qKeI5l+vZ9 D2HsuV971SVrH6mNB79JG0+Ye9s/ZuMgvQdYM7p1QUzGXxvxu5hplpsGg4JS0J67EbGMCKlxdGr 5hkA2OrPEHrnKiOkYwsoPTcYFfeqzTw69A95W+wR3zZmkfZm2FPSwtGqhIBau8aMke97bCcbs1O nJmI5BhY18tcq/1QC5YtdrUuGkh5eumCylQsJymB7Pp8yzWDFXWAUiwc= X-Received: by 2002:a05:620a:468a:b0:8c9:e98a:d9f1 with SMTP id af79cd13be357-8cd6d37173cmr229475185a.30.1772799727921; Fri, 06 Mar 2026 04:22:07 -0800 (PST) X-Received: by 2002:a05:620a:468a:b0:8c9:e98a:d9f1 with SMTP id af79cd13be357-8cd6d37173cmr229470285a.30.1772799727469; Fri, 06 Mar 2026 04:22:07 -0800 (PST) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4851fa87e56sm111972395e9.0.2026.03.06.04.22.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2026 04:22:06 -0800 (PST) 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 v4 06/13] ASoC: dt-bindings: qcom: add LPASS LPI MI2S dai ids Date: Fri, 6 Mar 2026 12:21:08 +0000 Message-ID: <20260306122115.509705-7-srinivas.kandagatla@oss.qualcomm.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260306122115.509705-1-srinivas.kandagatla@oss.qualcomm.com> References: <20260306122115.509705-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: AW1haW4tMjYwMzA2MDExNyBTYWx0ZWRfX2gcIeafaJ00K xWYQnaxOya3EJymhMOmcqnHVJMkgGqOk0gDQzi6LW4+YBoLTZ5zUSjDcyulc7tjppo+VtN+3+XV T7QQydeJGweQOPkVKhe+2iLZ+r0TLsHxcBFeQ5YlCDKWblIlyZeIqevnxuYIZCoYCX7zleMs+Ca yhs/+D04h5ui/9HZv5sj8J3tlCAIgFnw/3wRO5rdRfkinQdtHPt9Q6oom7J625R9LCCweFonEYg de35ZCUE7XSvdoeK9+hRhfDhmPDSBuYWWTnf2yYdMsbHZaQvlA3AMTJ4vEIFRuPWP9VhTeTGt0P /BeMsQIGR4UsU/itrGs478jz54Vr26reyLeQExJcXkflhDlz7ac1o5hS9h0ah+29oyHJIy+k3uu koQik1kSUmlH9rMBPN03yxyH4tu3Zbl/97GZ4M+1rVZy5y/VPfPG43r4+bmHqjTRJzGgXkzuxtl eF3IK+g7miOnMEFZxIQ== X-Proofpoint-GUID: t_KeVHztCPSrAp408HIXHkCsUkw_wssb X-Proofpoint-ORIG-GUID: t_KeVHztCPSrAp408HIXHkCsUkw_wssb X-Authority-Analysis: v=2.4 cv=e/MLiKp/ c=1 sm=1 tr=0 ts=69aac6f1 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=DJpcGTmdVt4CTyJn9g5Z:22 a=EUspDBNiAAAA:8 a=6P8UuP444nAwg2htitIA: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-06_04,2026-03-06_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 adultscore=0 clxscore=1015 spamscore=0 phishscore=0 malwarescore=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603060117 Content-Type: text/plain; charset="utf-8" Add new dai ids entries for LPASS LPI MI2S and SENARY MI2S audio lines. Signed-off-by: Srinivas Kandagatla Co-developed-by: Mohammad Rafi Shaik Signed-off-by: Mohammad Rafi Shaik --- .../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 17:23: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 5010C36605A for ; Fri, 6 Mar 2026 12:22:11 +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=1772799738; cv=none; b=FG/qd/LDGq3hnFunYILMX0EVcWhoGix5YTyy9Vx+/VjB36dASY9G9CJ/H8MsnEJIYc55G28Ue3jZm0yPOyAzFAZNBZfGWSwCNiIXl6dFDF27bmWgDFs9JvAxxHP7K7FbaHaWz+iKRvmkPbdEDy9YRD/59psHIWIYIZFTa0yWidQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772799738; c=relaxed/simple; bh=1AGWMMo+ZQ2MpMqgndQclqL9hoOIddPn00jRigW1KUQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JUkVSRQ3UJ+ZDqVatTEvJbup6ab0oZQttRc5/JqL8N7W1Jw5HV1uoa2wyiNo+SAJmYWD/rLUYoHObB9zKxyBGTZc+3V+gfvq6Nz0/IYonZe9GvPrzdGLbsIZ9WyEShtfebzJ5allwl7BmineFO4p1gKmtAU5zrb2GeGX8kEfeZQ= 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=ZivXB+9s; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=aoPKQgjw; 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="ZivXB+9s"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="aoPKQgjw" 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 626Bb2nx037395 for ; Fri, 6 Mar 2026 12:22:10 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=ZivXB+9sdb9jEnHianVoztRnL6C 9BzXQPCnKFSF1TxmV+2qMxT42/p0f0DYYF9UyOkdlA4ekBbXM/RTRrFWc1cjq7B6 NlPhpIgUf8b9E9d6lwriGDcB7K0H+lQWuCfteWePXNdFafxCgMGLaEMdAoDXtYLZ SPdaB2R3lyNy5lF4LMoNY5J1Trn709CxentL4JCpSSuFnZIeeyqjxRLAhsWlYkZ7 Kl+274Jh2YvyIV7eBdVVgJmcb2Tum0ap/4xmd6ez5eXQXZrJCmKSfeXexisfzyGN eTPjBS/kxYMEsxxqc4+8JScgFWcdaeoz7RFhYsF6eRwxPjswfgdnXsIczKg== 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 4cqpxdsqjs-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 06 Mar 2026 12:22:10 +0000 (GMT) Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-506b4bdde91so621847491cf.2 for ; Fri, 06 Mar 2026 04:22:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1772799729; x=1773404529; 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=aoPKQgjwYtsn+EF3bdo8MKnFIBNalPawAFrnnoWTiBfVMRnjTSn9ysA1zixd00aF/r DBOEp7a/yV1fyOLbFVsJTVhP05y1cHfVvsNY7V7Crb690uI67Xox/ZEJwGqh/RefulLp 8bIMdzxEJQNSpJ1QMMVbae7P8lp+Lota5U0kx++bAylEcIcv7ijujylvfn3Sm6rpquLd TZEGn2Gom45fCmDaBbY6SsX+B/u/AgNsGehOkXWBWxyYzVBpY6wuVReVztpQVOhFE4M0 tT6N3wTFd3hBOF+6Mu5T+I6LqPU2nc+Fef5ahoefF5XXExcFc1pmRTd/GahBHeMRPjB8 IDaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772799729; x=1773404529; 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=L+NuG/WXAUamIyh6gzegpCPn3+XNr81d99kVCaLxWGhdYTHZWBjPfreQ3EDWW9fMpq 255PpGeTYdhPXE3Dtegi29UBEO37q42/Y18lsznnitX4XHaRIz6RCNjoyQe7EyoEwEj6 8Q1F7pi0rjhGAlaYi+Fr2mrP8oH7lXfYAtlT3HpCVFNIOUEZpNdoUYGnRsql0NzZeenr /14mffPaJgYb4IJa7qNlk25p5SgPgUdG8Dbh5lA0roIoXshIH6Cut19f5gUoQZIyct5J 1Ix9mldgSC5+BuMAzU0Sj5DQmtOoExHyiH2Bqxti/y/0rpBZSvFmJ9hrO7p4td5jbzG6 Ubhg== X-Forwarded-Encrypted: i=1; AJvYcCXg1+890WMhcUXgGMh3wekBYjFcH38Xj39ZcEU1FPD4Rr/2vimXyB/xx2PV1XYcc2u5wYrBX1sE+oMkOPY=@vger.kernel.org X-Gm-Message-State: AOJu0YwdIbDBn0pvL3xQN0LzxTVUKLSV21otcC/pGiWl80YA5xOOpUFd 5OxlabsKIZft9+4Z5hvtOeME7ZIodUyOQKulPslOL7bWVrguncgV0N+AIcSdI+vDAWO6ZBUf70l Oa/ZNNc2vevpe9Lw4JbROx3zMM11hACqS8tW5owa77mFHphKSdOyz3ZVuvReVmg8Vns4= X-Gm-Gg: ATEYQzyTf9F0iCbqrDrZimUEbyxPcvEduPJNocyT/VRGnX4G4dL/bOJoxEriwdmKMF4 9k7PAHPrGQnS5Y2IKuMf+2yvcawFjW+NNWclTvQE+77U+ZqmY5+W6kv/AqRjXP4bcTSaDwCmcwV whLm8+y40GuPnkRuK9FwIUZQ8qz1fOsjg4gB4OQQwdGUC1v0myPffzPrNG4ThMEgSwI+GSv3DkT KFZSCA4dBPXIEJTmaaTkfYX8VGbhwvWgZWcx8TmSwkqXhCTxfgY50NQti1SVfEciUu8NwUI6VaU IRqW6r1CVmQSkfBW4JP1g2PKOs63frng18FPHuF9CWhdxNxJtyF1ngd+nvpKAyR2dV+DtvuZb8B hponeqkk5g2tmBm5Hsc0i0wVM/0Wy3u6QODwu/odkRETf6c/Lj0Q4QFc= X-Received: by 2002:a05:620a:471f:b0:8c6:a034:9220 with SMTP id af79cd13be357-8cd6d44a501mr233125085a.25.1772799729245; Fri, 06 Mar 2026 04:22:09 -0800 (PST) X-Received: by 2002:a05:620a:471f:b0:8c6:a034:9220 with SMTP id af79cd13be357-8cd6d44a501mr233121585a.25.1772799728800; Fri, 06 Mar 2026 04:22:08 -0800 (PST) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4851fa87e56sm111972395e9.0.2026.03.06.04.22.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2026 04:22:08 -0800 (PST) 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 v4 07/13] ASoC: qcom: qdsp6: lpass-ports: add support for LPASS LPI MI2S dais Date: Fri, 6 Mar 2026 12:21:09 +0000 Message-ID: <20260306122115.509705-8-srinivas.kandagatla@oss.qualcomm.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260306122115.509705-1-srinivas.kandagatla@oss.qualcomm.com> References: <20260306122115.509705-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: _s-iTT7ZrF0PV7RBQpQ89tk6VFFJghik X-Authority-Analysis: v=2.4 cv=E83AZKdl c=1 sm=1 tr=0 ts=69aac6f2 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=yOCtJkima9RkubShWh1s:22 a=EUspDBNiAAAA:8 a=nvRDalaNTaWZAukup-IA:9 a=kacYvNCVWA4VmyqE58fU:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA2MDExNyBTYWx0ZWRfX5nxfpfugGYH1 ulg8fNAK2QjHpAQkHQHH5r9r96TftTvqvHI87XoTjItRCzzsA0TkDtnsaBTNbAuLh5CmENiGpB6 bVFklrJiv9cRrK0Etqp7et9z1rmIODM1Aohjfu2Zt6L2kWaXdl933yUTGRE3DsJX7Y/CQL1a0dN 7xUBOFZgodB/gd9fHdUG/3UguA28g3WiINyunXb8Xcdpc6O+8HjPc9lI1eaayqp52JOxPHeyR9z sMWp00O285up+mAXQHMk/hpi9kg50mNAEBtKHRzUmKQP6qTs3CG/kYMqX9JVGfYIe0Z4AnFQwF2 xJI0NOz3Nbyyw3aVbLKKQzzcyr1II9jrJx8zFlnr+VcW2p/mWqGRg3OaMATS95l6Px8U2dpibOS Z8VdWg/YpcZLXtH14l1zbIuMaoEVdcYx1C4XO9H56I0/ZozV6JUOd5NHo/gi58nx8OcVUr2S91F L0WRPKL9Mg8032plq6w== X-Proofpoint-GUID: _s-iTT7ZrF0PV7RBQpQ89tk6VFFJghik 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-06_04,2026-03-06_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 suspectscore=0 bulkscore=0 phishscore=0 impostorscore=0 adultscore=0 lowpriorityscore=0 priorityscore=1501 malwarescore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603060117 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 17:23: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 83AB038E5DD for ; Fri, 6 Mar 2026 12:22:12 +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=1772799740; cv=none; b=ilwh9u9SniHmEOWVRd45QCAJv1luLDEM1GgClxmuD7zsp86W2BogXBFVNbS5Ox7hoYHNxjZguEQhFmQffUvTFlnAz2y6gWnuHSNllP6slDc5KC2a7iTxIuYlt1kbWQMGNBoXmL+hWP29tSoVQfWkh/HSUbJfBuR/XrMOm/ZChSA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772799740; c=relaxed/simple; bh=nhF962DJ35ZnGtg1Nyn29ALPxXwZIXyRUxas4dLT8SI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rDTANTj64+jzc7spR9UMyBWJDHRPAutqjnkjG5esWFq928lo9Ovy+4efrbtcIw6NyCh2RogJL8S01vrvgiYzWo7RnBCUTYXTEJ8djiHsr06hvzASD4m7F+76rybDVd/nibAjkGx42qvJSoiVK0BLTExN0+8v3RyNYS+fCTD04KY= 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=SYG7LYwT; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=dhb11gmh; 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="SYG7LYwT"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="dhb11gmh" 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 626BajCF3716442 for ; Fri, 6 Mar 2026 12:22:11 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=SYG7LYwTvMNeKedfmhhi/4278Kw 8g0kBwcfjG0Po7YrhUI0RSSRxH5ZnzIOaNQb4IEAOjn96mt40Xg9dTLLNNqhdcc9 K9rQKdCIkGAALXfjHtgDWE6m2NEeDroBpUj32icU13HLb1muCtBMTmUtqc1J2NNQ 2MP9tLby/heIeSdDGT12JY7RhISpDvOgXrHQim4v6HdjXbY34QsZMC6U246srnBw CGeQ3K3jOyu25me26N5n8aYJvKu3Hc15zQeZ9fKkbgF8SM0mCus7jLXLyI0vl9a/ S8xz4g9eq3g5VVYTmCtp/C20lHi9uvgx+HTJljgRxZt3skawNt/4YIfcuug== 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 4cqv98ggxf-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 06 Mar 2026 12:22:11 +0000 (GMT) Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-8cb3a2eb984so6320262685a.0 for ; Fri, 06 Mar 2026 04:22:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1772799730; x=1773404530; 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=dhb11gmhWHEFkgVEFt1wOe/PZjhQaVeXIQ7BOku6bzuaWAPfflVb2KFLUWCBpN/1oF ZoeitHdNJVAqq6orQHUdtZOp/l7zbgsi0XH+nShnapNY+OHAGl/WlWBJfC2VjhFHctsI 19VsRC0lq1rUr0Uin05jp4hJqKv0TP0KjJYYC99EZCl3Ftz0rldVuO8ia2vw6YNaqsV4 fA9+j1eM0/s6qndieCAgd05X064qXuk5H7bvcL9v3jQu/ZdWdBTu1MmBoLrk6LSliV7R 5BXdFG3bxLIERguU6HttcdTwJRwKRoVcOApsQm6BdFBLCydjJdmuLuXWWZFyS1tQPJ/o MCrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772799730; x=1773404530; 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=Itx5KpmNlvkyYHSghviJSVH78iDFjMzFc2hn33sIwJ3cYxUfMuU3kwbAB06SROMkyb TaQzWJXmtuulZeSK89UO4z+1ufalQHpl79lHY9yA/LQiMN47Ac4p/H4/pSYj89lZ9hjY ExZbUNFuHswxO+X4kAN7B9rP9xNfx+caVuO9dJ9uhNFzX8mmIjsxEh/YB/tURXkXb+6R F58fIQzSlUsbWAe/OwPLUeTJppNwMVyYyM/foRdGEvkmDRXd8DB4Taiiz3LT4CUjuoM8 eo2AwYIcl6I1DWiPFIKpB70/EMWt+YqrqWBNHJZXl4slUjl9C3RTqJ80pyCfn4bxTlth i2Qg== X-Forwarded-Encrypted: i=1; AJvYcCVXZVQis3+SNfQhJlom6fywEdqorg1qFZtSBtVptOqyehcHue0X1sovul/Xje74wwytrJmt/XDxYwyCaOo=@vger.kernel.org X-Gm-Message-State: AOJu0YzLfTIIcmFKF9QuAHR/uinyPVu8jyJa8+bDdIaESQ3rRfgKymN5 mKZSQlaU11OFyDAB+269SH2NSf9Xg6IGofaRW+p8OSP2wfFyDctZuRL+GDuZXj/TOSBGsuyqbhj daU154LvFHUXgfaanUQ82PhjU/u9SzURS7dQCzMdU/3aiUPsiJ+5ccEqbesRDElxNRgU= X-Gm-Gg: ATEYQzzgt/uZw4EDbvpYmzotTUNv6nerl/n5RSv0B4cOWIota2vIVlVLSWNZNHZSP1C bowwqUzikjajC/omS4W7hwbkkz+FVxkNOuJMbjCjPIR5fdPMY4CupWoQ7+tThuUlsxJD/eRR26z LccZr/i8uMTsXOeCXN2vFZ2brw9jWuZoJWSkh/WyxoYGJylc9jhOG0z1NzIh8uD6koYX/PvZIlp bugwzxNgXL1uqcCwRjymqw40OQiCtJOq9wXSxe5z05+HyBt/Y0IMtL7/MBwVBmJ8NhIHS5BTovF WZ9fYMmoRPdVaVzcASHNUSUQjdTfP3LHS6AFEp3oYnbrxoDg2ukOb6yEI5Jsl3odE2XOyjspWi9 O6Cr05Y3lemGVwej7zdWFuRYve7mLpRZgw4LPOw6ncOrAmkCIuHdUPj4= X-Received: by 2002:a05:620a:4093:b0:8cb:3505:443c with SMTP id af79cd13be357-8cd6d4b4e32mr241284485a.44.1772799730545; Fri, 06 Mar 2026 04:22:10 -0800 (PST) X-Received: by 2002:a05:620a:4093:b0:8cb:3505:443c with SMTP id af79cd13be357-8cd6d4b4e32mr241280085a.44.1772799730112; Fri, 06 Mar 2026 04:22:10 -0800 (PST) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4851fa87e56sm111972395e9.0.2026.03.06.04.22.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2026 04:22:09 -0800 (PST) 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 v4 08/13] ASoC: qcom: q6dsp: Add Senary MI2S audio interface support Date: Fri, 6 Mar 2026 12:21:10 +0000 Message-ID: <20260306122115.509705-9-srinivas.kandagatla@oss.qualcomm.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260306122115.509705-1-srinivas.kandagatla@oss.qualcomm.com> References: <20260306122115.509705-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: j6zvOAjEAkx3NfuClZrJitYVzgZ8Uv9o X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA2MDExNyBTYWx0ZWRfX9X71lcS3r70y 3VtQ0w4Fcorov7ZDJy0x1I3w8EN/Fx7Fxyfn67tbqZF2cRoVWIJ1UnAybnFUxQne6566FCiTgVw glYn/C+mVEEEvg4LEhtTbqJQA5iQTQD34F2MKgLAzlbS4Zdm20+o+GD6omtUBqDJb8pOQMebsmP 2lI1KQ2sqvlA9eXmVhLrzNsBOZBgC07pS19iQgVCjS2HN94REhmKakoQ+wcqM0MpoA/cHwFk8Tt zDFTUsjWXk/BAOhe/GQIsRNTBMisHLoYWVTWTRavdkJirzYkh5SDsmnnLINQPjktBaaVDIiLIxJ WqK6+uUOlRc0Y9uIv99LQilm4vZNPRo5Nr5nLtyggXc+VsleEPRyw+lRSxrSH68ceCVZGCbF08/ U+Za86z27R55cAHfp0PvmmiZdgn5/Zezm22R18aG5oiKSGZJpiGES7QkEJ1KgLIVMdFGESVTbMz JwKCwzJ5K8R4zeoxXnA== X-Authority-Analysis: v=2.4 cv=LbcxKzfi c=1 sm=1 tr=0 ts=69aac6f3 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=3WHJM1ZQz_JShphwDgj5:22 a=EUspDBNiAAAA:8 a=aBFzMgE2VLA-TvnT3JMA:9 a=NFOGd7dJGGMPyQGDc5-O:22 X-Proofpoint-ORIG-GUID: j6zvOAjEAkx3NfuClZrJitYVzgZ8Uv9o 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-06_04,2026-03-06_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 spamscore=0 priorityscore=1501 bulkscore=0 clxscore=1015 phishscore=0 adultscore=0 malwarescore=0 impostorscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603060117 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 --- 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 17:23: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 E60BC38F95F for ; Fri, 6 Mar 2026 12:22:13 +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=1772799742; cv=none; b=tfYRgVpHCDnwHOuXIo4PrJfNjS7Z69JD+EYMCXXOtyV8sf1ENdmWkZ5L40aN722f3opY0pHnD1mNH23LYw2cr08aimHlxwmSo/H4G2hpX8QXyGyIIG/NH4RYWtn0uBrIv9UYwSmjNU1wlmt2sBuaYhFw3WRBaLFcdu7iOUt7tRc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772799742; c=relaxed/simple; bh=sljgOhpaU8wHMtLfJBiR4fUV3hNt3/HmvH6kZPwy9as=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pHyE4yBz4l/bcXE6f1jilYf83qHM/QP24kVFfqAY8prozyi+yqpdRgW94pmiTHEsvEsheHuNrFDdJ+PgZuclAk+TkXrf8kiBLqepbtcDrOthDohmVLTc4hFbodOZZWrFfDAy3XLnbZjlgnbK2Qvb/QCJdziH9qHKWckgmFSK3xY= 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=M8aKK6/Y; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=kezEdVVZ; 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="M8aKK6/Y"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="kezEdVVZ" 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 626BauSQ864945 for ; Fri, 6 Mar 2026 12:22:12 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=79Hssidv5J9 yhS1Hc5RwtLaxh/YVdwsl6nwkjjN6Bow=; b=M8aKK6/YM+T+Yq/STX4au9lSml/ 0yZRAh5L+EUHlUqbf0Byg+i8n5tElz3k4BibRqYcxV85ORR0rK0/Yt9HIgPvyF1U zhVfzWZgF+b5h+URskJm+u/0qKTLhV+nItkMLwZQJ+yQ5oLW+nM4QRIynu7pi41S AEEB3nf6rn1UvB/vq9aKvzwyF4RJKpJKxjFtyB9Cc9VZs/P6qW0BIhroZwlbITjC B/KziA+l42IFclh1VbnszhtkU8N4Hr+j3Gn8E/9Ubp8ih742m3Szb35/DfXBpVNr GcSkmD8Bimq9awTII0OxJYYBcKDqs0vS84Vn1y97Y1FyyQd59c4D2d5gFDw== 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 4cqrf5sc7s-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 06 Mar 2026 12:22:12 +0000 (GMT) Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-8cb42f56c4aso5315789885a.3 for ; Fri, 06 Mar 2026 04:22:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1772799732; x=1773404532; 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=79Hssidv5J9yhS1Hc5RwtLaxh/YVdwsl6nwkjjN6Bow=; b=kezEdVVZ2Tl5Fil7UPcvBqE1olnSlaNN6Sr1tc9/uZ6K+8cNRKb8L+y8P1IOql7ci2 r8EhP96o6jroW1+dbOlpDYJpgQyPNx72w+SJp3Ez8MqfEuPJbu10gsZwr3nSdLh4qPf8 hc03Q5/FJQY6tIPHjcSEsSeVjOowwLNhj/E5l96XDtzUjyULiZNQFJ74odTGdiwvAdwF BP9X+CgCiZmkVibxg9Z5EPJkAQiG81CQXsH2vSOUqdCmqQ5f2eMBejw7ofnOhdufI/Db iXKyMlRfXDRykY5YVeag7dnrkKKx2XJPsBA6ZWt8D/9wRV46gcnawpH6BsbAa+NztNnu fReA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772799732; x=1773404532; 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=79Hssidv5J9yhS1Hc5RwtLaxh/YVdwsl6nwkjjN6Bow=; b=aOms8YXTlSh/H2yNbbHGsLrwvhqqiFwi4XvXxJ6q0tVNi/htWwX18eAJAzO21ZqZ5V MqHzZL+bmoXN1XKevGlfWztsy7tm6P6XJV/ZXRPjkRk36hJAFM46cybsMp/we0LXqe9h pu8x4cmOpKFHnVOsFoT3+C05zdp5gyN9WodkHo2uJtx8mFAybdkqJ1Ky44uf4X7j/aVL TZBp4RQxNcu6c3W7MhVxrUvgG8jWCE0MRiKzo6Qk0CiooiCk9iSNbXtxgaPhVM8+cHSE UkniedTfkhOnOqmymyXkpSHMKQhpoAnItyugnukLxwTHHIpB+LQKtN5iTJKLd84pSYzQ 7Y0g== X-Forwarded-Encrypted: i=1; AJvYcCWQplFsYIPCbR6+mY8CZL7fqCAA4Mr+O25Z0TF73BrIdZgm57K2cFN+/I0iKVpfEwzHYdF0j57nv+LdAmA=@vger.kernel.org X-Gm-Message-State: AOJu0Yy4NoBlBeyE2w8amoSQBqqv0DLMgBSPyTD4gSzhSxvHnScuBF7Q XHE1PXyqNFCawUuInj9I2mCMM/Y7gjFILMXH/7qtHQL5smnxbB+wR8NHrNj3y6Zteuj/lWbcNdf 4pxTfVbSNw5OYDlvnnp7Nz3gBncViejwfG9v7mLYw8Q/1xVGAb7KZIeL4j7zzuQLQcws= X-Gm-Gg: ATEYQzwf+4l6II5oAAX9iyTcCz+7+WZEve4k6VQ4IVqGeqHTfIlDvTnvXhSJc1Ac+Gh 8nVbFIdgUzXDys05I20k6rJRzDl5m/6yFUKCHeE0nAJV+OTHCEhSftBI9RN9PydevXoaYD/fDBS sYVJosjbHxSJ4xDOwfEwifFA1F1BASeGpEWygoTDpSAyxUUsKzGnpvRE/CRZA00J86G5nbo+hXn ENfslVnECoiCX/REnZlZfX+x1fEOzFqfhbjx/0m4cbBqj+LI1Zr2EgLyd8F/3bC6ToNbmWDQSLG ASstDXTM1njl0vhSWOOZWff5BQmRxF+x/B7QfXBxrRN8oqqfFXFDExvAu8qjn3muqth9Mj8N37N pqAbWfgVXXQ2cs6C6gRnGulzKXAZOI1JPSN5rosuioGC1X1BxwzvdY4Y= X-Received: by 2002:a05:620a:711a:b0:8c6:ab8b:29e3 with SMTP id af79cd13be357-8cd6d4a5208mr228839485a.44.1772799731934; Fri, 06 Mar 2026 04:22:11 -0800 (PST) X-Received: by 2002:a05:620a:711a:b0:8c6:ab8b:29e3 with SMTP id af79cd13be357-8cd6d4a5208mr228836185a.44.1772799731366; Fri, 06 Mar 2026 04:22:11 -0800 (PST) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4851fa87e56sm111972395e9.0.2026.03.06.04.22.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2026 04:22:10 -0800 (PST) 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 v4 09/13] ASoC: qcom: common: validate cpu dai id during parsing Date: Fri, 6 Mar 2026 12:21:11 +0000 Message-ID: <20260306122115.509705-10-srinivas.kandagatla@oss.qualcomm.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260306122115.509705-1-srinivas.kandagatla@oss.qualcomm.com> References: <20260306122115.509705-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: ULvHHFgUDpR6o_y6jD8PbMQuz8NlAR7D X-Proofpoint-GUID: ULvHHFgUDpR6o_y6jD8PbMQuz8NlAR7D X-Authority-Analysis: v=2.4 cv=L+oQguT8 c=1 sm=1 tr=0 ts=69aac6f4 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=gowsoOTTUOVcmtlkKump:22 a=EUspDBNiAAAA:8 a=FTFSxu1yF2iZ1NjiFwcA:9 a=NFOGd7dJGGMPyQGDc5-O:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA2MDExNyBTYWx0ZWRfX1O1P/dVfYwTA WINlJUUyRHnrnLyTqTrmunT1aaJkWVPgsnrYg+LPjGbM+MFdPOy7BnHVw0SII/GjUqaLknjnHlD zaICplY4vX7upfJuNIqj081pCup5vtqOrULduA/4k6W17C4LeW46ac3Imjk0Pz5XwU/Zjx7llJ4 wM7MGf7TcpC9Yqv0zQjyyFwvkB3BcvAv+HtUuOnLYq+vHnujz7ZYab8XkyBHmfE4rkMzlPEM5zQ au6gNcgFJw38Y2vjLx9UedLh+02jreCPhgv2FxjKC698wC+taFxTqrtp4iThOxeB+uobJlIReYC AFZae87yTfG3Mw6FKdb8ocg6Mhmx/kQRKCI3emPZsOFPF4Vbt5WRnZgco/Qk+0XUbD4o/fF2UyW sJAUvFT+4/ABYrKlYeUtwuM01XmkZU6D60wUySyjXhY91QZe3rxSVTlFLhGylxYBk4klBMu6paH yR2FKzo5v7rpJRk4DiQ== 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-06_04,2026-03-06_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 suspectscore=0 adultscore=0 bulkscore=0 priorityscore=1501 phishscore=0 impostorscore=0 lowpriorityscore=0 spamscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603060117 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..878b42babcc3 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 > 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 17:23: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 C0925390C9C for ; Fri, 6 Mar 2026 12:22:14 +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=1772799742; cv=none; b=sXKtIJ6LnDdNDyeQkxCskX0blMX7CW/pgbdI6imakt7hh4Fpk/SbhNcZyx/Ru+6MX6bLbRpZd/w8Ehr+YQtpKwdv5fxNDtjp80/c2ZYasbwEr/bxaqfhExTGQ3dtZlY4fhXDsFnQen5QOMUJkDxwa6E/oSP/7rdJihSA1Jzz5ZA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772799742; c=relaxed/simple; bh=iafQmWDeFIqwxoTztlKqMCFwj+DaAdYsFKAlvo4MX7E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oE8yevTAjVl9pgmA2qzi2ky23UwkHzkHXlDg9EXKo/L+uGuEoHDkd11/MxImuaUg2EwDSeed+T554Q2ZPQNUlStZG4gmDmNL80OxLEEj2RkMpViLR0XovGeEE1L8vt3cK2a5zmXLFCspawjn/lzxcYl4ae7/FZsd7qIKzLRPu5A= 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=X6j9A4S8; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=YJlvksrG; 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="X6j9A4S8"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="YJlvksrG" 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 626Bb3AX3716762 for ; Fri, 6 Mar 2026 12:22:14 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=X6j9A4S8/ZYYxhKpevuaYEVz6GE GPd9JoHZsrekQm5J4PH9iFEv5JF/ohDFNmRX2xtD5z8Zf5Y2cDCxi29PEKTrHFbP tXiLi1eBcDDLsX0up2XNwtDi/sufdJU1Fp8BuksbhICeq51Qer6oPdASr46Q8N4p uumAY+UKtBau70RlPnvDdYoljBdJcHW8mMbMDI+crz/lpjWMeJalZM+gVNH1pvAL 76z2mmuvpYyzQFDJ1vqRg6WniOgpCO4IO5ZZV0S6dZgyQ8YtG1yamEqn55Rad+9D On139bWonIdCI3NGmEz2aMloyWxco3/ZfShMU7EVfYo1Qi8IhISOWUvXPEA== 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 4cqv98ggxm-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 06 Mar 2026 12:22:13 +0000 (GMT) Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-8cb6291d95aso1506797885a.1 for ; Fri, 06 Mar 2026 04:22:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1772799733; x=1773404533; 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=YJlvksrGiaP0nVmTxP7ctRR2Pyzdq85j00iQe9Ex2dr+u0JFQhwOL6t0VoQc3bc4Xo mX+B/ZlVu64WXb6EGuVGAyp0Bnwg4S0ZTg/Z8NiZ3gVlmGngg7HavzrHoBSCHbXbjw38 bkPE71b+wYsTUdc6znwOqJRMxLId/ZdZ0lKTeRPbxBjS8RuZE0MOXhqxLoINEgZ6BayT UrVMjJmdU/rcOCVmExoAg00thxJLUsla+6e7ia0bhsB8sSve2JkrEyx3MqXzvmQqoxog Q6hjlaRBIIgHzx1w6pPSf+XrDDyfYVDSWMbZSP2oz3wqZS78YvfBxwvTN4HlcbZ+domm eAfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772799733; x=1773404533; 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=TMtClWxMtb77++CbCo7AYbID2M7sCQ3Ni6M8lgO0kdLftBMGrcfs8zLpaAanGgP9tA +LqxyfVx42cwffRSnUgcnlPsUFSQNHjMx9G4Y1kHXtHnI2JR7evLu3GHFl03yA6oxwCW VczD+7MVwLX3GsqmfLSZaTSYBfPqSwo1PqNzU6T0qo4tckWCmZ/wOWz1yAZQTo7qp45d 6vVFQHNi5/xNToSVadsgkUuGQeT4KYdSN/iiUMPhmLMESLF3RbHwM/lm4sYoNeoFfWu2 xpuzJUDPxWC6jRxXMgg30vfKitVniPMvi497QgbExR9ppwMXN+RYl1x7gajC4VdNcTGO aWIw== X-Forwarded-Encrypted: i=1; AJvYcCWAFU74rSeYQcMlq9PdbqXLzoriZeKST3kImsFsxFUL9PS9hY0X6dT6dWlGOoDkq63QzX0r2N90Js5Xcx0=@vger.kernel.org X-Gm-Message-State: AOJu0YwODW+P3NCyhDrg7okLRfTMIvgSNXpnieZeHbLmldtYREI847F5 PpQ8r0EWFxBvoP+yeMAvT5EULbe5YcIuuj4gLklcFLLcMHVyrJt3j2740RUhWu+PwlqNqsYR4eP HIJd9aPTLmHjXZV9ZYyRlUD73QHKRFBbrDRNREdHjOztg5gWbrTlK26yk/fcOKaamraE= X-Gm-Gg: ATEYQzyEVKOoJthtlWkaot4YIBpqWb+/l95EdtOGkxGS6GJslar/h4WicKTZ6w10M+i 71Jc1PE9Gqamrcb+SkxId7R4uxxGmtTm2E1CqELwMHyIDWAu8gPpyGAWVPIAiDl2DOnE0gD+LNW JcUzydsV93G3Ogy6Irz24X+T2lmJKarO/E/yz/CvykH4fTyFFkdsxcfkZoBmN1Vbc3VcMn/vyCR jP9szx5q9xBXaadK4dmAYU7jj+wBerSXPaMAADpgonyd53XYUqtLRG1IxMWy833Mgy2ieNMeGLA LGkPzYIsqhl+lgATm8JBa2ThFTMIvR1NGjgq2gMizzwKzcwwP+6V4kbVca+qsNoKp8ZBw0FXCS1 FhN7SSqqCMDhI0kwd319EOgyfYFnzwck0gVKAtcYu23+6Nd4tOXhm++s= X-Received: by 2002:a05:620a:408e:b0:8ca:105a:f5d1 with SMTP id af79cd13be357-8cd6d43d5eemr233442885a.30.1772799733203; Fri, 06 Mar 2026 04:22:13 -0800 (PST) X-Received: by 2002:a05:620a:408e:b0:8ca:105a:f5d1 with SMTP id af79cd13be357-8cd6d43d5eemr233440085a.30.1772799732770; Fri, 06 Mar 2026 04:22:12 -0800 (PST) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4851fa87e56sm111972395e9.0.2026.03.06.04.22.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2026 04:22:12 -0800 (PST) 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 v4 10/13] ASoC: qcom: qdapm-lpass-dai: correct the error message Date: Fri, 6 Mar 2026 12:21:12 +0000 Message-ID: <20260306122115.509705-11-srinivas.kandagatla@oss.qualcomm.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260306122115.509705-1-srinivas.kandagatla@oss.qualcomm.com> References: <20260306122115.509705-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: w97nkOyJeCmtEUYFlf_HqArzMwXKatRq X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA2MDExNyBTYWx0ZWRfX6NkIQbgWIxmE Tl8a4abrvSK/V4EkphidEP99fKG4bVo65f5Vit4KzdYDw3qhn0+onMc5lTWCf6gMuO1i7Njcbok kf6eTbEfJ3n3gBn76KjiyAdHP5X9jVJ7feHothp/h2/MtuzaFngOk9ZJiO10/3pjpUABKRHo88r gdYTPb8mkiPTu7fWG1BrrlZDJUmwxcsbKwiny12lsZOd4LnsTSDfs0zw1Xmc+4kr6UWYFhs3a8h nWs7u06yZH0tRtFJWDjSMTH9irzVZthGdcSYshM2xgbN3eRU+GCnKMNuqjAXVP0znJL5Bf9vMSQ uJW6mE6pT5gjsH0BIC4weSYMmjTRQfBwOqfBYG5L2v9Fq+/Gpch8MAHYt7fYhiYEKzLOyHT1jez Z7Yv0/ePN/xXRnEIgENuL1hwJ8Qp0xpnXZeAZQHmN+a8EeB61GUCoJANzaUVbCtgd4Uz4VsamWh gyK6aX/nsJpIr73zXxw== X-Authority-Analysis: v=2.4 cv=LbcxKzfi c=1 sm=1 tr=0 ts=69aac6f5 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=3WHJM1ZQz_JShphwDgj5:22 a=EUspDBNiAAAA:8 a=QkacBUY9L2qTTJrEq-kA:9 a=bTQJ7kPSJx9SKPbeHEYW:22 X-Proofpoint-ORIG-GUID: w97nkOyJeCmtEUYFlf_HqArzMwXKatRq 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-06_04,2026-03-06_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 spamscore=0 priorityscore=1501 bulkscore=0 clxscore=1015 phishscore=0 adultscore=0 malwarescore=0 impostorscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603060117 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 17:23: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 A2FFA392C54 for ; Fri, 6 Mar 2026 12:22:16 +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=1772799745; cv=none; b=i1DUkTrzoXBBTeIXnwlw1panskOSJR6HkUUipHJ5vhAZva/t77hNB3upzDpdVeWGGErZqeDGvJqvZRgc9Tv6OZ1NwTJFYAD4JSaA60OkTEQmqnscmNaC4D3bDvLXpcYdjMzUp1fF7/SoUfz5NmtZpMzCz1GpOeEbzvbN9YEYpjs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772799745; c=relaxed/simple; bh=B8mb+C29aHmXpiZ0KkyuEWv+QuyMzs+RA8VA08jucnY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qJ/96GAiLRWUwurP1RJ0EOdg4uK0q4C4mcnx8bkfkI5Re79kDkofbTsLe6JemjK5YMW5BkHjVYh2QLO/gVwnSNloGqNu0NymhrudO3aNO5Fb/LNd8St+1Fy4havvKa54AjsmWXfGDrX7VHxe0AxY8RlVdTq7ta2pN9uqbYuKj60= 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=h9zx2upK; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=XFL27lFw; 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="h9zx2upK"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="XFL27lFw" 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 626BauUJ864931 for ; Fri, 6 Mar 2026 12:22:15 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=h9zx2upKPzxJjheBIJqXNAqxAne AIJvmnyGUIHvD9i16GUHja2k1z4Nww2tTonNnWYr6hh74K0/S4RRkRm338A98Zlq uoge84oru11xNzKyBOVtjN+ls8PcEw1LETfgLQOwzELgSgZR7sPOMUDnSMgmW+Wq bPg6si9E37Z639DD+MdjyFgHpefk2gh1G1JdKfPyWRlkCZUmQst+35tLRodpEZar r23oXYCioSFf2LXzg7Cm3Dj8fGWXBHqn42Kcs9W9FcRo+ULrFRcu7LXk6uqoQGcW a/qP1Wm/8vlH/DzITpJI5Te7UgI90zKyXlbyfjarH8mhOE26ySxCW0llUaA== 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 4cqrf5sc7u-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 06 Mar 2026 12:22:15 +0000 (GMT) Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-8cb52a9c0eeso6768311085a.2 for ; Fri, 06 Mar 2026 04:22:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1772799734; x=1773404534; 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=XFL27lFwzV/tY5/OFor8j/JNkUHrEAGITzKfOW+SPeizBURqumZY+7y/0nfuwFTPHt MB9TAHOB038mye/0esAXBEdb0FzxJT2Ucq9aL1s+Dk7ilCgVlaYn2Rvn8VGUlIH8Ql0s o+dUDTBtJAwQbGTEwBvMv0yTh/CHtXmeCE7OmTUvas88OXSsBtsN6Xd8tnzEp9SMHD2n iWq+YCn557ytcLxsR3YXoHiJMkFV/4qtu4uvqou59+6yGlVsJ6D7Ijh29PI1JJc9GCYs M3zX2+8D56V/wGlzA3DdIj6mE3J3ghr5uShQXUGyupRMS3GN3o0SJqTxQXkPvzYjHbIr UGew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772799734; x=1773404534; 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=CTAa5VmrHvlDqi5tq2cIP/RVlci9wJlddfTmLOTEKc/xunl7LYBZYIe/N0nujGV9ks op9fjB+ORrMQ6ES1/chBNSnBhLyF2iyWiyU70Usu9hfgUn4E+6jRT2cYTpm8ck86RBHI Cl7mSVdULAph6b60zIT3NUsaaW0TmkzsMI0zIyICHc49baO7QEw+QJ8SUWJks5lWSy0Z R83ED1YUV8su1GykxYx5vsVV3RHEF+G/5gm0pefkuUJJgJaTfSeWC/InpXmEdxlF28rU 3TJd3PBBaDatGtKFxWI7vEEmiMJcPU1qhDyv76nPNQn5aLO+z4MGAVifNOr9JN/069wy b1KQ== X-Forwarded-Encrypted: i=1; AJvYcCVraHozu88TLaFcmw4BUhShNYzrZ7eWrHJLvsJnejNyhb+0IULlPPWCTkesQ4/v5zat7jjct2q47q1RfW4=@vger.kernel.org X-Gm-Message-State: AOJu0Yy1+i/zApDmXLyoYBwTNqP6Bq4RF9VUcw97o9ria6t/V1G+fJgp NOIEepEabARWrToqE5H32ic5pCsTRDLsZ2T/eerWcFpvd4dPG9NafTXd3mz3YR4ZkI2/ZdgpEPy AsH1SMtwJfASMKgM6/I8LbvOf+G0cgno/8fW4MX50kfSV9TgK1IZEpqrqcXnT4yNyQuo= X-Gm-Gg: ATEYQzxauMdgUBxzaxGqgFsKRhEmezxJ4i4vWdLWjsW3HrnWPH0hxF2Iv2nu0Qz4tmc eqhlmI/SMGZ2vm0xx4i6rJfdJIXogKHhF3YivOZD1vVSCuw2r5UtA9L9Lw0jWNGw4qio3EwSVhw lSTw1bIr/wCONlUGYb4sEB24Qc/x0WB0VBUxxrMVtG0+qkXBVW94LNPlwhxERDfaZ4gflHGxxtW Ar3GFV1RrZwxM1oU+jIx6e0IaKzK3lRBUY9Wvw+J52Jy3Xcn9TPWQVg4kojesCP1if+4iv+6eBu W9ngyXXGWcjwacO5hXPDCFIKfSCVkdCuwOixxOwsTlM+NmFDBDYhO2iXU/GO08qe0TDGetBdoxn 9TwDS6aiXm4rcuXXb060uGbaA7Vzbst1LW8Y3+3o8FoH88dLmBjF3VqI= X-Received: by 2002:a05:620a:7017:b0:8c6:af59:5e28 with SMTP id af79cd13be357-8cd6d411a4fmr237571585a.22.1772799734469; Fri, 06 Mar 2026 04:22:14 -0800 (PST) X-Received: by 2002:a05:620a:7017:b0:8c6:af59:5e28 with SMTP id af79cd13be357-8cd6d411a4fmr237568585a.22.1772799734049; Fri, 06 Mar 2026 04:22:14 -0800 (PST) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4851fa87e56sm111972395e9.0.2026.03.06.04.22.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2026 04:22:13 -0800 (PST) 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 v4 11/13] ASoC: qcom: q6apm-lpass-dai: move graph start to trigger Date: Fri, 6 Mar 2026 12:21:13 +0000 Message-ID: <20260306122115.509705-12-srinivas.kandagatla@oss.qualcomm.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260306122115.509705-1-srinivas.kandagatla@oss.qualcomm.com> References: <20260306122115.509705-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: qZb-hHnWcKkRzlIbECE2HWJjJJKYfp-O X-Proofpoint-GUID: qZb-hHnWcKkRzlIbECE2HWJjJJKYfp-O X-Authority-Analysis: v=2.4 cv=L+oQguT8 c=1 sm=1 tr=0 ts=69aac6f7 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=gowsoOTTUOVcmtlkKump:22 a=EUspDBNiAAAA:8 a=8udmP7N65bQo3KbB_RsA:9 a=NFOGd7dJGGMPyQGDc5-O:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA2MDExNyBTYWx0ZWRfX2f9id2Y0Z2Tn nVn8OohdXzBBYIUrRcwMLFlfQJcJ+TyCXUHXTW9ECMWEndOWtQduv7g4sVgXhgLN3A3HrifY9G0 9UdQeeWJxwyinAnUbk/rtcRg+74M45jSaDSvZQqTO6Nt1mkU+TqKgwWwOcTGxlV+zQSSCF4Fa4N O1czcKzV6IA9Jb3ralEhFD0IgNrrrilYjs9xFKUYnTxDSbOzPWJ6GWQ/eRG+p7mnBn7iX6NoBS4 bNTC4pzuTdlGGDSSgKk/NbBE756gJtfNBWLieTbkYyBzUQ3XHTz5naLD6Ba7U7uNoEyuJqgFs1C JZimrSADWlObF9PoKKk8FypbkfBScfmQF45hoLeIf1RriCAK8rMjvy4cTIrEMalq/7VDWlSazmt 2FvwXOREL6uhBPJnQx22Bk6ASMV/1VWuy0LRnMrjYrMVhPTgZp3jMtXtgKqq92X9aEXF2GdmTiR 0yjRG7GihSpiiEtMXJg== 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-06_04,2026-03-06_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 suspectscore=0 adultscore=0 bulkscore=0 priorityscore=1501 phishscore=0 impostorscore=0 lowpriorityscore=0 spamscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603060117 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 17:23: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 D240A3939AE for ; Fri, 6 Mar 2026 12:22:17 +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=1772799747; cv=none; b=ADGahnfx2uHjUaG8DBLasOYwfT8KNxrol1r7rItB575czbLbC8iawM54iSL7fgUyDpGmSpKFbmomdouubLWsxPojpGiRvzSKUi4gQss+QzjvrCV3ZjzYcq2jIkFOapNnSG4fT+D5msh4mlu6wpj0J8moKfRI5zRhr/yx7Q3+/kg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772799747; c=relaxed/simple; bh=VyhmcmdCocO/mXPDB+OqytJYIreg7wlJAag5CLmUSxg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=W6NJKqgA8Wzt2BB11awAZZNJBUWeWiqYE92so7oexoJL1U55QDPVty79vUYis/lR10qg2YD0CdgB4g5TxmdI2Mi0R9n5Oh5Ubkhj7rl8Raq65FG1CfKVx6QfSHoHH0J1AAy+J9OuhOBpiwxjiHto6E6DRmRBceiZaONLhES7cX0= 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=gJ3B4V6l; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=MQa1AFYm; 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="gJ3B4V6l"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="MQa1AFYm" 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 626BbEYt4150952 for ; Fri, 6 Mar 2026 12:22:17 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=gJ3B4V6lnRsRRx4g5VF149O2SUJ 1TnxaAjq7VfhwN73j6o6Y1godNU7j0FUA+peuM+IW26qCZr+haCHi3AnrPfgKnOD NslmhSM+JA3OPd46R7Pov6F5iIsmQQipxdLmcehk1ewUuVFbZ8OgQy+4xY/gXDgv yJH7UeWJczwAbu/TIWq8T9ii35aG6eFjx4OOK7mZxcVvZlrnXYlVFI5JOcrOWBeK BMBRvwwDnuFbzRPQEb919j6oOsiX4xzYqu0ciMUrCaPEr5kvvsxD5uFlay3Rep9g bT/b1GMiGBQXQaqrmeBJ0SQOrpNXshDm6pSyvCPOGDjuuWYYvG0Zj+HzVZw== 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 4cqf25u4ey-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 06 Mar 2026 12:22:16 +0000 (GMT) Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-8cb3ad1b81aso1505859985a.2 for ; Fri, 06 Mar 2026 04:22:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1772799736; x=1773404536; 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=MQa1AFYmUg464/nLel07QQttFLgfd3TqA5oJRNEek17R5o5/8Qg+sUMPRFixiRvcqZ /hwYfNjO3CdwjooeRFp27W51R7wuuM4R3qHh4CYf6aUNZ/bE8b6vHny8E7buLRr6Z374 gg2TBkToB6H/8B6wfeIvigZPc7txy6Gn5LYjft9zknJ7iOo6HiAzokMHuw+fcVSpmowa MjFaR18VbPmaaieNF3u/9aVPFKFGDdk8H/IGZEYfRJJoSIR1bvKz/g8HsDEsTp/UBxa1 dMMhlAGLE64eS64UlazYp9HWSGkQLUhZ6Ei1odKGSEI+Qss3lyekiofIfeqh51DX1c9Y gQLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772799736; x=1773404536; 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=IqZU6G+7QjLZo0kdzaDngJpteK5boSBnSxbqPgEHdWsnFKpqyIaAbIJzzteSGy888r EANDVtqz/U3dKUEkEu3lVTENnj033lc0X5Mhhz3gZb1QwMwJymyhqgRq6A9N8aADeDs1 kOeyplwa6ZLD9dW/AipmBWnU1LV7Gcx2/Jnla1YsM9xY7o0+l3WsJatRPYHyD4nsxx5Z cS6zavxQPqcEzzP/mC0SYb3uLSs7QuqDDA6hd6UU7pa/CXiBzH8KW8K4H6QeglUs6DrC VdV5SfhQmHp0Hti6qvwk4KhoZc93yzwu7FXaMFgd9U9qjN4gUMVWxrAHMjZJJwc2kYbX 59qw== X-Forwarded-Encrypted: i=1; AJvYcCVkTjjbq3RIagf/XyKK7/ZNbuEQ1QsYOCzYCnsA6v7tBiygDK5o9D7LHuyt3zqkeL7jjfjxeGHxB7U98lY=@vger.kernel.org X-Gm-Message-State: AOJu0Yw6oUisplw6x1ST2qawNEIj2CIHwAOafPZwemTCEMEEMpMJwZc7 4DOLp/uEGXWVXWPjVOKEicmLgN1nRo++uo78AD9UwJGfw7bC5bZx9hSAO6RB6hCdQzm+jWL2ERr 0kzfwsKJJyiPnPmAncUfsyTIhJ6rhYCfdBOjVCaHKu9ifwA1ubG+ig/WMadGDiWrRTa4= X-Gm-Gg: ATEYQzwGBz6Ipyoc7MMt3bAMD6zrmD3spR7JTvuumcuF4yjDGDDxaPFS0aym0wPVe8j ykyOjmQX19Hkls268GXDpf32Djlfa8Iv3KMdLcZpbj4rsTj450ehQDnkS5OrfXfsMxIcL7OfAiU R536+FGqoMy8kbWS5uepX4YAT1HcX5WJ8TcZWyoeuzoWNoMHsfOtuC09TaJtmmFTVKdjhLBOMng XgtuXM5ZzVdnCjZ8Hil6qSmDxUT4vJy+5x/hnDvEZLdn031zh65/TUn1h87jwKN9g0HuOB1mHnC 34zq2Pn+P1JfySMy9awC+BmGkJTCm13F169I8SOjNy+v8kKlJIr+6Yh9JRgtdAFYCR6gZljARkb cgO6bERs5lb5L3yK66Di/DHYVQaoPuvC+wmayX+xx0PphL0q46KoUd2Y= X-Received: by 2002:a05:620a:4723:b0:8ca:1107:1214 with SMTP id af79cd13be357-8cd6d3fb768mr236458285a.7.1772799735872; Fri, 06 Mar 2026 04:22:15 -0800 (PST) X-Received: by 2002:a05:620a:4723:b0:8ca:1107:1214 with SMTP id af79cd13be357-8cd6d3fb768mr236454085a.7.1772799735361; Fri, 06 Mar 2026 04:22:15 -0800 (PST) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4851fa87e56sm111972395e9.0.2026.03.06.04.22.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2026 04:22:14 -0800 (PST) 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 v4 12/13] ASoC: qcom: qdsp6: remove search for module iid in hot path Date: Fri, 6 Mar 2026 12:21:14 +0000 Message-ID: <20260306122115.509705-13-srinivas.kandagatla@oss.qualcomm.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260306122115.509705-1-srinivas.kandagatla@oss.qualcomm.com> References: <20260306122115.509705-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: YZsJKovjaN7y264R-GgMfTxG8rheWocM X-Authority-Analysis: v=2.4 cv=Uvdu9uwB c=1 sm=1 tr=0 ts=69aac6f8 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=eoimf2acIAo5FJnRuUoq:22 a=EUspDBNiAAAA:8 a=Ll4dbTg5roZnn8cDlSAA:9 a=PEH46H7Ffwr30OY-TuGO:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA2MDExNyBTYWx0ZWRfXwruTExwPw1eJ eiZbivKwvPKmOoPT5EgQwLo5wFHzsWzYjej0f8sSInKAke3JKLWxhqQb8Eyah0/55mGIVEc1HkR JhhhN81011kfiCM8oIaRwX0zhsCW0wf2A3L83fX4MpBIAZlLJbXLSgrQ/VkimYYDeJmXKHvbYjA krGrPeYT7GK4k1bZoWCGcbHI4xOwaXobZ/90APuCZxFPzC7p+D8UbpHrDXLh8idOuZgDx18Ppf3 uydy3uVB/34K/+oUURXDyhlIJsefTgPvIL7SO2hUnVoYnjz/ihAscPgNETwDQlsxwWFsaHDzApj pDWnm/Jkp4mhTUjvrPU//QfF80jdeDRBr6LLRfXHhTks09EYarfhCEPiOB2g9PFkL2dx5RGIi/X XdqTlnroqy83h8A55a37N48M+mb7LCjutzEhNmM7xQB/psQ+pWZx+jLm39LS6yKtsRxlIQ9Baq2 K1+oYA/BXgvxZeDyheg== X-Proofpoint-GUID: YZsJKovjaN7y264R-GgMfTxG8rheWocM 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-06_04,2026-03-06_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 bulkscore=0 clxscore=1015 malwarescore=0 spamscore=0 priorityscore=1501 suspectscore=0 impostorscore=0 phishscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603060117 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 17:23: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 2E557393DDD for ; Fri, 6 Mar 2026 12:22:20 +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=1772799750; cv=none; b=OCJ8vsTEaRU+ZF9xuG6mcNBh6iu1iS2Fb6phbmnMghVAMM4oh8askACpxvh20us7lvKggVZ/SpfZmqptzMaYu8M/mIq7VFe6AFx/GLpb15F6ttIJxCjVKOtOEU5l2A/IZ/1AkXqqDaGMsEIkJ/j31oPdIkqZBTZJ1kLd8brgwiw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772799750; c=relaxed/simple; bh=DvFP/wvaJ5CtBSK4QE/DhIGDUkVqOv8tT7vU0VUqQmU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cVwYvbmkNRC/YOzo9PoE9FdHolDzrZB85Icj21YpZhIMQD8++onN+QEDbBo9dQxPZKKMnG8KMNf1pQZITc3qbXH+HeI8+xZtddkuIMJLyeszHOu84HfDAyZ3ijktcbbUtbjBVYKTvg0fvCHFPG/7D+AdEumEwgyfh6kaJ+kFTYM= 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=WkOTSwDp; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=YCIPOC5p; 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="WkOTSwDp"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="YCIPOC5p" 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 626Bb3RG037405 for ; Fri, 6 Mar 2026 12:22:19 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=WkOTSwDpWcydB5sRlPdsftHA84h OO6Cvf5yCls51Tw6BW0oGB8+FZArXflj3kRe7kjzvVgsKlEZUJEzyJwOEgAp4orm 9iDlgJo1tdzLC2blbKPw4RpyZfFpLvHriHVXRXj/p5caehaIjLse+1UXoJ2l24ON 5BKylt89VU9N+uY6GudLAVQIbV6Uwr6EKRfHT7YRpc79s54cqB1smW1JFtoHiENg mXNv/7ceclGMSmDi68ZCfuS6Q/XK6oP21RPiQ460QtCM/q68rGjgecJhpB1C8LeL Cg9oxKwp8/MLvjqUOMWyAFz42d0iOGm9oe05GMYPjvrwS63/8oJbzyddx5w== 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 4cqpxdsqk4-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 06 Mar 2026 12:22:18 +0000 (GMT) Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-8cb3ff05c73so4728013985a.0 for ; Fri, 06 Mar 2026 04:22:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1772799738; x=1773404538; 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=YCIPOC5plaRzJW65RewYHEq3T+lWrp7NPsPbcdh+y3EnIWeZaX0lYnOAImH2BjIovW 3mwqajvX8ev8uZUyHFqc/xbafsOP74nAvRsrwIR2BCblhKoZGi/jw3YFMqnuQ7j9Wne9 ZP60TjbdLNWox2W8+XOiM72CUddYpt8VKU4/+CJWDdKIzA+kTtiS8hN3JZVADPlyNDm6 4O1pQLrXgnHUknWGxtqfMS4/bK0wXd/dMKsDXg3wU4ZcRLwvg71ZcBtRb5IYNzHGNstG MVWGchepqD3jjjvSEEpGIaShafba9e/nn/xh+cmoGSioAlKmEWsn8rkmJ2gvTxE3JzYq 5fqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772799738; x=1773404538; 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=kzacwJ8cARR5uj7zxpV7unbOUcgbVxQF4tdXaQY0sCBa1MvxV7mrBY+HC+A782nl0E mLrtvA2wgxBqGsW7nEypU8B2eWv2byfyzq2xxeTaDTkE7qfb69tfpZ0RTgQ36LtZrwnq OABK34JjtT7BH9Yhp63AHHaCLxEX/lLlflE3au3v6dgW5w5/gfndxquFp5LRB6YBaIuR 3QljEVY5ArMTDuaLyxKur6y9UB6Hvdh10xV7dlf6hcYafoIMpSa6AEYCdgkUqjt4avg/ HcWPio6szQgxYPAHZ48i41b8C21pHDQbL0rrkiZ1Jvz47wf4lrKAwR+7+0QUG+TnybmX bEQw== X-Forwarded-Encrypted: i=1; AJvYcCXKzarxM0xWrn3B7eCuaUfuZ46jGv69mjc2OGVegnIyr+HGRGvQnwux9kamjtrwu7L/1Srsev5sDc0rt/s=@vger.kernel.org X-Gm-Message-State: AOJu0Yw5WfwNXO7kxVu2prdOuuZTCHaByiKB+jKFX/iS0A7VSObvzbHF vTOVBlSkH0Gt101IEUJY8jJyCxJqkBuFlV6TaX9ubrqgvIFSAecyBc5x+zltDXYoRbfDsOlHXRy baXAHI0LsY0oTCA9duY9hqVsrX1/zlWfbI7VXO/p0vp7okijHGB98iCmQT1kQrUaNa/k= X-Gm-Gg: ATEYQzyre7oStor0+LaXxgCoTRSzhb0sy5lV5c2hBFCCTIrK2txCRFJBhx0Puy7eaHW 29q/dzMJ90+9mHDywzf43mENunF8vrBPj0uCE0jI+xjHiFJ9fmuCMAT6uEZd0sfMhcmp0FxcyP4 RJgTWiX447gqyQee5KPUqeUFzKbt55sE5oUEB9LsqFeEcA0zUkIuF5+F98zP78QUdsE2q3bK2Jb iSflUfc5u9SC6pOZQya73Z648BsQkg7FhbBB+abp0Piuz1f7rMg53VCfhyhgu9T2JLcmNvaYEwK ZpSp2r7gaODvdGJ9GSfpoTmJx7XyNaWoDh2i4NgDnpsNfYlT0qJuZhc2cP5Rb63vX/1w5XuUCHF kkz+LJcbzLYWOirxFYFaQiTgW49eGLGrQlZKW6XXh/Xfy8ocqgLcLsrE= X-Received: by 2002:a05:620a:2848:b0:8c7:ad9:d0a2 with SMTP id af79cd13be357-8cd6d4098ccmr229284785a.22.1772799737447; Fri, 06 Mar 2026 04:22:17 -0800 (PST) X-Received: by 2002:a05:620a:2848:b0:8c7:ad9:d0a2 with SMTP id af79cd13be357-8cd6d4098ccmr229280785a.22.1772799736926; Fri, 06 Mar 2026 04:22:16 -0800 (PST) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4851fa87e56sm111972395e9.0.2026.03.06.04.22.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2026 04:22:16 -0800 (PST) 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 v4 13/13] ASoC: qcom: q6apm: Add support for early buffer mapping on DSP Date: Fri, 6 Mar 2026 12:21:15 +0000 Message-ID: <20260306122115.509705-14-srinivas.kandagatla@oss.qualcomm.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260306122115.509705-1-srinivas.kandagatla@oss.qualcomm.com> References: <20260306122115.509705-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: x9i2UV_DItsZIfUhr5_gY23iAxZmv3xZ X-Authority-Analysis: v=2.4 cv=E83AZKdl c=1 sm=1 tr=0 ts=69aac6fa 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=Lmls0Cg-LgRrrh2KKlkA:9 a=IoWCM6iH3mJn3m4BftBB:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA2MDExNyBTYWx0ZWRfX1RVtKk7pTa31 x96R067sM/7prUwojpUiTQlHn0BxrX5Dzc3B6hpkxcRoiIWe1Lun4X8cH4pd3KwmozTyKuXstCv jaOvolPms9DCVoRCW4o+wLuoP3ukYo6ZgCSVs2uboFWC/tt+Zi94TGw3rKKZZzi7Hv4b8S12T1/ Cnd5iFIA5TVXyUGvzTpL0sj9v4T20nGgj0zuyHHM3NYoST7dkvF2CnfvPq5i+peKurqEYNk2+0Y g+fxWqH0l0M2O/70mVSwvS9TgGMCDdDkLjXAoincbHqbWuCbq4ev1swbwu78oBtmnpuz7JX+FMM 3D5X57NaMlKeq7UJRBDr22F20ioGgrF/S8S1QAmCYr4WP2RXrc8ji0Jtw8C0UeEAOqiybx1sGDJ WlN9+/h0rBpOx7paurIjXai3IRBGy5YfvEoxIBLiuxeTAlhcNjBMCkV1PWPyKBc29zl1HZaLoMV yZDSAVvpXU/ssO24lug== X-Proofpoint-GUID: x9i2UV_DItsZIfUhr5_gY23iAxZmv3xZ 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-06_04,2026-03-06_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 suspectscore=0 bulkscore=0 phishscore=0 impostorscore=0 adultscore=0 lowpriorityscore=0 priorityscore=1501 malwarescore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603060117 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