Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*
*
***********************************************************/
#include <onlplib/file.h>
#include <onlp/platformi/psui.h>
#include <onlplib/mmap.h>
#include <stdio.h>
Expand Down Expand Up @@ -89,45 +88,6 @@ static onlp_psu_info_t pinfo[] =
}
};

static int
psu_pmbus_info_get(int id, char *node, int *value)
{
int ret = 0;
*value = 0;
char *path[] = { PSU1_AC_PMBUS_PREFIX, PSU2_AC_PMBUS_PREFIX };

ret = onlp_file_read_int(value, "%s%s", path[id-1], node);
if (ret < 0) {
return ONLP_STATUS_E_INTERNAL;
}

return ret;
}

static int
psu_caps_get(int pid, onlp_psu_info_t* info)
{
int val = 0;

/* Read voltage, current and power */
if (psu_pmbus_info_get(pid, "psu_v_out", &val) == 0) {
info->mvout = val;
info->caps |= ONLP_PSU_CAPS_VOUT;
}

if (psu_pmbus_info_get(pid, "psu_i_out", &val) == 0) {
info->miout = val;
info->caps |= ONLP_PSU_CAPS_IOUT;
}

if (psu_pmbus_info_get(pid, "psu_p_out", &val) == 0) {
info->mpout = val;
info->caps |= ONLP_PSU_CAPS_POUT;
}

return ONLP_STATUS_OK;
}

int
onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info)
{
Expand Down Expand Up @@ -171,7 +131,6 @@ onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info)
case PSU_TYPE_AC_F2B:
case PSU_TYPE_AC_B2F:
info->caps = ONLP_PSU_CAPS_AC;
psu_caps_get(index, info);
ret = ONLP_STATUS_OK;
break;
case PSU_TYPE_UNKNOWN: /* User insert a unknown PSU or unplugged.*/
Expand Down