diff --git a/packages/platforms/accton/x86-64/x86-64-accton-as5916-54xm/onlp/builds/src/module/src/ledi.c b/packages/platforms/accton/x86-64/x86-64-accton-as5916-54xm/onlp/builds/src/module/src/ledi.c index 480f3570..829991e7 100644 --- a/packages/platforms/accton/x86-64/x86-64-accton-as5916-54xm/onlp/builds/src/module/src/ledi.c +++ b/packages/platforms/accton/x86-64/x86-64-accton-as5916-54xm/onlp/builds/src/module/src/ledi.c @@ -210,7 +210,25 @@ onlp_ledi_set(onlp_oid_t id, int on_or_off) if (!on_or_off) { return onlp_ledi_mode_set(id, ONLP_LED_MODE_OFF); } + else + { + /*Just pick a color to light*/ + int rv, i; + onlp_led_info_t info; + uint32_t caps; + rv = onlp_ledi_info_get(id, &info); + if (rv < 0) + return rv; + + caps = info.caps; + /*Bit scan*/ + for (i = 1; i < sizeof(caps)*8; i++) { + if( caps & (1< 36¢J or + * LM75_0x49 > 39¢J or + * LM75_0x4A > 38¢J or + * LM75_0x4C > 39¢J), + * fan duty = 100%. */ - for (i = (THERMAL_1_ON_MAIN_BROAD); i <= (THERMAL_3_ON_MAIN_BROAD); i++) { - if (ti[i-1].mcelsius < 50000) { + for (i = (THERMAL_1_ON_MAIN_BROAD); i <= (CHASSIS_THERMAL_COUNT); i++) { + desc = ti[i-1].hdr.description; + desc += strlen(desc) - 2; /*Take last 2 chars.*/ + addr = (int)strtol(desc, NULL, 16); + if ( _get_tmp_threshold(addr, &thrsh) != ONLP_STATUS_OK){ continue; } - *adjusted = 1; - return onlp_fani_percentage_set(ONLP_FAN_ID_CREATE(1), FAN_DUTY_MAX); - } - - /* When anyone higher than 45 degrees, all fans run with duty 62.5%. - */ - for (i = (THERMAL_1_ON_MAIN_BROAD); i <= (THERMAL_3_ON_MAIN_BROAD); i++) { - if (ti[i-1].mcelsius < 45000) { - continue; + if (ti[i-1].mcelsius > thrsh) { + *adjusted = 1; + return onlp_fani_percentage_set(ONLP_FAN_ID_CREATE(1), FAN_DUTY_MAX); } - - int fanduty_mid = FAN_DUTY_MID; - fanduty_mid += (fi[0].status & FANCTRL_DIR_FACTOR) ? FANCTRL_DIR_FACTOR_DUTY_ADDON : 0; - - *adjusted = 1; - return onlp_fani_percentage_set(ONLP_FAN_ID_CREATE(1), fanduty_mid); } - return ONLP_STATUS_OK; } @@ -249,34 +259,8 @@ sysi_fanctrl_overall_thermal_sensor_policy(onlp_fan_info_t fi[CHASSIS_FAN_COUNT] onlp_thermal_info_t ti[CHASSIS_THERMAL_COUNT], int *adjusted) { - int fanduty_min = FAN_DUTY_MIN; - int fanduty_mid = FAN_DUTY_MID; - int i, num_of_sensor = 0, temp_avg = 0; - + /*No overall policy.*/ *adjusted = 0; - fanduty_min += (fi[0].status & FANCTRL_DIR_FACTOR) ? FANCTRL_DIR_FACTOR_DUTY_ADDON : 0; - fanduty_mid += (fi[0].status & FANCTRL_DIR_FACTOR) ? FANCTRL_DIR_FACTOR_DUTY_ADDON : 0; - - for (i = (THERMAL_1_ON_MAIN_BROAD); i <= (THERMAL_3_ON_MAIN_BROAD); i++) { - num_of_sensor++; - temp_avg += ti[i-1].mcelsius; - } - - temp_avg /= num_of_sensor; - - if (temp_avg >= 45000) { - *adjusted = 1; - return onlp_fani_percentage_set(ONLP_FAN_ID_CREATE(1), FAN_DUTY_MAX); - } - else if (temp_avg >= 40000) { - *adjusted = 1; - return onlp_fani_percentage_set(ONLP_FAN_ID_CREATE(1), fanduty_mid); - } - else if (temp_avg < 35000) { - *adjusted = 1; - return onlp_fani_percentage_set(ONLP_FAN_ID_CREATE(1), fanduty_min); - } - return ONLP_STATUS_OK; } @@ -284,6 +268,11 @@ typedef int (*fan_control_policy)(onlp_fan_info_t fi[CHASSIS_FAN_COUNT], onlp_thermal_info_t ti[CHASSIS_THERMAL_COUNT], int *adjusted); +/* 1. default fan duty = 50% + * 2. if (LM75_0x4B > 36¢J or LM75_0x49 > 39¢J or LM75_0x4A > 38¢J or + * LM75_0x4C > 39¢J), fan duty = 100% + * 3. Any of 6 fans faults, set duty = 100%. + */ fan_control_policy fan_control_policies[] = { sysi_fanctrl_fan_fault_policy, sysi_fanctrl_fan_absent_policy, @@ -332,6 +321,7 @@ onlp_sysi_platform_manage_fans(void) rc = fan_control_policies[i](fi, ti, &adjusted); if (!adjusted) { + onlp_fani_percentage_set(ONLP_FAN_ID_CREATE(1), FAN_DUTY_DEF); continue; }