Skip to content

Commit d776f01

Browse files
laklimovbroonie
authored andcommitted
ASoC: codecs: wsa884x: report temps to hwmon in millidegree of Celsius
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 <[email protected]> Cc: Srinivas Kandagatla <[email protected]> Signed-off-by: Alexey Klimov <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 4363f02 commit d776f01

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sound/soc/codecs/wsa884x.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1875,7 +1875,7 @@ static int wsa884x_get_temp(struct wsa884x_priv *wsa884x, long *temp)
18751875
* Reading temperature is possible only when Power Amplifier is
18761876
* off. Report last cached data.
18771877
*/
1878-
*temp = wsa884x->temperature;
1878+
*temp = wsa884x->temperature * 1000;
18791879
return 0;
18801880
}
18811881

@@ -1934,7 +1934,7 @@ static int wsa884x_get_temp(struct wsa884x_priv *wsa884x, long *temp)
19341934
if ((val > WSA884X_LOW_TEMP_THRESHOLD) &&
19351935
(val < WSA884X_HIGH_TEMP_THRESHOLD)) {
19361936
wsa884x->temperature = val;
1937-
*temp = val;
1937+
*temp = val * 1000;
19381938
ret = 0;
19391939
} else {
19401940
ret = -EAGAIN;

0 commit comments

Comments
 (0)