From 64848d71ea92768c0355fe853bc97e195ea935dc Mon Sep 17 00:00:00 2001 From: Sean Wu Date: Tue, 13 Jul 2021 03:59:24 +0000 Subject: [PATCH] [Accton] Support ACBEL FSF045 PSU Signed-off-by: Sean Wu --- .../as7326-56x/modules/accton_as7326_56x_psu.c | 15 ++++++++------- .../as7712-32x/modules/accton_as7712_32x_psu.c | 15 ++++++++------- .../as7716-32x/modules/accton_as7716_32x_psu.c | 15 ++++++++------- .../as7726-32x/modules/accton_as7726_32x_psu.c | 15 ++++++++------- 4 files changed, 32 insertions(+), 28 deletions(-) diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_as7326_56x_psu.c b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_as7326_56x_psu.c index 705b94887207..ef831bd365ce 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_as7326_56x_psu.c +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_as7326_56x_psu.c @@ -240,22 +240,23 @@ enum psu_type { PSU_TYPE_AC_110V, PSU_TYPE_DC_48V, PSU_TYPE_DC_12V, - PSU_TYPE_AC_ACBEL_FSF019 + PSU_TYPE_AC_ACBEL_FSF019, + PSU_TYPE_AC_ACBEL_FSF045 }; struct model_name_info { enum psu_type type; u8 offset; u8 length; - u8 chk_length; char* model_name; }; struct model_name_info models[] = { -{PSU_TYPE_AC_110V, 0x20, 8, 8, "YM-2651Y"}, -{PSU_TYPE_DC_48V, 0x20, 8, 8, "YM-2651V"}, -{PSU_TYPE_DC_12V, 0x00, 11, 11, "PSU-12V-750"}, -{PSU_TYPE_AC_ACBEL_FSF019, 0x15, 10, 7, "FSF019-"} + {PSU_TYPE_AC_110V, 0x20, 8, "YM-2651Y"}, + {PSU_TYPE_DC_48V, 0x20, 8, "YM-2651V"}, + {PSU_TYPE_DC_12V, 0x00, 11, "PSU-12V-750"}, + {PSU_TYPE_AC_ACBEL_FSF019, 0x15, 10, "FSF019-"}, + {PSU_TYPE_AC_ACBEL_FSF045, 0x15, 10, "FSF045-"} }; static int as7326_56x_psu_model_name_get(struct device *dev) @@ -281,7 +282,7 @@ static int as7326_56x_psu_model_name_get(struct device *dev) /* Determine if the model name is known, if not, read next index */ - if (strncmp(data->model_name, models[i].model_name, models[i].chk_length) == 0) { + if (strncmp(data->model_name, models[i].model_name, strlen(models[i].model_name)) == 0) { return 0; } else { diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_psu.c b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_psu.c index edbad79fcbf5..7c611015cf8d 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_psu.c +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_psu.c @@ -240,22 +240,23 @@ enum psu_type { PSU_TYPE_AC_110V, PSU_TYPE_DC_48V, PSU_TYPE_DC_12V, - PSU_TYPE_AC_ACBEL_FSF019 + PSU_TYPE_AC_ACBEL_FSF019, + PSU_TYPE_AC_ACBEL_FSF045 }; struct model_name_info { enum psu_type type; u8 offset; u8 length; - u8 chk_length; char* model_name; }; struct model_name_info models[] = { -{PSU_TYPE_AC_110V, 0x20, 8, 8, "YM-2651Y"}, -{PSU_TYPE_DC_48V, 0x20, 8, 8, "YM-2651V"}, -{PSU_TYPE_DC_12V, 0x00, 11, 11, "PSU-12V-750"}, -{PSU_TYPE_AC_ACBEL_FSF019, 0x15, 10, 7, "FSF019-"} + {PSU_TYPE_AC_110V, 0x20, 8, "YM-2651Y"}, + {PSU_TYPE_DC_48V, 0x20, 8, "YM-2651V"}, + {PSU_TYPE_DC_12V, 0x00, 11, "PSU-12V-750"}, + {PSU_TYPE_AC_ACBEL_FSF019, 0x15, 10, "FSF019-"}, + {PSU_TYPE_AC_ACBEL_FSF045, 0x15, 10, "FSF045-"} }; static int as7712_32x_psu_model_name_get(struct device *dev) @@ -281,7 +282,7 @@ static int as7712_32x_psu_model_name_get(struct device *dev) /* Determine if the model name is known, if not, read next index */ - if (strncmp(data->model_name, models[i].model_name, models[i].chk_length) == 0) { + if (strncmp(data->model_name, models[i].model_name, strlen(models[i].model_name)) == 0) { return 0; } else { diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/accton_as7716_32x_psu.c b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/accton_as7716_32x_psu.c index 9d814d40cf58..7f5d8c2c8ccc 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/accton_as7716_32x_psu.c +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/accton_as7716_32x_psu.c @@ -249,22 +249,23 @@ enum psu_type { PSU_TYPE_AC_110V, PSU_TYPE_DC_48V, PSU_TYPE_DC_12V, - PSU_TYPE_AC_ACBEL_FSF019 + PSU_TYPE_AC_ACBEL_FSF019, + PSU_TYPE_AC_ACBEL_FSF045 }; struct model_name_info { enum psu_type type; u8 offset; u8 length; - u8 chk_length; char* model_name; }; struct model_name_info models[] = { -{PSU_TYPE_AC_110V, 0x20, 8, 8, "YM-2651Y"}, -{PSU_TYPE_DC_48V, 0x20, 8, 8, "YM-2651V"}, -{PSU_TYPE_DC_12V, 0x00, 11, 11, "PSU-12V-750"}, -{PSU_TYPE_AC_ACBEL_FSF019, 0x15, 10, 7, "FSF019-"} + {PSU_TYPE_AC_110V, 0x20, 8, "YM-2651Y"}, + {PSU_TYPE_DC_48V, 0x20, 8, "YM-2651V"}, + {PSU_TYPE_DC_12V, 0x00, 11, "PSU-12V-750"}, + {PSU_TYPE_AC_ACBEL_FSF019, 0x15, 10, "FSF019-"}, + {PSU_TYPE_AC_ACBEL_FSF045, 0x15, 10, "FSF045-"} }; static int as7716_32x_psu_model_name_get(struct device *dev) @@ -290,7 +291,7 @@ static int as7716_32x_psu_model_name_get(struct device *dev) /* Determine if the model name is known, if not, read next index */ - if (strncmp(data->model_name, models[i].model_name, models[i].chk_length) == 0) { + if (strncmp(data->model_name, models[i].model_name, strlen(models[i].model_name)) == 0) { return 0; } else { diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/modules/accton_as7726_32x_psu.c b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/modules/accton_as7726_32x_psu.c index c615df5664fa..a2ae40d2b4ea 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/modules/accton_as7726_32x_psu.c +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/modules/accton_as7726_32x_psu.c @@ -240,22 +240,23 @@ enum psu_type { PSU_TYPE_AC_110V, PSU_TYPE_DC_48V, PSU_TYPE_DC_12V, - PSU_TYPE_AC_ACBEL_FSF019 + PSU_TYPE_AC_ACBEL_FSF019, + PSU_TYPE_AC_ACBEL_FSF045 }; struct model_name_info { enum psu_type type; u8 offset; u8 length; - u8 chk_length; char* model_name; }; struct model_name_info models[] = { -{PSU_TYPE_AC_110V, 0x20, 8, 8, "YM-2651Y"}, -{PSU_TYPE_DC_48V, 0x20, 8, 8, "YM-2651V"}, -{PSU_TYPE_DC_12V, 0x00, 11, 11, "PSU-12V-750"}, -{PSU_TYPE_AC_ACBEL_FSF019, 0x15, 10, 7, "FSF019-"} + {PSU_TYPE_AC_110V, 0x20, 8, "YM-2651Y"}, + {PSU_TYPE_DC_48V, 0x20, 8, "YM-2651V"}, + {PSU_TYPE_DC_12V, 0x00, 11, "PSU-12V-750"}, + {PSU_TYPE_AC_ACBEL_FSF019, 0x15, 10, "FSF019-"}, + {PSU_TYPE_AC_ACBEL_FSF045, 0x15, 10, "FSF045-"} }; static int as7726_32x_psu_model_name_get(struct device *dev) @@ -281,7 +282,7 @@ static int as7726_32x_psu_model_name_get(struct device *dev) /* Determine if the model name is known, if not, read next index */ - if (strncmp(data->model_name, models[i].model_name, models[i].chk_length) == 0) { + if (strncmp(data->model_name, models[i].model_name, strlen(models[i].model_name)) == 0) { return 0; } else {