Skip to content

Commit

Permalink
[CI][doc][build] Trim device folder files trailing blanks
Browse files Browse the repository at this point in the history
- run pre-commit tox profile to trim all trailing blanks
- use several commits with a per-folder based strategy
  to ease their merge

Issue sonic-net#15114

Signed-off-by: Guillaume Lambert <guillaume.lambert@orange.com>
  • Loading branch information
guillaumelambert committed May 19, 2023
1 parent ecb4db5 commit 64b3b9c
Show file tree
Hide file tree
Showing 258 changed files with 3,638 additions and 3,641 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ ifp_inports_support_enable=1
#3x PM4x10Q (3 * 16 = 48 physical ports)
#Doesn't support oversubscribe in Q mode
#MCQ0
port_gmii_mode_1=1 #Q mode
port_gmii_mode_1=1 #Q mode

#PHY4 U56 xx1, MDC/MDIO2, PHYADDR:0x00-0x07, 0x08
port_phy_addr_1=0x40
Expand Down Expand Up @@ -432,7 +432,7 @@ phy_chain_tx_polarity_flip_physical{46.0}=0x1
phy_chain_tx_polarity_flip_physical{47.0}=0x1
phy_chain_tx_polarity_flip_physical{48.0}=0x1

#3x PM4x25 (3 * 4 = 12 physical ports)
#3x PM4x25 (3 * 4 = 12 physical ports)
#FC0
dport_map_port_49=51
dport_map_port_50=50
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@

"PSU":
{
"psu_present":
"psu_present":
{
"i2c":
{
"valmap": { "1":true, "0":false }
}
},

"psu_power_good":
"psu_power_good":
{
"i2c":
{
Expand Down Expand Up @@ -57,7 +57,7 @@
"valmap": {"1":true, "0":false}
}
},

"duty_cycle_to_pwm": "lambda dc: ((dc*100.0)/625)",

"pwm_to_duty_cycle": "lambda pwm: ((pwm*625.0)/100)"
Expand Down
24 changes: 12 additions & 12 deletions device/accton/x86_64-accton_as4630_54pe-r0/pddf/pddf-device.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,19 @@
"i2c":
{
"CONTROLLERS":
[
[
{ "dev_name":"i2c-1", "dev":"SMBUS1" }
]
}
},

"SMBUS1":
"SMBUS1":
{
"dev_info": {"device_type": "SMBUS", "device_name": "SMBUS1", "device_parent": "SYSTEM"},
"i2c":
"i2c":
{
"topo_info": {"dev_addr": "0x1"},
"DEVICES":
"DEVICES":
[
{"dev": "EEPROM1"},
{"dev": "MUX1"}
Expand All @@ -103,7 +103,7 @@
{
"dev_info": { "device_type":"MUX", "device_name":"MUX1", "device_parent":"SMBUS1"},
"i2c":
{
{
"topo_info": { "parent_bus":"0x1", "dev_addr":"0x77", "dev_type":"pca9548"},
"dev_attr": { "virt_bus":"0x2", "idle_state":"-2"},
"channel":
Expand Down Expand Up @@ -309,7 +309,7 @@

"PSU1":
{
"dev_info": { "device_type":"PSU", "device_name":"PSU1", "device_parent":"MUX2"},
"dev_info": { "device_type":"PSU", "device_name":"PSU1", "device_parent":"MUX2"},
"dev_attr": { "dev_idx":"1", "num_psu_fans": "1"},
"i2c":
{
Expand All @@ -318,7 +318,7 @@
{ "itf":"pmbus", "dev":"PSU1-PMBUS" },
{ "itf":"eeprom", "dev":"PSU1-EEPROM" }
]

}
},

Expand All @@ -327,9 +327,9 @@
"dev_info": { "device_type":"PSU-PMBUS", "device_name":"PSU1-PMBUS", "device_parent":"MUX2", "virt_parent":"PSU1"},
"i2c":
{
"topo_info":{ "parent_bus":"0xa", "dev_addr":"0x58", "dev_type":"psu_pmbus"},
"attr_list":
[
"topo_info":{ "parent_bus":"0xa", "dev_addr":"0x58", "dev_type":"psu_pmbus"},
"attr_list":
[
{ "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_fan_dir", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5"},
{ "attr_name":"psu_v_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
Expand Down Expand Up @@ -379,8 +379,8 @@
"i2c":
{
"topo_info": { "parent_bus":"0xb", "dev_addr":"0x59", "dev_type":"psu_pmbus"},
"attr_list":
[
"attr_list":
[
{ "attr_name":"psu_mfr_id", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" },
{ "attr_name":"psu_fan_dir", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5"},
{ "attr_name":"psu_v_out", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ def __init__(self):
ChassisBase.__init__(self)
self._api_helper = APIHelper()
self.is_host = self._api_helper.is_host()

self.config_data = {}

self.__initialize_fan()
self.__initialize_psu()
self.__initialize_thermals()
self.__initialize_components()
self.__initialize_sfp()
self.__initialize_eeprom()

def __initialize_sfp(self):
from sonic_platform.sfp import Sfp
for index in range(0, PORT_END):
Expand All @@ -68,19 +68,19 @@ def __initialize_fan(self):
fandrawer = FanDrawer(fant_index)
self._fan_drawer_list.append(fandrawer)
self._fan_list.extend(fandrawer._fan_list)

def __initialize_psu(self):
from sonic_platform.psu import Psu
for index in range(0, NUM_PSU):
psu = Psu(index)
self._psu_list.append(psu)

def __initialize_thermals(self):
from sonic_platform.thermal import Thermal
for index in range(0, NUM_THERMAL):
thermal = Thermal(index)
self._thermal_list.append(thermal)

def __initialize_eeprom(self):
from sonic_platform.eeprom import Tlv
self._eeprom = Tlv()
Expand Down Expand Up @@ -114,7 +114,7 @@ def get_name(self):
Returns:
string: The name of the device
"""

return self._eeprom.get_product_name()

def get_presence(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
COMPONENT_LIST= [
("CPLD1", "CPLD 1"),
("BIOS", "Basic Input/Output System")

]

class Component(ComponentBase):
Expand Down Expand Up @@ -55,7 +55,7 @@ def __get_cpld_version(self):
except Exception as e:
print('Get exception when read cpld')
cpld_version[cpld_name] = 'None'

return cpld_version

def get_name(self):
Expand All @@ -73,7 +73,7 @@ def get_description(self):
A string containing the description of the component
"""
return COMPONENT_LIST[self.index][1]


def get_firmware_version(self):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from io import StringIO
else:
from cStringIO import StringIO

from sonic_platform_base.sonic_eeprom import eeprom_tlvinfo
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class SfpEvent:
''' Listen to insert/remove sfp events '''

def __init__(self, sfp_list):
self._api_helper = APIHelper()
self._sfp_list = sfp_list
Expand Down
32 changes: 16 additions & 16 deletions device/accton/x86_64-accton_as4630_54pe-r0/sonic_platform/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ def __init__(self, fan_tray_index, fan_index=0, is_psu_fan=False, psu_index=0):
self.psu_i2c_addr = PSU_HWMON_I2C_MAPPING[self.psu_index]['addr']
self.psu_hwmon_path = I2C_PATH.format(
self.psu_i2c_num, self.psu_i2c_addr)

self.psu_i2c_num = PSU_CPLD_I2C_MAPPING[self.psu_index]['num']
self.psu_i2c_addr = PSU_CPLD_I2C_MAPPING[self.psu_index]['addr']
self.psu_cpld_path = I2C_PATH.format(
self.psu_i2c_num, self.psu_i2c_addr)

FanBase.__init__(self)
FanBase.__init__(self)


def get_direction(self):
Expand All @@ -85,7 +85,7 @@ def get_direction(self):
direction=self.FAN_DIRECTION_INTAKE
else:
direction=self.FAN_DIRECTION_EXHAUST

else: #For PSU
dir_str = "{}{}".format(self.psu_hwmon_path,'psu_fan_dir')
val=self._api_helper.read_txt_file(dir_str)
Expand All @@ -96,7 +96,7 @@ def get_direction(self):
direction=self.FAN_DIRECTION_INTAKE
else:
direction=self.FAN_DIRECTION_EXHAUST

return direction

def get_speed(self):
Expand All @@ -105,7 +105,7 @@ def get_speed(self):
Returns:
An integer, the percentage of full fan speed, in the range 0 (off)
to 100 (full speed)
"""
speed = 0
if self.is_psu_fan:
Expand All @@ -117,7 +117,7 @@ def get_speed(self):
speed=100
else:
return 0
elif self.get_presence():
elif self.get_presence():
speed_path = "{}{}".format(CPLD_FAN_I2C_PATH, 'duty_cycle_percentage')
speed=self._api_helper.read_txt_file(speed_path)
if speed is None:
Expand Down Expand Up @@ -158,8 +158,8 @@ def set_speed(self, speed):
A boolean, True if speed is set successfully, False if not
"""
if not self.is_psu_fan and self.get_presence():

if not self.is_psu_fan and self.get_presence():
speed_path = "{}{}".format(CPLD_FAN_I2C_PATH, 'duty_cycle_percentage')
return self._api_helper.write_txt_file(speed_path, int(speed))

Expand All @@ -175,7 +175,7 @@ def set_status_led(self, color):
bool: True if status LED state is set successfully, False if not
"""
return False #Not supported

def get_status_led(self):
"""
Gets the state of the fan status LED
Expand All @@ -188,7 +188,7 @@ def get_status_led(self):

return {
1: self.STATUS_LED_COLOR_GREEN,
0: self.STATUS_LED_COLOR_RED
0: self.STATUS_LED_COLOR_RED
}.get(status, self.STATUS_LED_COLOR_OFF)

def get_name(self):
Expand All @@ -202,7 +202,7 @@ def get_name(self):
else "PSU-{} FAN-{}".format(self.psu_index+1, self.fan_index+1)

return fan_name

def get_presence(self):
"""
Retrieves the presence of the FAN
Expand All @@ -215,7 +215,7 @@ def get_presence(self):
present_path="{}{}".format(self.psu_cpld_path, 'psu_present')
else:
present_path = "{}{}{}".format(CPLD_FAN_I2C_PATH, 'present_', self.fan_tray_index+1)

val=self._api_helper.read_txt_file(present_path)
if val is not None:
return int(val, 10)==1
Expand All @@ -235,24 +235,24 @@ def get_status(self):
return int(val, 10)==0
else:
return False
else:
else:
path = "{}{}{}".format(CPLD_FAN_I2C_PATH, 'fault_', self.fan_tray_index+1)
val=self._api_helper.read_txt_file(path)
if val is not None:
return int(val, 10)==0
else:
return False


def get_model(self):
"""
Retrieves the model number (or part number) of the device
Returns:
string: Model/part number of device
"""

return "N/A"

def get_serial(self):
"""
Retrieves the serial number of the device
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def __init__(self, fantray_index):
# FanTray is 0-based in platforms
self.fantrayindex = fantray_index
self.__initialize_fan_drawer()


def __initialize_fan_drawer(self):
from sonic_platform.fan import Fan
Expand Down
Loading

0 comments on commit 64b3b9c

Please sign in to comment.