[Nokia ixs7215] Platform API temperature threshold value fixes (#10372)

Incorrect high-threshold and critical-high-threshold values are displayed for
some of the temperature sensors. This commit fixes that.
This commit is contained in:
dflynn-Nokia 2022-04-07 10:44:31 -04:00 committed by GitHub
parent faabf00f82
commit e348dff77a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 11 deletions

View File

@ -30,7 +30,7 @@ def main():
high_thresh = "NA" high_thresh = "NA"
print(" Low Threshold(C): {}, High Threshold(C): {}".format(low_thresh, print(" Low Threshold(C): {}, High Threshold(C): {}".format(low_thresh,
high_thresh)) high_thresh))
try: try:
crit_low_thresh = thermal.get_low_critical_threshold() crit_low_thresh = thermal.get_low_critical_threshold()

View File

@ -44,8 +44,8 @@ class Thermal(ThermalBase):
if self.index < 3: if self.index < 3:
i2c_path = self.I2C_CLASS_DIR + self.I2C_DEV_MAPPING[self.index - 1][0] i2c_path = self.I2C_CLASS_DIR + self.I2C_DEV_MAPPING[self.index - 1][0]
sensor_index = self.I2C_DEV_MAPPING[self.index - 1][1] sensor_index = self.I2C_DEV_MAPPING[self.index - 1][1]
sensor_max_suffix = "max" sensor_high_suffix = "max"
sensor_crit_suffix = None sensor_high_crit_suffix = None
hwmon_node = os.listdir(i2c_path)[0] hwmon_node = os.listdir(i2c_path)[0]
self.SENSOR_DIR = i2c_path + hwmon_node + '/' self.SENSOR_DIR = i2c_path + hwmon_node + '/'
@ -53,8 +53,8 @@ class Thermal(ThermalBase):
elif self.index < 6: elif self.index < 6:
i2c_path = self.I2C_CLASS_DIR + self.I2C_DEV_MAPPING[self.index - 1][0] i2c_path = self.I2C_CLASS_DIR + self.I2C_DEV_MAPPING[self.index - 1][0]
sensor_index = self.I2C_DEV_MAPPING[self.index - 1][1] sensor_index = self.I2C_DEV_MAPPING[self.index - 1][1]
sensor_max_suffix = "max" sensor_high_suffix = "crit"
sensor_crit_suffix = "crit" sensor_high_crit_suffix = None
hwmon_node = os.listdir(i2c_path)[0] hwmon_node = os.listdir(i2c_path)[0]
self.SENSOR_DIR = i2c_path + hwmon_node + '/' self.SENSOR_DIR = i2c_path + hwmon_node + '/'
@ -62,8 +62,8 @@ class Thermal(ThermalBase):
else: else:
dev_path = self.HWMON_CLASS_DIR dev_path = self.HWMON_CLASS_DIR
sensor_index = 1 sensor_index = 1
sensor_max_suffix = None sensor_high_suffix = None
sensor_crit_suffix = None sensor_high_crit_suffix = None
hwmon_node = os.listdir(dev_path)[0] hwmon_node = os.listdir(dev_path)[0]
self.SENSOR_DIR = dev_path + hwmon_node + '/' self.SENSOR_DIR = dev_path + hwmon_node + '/'
@ -72,16 +72,16 @@ class Thermal(ThermalBase):
+ "temp{}_input".format(sensor_index) + "temp{}_input".format(sensor_index)
# sysfs file for high threshold value if supported for this sensor # sysfs file for high threshold value if supported for this sensor
if sensor_max_suffix: if sensor_high_suffix:
self.thermal_high_threshold_file = self.SENSOR_DIR \ self.thermal_high_threshold_file = self.SENSOR_DIR \
+ "temp{}_{}".format(sensor_index, sensor_max_suffix) + "temp{}_{}".format(sensor_index, sensor_high_suffix)
else: else:
self.thermal_high_threshold_file = None self.thermal_high_threshold_file = None
# sysfs file for crit high threshold value if supported for this sensor # sysfs file for crit high threshold value if supported for this sensor
if sensor_crit_suffix: if sensor_high_crit_suffix:
self.thermal_high_crit_threshold_file = self.SENSOR_DIR \ self.thermal_high_crit_threshold_file = self.SENSOR_DIR \
+ "temp{}_{}".format(sensor_index, sensor_crit_suffix) + "temp{}_{}".format(sensor_index, sensor_high_crit_suffix)
else: else:
self.thermal_high_crit_threshold_file = None self.thermal_high_crit_threshold_file = None