mirror of
https://github.com/Telecominfraproject/OpenNetworkLinux.git
synced 2025-12-26 17:57:01 +00:00
1. fix the wrong display value of PSU
2. modify the shut down temperature on thermal sensors 3. modify the corresponding capability of LED on the frnt panel and fan 4. fixed the relative speed of fan and thermal Signed-off-by: ericdocker <ericth.h.tzeng@gamil.com>
This commit is contained in:
@@ -257,9 +257,9 @@ static ssize_t for_vout_data(struct device *dev, struct device_attribute \
|
||||
exponent = two_complement_to_int(data->vout_mode, 5, 0x1f);
|
||||
mantissa = data->v_out;
|
||||
|
||||
return (exponent > 0) ? sprintf(buf, "%d\n", \
|
||||
(mantissa << exponent) * multiplier) : \
|
||||
sprintf(buf, "%d\n", (mantissa << exponent) / (1 << -exponent));
|
||||
return (exponent > 0) ? \
|
||||
sprintf(buf, "%d\n", mantissa * multiplier * (1 << exponent)) : \
|
||||
sprintf(buf, "%d\n", mantissa * multiplier / (1 << -exponent));
|
||||
|
||||
}
|
||||
|
||||
|
||||
274
packages/platforms/delta/x86-64/x86-64-delta-agc7648a/onlp/builds/src/module/src/ledi.c
Executable file → Normal file
274
packages/platforms/delta/x86-64/x86-64-delta-agc7648a/onlp/builds/src/module/src/ledi.c
Executable file → Normal file
@@ -51,37 +51,37 @@ static onlp_led_info_t linfo[] =
|
||||
{
|
||||
{ ONLP_LED_ID_CREATE(LED_FRONT_FAN), "FRONT LED (FAN LED)", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_AUTO,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_ORANGE_BLINKING,
|
||||
},
|
||||
{
|
||||
{ ONLP_LED_ID_CREATE(LED_FRONT_SYS), "FRONT LED (SYS LED)", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_GREEN_BLINKING | ONLP_LED_CAPS_AUTO,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_GREEN_BLINKING | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_ORANGE_BLINKING,
|
||||
},
|
||||
{
|
||||
{ ONLP_LED_ID_CREATE(LED_FRONT_PWR), "FRONT LED (PWR LED)", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_ORANGE_BLINKING | ONLP_LED_CAPS_GREEN,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_GREEN,
|
||||
},
|
||||
{
|
||||
{ ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_1), "REAR LED (FAN TRAY 1)", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_AUTO,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_RED ,
|
||||
},
|
||||
{
|
||||
{ ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_2), "REAR LED (FAN TRAY 2)", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_AUTO,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_RED,
|
||||
},
|
||||
{
|
||||
{ ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_3), "REAR LED (FAN TRAY 3)", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_AUTO,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_RED,
|
||||
},
|
||||
{
|
||||
{ ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_4), "REAR LED (FAN TRAY 4)", 0 },
|
||||
ONLP_LED_STATUS_PRESENT,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_AUTO,
|
||||
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_RED,
|
||||
}
|
||||
};
|
||||
/*
|
||||
@@ -121,23 +121,35 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info)
|
||||
{
|
||||
case LED_FRONT_FAN:
|
||||
if((r_data & 0x02) == 0x02)
|
||||
info->mode = ONLP_LED_MODE_GREEN;
|
||||
else if((r_data & 0x01) == 0x01)
|
||||
info->mode = ONLP_LED_MODE_ORANGE;
|
||||
info->mode = ONLP_LED_MODE_GREEN;
|
||||
else if((r_data & 0x01) == 0x01)
|
||||
info->mode = ONLP_LED_MODE_ORANGE;
|
||||
else if((r_data & 0x01) == 0x03)
|
||||
info->mode = ONLP_LED_MODE_ORANGE_BLINKING;
|
||||
else if((r_data & 0x01) == 0x00)
|
||||
info->mode = ONLP_LED_MODE_OFF;
|
||||
else
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
break;
|
||||
case LED_FRONT_SYS:
|
||||
if((r_data & 0x10) == 0x10)
|
||||
info->mode = ONLP_LED_MODE_GREEN;
|
||||
else if((r_data & 0x20) == 0x20)
|
||||
info->mode = ONLP_LED_MODE_ORANGE;
|
||||
else
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
if((r_data & 0xF0) == 0x10)
|
||||
info->mode = ONLP_LED_MODE_GREEN;
|
||||
else if((r_data & 0xF0) == 0x20)
|
||||
info->mode = ONLP_LED_MODE_ORANGE;
|
||||
else if((r_data & 0xF0) == 0xa0)
|
||||
info->mode = ONLP_LED_MODE_ORANGE_BLINKING;
|
||||
else if((r_data & 0xF0) == 0x90)
|
||||
info->mode = ONLP_LED_MODE_GREEN_BLINKING;
|
||||
else if((r_data & 0xF0) == 0x0)
|
||||
info->mode = ONLP_LED_MODE_OFF;
|
||||
else
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
break;
|
||||
case LED_FRONT_PWR:
|
||||
if((r_data & 0x08) == 0x08)
|
||||
info->mode = ONLP_LED_MODE_GREEN;
|
||||
info->mode = ONLP_LED_MODE_GREEN;
|
||||
else if((r_data & 0x04) == 0x04)
|
||||
info->mode = ONLP_LED_MODE_ORANGE;
|
||||
info->mode = ONLP_LED_MODE_ORANGE;
|
||||
else
|
||||
info->mode = ONLP_LED_MODE_OFF;
|
||||
break;
|
||||
@@ -151,10 +163,12 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info)
|
||||
if((r_data1 & 0x40) == 0x40)
|
||||
info->mode = ONLP_LED_MODE_GREEN;
|
||||
else if((r_data1 & 0x80) == 0x80)
|
||||
info->mode = ONLP_LED_MODE_ORANGE;
|
||||
info->mode = ONLP_LED_MODE_RED;
|
||||
else
|
||||
info->mode = ONLP_LED_MODE_OFF;
|
||||
}
|
||||
else
|
||||
info->mode = ONLP_LED_MODE_OFF;
|
||||
info->status = ONLP_LED_STATUS_FAILED;
|
||||
break;
|
||||
case LED_REAR_FAN_TRAY_2:
|
||||
mux_info.channel= 0x01;
|
||||
@@ -166,10 +180,12 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info)
|
||||
if((r_data1 & 0x10) == 0x10)
|
||||
info->mode = ONLP_LED_MODE_GREEN;
|
||||
else if((r_data1 & 0x20) == 0x20)
|
||||
info->mode = ONLP_LED_MODE_ORANGE;
|
||||
info->mode = ONLP_LED_MODE_RED;
|
||||
else
|
||||
info->mode = ONLP_LED_MODE_OFF;
|
||||
}
|
||||
else
|
||||
info->mode = ONLP_LED_MODE_OFF;
|
||||
info->status = ONLP_LED_STATUS_FAILED;
|
||||
break;
|
||||
case LED_REAR_FAN_TRAY_3:
|
||||
mux_info.channel= 0x02;
|
||||
@@ -178,13 +194,15 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info)
|
||||
fantray_present = dni_i2c_lock_read(&mux_info, &dev_info);
|
||||
if(fantray_present >= 0)
|
||||
{
|
||||
if((r_data1 & 0x04) == 0x04)
|
||||
info->mode = ONLP_LED_MODE_GREEN;
|
||||
else if((r_data1 & 0x08) == 0x08)
|
||||
info->mode = ONLP_LED_MODE_ORANGE;
|
||||
if((r_data1 & 0x04) == 0x04)
|
||||
info->mode = ONLP_LED_MODE_GREEN;
|
||||
else if((r_data1 & 0x08) == 0x08)
|
||||
info->mode = ONLP_LED_MODE_RED;
|
||||
else
|
||||
info->mode = ONLP_LED_MODE_OFF;
|
||||
}
|
||||
else
|
||||
info->mode = ONLP_LED_MODE_OFF;
|
||||
info->status = ONLP_LED_STATUS_FAILED;
|
||||
break;
|
||||
case LED_REAR_FAN_TRAY_4:
|
||||
mux_info.channel= 0x03;
|
||||
@@ -196,10 +214,12 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info)
|
||||
if((r_data1 & 0x01) == 0x01)
|
||||
info->mode = ONLP_LED_MODE_GREEN;
|
||||
else if((r_data1 & 0x02) == 0x02)
|
||||
info->mode = ONLP_LED_MODE_ORANGE;
|
||||
info->mode = ONLP_LED_MODE_RED;
|
||||
else
|
||||
info->mode = ONLP_LED_MODE_OFF;
|
||||
}
|
||||
else
|
||||
info->mode = ONLP_LED_MODE_OFF;
|
||||
info->status = ONLP_LED_STATUS_FAILED;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -250,23 +270,7 @@ onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode)
|
||||
{
|
||||
VALIDATE(id);
|
||||
int local_id = ONLP_OID_ID_GET(id);
|
||||
int i = 0, count = 0 ;
|
||||
int fantray_present = -1 ,rpm = 0,rpm1 = 0;
|
||||
uint8_t front_panel_led_value, fan_tray_led_value, power_state;
|
||||
|
||||
|
||||
mux_info_t mux_info;
|
||||
mux_info.bus = I2C_BUS_5;
|
||||
mux_info.addr = SWPLD;
|
||||
mux_info.offset = FAN_MUX_REG;
|
||||
mux_info.channel = 0x07;
|
||||
mux_info.flags = DEFAULT_FLAG;
|
||||
|
||||
dev_info_t dev_info;
|
||||
dev_info.bus = I2C_BUS_3;
|
||||
dev_info.offset = 0x00;
|
||||
dev_info.flags = DEFAULT_FLAG;
|
||||
|
||||
uint8_t front_panel_led_value, fan_tray_led_value;
|
||||
|
||||
front_panel_led_value = dni_lock_cpld_read_attribute(SWPLD_PATH,LED_REG);
|
||||
fan_tray_led_value = dni_lock_cpld_read_attribute(SWPLD_PATH,FAN_TRAY_LED_REG);
|
||||
@@ -275,141 +279,137 @@ onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode)
|
||||
case LED_FRONT_FAN:
|
||||
/* Clean the bit 1,0 */
|
||||
front_panel_led_value &= ~0x3;
|
||||
/* Read fan eeprom to check present */
|
||||
for(i = 0;i < 4; i++)
|
||||
if(mode == ONLP_LED_MODE_GREEN)
|
||||
{
|
||||
mux_info.channel = i;
|
||||
/* FAN TRAT 1~4: 0x52 , 0x53, 0x54, 0x55 */
|
||||
dev_info.addr = FAN_TRAY_1 + i;
|
||||
fantray_present = dni_i2c_lock_read(&mux_info, &dev_info);
|
||||
if( fantray_present >= 0 )
|
||||
count++;
|
||||
front_panel_led_value |= 0x02;
|
||||
dni_lock_cpld_write_attribute(SWPLD_PATH,LED_REG,front_panel_led_value);
|
||||
}
|
||||
/* Set front light of FAN */
|
||||
if(count == ALL_FAN_TRAY_EXIST)
|
||||
else if(mode == ONLP_LED_MODE_ORANGE_BLINKING)
|
||||
{
|
||||
front_panel_led_value|=0x02;
|
||||
dni_lock_cpld_write_attribute(SWPLD_PATH, LED_REG, front_panel_led_value);
|
||||
front_panel_led_value |= 0x03;
|
||||
dni_lock_cpld_write_attribute(SWPLD_PATH,LED_REG,front_panel_led_value);
|
||||
}
|
||||
else if(mode == ONLP_LED_MODE_ORANGE)
|
||||
{
|
||||
front_panel_led_value |= 0x01;
|
||||
dni_lock_cpld_write_attribute(SWPLD_PATH,LED_REG,front_panel_led_value);
|
||||
}
|
||||
else if(mode == ONLP_LED_MODE_OFF)
|
||||
dni_lock_cpld_write_attribute(SWPLD_PATH,LED_REG,front_panel_led_value);
|
||||
else
|
||||
{
|
||||
front_panel_led_value|=0x01;
|
||||
dni_lock_cpld_write_attribute(SWPLD_PATH, LED_REG, front_panel_led_value);
|
||||
}
|
||||
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
break;
|
||||
case LED_FRONT_SYS:
|
||||
front_panel_led_value &= ~0xF0;
|
||||
if(mode == ONLP_LED_MODE_GREEN)
|
||||
{
|
||||
front_panel_led_value |= 0x10;
|
||||
dni_lock_cpld_write_attribute(SWPLD_PATH,LED_REG,front_panel_led_value);
|
||||
}
|
||||
else if(mode == ONLP_LED_MODE_ORANGE_BLINKING)
|
||||
{
|
||||
front_panel_led_value |= 0xA0;
|
||||
dni_lock_cpld_write_attribute(SWPLD_PATH,LED_REG,front_panel_led_value);
|
||||
}
|
||||
else if(mode == ONLP_LED_MODE_ORANGE)
|
||||
{
|
||||
front_panel_led_value |= 0x20;
|
||||
dni_lock_cpld_write_attribute(SWPLD_PATH,LED_REG,front_panel_led_value);
|
||||
}
|
||||
else if(mode == ONLP_LED_MODE_GREEN_BLINKING)
|
||||
{
|
||||
front_panel_led_value |= 0x90;
|
||||
dni_lock_cpld_write_attribute(SWPLD_PATH,LED_REG,front_panel_led_value);
|
||||
}
|
||||
else if(mode == ONLP_LED_MODE_OFF)
|
||||
dni_lock_cpld_write_attribute(SWPLD_PATH,LED_REG,front_panel_led_value);
|
||||
else
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
break;
|
||||
|
||||
case LED_FRONT_PWR:
|
||||
/* Clean bit 3,2 */
|
||||
front_panel_led_value &= ~0x0C;
|
||||
/* switch CPLD to PSU 1 */
|
||||
dev_info.bus = I2C_BUS_4;
|
||||
dev_info.addr = PSU_EEPROM;
|
||||
mux_info.channel = 0x00;
|
||||
|
||||
/* Check the state of PSU 1, "state = 1, PSU exists' */
|
||||
power_state = dni_lock_cpld_read_attribute(SWPLD_PATH, PSU_PWR_REG);
|
||||
/* Set the light of PSU */
|
||||
if((power_state&0x80) != 0x80)
|
||||
if(mode == ONLP_LED_MODE_GREEN)
|
||||
{
|
||||
/* Red */
|
||||
front_panel_led_value|=0x04;
|
||||
dni_lock_cpld_write_attribute(SWPLD_PATH, LED_REG, front_panel_led_value);
|
||||
front_panel_led_value |= 0x08;
|
||||
dni_lock_cpld_write_attribute(SWPLD_PATH,LED_REG,front_panel_led_value);
|
||||
}
|
||||
else if((power_state&0x80)==0x80)
|
||||
else if(mode == ONLP_LED_MODE_ORANGE)
|
||||
{
|
||||
/* Green */
|
||||
front_panel_led_value|=0x08;
|
||||
dni_lock_cpld_write_attribute(SWPLD_PATH, LED_REG, front_panel_led_value);
|
||||
front_panel_led_value |= 0x04;
|
||||
dni_lock_cpld_write_attribute(SWPLD_PATH,LED_REG,front_panel_led_value);
|
||||
}
|
||||
else
|
||||
dni_lock_cpld_write_attribute(SWPLD_PATH,LED_REG, front_panel_led_value);
|
||||
else if(mode == ONLP_LED_MODE_OFF)
|
||||
{
|
||||
dni_lock_cpld_write_attribute(SWPLD_PATH,LED_REG,front_panel_led_value);
|
||||
}
|
||||
else
|
||||
return ONLP_STATUS_E_UNSUPPORTED;
|
||||
break;
|
||||
|
||||
case LED_REAR_FAN_TRAY_1:
|
||||
mux_info.channel= 0x00;
|
||||
dev_info.addr = FAN_TRAY_1;
|
||||
dev_info.bus = I2C_BUS_3;
|
||||
fantray_present = dni_i2c_lock_read(&mux_info, &dev_info);
|
||||
rpm = dni_i2c_lock_read_attribute(NULL, FAN4_FRONT);
|
||||
rpm1 = dni_i2c_lock_read_attribute(NULL, FAN4_REAR);
|
||||
fan_tray_led_value &= ~0xC0;
|
||||
if(fantray_present >= 0 && rpm != 960 && rpm != 0 && rpm1 != 960 && rpm1 != 0 )
|
||||
if(mode == ONLP_LED_MODE_GREEN)
|
||||
{
|
||||
/* Green */
|
||||
fan_tray_led_value |=0x40;
|
||||
fan_tray_led_value |= 0x40;
|
||||
dni_lock_cpld_write_attribute(SWPLD_PATH,FAN_TRAY_LED_REG,fan_tray_led_value);
|
||||
}
|
||||
else if(mode == ONLP_LED_MODE_RED)
|
||||
{
|
||||
fan_tray_led_value |= 0x80;
|
||||
dni_lock_cpld_write_attribute(SWPLD_PATH,FAN_TRAY_LED_REG,fan_tray_led_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Red */
|
||||
fan_tray_led_value |=0x80;
|
||||
dni_lock_cpld_write_attribute(SWPLD_PATH,FAN_TRAY_LED_REG,fan_tray_led_value);
|
||||
}
|
||||
break;
|
||||
case LED_REAR_FAN_TRAY_2:
|
||||
mux_info.channel= 0x01;
|
||||
dev_info.addr = FAN_TRAY_2;
|
||||
dev_info.bus = I2C_BUS_3;
|
||||
fantray_present = dni_i2c_lock_read(&mux_info, &dev_info);
|
||||
rpm = dni_i2c_lock_read_attribute(NULL, FAN3_FRONT);
|
||||
rpm1 = dni_i2c_lock_read_attribute(NULL, FAN3_REAR);
|
||||
fan_tray_led_value &= ~0x30;
|
||||
|
||||
if(fantray_present >= 0 && rpm != 960 && rpm != 0 && rpm1 != 960 && rpm1 != 0 )
|
||||
case LED_REAR_FAN_TRAY_2:
|
||||
fan_tray_led_value &= ~0x30;
|
||||
if(mode == ONLP_LED_MODE_GREEN)
|
||||
{
|
||||
/* Green */
|
||||
fan_tray_led_value |=0x10;
|
||||
fan_tray_led_value |= 0x10;
|
||||
dni_lock_cpld_write_attribute(SWPLD_PATH,FAN_TRAY_LED_REG,fan_tray_led_value);
|
||||
}
|
||||
else if(mode == ONLP_LED_MODE_RED)
|
||||
{
|
||||
fan_tray_led_value |= 0x20;
|
||||
dni_lock_cpld_write_attribute(SWPLD_PATH,FAN_TRAY_LED_REG,fan_tray_led_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Red */
|
||||
fan_tray_led_value |=0x20;
|
||||
dni_lock_cpld_write_attribute(SWPLD_PATH,FAN_TRAY_LED_REG,fan_tray_led_value);
|
||||
}
|
||||
break;
|
||||
case LED_REAR_FAN_TRAY_3:
|
||||
mux_info.channel= 0x02;
|
||||
dev_info.bus = I2C_BUS_3;
|
||||
dev_info.addr = FAN_TRAY_3;
|
||||
fantray_present = dni_i2c_lock_read(&mux_info, &dev_info);
|
||||
rpm = dni_i2c_lock_read_attribute(NULL, FAN2_FRONT);
|
||||
rpm1 = dni_i2c_lock_read_attribute(NULL, FAN2_REAR);
|
||||
fan_tray_led_value &= ~0x0c;
|
||||
if(fantray_present >= 0 && rpm != 960 && rpm != 0 && rpm1 != 960 && rpm1 != 0 )
|
||||
if(mode == ONLP_LED_MODE_GREEN)
|
||||
{
|
||||
/* Green */
|
||||
fan_tray_led_value |=0x04;
|
||||
fan_tray_led_value |= 0x04;
|
||||
dni_lock_cpld_write_attribute(SWPLD_PATH,FAN_TRAY_LED_REG,fan_tray_led_value);
|
||||
}
|
||||
else if(mode == ONLP_LED_MODE_RED)
|
||||
{
|
||||
fan_tray_led_value |= 0x08;
|
||||
dni_lock_cpld_write_attribute(SWPLD_PATH,FAN_TRAY_LED_REG,fan_tray_led_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Red */
|
||||
fan_tray_led_value |=0x08;
|
||||
dni_lock_cpld_write_attribute(SWPLD_PATH,FAN_TRAY_LED_REG,fan_tray_led_value);
|
||||
}
|
||||
break;
|
||||
case LED_REAR_FAN_TRAY_4:
|
||||
mux_info.channel= 0x03;
|
||||
dev_info.addr = FAN_TRAY_4;
|
||||
dev_info.bus = I2C_BUS_3;
|
||||
fantray_present = dni_i2c_lock_read(&mux_info, &dev_info);
|
||||
rpm = dni_i2c_lock_read_attribute(NULL, FAN1_FRONT);
|
||||
rpm1 = dni_i2c_lock_read_attribute(NULL, FAN1_REAR);
|
||||
fan_tray_led_value &= ~0x03;
|
||||
if(fantray_present >= 0 && rpm != 960 && rpm != 0 && rpm1 != 960 && rpm1 != 0 )
|
||||
if(mode == ONLP_LED_MODE_GREEN)
|
||||
{
|
||||
/* Green */
|
||||
fan_tray_led_value |=0x01;
|
||||
fan_tray_led_value |= 0x01;
|
||||
dni_lock_cpld_write_attribute(SWPLD_PATH,FAN_TRAY_LED_REG,fan_tray_led_value);
|
||||
}
|
||||
else if(mode == ONLP_LED_MODE_RED)
|
||||
{
|
||||
fan_tray_led_value |= 0x02;
|
||||
dni_lock_cpld_write_attribute(SWPLD_PATH,FAN_TRAY_LED_REG,fan_tray_led_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Red */
|
||||
fan_tray_led_value |=0x02;
|
||||
dni_lock_cpld_write_attribute(SWPLD_PATH,FAN_TRAY_LED_REG,fan_tray_led_value);
|
||||
}
|
||||
break;
|
||||
dni_lock_cpld_write_attribute(SWPLD_PATH,FAN_TRAY_LED_REG,fan_tray_led_value);
|
||||
|
||||
break;
|
||||
}
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
2
packages/platforms/delta/x86-64/x86-64-delta-agc7648a/onlp/builds/src/module/src/platform_lib.h
Executable file → Normal file
2
packages/platforms/delta/x86-64/x86-64-delta-agc7648a/onlp/builds/src/module/src/platform_lib.h
Executable file → Normal file
@@ -33,7 +33,7 @@
|
||||
|
||||
#define PSU1_ID 1
|
||||
#define PSU2_ID 2
|
||||
|
||||
#define ALL_FAN_TRAY_EXIST 4
|
||||
#define SYS_DEV_PATH "/sys/bus/i2c/devices"
|
||||
#define CPU_CPLD_PATH SYS_DEV_PATH "/2-0031"
|
||||
#define SWPLD_PATH SYS_DEV_PATH "/5-0030"
|
||||
|
||||
166
packages/platforms/delta/x86-64/x86-64-delta-agc7648a/onlp/builds/src/module/src/sysi.c
Executable file → Normal file
166
packages/platforms/delta/x86-64/x86-64-delta-agc7648a/onlp/builds/src/module/src/sysi.c
Executable file → Normal file
@@ -58,27 +58,27 @@ decide_percentage(int *percentage, int temper)
|
||||
{
|
||||
int level;
|
||||
|
||||
if(temper < 65)
|
||||
if(temper <= 25)
|
||||
{
|
||||
*percentage = 50;
|
||||
*percentage = 40;
|
||||
level = 0;
|
||||
}
|
||||
else if(temper >= 65 && temper <= 70)
|
||||
else if(temper > 25 && temper <= 40)
|
||||
{
|
||||
*percentage = 60;
|
||||
level = 1;
|
||||
}
|
||||
else if(temper > 70 && temper <= 75)
|
||||
else if(temper > 40 && temper <= 55)
|
||||
{
|
||||
*percentage = 70;
|
||||
*percentage = 80;
|
||||
level = 2;
|
||||
}
|
||||
else if(temper > 75 && temper <= 80)
|
||||
else if(temper > 55 && temper <= 75)
|
||||
{
|
||||
*percentage = 85;
|
||||
*percentage = 90;
|
||||
level = 3;
|
||||
}
|
||||
else if(temper > 80)
|
||||
else if(temper > 75)
|
||||
{
|
||||
*percentage = 100;
|
||||
level = 4;
|
||||
@@ -229,64 +229,156 @@ int
|
||||
onlp_sysi_platform_manage_leds(void)
|
||||
{
|
||||
|
||||
uint8_t present_bit = 0 ,addr = 0;
|
||||
|
||||
uint8_t count, power_state;
|
||||
int fantray_present = -1 ,rpm = 0,rpm1 = 0 , i;
|
||||
/* set PWR led in front panel */
|
||||
addr = dni_lock_cpld_read_attribute(SWPLD_PATH,LED_REG);
|
||||
|
||||
/* Turn the fan led on or off */
|
||||
if((addr & 0x3) == 0 || (addr & 0x3) == 0x3 )
|
||||
mux_info_t mux_info;
|
||||
mux_info.bus = I2C_BUS_5;
|
||||
mux_info.addr = SWPLD;
|
||||
mux_info.offset = FAN_MUX_REG;
|
||||
mux_info.channel = 0x07;
|
||||
mux_info.flags = DEFAULT_FLAG;
|
||||
|
||||
dev_info_t dev_info;
|
||||
dev_info.bus = I2C_BUS_3;
|
||||
dev_info.offset = 0x00;
|
||||
dev_info.flags = DEFAULT_FLAG;
|
||||
|
||||
|
||||
/* FRONT FAN & SYS LED */
|
||||
for(i = 0;i < 4; i++)
|
||||
{
|
||||
onlp_ledi_set(ONLP_LED_ID_CREATE(LED_FRONT_FAN), TURN_OFF);
|
||||
mux_info.channel = i;
|
||||
/* FAN TRAT 1~4: 0x52 , 0x53, 0x54, 0x55 */
|
||||
dev_info.addr = FAN_TRAY_1 + i;
|
||||
fantray_present = dni_i2c_lock_read(&mux_info, &dev_info);
|
||||
if( fantray_present >= 0 )
|
||||
count++;
|
||||
}
|
||||
if(count == ALL_FAN_TRAY_EXIST)
|
||||
{
|
||||
onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_FRONT_FAN), ONLP_LED_MODE_GREEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
onlp_ledi_set(ONLP_LED_ID_CREATE(LED_FRONT_FAN), TURN_ON);
|
||||
onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_FRONT_FAN), ONLP_LED_MODE_ORANGE);
|
||||
}
|
||||
|
||||
if(dni_psu_present_get(1) == 1)
|
||||
{ /* PSU1 is present */
|
||||
onlp_ledi_set(ONLP_LED_ID_CREATE(LED_FRONT_PWR), TURN_ON);
|
||||
}
|
||||
else
|
||||
{
|
||||
onlp_ledi_set(ONLP_LED_ID_CREATE(LED_FRONT_PWR), TURN_OFF);
|
||||
}
|
||||
/* Rare light fan tray 1-4 */
|
||||
present_bit = dni_lock_cpld_read_attribute(SWPLD_PATH,FAN_TRAY_LED_REG);
|
||||
dev_info.bus = I2C_BUS_4;
|
||||
dev_info.addr = PSU_EEPROM;
|
||||
mux_info.channel = 0x00;
|
||||
|
||||
if ((present_bit& 0x08) == 0x00)
|
||||
/* Check the state of PSU 1, "state = 1, PSU exists' */
|
||||
power_state = dni_lock_cpld_read_attribute(SWPLD_PATH, PSU_PWR_REG);
|
||||
/* Set the light of PSU */
|
||||
if((power_state&0x80) != 0x80)
|
||||
{
|
||||
onlp_ledi_set(ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_1), TURN_ON);
|
||||
/* ORANGE */
|
||||
onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_FRONT_PWR), ONLP_LED_MODE_ORANGE);
|
||||
}
|
||||
else if((power_state&0x80)==0x80)
|
||||
{
|
||||
/* Green */
|
||||
onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_FRONT_PWR), ONLP_LED_MODE_GREEN);
|
||||
}
|
||||
else
|
||||
onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_FRONT_PWR), ONLP_LED_MODE_OFF);
|
||||
|
||||
mux_info.channel= 0x00;
|
||||
dev_info.addr = FAN_TRAY_1;
|
||||
dev_info.bus = I2C_BUS_3;
|
||||
fantray_present = dni_i2c_lock_read(&mux_info, &dev_info);
|
||||
rpm = dni_i2c_lock_read_attribute(NULL, FAN4_FRONT);
|
||||
rpm1 = dni_i2c_lock_read_attribute(NULL, FAN4_REAR);
|
||||
if(fantray_present >= 0 && rpm != 960 && rpm != 0 && rpm1 != 960 && rpm1 != 0 )
|
||||
{
|
||||
/* Green */
|
||||
onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_1),ONLP_LED_MODE_GREEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
onlp_ledi_set(ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_1), TURN_OFF);
|
||||
/* Red */
|
||||
onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_1),ONLP_LED_MODE_RED);
|
||||
}
|
||||
if ((present_bit& 0x04) == 0x00)
|
||||
/* Fan tray 2 */
|
||||
mux_info.channel= 0x01;
|
||||
dev_info.addr = FAN_TRAY_2;
|
||||
dev_info.bus = I2C_BUS_3;
|
||||
fantray_present = dni_i2c_lock_read(&mux_info, &dev_info);
|
||||
rpm = dni_i2c_lock_read_attribute(NULL, FAN3_FRONT);
|
||||
rpm1 = dni_i2c_lock_read_attribute(NULL, FAN3_REAR);
|
||||
if(fantray_present >= 0 && rpm != 960 && rpm != 0 && rpm1 != 960 && rpm1 != 0 )
|
||||
{
|
||||
onlp_ledi_set(ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_2), TURN_ON);
|
||||
/* Green */
|
||||
onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_2),ONLP_LED_MODE_GREEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
onlp_ledi_set(ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_2), TURN_OFF);
|
||||
/* Red */
|
||||
onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_2),ONLP_LED_MODE_RED);
|
||||
}
|
||||
if ((present_bit& 0x02) == 0x00)
|
||||
|
||||
/* Fan tray 3 */
|
||||
mux_info.channel= 0x02;
|
||||
dev_info.bus = I2C_BUS_3;
|
||||
dev_info.addr = FAN_TRAY_3;
|
||||
fantray_present = dni_i2c_lock_read(&mux_info, &dev_info);
|
||||
rpm = dni_i2c_lock_read_attribute(NULL, FAN2_FRONT);
|
||||
rpm1 = dni_i2c_lock_read_attribute(NULL, FAN2_REAR);
|
||||
|
||||
if(fantray_present >= 0 && rpm != 960 && rpm != 0 && rpm1 != 960 && rpm1 != 0 )
|
||||
{
|
||||
onlp_ledi_set(ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_3), TURN_ON);
|
||||
/* Green */
|
||||
onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_3),ONLP_LED_MODE_GREEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
onlp_ledi_set(ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_3), TURN_OFF);
|
||||
/* Red */
|
||||
onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_3),ONLP_LED_MODE_RED);
|
||||
}
|
||||
if ((present_bit& 0x01) == 0x00)
|
||||
|
||||
/* Fan tray 4 */
|
||||
mux_info.channel= 0x03;
|
||||
dev_info.addr = FAN_TRAY_4;
|
||||
dev_info.bus = I2C_BUS_3;
|
||||
fantray_present = dni_i2c_lock_read(&mux_info, &dev_info);
|
||||
rpm = dni_i2c_lock_read_attribute(NULL, FAN1_FRONT);
|
||||
rpm1 = dni_i2c_lock_read_attribute(NULL, FAN1_REAR);
|
||||
if(fantray_present >= 0 && rpm != 960 && rpm != 0 && rpm1 != 960 && rpm1 != 0 )
|
||||
{
|
||||
onlp_ledi_set(ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_4), TURN_ON);
|
||||
/* Green */
|
||||
onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_4),ONLP_LED_MODE_GREEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
onlp_ledi_set(ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_4), TURN_OFF);
|
||||
/* Red */
|
||||
onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_REAR_FAN_TRAY_4),ONLP_LED_MODE_RED);
|
||||
}
|
||||
|
||||
|
||||
/* Set front light of PWR */
|
||||
dev_info.bus = I2C_BUS_4;
|
||||
dev_info.addr = PSU_EEPROM;
|
||||
mux_info.channel = 0x00;
|
||||
|
||||
/* Check the state of PSU 1, "state = 1, PSU exists' */
|
||||
power_state = dni_lock_cpld_read_attribute(SWPLD_PATH, PSU_PWR_REG);
|
||||
/* Set the light of PSU */
|
||||
|
||||
if((power_state&0x80) == 0x80)
|
||||
{
|
||||
/* Green */
|
||||
onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_FRONT_PWR), ONLP_LED_MODE_GREEN);
|
||||
}
|
||||
else if((power_state&0x80) != 0x80)
|
||||
{
|
||||
/* Red */
|
||||
onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_FRONT_PWR), ONLP_LED_MODE_ORANGE);
|
||||
}
|
||||
else
|
||||
onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_FRONT_PWR), ONLP_LED_MODE_OFF);
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,6 @@ class OnlPlatform_x86_64_delta_agc7648a_r0(OnlPlatformDelta,
|
||||
self.new_i2c_device('agc7648a_sfp', 0x50, 8)
|
||||
|
||||
# Set front panel green light of sys led
|
||||
os.system("echo 0x30 > /sys/bus/i2c/devices/5-0030/addr")
|
||||
os.system("echo 0x1c > /sys/bus/i2c/devices/5-0030/addr")
|
||||
os.system("echo 0x10 > /sys/bus/i2c/devices/5-0030/data")
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user