From 79462a4b08212281c5d905e15673738ffe022c05 Mon Sep 17 00:00:00 2001 From: brandonchuang Date: Thu, 15 Jun 2017 17:46:51 +0800 Subject: [PATCH] [as6712-32x] Add thermal sensor for YM2401 PSU --- .../onlp/builds/src/module/src/thermali.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/platforms/accton/x86-64/x86-64-accton-as6712-32x/onlp/builds/src/module/src/thermali.c b/packages/platforms/accton/x86-64/x86-64-accton-as6712-32x/onlp/builds/src/module/src/thermali.c index 98d9a816..43f0ce84 100644 --- a/packages/platforms/accton/x86-64/x86-64-accton-as6712-32x/onlp/builds/src/module/src/thermali.c +++ b/packages/platforms/accton/x86-64/x86-64-accton-as6712-32x/onlp/builds/src/module/src/thermali.c @@ -24,10 +24,8 @@ * ***********************************************************/ #include -#include #include #include -#include #include "platform_lib.h" #define VALIDATE(_id) \ @@ -112,6 +110,9 @@ int onlp_thermali_info_get(onlp_oid_t id, onlp_thermal_info_t* info) { int local_id; + int psu_id; + psu_type_t psu_type; + VALIDATE(id); local_id = ONLP_OID_ID_GET(id); @@ -124,5 +125,13 @@ onlp_thermali_info_get(onlp_oid_t id, onlp_thermal_info_t* info) return rv; } + psu_id = local_id - THERMAL_1_ON_PSU1 + 1; + psu_type = get_psu_type(psu_id, NULL, 0); + + if (psu_type == PSU_TYPE_AC_3YPOWER_F2B || psu_type == PSU_TYPE_AC_3YPOWER_B2F ) { + int rv = psu_ym2401_pmbus_info_get(psu_id, "psu_temp1_input", &info->mcelsius); + return rv; + } + return onlp_file_read_int(&info->mcelsius, devfiles[local_id]); }