From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=205.220.168.131 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796078432; b=iLLNcancmmVt/lisAMX2FyPCLMDHAN0dH+izs8UFfvS5lMCq1qLE95QNfefUZizakLLW 17+7ddvMePSC1NTrJVWvjJu+HQzzKqOR5bHBFpImqaFe8/KW7ZCj7Y0Ss1rM+JRzZJz5N RlzCoCEcgNN9i9+VS8acUkf1/arScugtyNC4AzXH8I13GD6/mafu8o1wWOx3tJr8xfi/4 qU4NvM0zjOhxuKFS2WThAYi1Fdo/EyOUaSfwk28evRiTYqoyICiY11+lfmIwNSARi3hma 7G4j43mrrq3LrXrTMX8TJ2zXMHxqilI3lxE804j6wcry2BdYe5TmVWFE87PXzVDpVQw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796078432; h=DMARC-Filter:Received:DKIM-Signature:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:X-Received:Received:From:To:Cc: Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding:X-Authority-Analysis:X-Proofpoint-ORIG-GUID: X-Proofpoint-GUID:X-Proofpoint-Spam-Info: X-Proofpoint-Spam-Details-Enc:X-Proofpoint-Virus-Version: X-Proofpoint-Spam-Details; bh=IV5KP2kFg37VY9giXGuFf/rCi7TXj7HTUConjf2lTII=; b=rtBpeLdEc6k9/sfkZIYpdO2MaYn9OTqqdHxrZAq8Mh7V2+jqbWm3adz93e5cl1b80yhp HTAY8RG2oTCIDrIUGn5hyw08I4y/UvyOEtO6ylC2SJZP5RkjCcj/nPrcI/E1SFFpCz2EG 4bEXGN9oPvaopqzQdHc1atwvzZrd7RAp+DrQcXtOjvZ6QgCONGYfNoLdhpURf8SDm7ZSI D+b9/AF8Hh3igGcIDsfIIcyTVURfY9G8XBziEO61ufiKudlxQ/SqkIu8m84WUetuL/ymo XiwYt9nx35oHAsn09Dlk9ZhQOObfsn1pLmRSB7kKLJ3xa5kvS28k47l/wE/EivEKrig== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=BQsv+j3S; dkim=pass header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=TVJaoZTZ; arc=none smtp.remote-ip=205.220.168.131 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 70B91606A31A for ; Mon, 30 Nov 2026 22:40:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 70B91606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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.a=rsa-sha256 header.s=qcppdkim1 header.b=BQsv+j3S; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=TVJaoZTZ 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 6AUKQDZG2032724 for ; Mon, 30 Nov 2026 22:40:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:message-id:mime-version :subject:to; s=qcppdkim1; bh=IV5KP2kFg37VY9giXGuFf/rCi7TXj7HTUCo njf2lTII=; b=BQsv+j3ScmKvX6cTpjfREU+l3o98SDgirY+n8N+lfM9LxJ4eM5v OWEGWtyAX89WCCS/VeczXAsYnZS4Uq9Nk0C7ljGKJM1sHbYefQVB1eV9ZCsXMLJT 9BM8ZZpkcezUrXstyR4tsI2rUGdPy0opDanpeFXUbFN6y4ShAr9FKGMBwb+z41LC YyKS8IWyodsLZjzkbEOJnsFghtUzeQ6qt5JZxNpz5zgqF2PdRJRFGyhH8Pp9vzKv YUu3DNSEOADIv9RENFOBxqJwfz62elGJrtEayJn9q1Ga3aV2sVWJCr3DSFbTNDrO uuWaB5CaXICsU72vA3XaUVYped1BFy5WlAg== 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 4j9enx0sjc-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 30 Nov 2026 22:40:30 +0000 (GMT) Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-94967c6d4f4so1245706885a.2 for ; Mon, 30 Nov 2026 14:40:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1796078430; x=1796683230; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=IV5KP2kFg37VY9giXGuFf/rCi7TXj7HTUConjf2lTII=; b=TVJaoZTZcPZ1phNqEVOM4hG7w98ndEQHvVQzmXhJsE1EXEBtOYor5fKDqdYySk/mby dotauxe9cil9Q16JeIEWrsi4A1l4OfEr7WDo261QnXGc3eKNq7kYkaN1vstxjhKBTGfm ko7NEj/kmFYIzthHD9XCQwAq46tx7X1YpM6oFiYkrPjEc0PZjZI+9aHPj2Sn951Rtnn2 CAydw/llKwl9H6fsE9KAVutYBUUpQZI3yYAEKJC4uUC0BXQlj07bAa8pSyeNIcj70Aqr ssm5MXnkRVJUBNj904gesBSvXWaj5/0OA4IgdKNbRtqnHNXboGgcXtsjdNUz15/5fckS J19g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796078430; x=1796683230; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=IV5KP2kFg37VY9giXGuFf/rCi7TXj7HTUConjf2lTII=; b=y7fFellGlMCci/3DIYsJtwmMiG/d6tEZ0xAcKAGxHXBCAMTnqfr4Es/vA7Oga7N6jU JvuRMuP4XEBPKTNHUg3sff3KSaQn8YVEgOYgd8QORxyO1UPZKFNkOot3wdHWIcQwbAiJ WFfS780wVwXgzdIQPMt2Z+gccpPNNz7ox08pBZF1rSEuK2VtWM2vmver74KDlk8HawfO 2001GOYYvSXJ6Q0CI0E/8gMxG3RvjV9OPsFYWmpUoldUNSU0NsbYNghLJ5LGrx9eUX8v xp0y1WaBC1pwBKRv2nJ+/QlpcxLJMWkQ5O6XqpUMH4eLdvtJr2WWLupHipJdJ6t5gU52 K9Pw== X-Forwarded-Encrypted: i=1; AL+hErFMhf59J94mfsakbUs0AP+nlEPyqd24FZIzd6tA0PL+eR6dAwJYBI2v2fT8ZjqImS7hhQthov+ITT7Ch1I=@vger.kernel.org X-Gm-Message-State: APuU4Z+wnEqIgy+J56nfXEQEgnGca3jtvlbsHLRIdg9OusyQQHAaULxQ HR7iYGYxrevY5sriHq6hZ9PLB+JVTDJnvCzjTEZQtLJvgBDpimSX8SmdGeKXGZ033DqgOxh+Dac JDxrADfI2TBIghg2Thk/YFfbQ/jv/s1eEbZ9CRb62XW7wZYjG7CG438u5oMdhfry9iZs= X-Gm-Gg: AZFdTZcL8rjMYG7z2EMZX/M3rCNUD/zACXFaJwt8648LHz5ApbOmLKUgEOW956Vfy+b MJR10qhVGYl8JTcAChSkayLxVTAvx8IS3q+iXu1hdvBvpoZmEFDFJkK2S5pR70nfZY218lKJLUb 8XrDGAuXF9Eet7lV9rs15ZZ2gy1n8NKsQVj4kl8IyxuMXA/rA2PnqGc97HLTCY90YfDKYF+XOAK NLmGmURwdcS5nMgBfJMhK/Bv7IqzruDhdBXFjoLkA7mEmvMoUnLgVlYdbaW1GeI5QhnKOCpBadm RKHNAizNHgCEd0Vm4gaHrCLbkHpurCrlBHWf/nP5hk0IZCClex0ol0sUdTe3gHT30nTEH0BthJK NDrHq9gbLE81LxT9Tpadcw8Xheh62/UT0Dw78fYjmUxChDTkrxN7M2D/rNB2cjDvy X-Received: by 2002:a05:620a:2610:b0:947:920d:3408 with SMTP id af79cd13be357-949bab188famr6789294285a.46.1796078429426; Mon, 30 Nov 2026 14:40:29 -0800 (PST) X-Received: by 2002:a05:620a:2610:b0:947:920d:3408 with SMTP id af79cd13be357-949bab188famr6789289185a.46.1796078428793; Mon, 30 Nov 2026 14:40:28 -0800 (PST) Received: from debian ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4ab65cb42absm66697503f8f.1.2026.11.30.14.40.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2026 14:40:28 -0800 (PST) From: Srinivas Kandagatla To: Vinod Koul , Bard Liao Cc: Pierre-Louis Bossart , Sanyog Kale , Mark Brown , Jonathan Corbet , Bjorn Andersson , Konrad Dybcio , Srinivas Kandagatla , alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 0/2] soundwire: multi-direction stream API Date: Mon, 30 Nov 2026 22:40:16 +0000 Message-ID: <20261130224018.20359-1-srinivas.kandagatla@oss.qualcomm.com> X-Mailer: git-send-email 2.53.0 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Authority-Analysis: v=2.4 cv=Lv0HWXdc c=1 sm=1 tr=0 ts=6b0dfb5e cx=c_pps a=qKBjSQ1v91RyAK45QCPf5w==:117 a=ZsC4DHZuhs/kKio7QBcDoQ==:17 a=zJRp6_cAMcgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=DJpcGTmdVt4CTyJn9g5Z:22 a=tSXitxaNE1rt3D8SdI0A:9 a=NFOGd7dJGGMPyQGDc5-O:22 X-Proofpoint-ORIG-GUID: MIoOaWkZkqnESIyg0EHC1ZGw-FiTSOzm X-Proofpoint-GUID: MIoOaWkZkqnESIyg0EHC1ZGw-FiTSOzm X-Proofpoint-Spam-Info: AW1haW4tMjYxMTMwMDA5MSBTYWx0ZWRfX6bhH6N/kznX6 L0AJZcymI0INblpQZLzSAlJF50O/VUrL3KNAlzVHX4Q3LnFXSJDC4L1qIzMuMtRyCWkbv035c+o zdgM4xV8qgusoWYSkkLl9Zh7+3qD3W0= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTMwMDA5MSBTYWx0ZWRfX1vHJZAeW6fkp pp1dMoW+d9WcLOsPVEaErAByhPwetCfgodaeqdogmUfRXCFmP/42tga2lbjSfR5qu/RRpxm0O3Y F+mvOvMRoiF3jHi1tAqcEKRsE58KCgD0qf/H/yr08+jT97HN/6PjlDezKTqj7oL44OsokKEkNbr Fyx2cX/UUjilN5GlMWMOz4bSHbJPN3nfvfUN3Ycc0QiQjfKPusNEXc+tYuQVE0/a5GAE2LwkAnj KqiwbfZ/ARNhlhk6t2DmpmpSrwHhhLM9QNJlQ7JDgVUji/FkWoWtlpeY4SGMn6/6yMkm8ZGBIOe 8tZzF9wamOf9BfBHvAsT4Zvgxi2mjpyOwA3hrN6PSW3zwi4Dc+IKgCOHemL5tT7NcKHX9RiUHMD 2QxhAOdTuV8ICxVJ7spe3eZyieLE+VXMYJ8Jo/Y692ru44Au9+gQyu60LrkLhMGuDkBiv/9qm+m lZ8LO9YOkRtb1MNduCg== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-30_05,2026-11-30_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 phishscore=0 bulkscore=0 malwarescore=0 suspectscore=0 priorityscore=1501 spamscore=0 clxscore=1015 impostorscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611300091 During Speaker Protection patches for Qualcomm SoCs, Pierre suggested that we should add support to multi-direction in sdw_stream. This patchset is to start that discussion on how these apis should look like. Some SoundWire codec-codec links drive more than one direction on the same BE and the two directions are coupled on the bus: they share a bring-up sequence and want to fail or succeed together. The first in-tree case is WSA playback plus V/I-sense feedback on the same BE (DSP speaker protection and thermal/excursion feedback). Today callers like sound/soc/qcom/sdw.c hand-roll that: call sdw_prepare_stream() / sdw_enable_stream() per direction, open-code rollback when the second direction fails. The branching lives in every driver that wants a multi-direction codec-codec link. -- DO NOT APPLY THIS PATCH --- This RFC proposes a small first-class object for the concept, so the coupling is expressed in the type rather than left to caller discipline: struct sdw_multi_direction_stream; void sdw_multi_direction_stream_init (struct sdw_multi_direction_stream *md, const char *name); struct sdw_multi_direction_stream * sdw_multi_direction_stream_alloc (const char *name); void sdw_multi_direction_stream_release(struct sdw_multi_direction_stream *md); int sdw_multi_direction_stream_add (struct sdw_multi_direction_stream *md, struct sdw_stream_runtime *stream); int sdw_prepare_multi_direction_stream (struct sdw_multi_direction_stream *md); int sdw_enable_multi_direction_stream (struct sdw_multi_direction_stream *md); int sdw_disable_multi_direction_stream (struct sdw_multi_direction_stream *md); int sdw_deprepare_multi_direction_stream(struct sdw_multi_direction_stream *md); A group with one constituent behaves exactly like calling the matching sdw_prepare_stream() / ... directly, so callers can use this unconditionally instead of branching on dai_link->multi_direction_codecs. prepare/enable do all-or-nothing rollback: on failure at step N the earlier streams are torn down in reverse order. disable/deprepare are best-effort (first error returned, all entries walked) so the bus always ends up quiesced. sdw_multi_direction_stream_init() exists for callers that want to embed the handle in their own state (dai_link drvdata) and avoid any allocation on the PCM hot path; _alloc() is kept for callers that prefer a heap handle. Both expose the same lifecycle entry points. Patch 2 illustrates the shape at the call site by converting sound/soc/qcom/sdw.c. qcom_snd_sdw_prepare() and _hw_free() lose their hand-rolled rollback and funnel single-direction and multi-direction links through the same code. Patch 2 depends on the WSA speaker-protection series for the multi_direction_codecs dai_link flag; it is included here to validate the API shape and is not intended to land through the SoundWire tree. Open questions -------------- 1. Future: coalescing the bank switch. 2. SDW_MULTI_DIRECTION_STREAM_MAX is set to 4 - comfortably covers WSA+VI (2) and leaves headroom for future TX+RX+companion-amp topologies. Let me know if a different ceiling or a growable backing array is preferred. 3. Bank switching. Build-tested and exercised on Qualcomm X1E (Glymur CRD) and Lenovo ThinkPad T14s Gen 7 with the WSA speaker-protection series, which is the first in-tree user of a multi-direction codec-codec link. Srinivas Kandagatla (2): soundwire: stream: add multi-direction stream lifecycle API ASoC: qcom: sdw: use multi-direction stream lifecycle for prepare/hw_free Documentation/driver-api/soundwire/stream.rst | 50 +++++ drivers/soundwire/stream.c | 202 ++++++++++++++++++ include/linux/soundwire/sdw.h | 39 ++++ sound/soc/qcom/sdw.c | 113 +++++----- 4 files changed, 353 insertions(+), 51 deletions(-) base-commit: 253f86660c1f882fbf554db5eaa34bc5d66dc7e8 -- 2.53.0