From ee7d590e690ba34959a42aee0e42f69af77f4e6b Mon Sep 17 00:00:00 2001 From: Oleksandr Shamray Date: Wed, 29 May 2024 16:19:59 +0300 Subject: [PATCH] hw-mgmt: thermal: TC: Add special configuration for sensor_read_error 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 --- usr/usr/bin/hw_management_thermal_control.py | 31 +++++++++++++++----- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/usr/usr/bin/hw_management_thermal_control.py b/usr/usr/bin/hw_management_thermal_control.py index 17a2bdb73..1a6641979 100755 --- a/usr/usr/bin/hw_management_thermal_control.py +++ b/usr/usr/bin/hw_management_thermal_control.py @@ -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: @@ -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) @@ -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: @@ -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) @@ -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)) @@ -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) @@ -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)) @@ -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)) @@ -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)) @@ -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) @@ -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: @@ -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() @@ -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))