diff --git a/device/accton/x86_64-accton_as9736_64d-r0/platform.json b/device/accton/x86_64-accton_as9736_64d-r0/platform.json index f062dccc6ad4..786363e5da42 100644 --- a/device/accton/x86_64-accton_as9736_64d-r0/platform.json +++ b/device/accton/x86_64-accton_as9736_64d-r0/platform.json @@ -158,7 +158,7 @@ ], "thermals": [ { - "name": "Temp sensor 1", + "name": "SMB_RearMiddle_temp(0x48)", "controllable": true, "low-threshold": false, "high-threshold": true, @@ -166,7 +166,7 @@ "high-crit-threshold": true }, { - "name": "Temp sensor 2", + "name": "SMB_FrontMiddle_temp(0x49)", "controllable": true, "low-threshold": false, "high-threshold": true, @@ -174,7 +174,7 @@ "high-crit-threshold": true }, { - "name": "Temp sensor 3", + "name": "SMB_LeftMiddle_temp(0x4C)", "controllable": true, "low-threshold": false, "high-threshold": true, @@ -182,7 +182,7 @@ "high-crit-threshold": true }, { - "name": "Temp sensor 4", + "name": "FCM_Center_temp(0x48)", "controllable": true, "low-threshold": false, "high-threshold": true, @@ -190,7 +190,7 @@ "high-crit-threshold": true }, { - "name": "Temp sensor 5", + "name": "FCM_Left_temp(0x49)", "controllable": true, "low-threshold": false, "high-threshold": true, @@ -198,7 +198,7 @@ "high-crit-threshold": true }, { - "name": "Temp sensor 6", + "name": "PDB-L_temp(0x48)", "controllable": true, "low-threshold": false, "high-threshold": true, @@ -206,7 +206,7 @@ "high-crit-threshold": true }, { - "name": "Temp sensor 7", + "name": "PDB-R_temp(0x49)", "controllable": true, "low-threshold": false, "high-threshold": true, @@ -214,7 +214,7 @@ "high-crit-threshold": true }, { - "name": "Temp sensor 8", + "name": "UDB_RearLeft_temp_temp(0x48)", "controllable": true, "low-threshold": false, "high-threshold": true, @@ -222,7 +222,7 @@ "high-crit-threshold": true }, { - "name": "Temp sensor 9", + "name": "UDB_RearMiddle_temp_temp(0x4C)", "controllable": true, "low-threshold": false, "high-threshold": true, @@ -230,7 +230,7 @@ "high-crit-threshold": true }, { - "name": "Temp sensor 10", + "name": "LDB_FrontRight_temp_temp(0x4C)", "controllable": true, "low-threshold": false, "high-threshold": true, @@ -238,7 +238,7 @@ "high-crit-threshold": true }, { - "name": "Temp sensor 11", + "name": "LDB_RearRight_temp_temp(0x4D)", "controllable": true, "low-threshold": false, "high-threshold": true, @@ -246,7 +246,71 @@ "high-crit-threshold": true }, { - "name": "CPU Temp", + "name": "CPU_Package_temp", + "controllable": true, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": true + }, + { + "name": "CPU_Core_0_temp", + "controllable": true, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": true + }, + { + "name": "CPU_Core_1_temp", + "controllable": true, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": true + }, + { + "name": "CPU_Core_2_temp", + "controllable": true, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": true + }, + { + "name": "CPU_Core_3_temp", + "controllable": true, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": true + }, + { + "name": "CPU_Core_4_temp", + "controllable": true, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": true + }, + { + "name": "CPU_Core_5_temp", + "controllable": true, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": true + }, + { + "name": "CPU_Core_6_temp", + "controllable": true, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": true + }, + { + "name": "CPU_Core_7_temp", "controllable": true, "low-threshold": false, "high-threshold": true, diff --git a/platform/broadcom/sonic-platform-modules-accton/as9736-64d/modules/accton_i2c_psu.c b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/modules/accton_i2c_psu.c index 39adbb0690df..6e743989769b 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as9736-64d/modules/accton_i2c_psu.c +++ b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/modules/accton_i2c_psu.c @@ -50,6 +50,7 @@ #define PMBUS_REGISTER_READ_IOUT_MAX 0xa6 #define PMBUS_REGISTER_READ_POUT_MAX 0xa7 #define PMBUS_REGISTER_READ_TEMP_MAX 0xa8 +#define PMBUS_REGISTER_READ_TEMP_MIN 0xa9 #define MAX_FAN_DUTY_CYCLE 100 #define I2C_RW_RETRY_COUNT 10 @@ -91,6 +92,7 @@ struct accton_i2c_psu_data { u16 mfr_vout_min; /* Register value */ u16 mfr_vout_max; /* Register value */ u16 mfr_tambient_max; /* Register value */ + u16 mfr_tambient_min; /* Register value */ }; static ssize_t show_linear(struct device *dev, struct device_attribute *da, char *buf); @@ -130,7 +132,8 @@ enum accton_i2c_psu_sysfs_attributes { PSU_MFR_IOUT_MAX, PSU_MFR_PIN_MAX, PSU_MFR_POUT_MAX, - PSU_MFR_TAMBIENT_MAX + PSU_MFR_TAMBIENT_MAX, + PSU_MFR_TAMBIENT_MIN }; /* sysfs attributes for hwmon @@ -159,6 +162,7 @@ static SENSOR_DEVICE_ATTR(psu_mfr_iout_max, S_IRUGO, show_linear, NULL, PSU_MF static SENSOR_DEVICE_ATTR(psu_mfr_pin_max, S_IRUGO, show_linear, NULL, PSU_MFR_PIN_MAX); static SENSOR_DEVICE_ATTR(psu_mfr_pout_max, S_IRUGO, show_linear, NULL, PSU_MFR_POUT_MAX); static SENSOR_DEVICE_ATTR(psu_temp1_max, S_IRUGO, show_linear, NULL, PSU_MFR_TAMBIENT_MAX); +static SENSOR_DEVICE_ATTR(psu_temp1_min, S_IRUGO, show_linear, NULL, PSU_MFR_TAMBIENT_MIN); /*Duplicate nodes for lm-sensors.*/ @@ -195,6 +199,7 @@ static struct attribute *accton_i2c_psu_attributes[] = { &sensor_dev_attr_psu_mfr_vout_max.dev_attr.attr, &sensor_dev_attr_psu_mfr_iout_max.dev_attr.attr, &sensor_dev_attr_psu_temp1_max.dev_attr.attr, + &sensor_dev_attr_psu_temp1_min.dev_attr.attr, /*Duplicate nodes for lm-sensors.*/ &sensor_dev_attr_curr2_input.dev_attr.attr, &sensor_dev_attr_in3_input.dev_attr.attr, @@ -272,6 +277,9 @@ static ssize_t show_linear(struct device *dev, struct device_attribute *da, case PSU_MFR_TAMBIENT_MAX: value = data->mfr_tambient_max; break; + case PSU_MFR_TAMBIENT_MIN: + value = data->mfr_tambient_min; + break; case PSU_FAN1_DUTY_CYCLE: multiplier = 1; value = data->fan_duty_cycle[0]; @@ -602,6 +610,7 @@ static struct accton_i2c_psu_data *accton_i2c_psu_update_device(struct device *d {PMBUS_REGISTER_READ_IOUT_MAX, &data->mfr_iout_max}, {PMBUS_REGISTER_READ_POUT_MAX, &data->mfr_pout_max}, {PMBUS_REGISTER_READ_TEMP_MAX, &data->mfr_tambient_max}, + {PMBUS_REGISTER_READ_TEMP_MIN, &data->mfr_tambient_min}, }; dev_dbg(&client->dev, "Starting accton_i2c_psu update\n"); @@ -687,3 +696,4 @@ MODULE_LICENSE("GPL"); module_init(accton_i2c_psu_init); module_exit(accton_i2c_psu_exit); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/thermal.py b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/thermal.py index 6f8432fbf35b..3a91e3a19518 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/thermal.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/thermal.py @@ -43,7 +43,10 @@ THERMAL_NAME_LIST = ["Temp sensor 1", "Temp sensor 2", "Temp sensor 3", "Temp sensor 4", "Temp sensor 5", "Temp sensor 6", "Temp sensor 7", "Temp sensor 8", "Temp sensor 9", - "Temp sensor 10", "Temp sensor 11", "CPU Temp"] + "Temp sensor 10", "Temp sensor 11", "CPU Package Temp", + "CPU Core 0 Temp", "CPU Core 1 Temp", "CPU Core 2 Temp", + "CPU Core 3 Temp", "CPU Core 4 Temp", "CPU Core 5 Temp", + "CPU Core 6 Temp", "CPU Core 7 Temp"] PSU_THERMAL_NAME_LIST = ["PSU-1 temp sensor 1", "PSU-2 temp sensor 1"] @@ -55,6 +58,7 @@ class Thermal(ThermalBase): def __init__(self, thermal_index=0, is_psu=False, psu_index=0): global psu_temp_max + global psu_temp_min self.index = thermal_index self.is_psu = is_psu self.psu_index = psu_index @@ -74,6 +78,8 @@ def __init__(self, thermal_index=0, is_psu=False, psu_index=0): if self.is_psu: temp_file_path = self.psu_hwmon_path + "psu_temp1_max" psu_temp_max = self.__get_temp(temp_file_path) + temp_file_path = self.psu_hwmon_path + "psu_temp1_min" + psu_temp_min = self.__get_temp(temp_file_path) # Default thresholds self.default_threshold = { THERMAL_NAME_LIST[0] : { @@ -148,15 +154,63 @@ def __init__(self, thermal_index=0, is_psu=False, psu_index=0): self.conf.HIGH_CRIT_THRESHOLD_FIELD : '107.0', self.conf.LOW_CRIT_THRESHOLD_FIELD : '72.0' }, + THERMAL_NAME_LIST[12] : { + self.conf.HIGH_THRESHOLD_FIELD : '99.0', + self.conf.LOW_THRESHOLD_FIELD : '84.0', + self.conf.HIGH_CRIT_THRESHOLD_FIELD : '107.0', + self.conf.LOW_CRIT_THRESHOLD_FIELD : '72.0' + }, + THERMAL_NAME_LIST[13] : { + self.conf.HIGH_THRESHOLD_FIELD : '99.0', + self.conf.LOW_THRESHOLD_FIELD : '84.0', + self.conf.HIGH_CRIT_THRESHOLD_FIELD : '107.0', + self.conf.LOW_CRIT_THRESHOLD_FIELD : '72.0' + }, + THERMAL_NAME_LIST[14] : { + self.conf.HIGH_THRESHOLD_FIELD : '99.0', + self.conf.LOW_THRESHOLD_FIELD : '84.0', + self.conf.HIGH_CRIT_THRESHOLD_FIELD : '107.0', + self.conf.LOW_CRIT_THRESHOLD_FIELD : '72.0' + }, + THERMAL_NAME_LIST[15] : { + self.conf.HIGH_THRESHOLD_FIELD : '99.0', + self.conf.LOW_THRESHOLD_FIELD : '84.0', + self.conf.HIGH_CRIT_THRESHOLD_FIELD : '107.0', + self.conf.LOW_CRIT_THRESHOLD_FIELD : '72.0' + }, + THERMAL_NAME_LIST[16] : { + self.conf.HIGH_THRESHOLD_FIELD : '99.0', + self.conf.LOW_THRESHOLD_FIELD : '84.0', + self.conf.HIGH_CRIT_THRESHOLD_FIELD : '107.0', + self.conf.LOW_CRIT_THRESHOLD_FIELD : '72.0' + }, + THERMAL_NAME_LIST[17] : { + self.conf.HIGH_THRESHOLD_FIELD : '99.0', + self.conf.LOW_THRESHOLD_FIELD : '84.0', + self.conf.HIGH_CRIT_THRESHOLD_FIELD : '107.0', + self.conf.LOW_CRIT_THRESHOLD_FIELD : '72.0' + }, + THERMAL_NAME_LIST[18] : { + self.conf.HIGH_THRESHOLD_FIELD : '99.0', + self.conf.LOW_THRESHOLD_FIELD : '84.0', + self.conf.HIGH_CRIT_THRESHOLD_FIELD : '107.0', + self.conf.LOW_CRIT_THRESHOLD_FIELD : '72.0' + }, + THERMAL_NAME_LIST[19] : { + self.conf.HIGH_THRESHOLD_FIELD : '99.0', + self.conf.LOW_THRESHOLD_FIELD : '84.0', + self.conf.HIGH_CRIT_THRESHOLD_FIELD : '107.0', + self.conf.LOW_CRIT_THRESHOLD_FIELD : '72.0' + }, PSU_THERMAL_NAME_LIST[0] : { self.conf.HIGH_THRESHOLD_FIELD : str(float(psu_temp_max)), - self.conf.LOW_THRESHOLD_FIELD : self.conf.NOT_AVAILABLE, + self.conf.LOW_THRESHOLD_FIELD : str(float(psu_temp_min)), self.conf.HIGH_CRIT_THRESHOLD_FIELD : self.conf.NOT_AVAILABLE, self.conf.LOW_CRIT_THRESHOLD_FIELD : self.conf.NOT_AVAILABLE }, PSU_THERMAL_NAME_LIST[1] : { self.conf.HIGH_THRESHOLD_FIELD : str(float(psu_temp_max)), - self.conf.LOW_THRESHOLD_FIELD : self.conf.NOT_AVAILABLE, + self.conf.LOW_THRESHOLD_FIELD : str(float(psu_temp_min)), self.conf.HIGH_CRIT_THRESHOLD_FIELD : self.conf.NOT_AVAILABLE, self.conf.LOW_CRIT_THRESHOLD_FIELD : self.conf.NOT_AVAILABLE } @@ -164,35 +218,44 @@ def __init__(self, thermal_index=0, is_psu=False, psu_index=0): # Set hwmon path i2c_path = { - 0: "2-0048/hwmon/hwmon*/", - 1: "2-0049/hwmon/hwmon*/", - 2: "14-004c/hwmon/hwmon*/", - 3: "27-0048/hwmon/hwmon*/", - 4: "27-0049/hwmon/hwmon*/", - 5: "34-0048/hwmon/hwmon*/", - 6: "42-0049/hwmon/hwmon*/", - 7: "57-0048/hwmon/hwmon*/", - 8: "58-004c/hwmon/hwmon*/", - 9: "65-004c/hwmon/hwmon*/", - 10: "66-004d/hwmon/hwmon*/", - 11: "coretemp.0/hwmon/hwmon*/" + 0: {"hwmon_path":"2-0048/hwmon/hwmon*/", "ss_index":1}, + 1: {"hwmon_path":"2-0049/hwmon/hwmon*/", "ss_index":1}, + 2: {"hwmon_path":"14-004c/hwmon/hwmon*/", "ss_index":1}, + 3: {"hwmon_path":"27-0048/hwmon/hwmon*/", "ss_index":1}, + 4: {"hwmon_path":"27-0049/hwmon/hwmon*/", "ss_index":1}, + 5: {"hwmon_path":"34-0048/hwmon/hwmon*/", "ss_index":1}, + 6: {"hwmon_path":"42-0049/hwmon/hwmon*/", "ss_index":1}, + 7: {"hwmon_path":"57-0048/hwmon/hwmon*/", "ss_index":1}, + 8: {"hwmon_path":"58-004c/hwmon/hwmon*/", "ss_index":1}, + 9: {"hwmon_path":"65-004c/hwmon/hwmon*/", "ss_index":1}, + 10: {"hwmon_path":"66-004d/hwmon/hwmon*/", "ss_index":1}, + 11: {"hwmon_path":"coretemp.0/hwmon/hwmon*/", "ss_index":1}, + 12: {"hwmon_path":"coretemp.0/hwmon/hwmon*/", "ss_index":2}, + 13: {"hwmon_path":"coretemp.0/hwmon/hwmon*/", "ss_index":3}, + 14: {"hwmon_path":"coretemp.0/hwmon/hwmon*/", "ss_index":4}, + 15: {"hwmon_path":"coretemp.0/hwmon/hwmon*/", "ss_index":5}, + 16: {"hwmon_path":"coretemp.0/hwmon/hwmon*/", "ss_index":6}, + 17: {"hwmon_path":"coretemp.0/hwmon/hwmon*/", "ss_index":7}, + 18: {"hwmon_path":"coretemp.0/hwmon/hwmon*/", "ss_index":8}, + 19: {"hwmon_path":"coretemp.0/hwmon/hwmon*/", "ss_index":9} }.get(self.index, None) self.is_cpu = False - if self.index == 11: + if self.index in range(11,20): self.is_cpu = True - self.hwmon_path = "{}/{}".format(CPU_SYSFS_PATH, i2c_path) + self.hwmon_path = "{}/{}".format(CPU_SYSFS_PATH, i2c_path["hwmon_path"]) else: - self.hwmon_path = "{}/{}".format(SYSFS_PATH, i2c_path) + self.hwmon_path = "{}/{}".format(SYSFS_PATH, i2c_path["hwmon_path"]) self.ss_key = THERMAL_NAME_LIST[self.index] - self.ss_index = 1 + self.ss_index = i2c_path["ss_index"] def __read_txt_file(self, file_path): for filename in glob.glob(file_path): try: with open(filename, 'r') as fd: - data =fd.readline().rstrip() - return data + data =fd.readline().strip() + if len(data) > 0: + return data except IOError as e: pass @@ -303,7 +366,10 @@ def get_presence(self): if self.is_psu: val = self.__read_txt_file(self.cpld_path + "psu_present") - return int(val, 10) == 1 + if val is not None: + return int(val, 10) == 1 + else: + return False temp_file = "temp{}_input".format(self.ss_index) temp_file_path = os.path.join(self.hwmon_path, temp_file) raw_txt = self.__read_txt_file(temp_file_path) @@ -324,8 +390,10 @@ def get_status(self): if self.is_psu: temp_file = self.psu_hwmon_path + "psu_temp1_input" - return self.get_presence() and (int( - self.__read_txt_file(temp_file))) + psu_temp1_input = self.__read_txt_file(temp_file) + if psu_temp1_input is None: + psu_temp1_input = '0' + return self.get_presence() and (int(psu_temp1_input)) file_str = "temp{}_input".format(self.ss_index) file_path = os.path.join(self.hwmon_path, file_str)