Merge pull request #469 from roylee123/as5916_as7316_26xb_fix_psu_fan_wrong_rpm

[platform]as5916-26xb/as7316-26xb: add support for DC-PSU, model YM-2401U.
This commit is contained in:
Jeffrey Townsend
2018-11-27 13:17:33 -08:00
committed by GitHub
4 changed files with 38 additions and 4 deletions

View File

@@ -425,8 +425,8 @@ static ssize_t show_psu(struct device *dev, struct device_attribute *da, char *b
case PSU1_FAN_INPUT:
case PSU2_FAN_INPUT:
VALIDATE_PRESENT_RETURN(pid);
value = ((int)data->ipmi_resp[pid].status[PSU_FAN0] |
(int)data->ipmi_resp[pid].status[PSU_FAN1] << 8);
value = (((unsigned char)data->ipmi_resp[pid].status[PSU_FAN0]) |
((unsigned char)data->ipmi_resp[pid].status[PSU_FAN1]) << 8);
break;
default:
return -EINVAL;

View File

@@ -57,6 +57,22 @@ static onlp_psu_info_t pinfo[] =
}
};
static int
get_DCorAC_cap(char *model)
{
const char *dc_models[] = {"YM-2401U", "um400d", NULL };
int i;
i = 0;
while(dc_models[i]) {
if (!strncasecmp(model, dc_models[i], strlen(dc_models[i]))){
return ONLP_PSU_CAPS_DC12;
}
i++;
}
return ONLP_PSU_CAPS_AC;
}
int
onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info)
{
@@ -140,6 +156,7 @@ onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info)
if (string && len) {
strncpy(info->model, string, len);
aim_free(string);
info->caps |= get_DCorAC_cap (info->model);
}
/* Read serial */

View File

@@ -425,8 +425,8 @@ static ssize_t show_psu(struct device *dev, struct device_attribute *da, char *b
case PSU1_FAN_INPUT:
case PSU2_FAN_INPUT:
VALIDATE_PRESENT_RETURN(pid);
value = ((int)data->ipmi_resp[pid].status[PSU_FAN0] |
(int)data->ipmi_resp[pid].status[PSU_FAN1] << 8);
value = (((unsigned char)data->ipmi_resp[pid].status[PSU_FAN0]) |
((unsigned char)data->ipmi_resp[pid].status[PSU_FAN1]) << 8);
break;
default:
return -EINVAL;

View File

@@ -57,6 +57,22 @@ static onlp_psu_info_t pinfo[] =
}
};
static int
get_DCorAC_cap(char *model)
{
const char *dc_models[] = {"YM-2401U", "um400d", NULL };
int i;
i = 0;
while(dc_models[i]) {
if (!strncasecmp(model, dc_models[i], strlen(dc_models[i]))){
return ONLP_PSU_CAPS_DC12;
}
i++;
}
return ONLP_PSU_CAPS_AC;
}
int
onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info)
{
@@ -140,6 +156,7 @@ onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info)
if (string && len) {
strncpy(info->model, string, len);
aim_free(string);
info->caps |= get_DCorAC_cap (info->model);
}
/* Read serial */