mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ASoC: codecs: wsa884x: report temps to hwmon in millidegree of Celsius
@ 2025-02-21  4:40 Alexey Klimov
  2025-03-04 12:33 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Alexey Klimov @ 2025-02-21  4:40 UTC (permalink / raw)
  To: srinivas.kandagatla, broonie, lgirdwood
  Cc: krzysztof.kozlowski, abel.vesa, neil.armstrong, perex, tiwai,
	jdelvare, linux-sound, linux-arm-msm, linux-kernel, linux-hwmon

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 <krzysztof.kozlowski@linaro.org>
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Alexey Klimov <alexey.klimov@linaro.org>
---
 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 86df5152c547..560a2c04b695 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.47.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ASoC: codecs: wsa884x: report temps to hwmon in millidegree of Celsius
  2025-02-21  4:40 [PATCH] ASoC: codecs: wsa884x: report temps to hwmon in millidegree of Celsius Alexey Klimov
@ 2025-03-04 12:33 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2025-03-04 12:33 UTC (permalink / raw)
  To: srinivas.kandagatla, lgirdwood, Alexey Klimov
  Cc: krzysztof.kozlowski, abel.vesa, neil.armstrong, perex, tiwai,
	jdelvare, linux-sound, linux-arm-msm, linux-kernel, linux-hwmon

On Fri, 21 Feb 2025 04:40:24 +0000, Alexey Klimov wrote:
> 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:
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: codecs: wsa884x: report temps to hwmon in millidegree of Celsius
      commit: d776f016d24816f15033169dcd081f077b6c10f4

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-03-04 12:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-21  4:40 [PATCH] ASoC: codecs: wsa884x: report temps to hwmon in millidegree of Celsius Alexey Klimov
2025-03-04 12:33 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®