Skip to content

Commit

Permalink
hw-mgmt: thermal: Fix ASIC tz mode
Browse files Browse the repository at this point in the history
In case ASIC starts after TC it can set thermal zone mode to 'step_wise'.
This fix set thermal zone policy to 'user_space' after ASIC start.

Signed-off-by: Oleksandr Shamray <[email protected]>
  • Loading branch information
sholeksandr committed Aug 3, 2023
1 parent aa989f2 commit dd6ddca
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions usr/usr/bin/hw_management_thermal_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -1250,17 +1250,22 @@ def sensor_configure(self):
"""
@summary: this function calling on sensor start after initialization or suspend off
"""
# Disable kernel control for this thermal zone
self.refresh_attr()
if "asic" in self.base_file_name:
tz_name = "mlxsw"
else:
tz_name = "mlxsw-{}".format(self.base_file_name)
tz_policy_filename = "thermal/{}/thermal_zone_policy".format(tz_name)
tz_mode_filename = "thermal/{}/thermal_zone_mode".format(tz_name)

self.log.info("Configure module {} policy".format(tz_name))
# Disable kernel control for this thermal zone
try:
self.write_file(tz_policy_filename, "user_space")
self.write_file(tz_mode_filename, "disabled")
policy = self.read_file(tz_policy_filename)
# do not set policy if tz already configured
if "user_space" not in policy:
self.write_file(tz_policy_filename, "user_space")
self.write_file(tz_mode_filename, "disabled")
except BaseException:
pass

Expand Down Expand Up @@ -1330,6 +1335,9 @@ def handle_input(self, thermal_table, flow_dir, amb_tmp):
else:
try:
temperature = int(self.read_file(temp_read_file))
if temp_read_file in self.check_reading_file_err():
# senor returned back. Reconfigure module.
self.sensor_configure()
self.handle_reading_file_err(temp_read_file, reset=True)
temperature /= CONST.TEMP_SENSOR_SCALE
self.log.debug("{} value:{}".format(self.name, temperature))
Expand Down

0 comments on commit dd6ddca

Please sign in to comment.