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=1796074752; b=wA8ZrM2HyJ+ua3DKDpjOVvnITD0m4vgoCNU5kZsEY2HWVxSt361zf0i/tFmow38H6ReK JrMMybS5SmFJDmT9ugsWqU6+E8dkCyyt8d9RSK1EgRX+jOjNn9nL3luTWJ4Ejp0NDRKzL zZ5sZ4z61F89w7E8eUsbdKWeTd0TaAq8c1did3TbFI7K6K+2oZ0Yvw8hyNfrbggoNvtM0 lvJSwuj83u9KiEOrZTPlBRJ4OwjssU1mFuxwESPpM0IpGwRy8r083BuWiaUpAh8WIwY5T MEeKnd8U3Ew4ZgYR0GNWfWHDkrEc0nVUunZBbWiXDllqFvMrTzmR3sI8Ti6fV6NzRHA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796074752; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=BkLQjhPlmlk5fm5vSqGZEtLhrWrgrF8yKPzbnPHxQP8=; b=FD4KRpBXc/WpPBaPs4dW9OlCCagWjOZtuEJlHIGnQjxz1cnjy2/hVKn+AH6JiFc3CsHN 3iJCsquH9MNQJ6Ltr23xvyZwSXqQaluSt18CZQBCmdEto/bAI7WZoqhDcFIGe9JNDKakB alSjOxLrC/w7OreSHabAxT4vSCOjrRrVG9la+tkQ6EDNQ/jSHZZu3k3TEo2DmiVsxKE1W EL1PEsYny605QN+/okEseF0DiwIX8TniUwYLR/sgXdUcg4ynxQJqtcESbSd8bbF3rLV/L fLgCxXXoXmT050JJjykzFu3AYfQJKvl3vn/Cix3NvBTDSxWIeZJXyCTMY16F58kaJJw== 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=V0OUgcwZ; 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 14FE7606A31A; Mon, 30 Nov 2026 21:39:11 +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=V0OUgcwZ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 152221F0089B; Mon, 30 Nov 2026 21:39:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796074751; bh=BkLQjhPlmlk5fm5vSqGZEtLhrWrgrF8yKPzbnPHxQP8=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=V0OUgcwZNfD89GwdsBfX5hDE7RHjWRaqqwUridDthOOa53RbadEViMNRzEEi+FkBI 7wnMM7iFeTklH5C2nx76v5+G/C3rURpixnDZgyDoNYVdJZlweT5iON3fDAndgLMxQO BRXA3vYQXdPTIeEUqf5zbSQEMGe8WPTZ/wMtvMdlYPQLOPPsE6Bu3BX+i2z+ZCzJQ0 qiE8SABND5Tf63kpPAAXbz+/hitOsCiP2ByQh322tdGW/YMCtcoyMJ4CcOvTWouPPL 4O7lGIJleQscEMR4VrFOeHRznz7ROm4VbXC9fTp7uNRxOmYUXmL+xWvGQwLQd/NcDi +OKodtFrqfylg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v3 08/24] ASoC: codecs: wsa884x: register the die temperature as a thermal zone 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: <20261130212258.7376-9-srinivas.kandagatla@oss.qualcomm.com> References: <20261130212258.7376-1-srinivas.kandagatla@oss.qualcomm.com> <20261130212258.7376-9-srinivas.kandagatla@oss.qualcomm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Mon, 30 Nov 2026 21:39:10 +0000 X-Mailing-List: devicetree@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 3 potential issues to consider: - [Medium] ASoC: codecs: wsa884x: missing hw_init check in wsa884x_get_temp() - [Medium] ASoC: codecs: wsa884x: duplicate hwmon registration in wsa884x_probe() - [Low] ASoC: codecs: wsa884x: 0 degC cache sentinel collision in wsa884x_get_temp() -- commit eeb28091eb55a0c81338c5cbd1905079de782166 Author: Srinivas Kandagatla ASoC: codecs: wsa884x: register the die temperature as a thermal zone This commit registers a tripless thermal zone for the WSA884x die temperature sensor and returns -EAGAIN or THERMAL_TEMP_INVALID when a valid temperature reading is not available. > diff --git a/sound/soc/codecs/wsa884x.c b/sound/soc/codecs/wsa884x.c > index 91aa004d7137b..d0a00aced2208 100644 > --- a/sound/soc/codecs/wsa884x.c > +++ b/sound/soc/codecs/wsa884x.c [ ... ] > @@ -1935,8 +1936,10 @@ static int wsa884x_get_temp(struct wsa884x_priv *w= sa884x, long *temp) > if (wsa884x->pa_on) { > /* > * Reading temperature is possible only when Power Amplifier is > - * off. Report last cached data. > + * off. Report last cached data if we have one, -EAGAIN otherwise. > */ > + if (!wsa884x->temperature) > + return -EAGAIN; > *temp =3D wsa884x->temperature * 1000; > return 0; > } [Severity: Low] Does checking !wsa884x->temperature treat a valid cached 0 degC reading as uninitialised? wsa884x_get_temp() accepts measured temperatures in [WSA884X_LOW_TEMP_THRESHOLD, WSA884X_HIGH_TEMP_THRESHOLD] ([-10, 150] degC), so a 0 degC measurement cached before the PA turns on will make subsequent reads while pa_on is true fail with -EAGAIN for hwmon and THERMAL_TEMP_INVALID for the thermal zone. Also, because wsa884x->temperature is an unsigned int, caching a valid negative reading in [-10, -1] degC wraps to a large unsigned value before multiplying by 1000 and widening to long *temp. > @@ -2058,6 +2061,42 @@ static const struct hwmon_chip_info wsa884x_hwmon_= chip_info =3D { > .info =3D wsa884x_hwmon_info, > }; > =20 > +static int wsa884x_tz_get_temp(struct thermal_zone_device *tz, int *temp= _mdeg) > +{ > + struct wsa884x_priv *wsa884x =3D thermal_zone_device_priv(tz); > + long mdeg; > + int ret; > + > + /* > + * OTP trims read back as zero until the codec is initialised. Report > + * no reading rather than -EAGAIN, which makes the core poll the zone. > + */ > + if (!wsa884x->hw_init) { > + *temp_mdeg =3D THERMAL_TEMP_INVALID; > + return 0; > + } > + > + ret =3D wsa884x_get_temp(wsa884x, &mdeg); [Severity: Medium] Should the !wsa884x->hw_init check live inside wsa884x_get_temp() under wsa884x->sp_lock instead of only in wsa884x_tz_get_temp()? The commit message says hwmon returns -EAGAIN until the codec is initialised, but wsa884x_hwmon_read() calls wsa884x_get_temp() directly without checking wsa884x->hw_init. Reading hwmon while hw_init is false calls pm_runtime_resume_and_get() (which in wsa884x_runtime_resume() disables regcache_cache_only() and runs regcache_sync() on an unattached SoundWire slave if the device has runtime-suspended), attempts register accesses, and either returns -EINVAL when uncached OTP registers read as zero (d1 =3D=3D d2 =3D=3D 0) or caches a bogus reading from dmeas =3D=3D 0 = if the non-volatile OTP registers were cached during an earlier attachment. Checking wsa884x->hw_init outside sp_lock also races with wsa884x_update_status() clearing hw_init on SDW_SLAVE_UNATTACHED, allowing wsa884x_get_temp() to return -EINVAL to the thermal core. [ ... ] > @@ -2194,6 +2233,35 @@ static int wsa884x_probe(struct sdw_slave *pdev, > if (ret) > return ret; > =20 > + if (IS_REACHABLE(CONFIG_THERMAL)) { > + char tz_name[THERMAL_NAME_LENGTH]; > + struct thermal_zone_device *tz; > + > + /* > + * Register after runtime PM is enabled, as the zone is read > + * right away. dev_name() is too long for a zone name. > + */ > + scnprintf(tz_name, sizeof(tz_name), "wsa-%d-%u", > + pdev->bus->id, pdev->id.unique_id); > + tz =3D thermal_tripless_zone_device_register(tz_name, > + wsa884x, > + &wsa884x_tz_ops, > + NULL); [Severity: Medium] Does passing NULL for tzp register a duplicate hwmon device for this sensor? wsa884x_probe() already registers a hwmon device via devm_hwmon_device_register_with_info(). When tzp is NULL, thermal_zone_device_register_with_trips() calls thermal_add_hwmon_sysfs() (when CONFIG_THERMAL_HWMON is enabled), creating a second hwmon device for the same die temperature sensor that wakes the codec a second time on hwmon scans and returns -ENODATA instead of -EAGAIN when no reading is available. Passing a struct thermal_zone_params with .no_hwmon =3D true avoids the duplicate registration. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261130212258.7376= -1-srinivas.kandagatla@oss.qualcomm.com?part=3D8