[as7816-64x]Modify to check specific DUT (#7826)

AS7816 support AT or non-AT DUT. They use different pmbus i2c bus. So use "pre_pddf_init.sh" to check this case.

Signed-off-by: Jostar Yang <jostar_yang@accton.com.tw>
This commit is contained in:
jostar-yang 2022-03-02 05:09:17 +08:00 committed by GitHub
parent b617ffd88c
commit 74e790c89f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 158 additions and 150 deletions

View File

@ -1,2 +1,6 @@
obj-m:=x86-64-accton-as7816-64x-fan.o x86-64-accton-as7816-64x-sfp.o x86-64-accton-as7816-64x-leds.o \
obj-m:=x86-64-accton-as7816-64x-fan.o x86-64-accton-as7816-64x-leds.o \
x86-64-accton-as7816-64x-psu.o accton_i2c_cpld.o ym2651y.o pddf_custom_fan.o
CFLAGS_pddf_custom_fan.o := -I$(M)/../../../../pddf/i2c/modules/include
KBUILD_EXTRA_SYMBOLS := $(M)/../../../../pddf/i2c/Module.symvers.PDDF

View File

@ -9,8 +9,8 @@
#include <linux/sysfs.h>
#include <linux/slab.h>
#include <linux/dmi.h>
#include "../../../../pddf/i2c/modules/include/pddf_fan_defs.h"
#include "../../../../pddf/i2c/modules/include/pddf_fan_driver.h"
#include "pddf_fan_defs.h"
#include "pddf_fan_driver.h"
extern FAN_SYSFS_ATTR_DATA data_fan1_input;
extern FAN_SYSFS_ATTR_DATA data_fan2_input;

View File

@ -0,0 +1,151 @@
#!/bin/bash
# Steps to check syseeprom i2c address
modprobe i2c-i801
modprobe i2c-dev
at_id=false
(i2cset -y -f 0 0x77 0x1) > /dev/null 2>&1
(i2cset -y -f 0 0x76 0x4) > /dev/null 2>&1
(i2cget -y -f 0 0x60 0xfd) > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo "get at_id"
at_1=$(i2cget -y -f 0 0x60 0xfd)
if [[ ${at_1} -eq 0x41 ]]; then
echo "get at_1 is 0x41"
at_2=$(i2cget -y -f 0 0x60 0xfe)
if [[ ${at_2} -eq 0x54 ]]; then
echo "get at_2 is 0x54"
at_id=true
fi
else
cpld_id=$(i2cget -y -f 0 0x60 0x1) #This CPD version that not support to record at_id
if [[ ${cpld_id} -eq 0x5 ]]; then
at_id=true
fi
fi
fi
if $at_id ; then
echo "This CPLD is for AT used PSU"
echo "PSU-1 pmbus use parent_bus:0x9, dev_addr:0x58"
echo "PSU-1 eeprom use parent_bus:0x9, dev_addr:0x50"
echo "PSU-2 pmbus use parent_bus:0xa, dev_addr:0x5b"
echo "PSU-2 eeprom use parent_bus:0xa, dev_addr:0x53"
if [ -f /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf_support ] && \
[ -f /usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json ]; then
#Change the PDDF JSON file
sed -i 's@{ "chn":"0", "dev":"PSU2"},@\
{ "chn":"0", "dev":"PSU1" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@{ "chn":"1", "dev":"PSU1"}@\
{ "chn":"1", "dev":"PSU2" }@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@"topo_info":{ "parent_bus":"0xa", "dev_addr":"0x5b", "dev_type":"psu_pmbus"},@\
"topo_info": {"parent_bus":"0x9", "dev_addr":"0x58" , "dev_type": "psu_pmbus" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@{ "attr_name":"psu_model_name", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x9a", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10"},@\
{ "attr_name":"psu_model_name", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0x9a", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@{ "attr_name":"psu_mfr_id", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10"},@\
{ "attr_name":"psu_mfr_id", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@{ "attr_name":"psu_fan_dir", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5"},@\
{ "attr_name":"psu_fan_dir", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@{ "attr_name":"psu_v_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\
{ "attr_name":"psu_v_out", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@{ "attr_name":"psu_i_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\
{ "attr_name":"psu_i_out", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@{ "attr_name":"psu_p_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\
{ "attr_name":"psu_p_out", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@{ "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\
{ "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@{ "attr_name":"psu_temp1_input", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}@\
{ "attr_name":"psu_temp1_input", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" }@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@"topo_info":{ "parent_bus":"0xa", "dev_addr":"0x53", "dev_type":"psu_eeprom"},@\
"topo_info": {"parent_bus":"0x9", "dev_addr":"0x50" , "dev_type": "psu_eeprom" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@"topo_info": { "parent_bus":"0x9", "dev_addr":"0x58", "dev_type":"psu_pmbus"},@\
"topo_info": {"parent_bus":"0xa", "dev_addr":"0x5b", "dev_type": "psu_pmbus" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@{ "attr_name":"psu_model_name", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x9a", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10"},@\
{ "attr_name":"psu_model_name", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x9a", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@{ "attr_name":"psu_mfr_id", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10"},@\
{ "attr_name":"psu_mfr_id", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@{ "attr_name":"psu_fan_dir", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5"},@\
{ "attr_name":"psu_fan_dir", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@{ "attr_name":"psu_v_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\
{ "attr_name":"psu_v_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@{ "attr_name":"psu_i_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\
{ "attr_name":"psu_i_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@{ "attr_name":"psu_p_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\
{ "attr_name":"psu_p_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@{ "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\
{ "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@{ "attr_name":"psu_temp1_input", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}@\
{ "attr_name":"psu_temp1_input", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" }@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@"topo_info":{ "parent_bus":"0x9", "dev_addr":"0x50", "dev_type":"psu_eeprom"},@\
"topo_info": {"parent_bus":"0xa", "dev_addr":"0x53", "dev_type": "psu_eeprom" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
fi
fi
(i2cset -y -f 0 0x76 0x0) > /dev/null 2>&1
(i2cset -y -f 0 0x77 0x0) > /dev/null 2>&1
echo "Pre PDDF init steps completed successully"
#For others, psu i2c bus use below,
#PSU-1 pmbus use "parent_bus":"0xa", "dev_addr":"0x5b"
#PSU-1 eeprom use "parent_bus":"0xa", "dev_addr":"0x53"
#PSU-2 pmbus use "parent_bus":"0x9", "dev_addr":"0x58"
#PSU-2 eeprom use "parent_bus":"0x9", "dev_addr":"0x50"

View File

@ -2,153 +2,6 @@
# Disable monitor, monitor-fan, monitor-psu (not enabling them would imply they will be disabled by default)
# Enable pddf-platform-monitor
# Steps to check syseeprom i2c address
modprobe i2c-i801
modprobe i2c-dev
at_id=false
(i2cset -y -f 0 0x77 0x1) > /dev/null 2>&1
(i2cset -y -f 0 0x76 0x4) > /dev/null 2>&1
(i2cget -y -f 0 0x60 0xfd) > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo "get at_id"
at_1=$(i2cget -y -f 0 0x60 0xfd)
if [ ${at_1} = '0x41' ]; then
echo "get at_1 is 0x41"
at_2=$(i2cget -y -f 0 0x60 0xfe)
if [ ${at_2} = '0x54' ]; then
echo "get at_2 is 0x54"
at_id=true
fi
fi
else
cpld_id=$(i2cget -y -f 1 0x60 0x1) #This CPD version that not support to record at_id
if [ ${cpld_id} = '0x5' ]; then
at_id=true
fi
fi
if $at_id ; then
echo "This CPLD is for AT used PSU"
echo "PSU-1 pmbus use parent_bus:0x9, dev_addr:0x58"
echo "PSU-1 eeprom use parent_bus:0x9, dev_addr:0x50"
echo "PSU-2 pmbus use parent_bus:0xa, dev_addr:0x5b"
echo "PSU-2 eeprom use parent_bus:0xa, dev_addr:0x53"
#Change the PDDF JSON file
sed -i 's@{ "chn":"0", "dev":"PSU2"},@\
{ "chn":"0", "dev":"PSU1" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@{ "chn":"1", "dev":"PSU1"}@\
{ "chn":"1", "dev":"PSU2" }@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@"topo_info":{ "parent_bus":"0xa", "dev_addr":"0x5b", "dev_type":"psu_pmbus"},@\
"topo_info": {"parent_bus":"0x9", "dev_addr":"0x58" , "dev_type": "psu_pmbus" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@{ "attr_name":"psu_model_name", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x9a", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10"},@\
{ "attr_name":"psu_model_name", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0x9a", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@{ "attr_name":"psu_mfr_id", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10"},@\
{ "attr_name":"psu_mfr_id", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@{ "attr_name":"psu_fan_dir", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5"},@\
{ "attr_name":"psu_fan_dir", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@{ "attr_name":"psu_v_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\
{ "attr_name":"psu_v_out", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@{ "attr_name":"psu_i_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\
{ "attr_name":"psu_i_out", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@{ "attr_name":"psu_p_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\
{ "attr_name":"psu_p_out", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@{ "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\
{ "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@{ "attr_name":"psu_temp1_input", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}@\
{ "attr_name":"psu_temp1_input", "attr_devaddr":"0x58" , "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" }@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@"topo_info":{ "parent_bus":"0xa", "dev_addr":"0x53", "dev_type":"psu_eeprom"},@\
"topo_info": {"parent_bus":"0x9", "dev_addr":"0x50" , "dev_type": "psu_pmbus" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@"topo_info": { "parent_bus":"0x9", "dev_addr":"0x58", "dev_type":"psu_pmbus"},@\
"topo_info": {"parent_bus":"0xa", "dev_addr":"0x5b", "dev_type": "psu_pmbus" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@{ "attr_name":"psu_model_name", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x9a", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10"},@\
{ "attr_name":"psu_model_name", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x9a", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@{ "attr_name":"psu_mfr_id", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10"},@\
{ "attr_name":"psu_mfr_id", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@{ "attr_name":"psu_fan_dir", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5"},@\
{ "attr_name":"psu_fan_dir", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@{ "attr_name":"psu_v_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\
{ "attr_name":"psu_v_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@{ "attr_name":"psu_i_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\
{ "attr_name":"psu_i_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@{ "attr_name":"psu_p_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\
{ "attr_name":"psu_p_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@{ "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},@\
{ "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@{ "attr_name":"psu_temp1_input", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}@\
{ "attr_name":"psu_temp1_input", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2" }@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
sed -i 's@"topo_info":{ "parent_bus":"0x9", "dev_addr":"0x50", "dev_type":"psu_eeprom"},@\
"topo_info": {"parent_bus":"0xa", "dev_addr":"0x53", "dev_type": "psu_pmbus" },@g' \
/usr/share/sonic/device/x86_64-accton_as7816_64x-r0/pddf/pddf-device.json
sync
fi
(i2cset -y -f 0 0x76 0x0) > /dev/null 2>&1
(i2cset -y -f 0 0x77 0x0) > /dev/null 2>&1
#For other CPLD that use below
#PSU-1 pmbus use "parent_bus":"0x21", "dev_addr":"0x5b"
#PSU-1 eeprom use "parent_bus":"0x21", "dev_addr":"0x53"
#PSU-2 pmbus use "parent_bus":"0x20", "dev_addr":"0x58"
#PSU-2 eeprom use "parent_bus":"0x20", "dev_addr":"0x50"
depmod -a
systemctl enable pddf-platform-init.service
systemctl start pddf-platform-init.service