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=1796129289; b=dpBaI0sZfDbxWuBmz95pTHMzAjLXqQyEGdQ8qgcIJGxPlSJfe35Q6/7HwibVqlvMDNir iU9Kev7xeXi4ZQeEB4OMg16IlwrzMtqbGw5Fu/SOfyJHj2Mv+Ehyl8mV3eUhIrBUv9KwI wgKF3lxsJIXjsySHSsIkBmfigAF/Z1QxnyTmRuDECzyfvFyZUtjbuWFVff8ZNqj0j+qO+ nkRZWId32oOw80oPAQgZ0FvQG5ZvYz066qljaMosut1qNb2OUl2aLq1vnkobOmU7XvY8R wjXtCQb+yNulqMSwehehO6qhtadrymcdvG1MS8/pA7Yf/NZ3OFWT2RQuRKe7Db+bmBQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796129289; 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-Proofpoint-Spam-Info: X-Proofpoint-Spam-Details-Enc:X-Authority-Analysis: X-Proofpoint-ORIG-GUID:X-Proofpoint-GUID:X-Proofpoint-Virus-Version: X-Proofpoint-Spam-Details; bh=e9DYfkbw9jLf+NiHDZWyZLU1Ios9K1ANMM2a+ikWZ98=; b=WBKPutbPTJWzuv7RRo4NJg+jcQfodnEh1AwLoR1yUwztkjnSxnJ1MO5UQKNAWwlXEMNZ RH2xbwVWYSUmurzZGGIm7j9iaZfJuBA6Yo8cAZZp6NybOKK9jLntGF86EvUVciGkoNWCL XFO4Od3ToP0oZkeDdu4ESZL98V4NjocylNtBdxJGKg7IPkKbceAXXYhEWA4PfruYBJPsj zLZWQMQKb02maoBx6HLql591uJNZYQWSWpDxsNYcwZ9o3nQgaeeIGy0Pj3JCFqSU6VF7K H4ILmNJvGGp4KHp/TA2Kg5B7gvSlsmVbSfArXefsV3M/N2KLbJznLtbqco2CG8EJ9QA== 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="ED/+ciXc"; dkim=pass header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=kMlRbJMF; 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 4325C606A31A for ; Tue, 1 Dec 2026 12:48:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4325C606A31A 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=ED/+ciXc; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=kMlRbJMF 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 6B1AQPLs2313359 for ; Tue, 1 Dec 2026 12:48:07 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=e9DYfkbw9jLf+NiHDZWyZLU1Ios9K1ANMM2 a+ikWZ98=; b=ED/+ciXcPCh3Vu6R3aUyt41399Mzai2GrBKP/84v9Fk6JJbZrRe qIpPQ4XAf5m6ssIv3GyM4A+R+KXJe3cYnVNpZqBHRXbv5Y/ROMUmGwIS8yX+UDet wPRNCHYRse7AOnjcXtYCu/jcxUz8bkWvsl1VOt/zR6rMzPKS1tzQxDEyxO6tXPoE NH0GoSxgoOSmB4GzXeZyr47thRVu+pszpOSQSXOWW56Tb79SpAxZiHk0FJjOcP6Q EkAkD2O07IFn9KlAPosIpIHWlPwGLhEhsh9Wm2roMF8IvEvJfRGrgaC2/QAhfk6J yRyBdCRrGbQKOJ4zm7rJdE2Kwrun+ZfL3qg== 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 4j9nb62c39-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 01 Dec 2026 12:48:07 +0000 (GMT) Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-94961ed97d6so1929233885a.1 for ; Tue, 01 Dec 2026 04:48:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1796129286; x=1796734086; 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=e9DYfkbw9jLf+NiHDZWyZLU1Ios9K1ANMM2a+ikWZ98=; b=kMlRbJMF3AmBkdtyxwwQ/7BJeguq7CvyI9VX2GJZAkLAXMnUSq8K0bhzuKbMXmabkW 6Cx6BlceWo7RVlu8UB46cAq0efkGTW9sY7NIO8uEmm6D/GBlsoKuEqPSmLnT8MuS3YMh fpZOb0xyhf0gjh+2n1kwQUid7OqYw+/C24C8/FVrLBEA5uwkGyxwSFBeLGtlvn85Bad6 gGebC/uYSehnVA3SL92Qv7bNRGBpfUOimx3z9YpdWa1WVFou++e02FsVLSWuspbPSgRF JViWqbVkH7XZIwJ3TEbm8Y2a6TAF88BMYxTC57cySsgrQe9zWx/V8P16F76yYDnfLzzs UJWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796129286; x=1796734086; 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=e9DYfkbw9jLf+NiHDZWyZLU1Ios9K1ANMM2a+ikWZ98=; b=HItepc0zldrfyjDAaIGS3lQfMyiVzE4JMo4FUwUqMj79HT3gz+EkSh4RC3y2j48pu2 kJRXxScOpPx1p8Vwl6j83VNJhj3/AiIvsMlPaP4bXyaHiDfDE8IXAYq5mAbJNIqg6S1g nlPr2eIMvDoeU6Byq4LsMrBKYakBZQ3m6oFg2MA5OIGJcxHoUPiko8iL4xCGvBoV8LKY KpxbSlobvf9CPjV5+XLn2TmJSrKjSANWIeemixnhFYNgoEeWbcDzzhN1H+vae2kW1VSH gqh5tD7Pkw4R7T167Z8+jEUwUNbW6LZXdI8XFO3ZRFDllpYglzjzB7O89RwCTpWNbxna 1STg== X-Forwarded-Encrypted: i=1; AL+hErHmWQru/9J8UfSVQvy+svKB9bYuLOepUMAZcPv70+QZ3kJQP47xWsN8tHtnBmRy6VKWEOjqpZ+Iyys2rGI=@vger.kernel.org X-Gm-Message-State: APuU4Z/GbyTpoE6M0oAT97qP0HkKhXt7jHCI5ZmZ1YjmK8BkA2cUGb90 pBFKQUK/cmysimGijHvQf2HMb2wxGFSuepoYZAwuwoVa59vD4Ubt/4HAAJDlFyt+eXF0R1wPkx0 DY79vnYmlUieqP3yqIbDZmGMBRQJataV/XXuKfusNxRRDVg+QTLxDgyK0YYkA5G7RHjPGyfsvrd 4= X-Gm-Gg: AZFdTZcymolcSB5P7HYF4v9j7VBJI4VK9Ieb9PNWRuB+qNp/pGzT/EVMWBnUMn3sqbg gcZTGF1KDpM5gbRw4dOrusOgYC8/DwlZ5rK0DnHxHJU4yr7pHlqvF2VYsPG41d6/1G/xO2tlqun 9b5WaeFprWDgtJbl2zYMr+I8+TVx4ZvbGIckUHrdbVc4YSRxl+pfKAdrK/CoURV8d3NWXFfvwej HBwo+dVFoCk9pB7tU12HrvW+adwi9R7vmzw4MXIpvCPw3ERUH10MUfzW+i4OPo5PG3PCYaHzglU 9VaayS/22mheqAJ3wyTK9FBShRtnEtEJpw/DIQCqo1ecJSTXuYFxdKj0GhXQAgZRHxrilut+o0/ Mktt9irxBjqgNglt+wWgKzLApz9re+wWwgbzxKA18C1I1IFg/NgcANbptkbbsNH+i X-Received: by 2002:a05:620a:4085:b0:93c:d209:4ea1 with SMTP id af79cd13be357-949b35cf4ccmr5883487685a.24.1796129286265; Tue, 01 Dec 2026 04:48:06 -0800 (PST) X-Received: by 2002:a05:620a:4085:b0:93c:d209:4ea1 with SMTP id af79cd13be357-949b35cf4ccmr5883483285a.24.1796129285705; Tue, 01 Dec 2026 04:48:05 -0800 (PST) Received: from debian ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb853a9687sm1131892375e9.10.2026.12.01.04.48.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2026 04:48:04 -0800 (PST) From: Srinivas Kandagatla To: Mark Brown Cc: Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Kuninori Morimoto , Pierre-Louis Bossart , Bjorn Andersson , Konrad Dybcio , Abel Vesa , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Corbet , Randy Dunlap , Shuah Khan , linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH v4 00/24] ASoC: qcom: AudioReach Active speaker protection for WSA88xx Date: Tue, 1 Dec 2026 12:47:29 +0000 Message-ID: <20261201124753.196748-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-Proofpoint-Spam-Info: AW1haW4tMjYxMjAxMDA1MCBTYWx0ZWRfX8h+F6okBSKxq HYNVEB/skHJd9Wv0ZkdmM+MqWwMHuiO56rwwm/iyHLwqZALXO9EjSRo0DOCVUDIhVKvwMZDj2eO yhzgg+o0KVOyAaaESEId5zTSE5SS5qI= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAxMDA1MCBTYWx0ZWRfX61k5KZF3nFxV G/YSIn1dmhrQvm3FbIoDSIPaewdnaRLkTqgRjkYs+7gHqYw6Mxkcbem0EbPbVwhoT4zm9H0yLkF sxdlWxGvldpw29mMYgjMLvPXYCGZWUGeKnLMgLaA/eQUozDvVQhLKholBaS9Pzulb/so5zs0FCm Y6o1L4zFzrC6Y74PKjW3GTirdxBsRZ5psxB/v44OqP5iEg0TZKzijazUnZQP99W/RD4sguT+pm+ sDgdYYIpANig6Z6JzGi+XmEjGl5kuOICrC6I1du8Ye8OnU/xwlfzVj3p1yOc4rqQy9+TcyK4cTz OgLDiqed5vtgPuQ1srtFI/uwC6dze5SeSFBLurb8hcRTkNxzr/xyZ2RUxEZPao640YltJJmFDnW fpPzHA5/sTJfhceVPBD9T0E+fIXr6vQpDSrBsX5RSQ0TRQH7vq+rDqDXZAp+PHWfUOBfQeH/sVp k8NDZ6xyVvyB6q9fGMg== X-Authority-Analysis: v=2.4 cv=fc44WEQF c=1 sm=1 tr=0 ts=6b0ec207 cx=c_pps a=50t2pK5VMbmlHzFWWp8p/g==:117 a=ZsC4DHZuhs/kKio7QBcDoQ==:17 a=pUM-KoujPXoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=NEAV23lmAAAA:8 a=olLT7kOCJqeWAwkjLx4A:9 a=IoWCM6iH3mJn3m4BftBB:22 X-Proofpoint-ORIG-GUID: lMzhViPgz-BV1QAv8_kBvUqepWZu16lI X-Proofpoint-GUID: lMzhViPgz-BV1QAv8_kBvUqepWZu16lI 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-12-01_02,2026-11-30_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 lowpriorityscore=0 impostorscore=0 phishscore=0 adultscore=0 suspectscore=0 clxscore=1015 bulkscore=0 priorityscore=1501 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612010050 This series adds DSP Active speaker protection (SP) for WSA88xx speakers on Qualcomm AudioReach platforms. It was tested on the Lenovo ThinkPad T14s Gen 6 (2x WSA8845), T14s Gen 7 (2x WSA8845) and the Glymur CRD (4x WSA8845). Speaker protection needs the amplifiers' V/I sense capture running whenever the speakers play. Rather than a separate capture link that userspace has to keep open, the VI codec DAIs sit on the WSA Playback BE link, using a new multi_direction codec-codec link flag that makes the core run .hw_params/.hw_free and stream events for codec DAIs of the other direction. The V/I data never reaches userspace: the capture codec DAIs power up their SoundWire capture ports and feed the DSP through a codec-to-codec control link in the topology (the SP_VI module). The per-direction SoundWire stream runtime needed to configure those capture ports is added by the qcom sdw patch. - ASoC core: bump the default ch_map cap to 18 (the WSA Playback link on glymur-crd has 18 codec DAIs), and add the multi_direction_codecs link flag (documented). - qcom sdw: per-direction stream runtimes on such links. - wsa883x/wsa884x: VI sense capture DAI, die temperature as a thermal zone. - AudioReach: control links, VI calibration run with per-speaker events, R0/T0 cache and restore in normal mode, static cfg blobs, mixer controls for status/R0T0/live T0/calibration state, and a "Speaker Protection Calibrate" trigger to arm a run. - x1e80100: VI feedback on the WSA Playback link, speaker thermal zones. - DT: VI feedback for glymur-crd, mahua-t14s (Gen 7) and x1e78100-t14s (Gen 6). A topology with the SP and SP_VI modules is needed to use it. How it works: 1. The topology puts the speaker protection (SP) module in the playback graph and the SP_VI module in a VI feedback graph fed by the WSA VI sense ports, joined by a control link. 2. Starting playback on the WSA Playback link also starts the VI sense capture (8 kHz, 32-bit, one V/I pair per speaker), so the DSP always gets feedback while the speakers play. 3. Calibration, once per device with the speakers cold: userspace writes "Speaker Protection Calibrate" and plays silence; the DSP makes its own stimulus. The VI module measures each speaker's resistance (R0), the driver records the amplifier die temperature (T0) with it, and "Speaker Protection Calibration State" reports the result. The mode auto-returns to Normal on terminal state or graph abort. 4. Userspace reads R0/T0 from "Speaker Protection R0T0" and saves them, e.g. with alsactl store. 5. At boot the saved values are written back (alsactl restore). In Normal mode the driver sends R0/T0 to the VI module, and the SP module uses the live V/I feedback to keep each speaker within its temperature and excursion limits. Changes in v4: - patch 01: pick up Morimoto-san's Acked-by. - Rebased onto sound-next; patch 10 adopts the PCM_MAX_NUM_CHANNEL rename (c3409cbf70ac). Changes in v3: - patch 01: replace the devm "always allocate default ch_maps" rework with a simple bump of MAX_DEFAULT_CH_MAP_SIZE from 12 to 18, per Morimoto-san's suggestion that the cap is just a placeholder and should be grown when needed. 18 is the exact width needed by the glymur-crd WSA Playback link. - patch 02: expand commit message to explain that V/I feedback never reaches userspace; the capture codec DAIs power up their SoundWire ports and feed the DSP via a codec-to-codec control link, and the per-direction SoundWire stream runtime is added by the next qcom sdw patch (addressing Pierre-Louis' review). - patch 08: drop const from wsa884x_tz_ops to match the thermal_tripless_zone_device_register() signature on configs where it is not const (kernel test robot). - patch 18: use div_s64() for the Q6 temperature conversion so the module builds on 32-bit arches without __divdi3 (kernel test robot). - DT patches 22-24: pick up Abel Vesa's Reviewed-by. - Rebased onto next-20261130; no other code changes. - there was a discussion with Pierre about introducing new multi-directional soundwire stream apis, I will send that framwork change as RFC for more discussions, I dont think we should block this series for that api to evolve. Tool use: an LLM coding assistant (Claude Code with Claude Opus) was used for some of the patches in this series, to debug the bring-up and to draft the code and commit messages. My wip trees (kernel, topology, ucm): https://github.com/Srinivas-Kandagatla/linux/tree/glymur https://github.com/Srinivas-Kandagatla/audioreach-topology/tree/glymur https://github.com/Srinivas-Kandagatla/alsa-ucm-conf/tree/glymur Ravi Hothi (11): ASoC: dt-bindings: qcom,wsa8840: allow one sound DAI cell ASoC: codecs: wsa884x: add VI sense capture DAI ASoC: codecs: wsa883x: add VI sense capture DAI ASoC: qcom: audioreach: run VI module in calibration mode with per-speaker events ASoC: qcom: q6apm-dai: add S32_LE format support ASoC: qcom: audioreach: cache VI calibration results per speaker ASoC: qcom: audioreach: add speaker protection calibration trigger infrastructure ASoC: qcom: audioreach: send cached R0/T0 to the VI module in normal mode ASoC: qcom: audioreach: send static cfg blobs to speaker protection modules ASoC: qcom: audioreach: add speaker protection mixer controls arm64: dts: qcom: glymur-crd: add WSA speaker protection VI feedback Srinivas Kandagatla (13): ASoC: soc-core: bump MAX_DEFAULT_CH_MAP_SIZE to 18 ASoC: soc-pcm: add multi_direction_codecs link flag ASoC: soc-dai: export snd_soc_dai_stream_valid ASoC: qcom: sdw: add per-direction stream runtimes for multi_direction links ASoC: codecs: wsa884x: register the die temperature as a thermal zone ASoC: qcom: audioreach: add control link support to graphs ASoC: qcom: audioreach: pin SPEAKER_PROTECTION_VI media format ASoC: qcom: audioreach: add live speaker temperature (T0) readback ASoC: qcom: audioreach: add speaker protection calibration state control ASoC: qcom: x1e80100: carry WSA VI feedback on the WSA Playback BE link ASoC: qcom: x1e80100: register WSA speaker thermal zones for speaker protection arm64: dts: qcom: mahua-t14s: add WSA speaker protection VI feedback arm64: dts: qcom: x1e78100-t14s: add WSA speaker protection VI feedback .../bindings/sound/qcom,wsa8840.yaml | 5 +- Documentation/sound/soc/index.rst | 1 + .../sound/soc/multi-direction-codecs.rst | 156 ++++ arch/arm64/boot/dts/qcom/glymur-crd.dtsi | 20 +- .../mahua-lenovo-thinkpad-t14s-gen7-lcd.dts | 11 +- .../qcom/x1e78100-lenovo-thinkpad-t14s.dtsi | 18 +- include/sound/soc-dapm.h | 2 + include/sound/soc.h | 7 + include/uapi/sound/snd_ar_tokens.h | 13 + sound/soc/codecs/wsa883x.c | 77 +- sound/soc/codecs/wsa884x.c | 165 +++- sound/soc/qcom/qdsp6/audioreach.c | 819 +++++++++++++++++- sound/soc/qcom/qdsp6/audioreach.h | 105 +++ sound/soc/qcom/qdsp6/q6apm-dai.c | 16 +- sound/soc/qcom/qdsp6/q6apm.c | 42 +- sound/soc/qcom/qdsp6/q6apm.h | 1 + sound/soc/qcom/qdsp6/topology.c | 313 +++++++ sound/soc/qcom/sdw.c | 232 +++-- sound/soc/qcom/x1e80100.c | 100 +++ sound/soc/soc-core.c | 20 +- sound/soc/soc-dai.c | 1 + sound/soc/soc-dapm.c | 32 + sound/soc/soc-pcm.c | 136 ++- 23 files changed, 2150 insertions(+), 142 deletions(-) create mode 100644 Documentation/sound/soc/multi-direction-codecs.rst base-commit: dc9d6bcd9a9d9da8b44ef1f5f4c6ed469ce843ae -- 2.53.0