From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 DAC911A3147; Mon, 17 Mar 2025 16:37:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742229452; cv=none; b=c3+z19HO185MNopTdR5V+VtM45XE3EGaPXDYAoiSEsGurTdvvwNtOGE8vkkbRGir62f35jK/xE6ZTz3olcja6iD+tIMlAOuaYQEfR84A/wHPrPKy0nzInoKo2eVCPzavQ1ViaKYnGXa/1tIHHvZ0G6QHY9LAx1yocdbkIMnM6wo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742229452; c=relaxed/simple; bh=HR4snbWFFwiMo+npQvVU112otp9kuqyRniHfyZV8d3I=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=Zba8BvLPFSyEaOoqhlfFXBfiKUqNfKNdT6Vu8DnwQzZiW4YdnVB8ANPy8oHUxXpOgHG6wSVOU5rWnz5xn4C9lAhy5jhRbiBDXhQGoGnhwxLuptH8yiwBPyejIQFROHi0Xs0r1a/2qJaSSfJNZ/+cyQZ/wyFkt5kLNWyaGtm7m4E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=glS8TCai; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="glS8TCai" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32F73C4CEEC; Mon, 17 Mar 2025 16:37:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1742229451; bh=HR4snbWFFwiMo+npQvVU112otp9kuqyRniHfyZV8d3I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=glS8TCaiKvX8bXzoa/7OdDLJsDnJa8EFMIc9OVCI1J0uAgVRsxJSXmgL2cbHUPLg9 N8Ve0DW35YLhPP7m7jrjsDHIqtdQGBn6BzoGPzc2XZME3NjzYEdEfN6fYjkKSKPfHN T6VOGwZedO4geRoCLjyVQOURj7KDh0idhe0435A63d1rTbgrBx9onF9j2GmwI1tOLp vX+agQihKzgS+CMmaTSZ+ALTA+3YLmR6kFlRlLEX/n8Jjv5IDm3lq/SqcWS9rHDfJS CuzuUkbDgtmRMElauNhHhEEHVtAyF3R+66qZcihWrs8TIBWYS3fXxQsBy9+FXA5p7p P1bg/8JjmDuNw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Alexey Klimov , Krzysztof Kozlowski , Srinivas Kandagatla , Mark Brown , Sasha Levin , lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH AUTOSEL 6.13 02/16] ASoC: codecs: wsa884x: report temps to hwmon in millidegree of Celsius Date: Mon, 17 Mar 2025 12:37:11 -0400 Message-Id: <20250317163725.1892824-2-sashal@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250317163725.1892824-1-sashal@kernel.org> References: <20250317163725.1892824-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.13.7 Content-Transfer-Encoding: 8bit From: Alexey Klimov [ Upstream commit d776f016d24816f15033169dcd081f077b6c10f4 ] Temperatures are reported in units of Celsius however hwmon expects values to be in millidegree of Celsius. Userspace tools observe values close to zero and report it as "Not available" or incorrect values like 0C or 1C. Add a simple conversion to fix that. Before the change: wsa884x-virtual-0 Adapter: Virtual device temp1: +0.0°C -- wsa884x-virtual-0 Adapter: Virtual device temp1: +0.0°C Also reported as N/A before first amplifier power on. After this change and initial wsa884x power on: wsa884x-virtual-0 Adapter: Virtual device temp1: +39.0°C -- wsa884x-virtual-0 Adapter: Virtual device temp1: +37.0°C Tested on sm8550 only. Cc: Krzysztof Kozlowski Cc: Srinivas Kandagatla Signed-off-by: Alexey Klimov Link: https://patch.msgid.link/20250221044024.1207921-1-alexey.klimov@linaro.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/wsa884x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/wsa884x.c b/sound/soc/codecs/wsa884x.c index 86df5152c547b..560a2c04b6955 100644 --- a/sound/soc/codecs/wsa884x.c +++ b/sound/soc/codecs/wsa884x.c @@ -1875,7 +1875,7 @@ static int wsa884x_get_temp(struct wsa884x_priv *wsa884x, long *temp) * Reading temperature is possible only when Power Amplifier is * off. Report last cached data. */ - *temp = wsa884x->temperature; + *temp = wsa884x->temperature * 1000; return 0; } @@ -1934,7 +1934,7 @@ static int wsa884x_get_temp(struct wsa884x_priv *wsa884x, long *temp) if ((val > WSA884X_LOW_TEMP_THRESHOLD) && (val < WSA884X_HIGH_TEMP_THRESHOLD)) { wsa884x->temperature = val; - *temp = val; + *temp = val * 1000; ret = 0; } else { ret = -EAGAIN; -- 2.39.5