Skip to content

Commit

Permalink
hw-mgmt: thermal: TC: Add special configuration for sensor_read_error
Browse files Browse the repository at this point in the history
Add special configuration for sensor_read_error. It can be used for
ASIC thermal sensor read error which requires higher PWM value, compared
to value defined in dmin sensor_read_error table.

Minor fix: align outut style of sensor_error log messages.

Signed-off-by: Oleksandr Shamray <[email protected]>
  • Loading branch information
sholeksandr committed Jul 24, 2024
1 parent 69e7cbc commit ee7d590
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions usr/usr/bin/hw_management_thermal_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -1397,7 +1397,7 @@ def handle_input(self, thermal_table, flow_dir, amb_tmp):
pwm = self.pwm_min
value = self.value
if not self.check_file(self.file_input):
self.log.info("Missing file {}".format(self.name, self.file_input))
self.log.info("Missing file: {}".format(self.file_input))
self.handle_reading_file_err(self.file_input)
else:
try:
Expand Down Expand Up @@ -1438,6 +1438,9 @@ def handle_err(self, thermal_table, flow_dir, amb_tmp):
fault_list = self.get_fault_list_filtered()
# sensor error reading counter
if CONST.SENSOR_READ_ERR in fault_list:
# get special error case for sensor missing
sensor_err = self.sensors_config.get(CONST.SENSOR_READ_ERR, 0)
self.pwm = max(int(sensor_err), self.pwm)
pwm = g_get_dmin(thermal_table, amb_tmp, [flow_dir, CONST.SENSOR_READ_ERR])
self.pwm = max(pwm, self.pwm)

Expand Down Expand Up @@ -1533,7 +1536,7 @@ def handle_input(self, thermal_table, flow_dir, amb_tmp):

temp_read_file = "thermal/{}".format(self.file_input)
if not self.check_file(temp_read_file):
self.log.info("Missing file {} :{}.".format(self.name, temp_read_file))
self.log.info("Missing file: {}.".format(temp_read_file))
self.handle_reading_file_err(temp_read_file)
else:
try:
Expand Down Expand Up @@ -1585,6 +1588,9 @@ def handle_err(self, thermal_table, flow_dir, amb_tmp):
# sensor error reading counter
if CONST.SENSOR_READ_ERR in fault_list:
self.append_fault(CONST.SENSOR_READ_ERR)
# get special error case for sensor missing
sensor_err = self.sensors_config.get(CONST.SENSOR_READ_ERR, 0)
self.pwm = max(int(sensor_err), self.pwm)
pwm = g_get_dmin(thermal_table, amb_tmp, [flow_dir, CONST.SENSOR_READ_ERR], interpolated=False)
self.pwm = max(pwm, self.pwm)

Expand Down Expand Up @@ -1649,7 +1655,7 @@ def _get_status(self):
psu_status_filename = "thermal/{}_status".format(self.base_file_name)
psu_status = 0
if not self.check_file(psu_status_filename):
self.log.info("Missing file {} dev: {}".format(psu_status_filename, self.name))
self.log.info("Missing file: {}".format(psu_status_filename))
else:
try:
psu_status = int(self.read_file(psu_status_filename))
Expand Down Expand Up @@ -1777,6 +1783,9 @@ def handle_err(self, thermal_table, flow_dir, amb_tmp):

# sensor error reading file
if CONST.SENSOR_READ_ERR in fault_list:
# get special error case for sensor missing
sensor_err = self.sensors_config.get(CONST.SENSOR_READ_ERR, 0)
self.pwm = max(int(sensor_err), self.pwm)
pwm = g_get_dmin(thermal_table, amb_tmp, [flow_dir, CONST.SENSOR_READ_ERR])
pwm_new = max(pwm, pwm_new)

Expand Down Expand Up @@ -1899,7 +1908,7 @@ def _get_status(self):
status_filename = "thermal/fan{}_status".format(self.fan_drwr_id)
status = 0
if not self.check_file(status_filename):
self.log.info("Missing file {} dev: {}".format(status_filename, self.name))
self.log.info("Missing file: {}".format(status_filename))
else:
try:
status = int(self.read_file(status_filename))
Expand All @@ -1915,7 +1924,7 @@ def _get_fault(self):
for tacho_idx in range(self.tacho_idx, self.tacho_idx + self.tacho_cnt):
fan_fault_filename = "thermal/fan{}_fault".format(tacho_idx)
if not self.check_file(fan_fault_filename):
self.log.info("Missing file {} dev: {}".format(fan_fault_filename, self.name))
self.log.info("Missing file: {}".format(fan_fault_filename))
else:
try:
val = int(self.read_file(fan_fault_filename))
Expand Down Expand Up @@ -2084,7 +2093,7 @@ def handle_input(self, thermal_table, flow_dir, amb_tmp):
value = 0
rpm_file_name = "thermal/fan{}_speed_get".format(self.tacho_idx + tacho_id)
if not self.check_file(rpm_file_name):
self.log.info("Missing file {} dev: {}".format(rpm_file_name, self.name))
self.log.info("Missing file {}".format(rpm_file_name))
else:
try:
value = int(self.read_file(rpm_file_name))
Expand Down Expand Up @@ -2156,6 +2165,9 @@ def handle_err(self, thermal_table, flow_dir, amb_tmp):
# sensor error reading counter
if CONST.SENSOR_READ_ERR in fault_list:
if CONST.SENSOR_READ_ERR not in self.mask_fault_list:
# get special error case for sensor missing
sensor_err = self.sensors_config.get(CONST.SENSOR_READ_ERR, 0)
self.pwm = max(int(sensor_err), self.pwm)
pwm = g_get_dmin(thermal_table, amb_tmp, [flow_dir, CONST.SENSOR_READ_ERR])
pwm_new = max(pwm, pwm_new)

Expand Down Expand Up @@ -2226,7 +2238,7 @@ def handle_input(self, thermal_table, flow_dir, amb_tmp):
for _, file_name in self.base_file_name.items():
sens_file_name = "thermal/{}".format(file_name)
if not self.check_file(sens_file_name):
self.log.info("{}: missing file {}".format(self.name, sens_file_name))
self.log.info("Missing file: {}".format(sens_file_name))
self.handle_reading_file_err(sens_file_name)
else:
try:
Expand Down Expand Up @@ -2273,6 +2285,9 @@ def handle_err(self, thermal_table, flow_dir, amb_tmp):
fault_list = self.get_fault_list_filtered()

if CONST.SENSOR_READ_ERR in fault_list:
# get special error case for sensor missing
sensor_err = self.sensors_config.get(CONST.SENSOR_READ_ERR, 0)
self.pwm = max(int(sensor_err), self.pwm)
pwm = g_get_dmin(thermal_table, self.value, [self.flow_dir, CONST.SENSOR_READ_ERR])
self.pwm = max(pwm, self.pwm)
self._update_pwm()
Expand Down Expand Up @@ -2333,7 +2348,7 @@ def handle_input(self, thermal_table, flow_dir, amb_tmp):
""
dps_ready_filename = self.file_input
if not self.check_file(dps_ready_filename):
self.log.info("{}: missing file {}".format(self.name, dps_ready_filename))
self.log.info("Missing file: {}".format(dps_ready_filename))
else:
try:
self.ready = bool(self.read_file_int(dps_ready_filename))
Expand Down

0 comments on commit ee7d590

Please sign in to comment.