From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796131400; b=HTMjLOHQBjPBE1m2OS2seylT0DgS7LCQTBHwntlZ/KKSwKptBL9lIIF++jAzWCORWq8C CsTGqHBEpQZ71XUVRAfHJX8spohCe7QjOjbyaQhkcrPDkxNJJJQ+tqjjH/w6T1oI/AaVA QA6gKyWnAYiBI1bxrSiet8s4WCP1kypnnOxgE25o8kvoZ/l2XIGPe1pjEiTqbA3let2c5 osOg1wbK4Mxg1WcGlGPOy9yNVTAy1ANyshyPWinBrejhzBfFYC6zKx2rqpEUqdY2JZNZI ooHUJiTtTM3Ur834mSfY8yycoaPC1ChyYITTz9IAl+zl9cNwITlBbWmtiVrSolMDFmQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796131400; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=JUtVzVFuUFcqMClVppeN85Xp1rOjaQxvcSzUMfVJnhc=; b=Gcr8fqYWK9okpG52UfejRKJ20fBjOwy55XjJ6JlO8QbTjtNLzNPfk8rLjP07XGJwdHnG JUINWiCfa/mWY1Cn1zs6eHiTrV6mW5uGmDha3dMG7My33KVgiWsDAuKKbkQbj8/G1TLJM 6DmrzTY8MkEsCC7QGp4pux7NB+bQJ10m8HLe478cc0MdVGj5dvt8Yheb+655aihbGyOVE j+jJRUZQr84jN5bmX12Ic07UfKPXeD5/HSEGByntjyDojF1n2bmdMkdIH+7LvNWUQ+/1V kqKXaoe86A+lNZOCemTFAEoDpMs6U7s+Jhe3i+NMa0CwTydmFgwZHKhwfahqdlQuikQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Hn8TFyOQ; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 157D7606A335; Tue, 1 Dec 2026 13:23:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Hn8TFyOQ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84EC51F00924; Tue, 1 Dec 2026 13:23:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796131399; bh=JUtVzVFuUFcqMClVppeN85Xp1rOjaQxvcSzUMfVJnhc=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=Hn8TFyOQZhvTd2n0pRS4frslAJFFMviGYx05obE9N0vtvSYzRcbiPFZjoKtKtQjDG pH7VomAMP+SU/Vs8W63gy85UL6Qv5Q4PhJoE+28KjfBql9c+K/mCFM4Dv7eW9bM6S6 LGELyVny3w+Cb90UmHBRga5EmyFfe4rgzd0DpZrENJc0my5xqrh8Iej2pdUGlNN/hr UxzrXwF2avLHqbZEm2VZ8Ev6lwmSofq5lokFhU4oOf0PynF6qoniDKDZWDIfKGUs2C bEGN72TRfWnqg4xlSI9jAMOMivMCrSln+m+ChVYjdltVV8XeOCtMZW3qMfJjupFPCj S1Dsuf/Fp0EzA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v4 18/24] ASoC: qcom: audioreach: add live speaker temperature (T0) readback Reply-To: sashiko-reviews@lists.linux.dev To: "Srinivas Kandagatla" Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org In-Reply-To: <20261201124753.196748-19-srinivas.kandagatla@oss.qualcomm.com> References: <20261201124753.196748-1-srinivas.kandagatla@oss.qualcomm.com> <20261201124753.196748-19-srinivas.kandagatla@oss.qualcomm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 01 Dec 2026 13:23:19 +0000 X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] ASoC: qcom: audioreach: T0 read in audioreach_vi_calibration_event() with PA on -- commit d28517cfefa07bca8124d773d197683be8b7f061 Author: Srinivas Kandagatla ASoC: qcom: audioreach: add live speaker temperature (T0) readback This commit allows machine drivers to register speaker thermal zones in VI channel order, exposes their live temperatures in Q6 format via a read-only "Speaker Protection T0" control, and pairs the read T0 with R0 when speaker calibration completes. > diff --git a/sound/soc/qcom/qdsp6/audioreach.c b/sound/soc/qcom/qdsp6/aud= ioreach.c > index 42e542f305913..3974191f9c536 100644 > --- a/sound/soc/qcom/qdsp6/audioreach.c > +++ b/sound/soc/qcom/qdsp6/audioreach.c [ ... ] > @@ -1579,6 +1588,50 @@ void audioreach_get_sp_vi_r0t0(long *vals, unsigne= d int count) > } > } > =20 > +int audioreach_sp_register_speaker_map(struct thermal_zone_device * cons= t *tzs, > + unsigned int num) > +{ > + unsigned int i; > + > + if (num > MAX_SP_VI_SPEAKERS) > + return -EINVAL; > + > + guard(mutex)(&sp_speaker_map_lock); > + > + for (i =3D 0; i < num; i++) > + sp_speaker_map.tz[i] =3D tzs[i]; > + for (; i < MAX_SP_VI_SPEAKERS; i++) > + sp_speaker_map.tz[i] =3D NULL; > + sp_speaker_map.num =3D num; > + > + return 0; > +} > +EXPORT_SYMBOL_GPL(audioreach_sp_register_speaker_map); > + > +/* Read each speaker's T0 in Q6 (degC * 64), 0 if its zone cannot be rea= d */ > +int audioreach_get_sp_vi_t0(long *vals, unsigned int count) > +{ > + unsigned int i, n; > + > + guard(mutex)(&sp_speaker_map_lock); > + > + n =3D min(count, sp_speaker_map.num); > + for (i =3D 0; i < n; i++) { > + int mdeg; > + > + if (sp_speaker_map.tz[i] && > + !thermal_zone_get_temp(sp_speaker_map.tz[i], &mdeg)) > + vals[i] =3D div_s64((s64)mdeg * 64, 1000); > + else > + vals[i] =3D 0; > + } > + for (; i < count; i++) > + vals[i] =3D 0; > + > + return n; > +} > +EXPORT_SYMBOL_GPL(audioreach_get_sp_vi_t0); [ ... ] > @@ -1704,12 +1758,20 @@ void audioreach_vi_calibration_event(struct devic= e *dev, > i, r0_int, r0_frac, sp_vi_r0.r0_cali_q24[i]); > } > =20 > - /* Only a run where every speaker succeeded gives a usable R0/T0 set */ > + /* > + * Only a run where every speaker succeeded gives a usable R0/T0 set. > + * The DSP reports only R0, so pair it with the speakers' last T0 > + * reading; a zone that cannot be read gives T0 =3D 0. > + */ > if (success) { > + audioreach_get_sp_vi_t0(t0_live, num_ch); > + > guard(mutex)(&sp_vi_r0t0_cfg_lock); > sp_vi_r0t0_cfg.num_ch =3D num_ch; > - for (i =3D 0; i < num_ch; i++) > + for (i =3D 0; i < num_ch; i++) { > sp_vi_r0t0_cfg.r0_cali_q24[i] =3D cali->cali_param[i].r0_cali_q24; > + sp_vi_r0t0_cfg.t0_cali_q6[i] =3D (s16)t0_live[i]; > + } > } [Severity: Medium] Can reading T0 in audioreach_vi_calibration_event() store 0.000 degC into sp_vi_r0t0_cfg.t0_cali_q6[] on WSA884x speakers when calibration runs while the power amplifier is active? audioreach_vi_calibration_event() runs during active playback while the PA is on. In wsa884x_get_temp(), hardware temperature registers cannot be read while pa_on is true: sound/soc/codecs/wsa884x.c:wsa884x_get_temp() { ... if (wsa884x->pa_on) { /* * Reading temperature is possible only when Power Amplifier is * off. Report last cached data if we have one, -EAGAIN otherwise. */ if (!wsa884x->temperature) return -EAGAIN; *temp =3D wsa884x->temperature * 1000; return 0; } ... } Because wsa884x_probe() enables its tripless thermal zone before SoundWire attachment (while wsa884x->hw_init is false), wsa884x->temperature starts at 0 unless userspace manually reads the thermal zone while the codec is initialized and the PA is off, and nothing primes T0 in audioreach_arm_vi_calibration() during DAI prepare before DAPM powers on the PA. When thermal_zone_get_temp() fails, audioreach_get_sp_vi_t0() falls ba= ck to 0, which is a valid Q6 temperature (0.000 degC, within SP_VI_T0_MIN_Q6..SP_VI_T0_MAX_Q6) that audioreach_speaker_protection_vi() will then send to the DSP as the calibration reference temperature in normal mode. In addition, t0_live[i] is not checked against SP_VI_T0_MIN_Q6..SP_VI_T0_MAX_Q6 before storing, which would cause a later audioreach_set_sp_vi_r0t0() restore to fail with -ERANGE if an out-of-range value was read. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261201124753.1967= 48-1-srinivas.kandagatla@oss.qualcomm.com?part=3D18