Skip to content

Commit ffdb7ae

Browse files
dflynn-Nokiapull[bot]
authored andcommitted
[Nokia ixs7215] Fixes to support Debian bullseye (sonic-net#10309)
The following changes are provided to support bullseye and the latest master branch content. - Accommodate relocated fan and thermal sysfs entries in bullseye - Add support for chassis and PSU HW revision Why I did it Fix platform issues introduced by the bullseye kernel upgrade. How I did it Minor fixes to Nokia ixs7215 platform code How to verify it Execute the following CLI commands show platform summary show platform fan show platform temperature
1 parent f83d1b4 commit ffdb7ae

File tree

6 files changed

+43
-15
lines changed

6 files changed

+43
-15
lines changed

device/nokia/armhf-nokia_ixs7215_52x-r0/plugins/led_control.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ def _set_i2c_register(self, reg_file, value):
6060

6161
def _initSystemLed(self):
6262
# Front Panel System LEDs setting
63-
oldfan = 0xf
64-
oldpsu = 0xf
63+
oldfan = 0xf # 0=amber, 1=green
64+
oldpsu = 0xf # 0=amber, 1=green
6565

6666
# Write sys led
6767
if smbus_present == 0:
@@ -73,42 +73,44 @@ def _initSystemLed(self):
7373
bus.write_byte_data(DEVICE_ADDRESS, DEVICEREG, 0x02)
7474
DBG_PRINT(" System LED set O.K. ")
7575

76+
# Timer loop to monitor and set front panel Status, Fan, and PSU LEDs
7677
while True:
77-
# Front Panel FAN Panel LED setting in register 0x08
78+
# Front Panel FAN Panel LED setting
7879
if (self.chassis.get_fan(0).get_status() == self.chassis.get_fan(1).get_status() == True):
79-
if (os.path.isfile("/sys/class/gpio/fanLedAmber/value")):
80+
if (os.path.isfile("/sys/class/gpio/fanLedGreen/value")):
8081
if oldfan != 0x1:
8182
self._set_i2c_register("/sys/class/gpio/fanLedAmber/value", 0)
8283
self._set_i2c_register("/sys/class/gpio/fanLedGreen/value", 1)
8384
oldfan = 0x1
8485
else:
85-
oldfan = 0xf
86+
oldfan = 0xf
8687
else:
87-
if (os.path.isfile("/sys/class/gpio/fanLedGreen/value")):
88+
if (os.path.isfile("/sys/class/gpio/fanLedAmber/value")):
8889
if oldfan != 0x0:
8990
self._set_i2c_register("/sys/class/gpio/fanLedGreen/value", 0)
9091
self._set_i2c_register("/sys/class/gpio/fanLedAmber/value", 1)
9192
oldfan = 0x0
9293
else:
9394
oldfan = 0xf
9495

95-
# Front Panel PSU Panel LED setting in register 0x09
96+
# Front Panel PSU Panel LED setting
9697
if (self.chassis.get_psu(0).get_status() == self.chassis.get_psu(1).get_status() == True):
97-
if (os.path.isfile("/sys/class/gpio/psuLedAmber/value")):
98+
if (os.path.isfile("/sys/class/gpio/psuLedGreen/value")):
9899
if oldpsu != 0x1:
99100
self._set_i2c_register("/sys/class/gpio/psuLedAmber/value", 0)
100101
self._set_i2c_register("/sys/class/gpio/psuLedGreen/value", 1)
101102
oldpsu = 0x1
102103
else:
103104
oldpsu = 0xf
104105
else:
105-
if (os.path.isfile("/sys/class/gpio/psuLedGreen/value")):
106+
if (os.path.isfile("/sys/class/gpio/psuLedAmber/value")):
106107
if oldpsu != 0x0:
107108
self._set_i2c_register("/sys/class/gpio/psuLedGreen/value", 0)
108109
self._set_i2c_register("/sys/class/gpio/psuLedAmber/value", 1)
109110
oldpsu = 0x0
110111
else:
111112
oldpsu = 0xf
113+
112114
time.sleep(6)
113115

114116
# Helper method to map SONiC port name to index

platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/chassis.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,22 @@ def get_serial(self):
201201
"""
202202
return self._eeprom.serial_number_str()
203203

204+
def get_revision(self):
205+
"""
206+
Retrieves the hardware revision of the chassis
207+
208+
Returns:
209+
string: Revision value of chassis
210+
"""
211+
if smbus_present == 0: # called from host
212+
cmdstatus, value = cmd.getstatusoutput('sudo i2cget -y 0 0x41 0x0')
213+
else:
214+
bus = smbus.SMBus(0)
215+
DEVICE_ADDRESS = 0x41
216+
DEVICE_REG = 0x0
217+
value = bus.read_byte_data(DEVICE_ADDRESS, DEVICE_REG)
218+
return str(value)
219+
204220
def get_system_eeprom_info(self):
205221
"""
206222
Retrieves the full content of system EEPROM information for the

platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/fan.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Fan(FanBase):
3333

3434
def __init__(self, fan_index, fan_drawer, psu_fan=False, dependency=None):
3535
self.is_psu_fan = psu_fan
36-
ADT7473_DIR = "/sys/bus/i2c/devices/0-002e/"
36+
ADT7473_DIR = "/sys/bus/i2c/devices/0-002e/hwmon/hwmon1/"
3737

3838
if not self.is_psu_fan:
3939
# Fan is 1-based in Nokia platforms

platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/psu.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ def get_model(self):
114114
"""
115115
return self.eeprom.modelstr()
116116

117-
118117
def get_serial(self):
119118
"""
120119
Retrieves the serial number of the PSU
@@ -124,6 +123,14 @@ def get_serial(self):
124123
"""
125124
return self.eeprom.serial_number_str()
126125

126+
def get_revision(self):
127+
"""
128+
Retrieves the HW revision of the PSU
129+
130+
Returns:
131+
string: HW revision of PSU
132+
"""
133+
return self.eeprom.part_number_str()
127134

128135
def get_part_number(self):
129136
"""

platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-chassis.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ def main():
2121

2222
print(" Chassis serial: {}".format(chassis.get_serial()))
2323

24+
print(" Chassis revision: {}".format(chassis.get_revision()))
25+
2426
print(" Chassis status: {}".format(chassis.get_status()))
2527

2628
print(" Chassis base_mac: {}".format(chassis.get_base_mac()))

platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/thermal.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ class Thermal(ThermalBase):
2222
I2C_CLASS_DIR = "/sys/class/i2c-adapter/"
2323
I2C_DEV_MAPPING = (['i2c-0/0-004a/hwmon/', 1],
2424
['i2c-0/0-004b/hwmon/', 1],
25-
['i2c-0/0-002e/', 1],
26-
['i2c-0/0-002e/', 2],
27-
['i2c-0/0-002e/', 3])
25+
['i2c-0/0-002e/hwmon/', 1],
26+
['i2c-0/0-002e/hwmon/', 2],
27+
['i2c-0/0-002e/hwmon/', 3])
2828

2929
HWMON_CLASS_DIR = "/sys/class/hwmon/"
3030

@@ -55,7 +55,8 @@ def __init__(self, thermal_index):
5555
sensor_index = self.I2C_DEV_MAPPING[self.index - 1][1]
5656
sensor_max_suffix = "max"
5757
sensor_crit_suffix = "crit"
58-
self.SENSOR_DIR = i2c_path
58+
hwmon_node = os.listdir(i2c_path)[0]
59+
self.SENSOR_DIR = i2c_path + hwmon_node + '/'
5960

6061
# Armada 38x SOC temperature sensor
6162
else:

0 commit comments

Comments
 (0)