Skip to content

Commit

Permalink
[Nokia ixs7215] Fixes to support Debian bullseye (#10309)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dflynn-Nokia authored and pull[bot] committed Aug 19, 2024
1 parent f83d1b4 commit ffdb7ae
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 15 deletions.
20 changes: 11 additions & 9 deletions device/nokia/armhf-nokia_ixs7215_52x-r0/plugins/led_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ def _set_i2c_register(self, reg_file, value):

def _initSystemLed(self):
# Front Panel System LEDs setting
oldfan = 0xf
oldpsu = 0xf
oldfan = 0xf # 0=amber, 1=green
oldpsu = 0xf # 0=amber, 1=green

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

# Timer loop to monitor and set front panel Status, Fan, and PSU LEDs
while True:
# Front Panel FAN Panel LED setting in register 0x08
# Front Panel FAN Panel LED setting
if (self.chassis.get_fan(0).get_status() == self.chassis.get_fan(1).get_status() == True):
if (os.path.isfile("/sys/class/gpio/fanLedAmber/value")):
if (os.path.isfile("/sys/class/gpio/fanLedGreen/value")):
if oldfan != 0x1:
self._set_i2c_register("/sys/class/gpio/fanLedAmber/value", 0)
self._set_i2c_register("/sys/class/gpio/fanLedGreen/value", 1)
oldfan = 0x1
else:
oldfan = 0xf
oldfan = 0xf
else:
if (os.path.isfile("/sys/class/gpio/fanLedGreen/value")):
if (os.path.isfile("/sys/class/gpio/fanLedAmber/value")):
if oldfan != 0x0:
self._set_i2c_register("/sys/class/gpio/fanLedGreen/value", 0)
self._set_i2c_register("/sys/class/gpio/fanLedAmber/value", 1)
oldfan = 0x0
else:
oldfan = 0xf

# Front Panel PSU Panel LED setting in register 0x09
# Front Panel PSU Panel LED setting
if (self.chassis.get_psu(0).get_status() == self.chassis.get_psu(1).get_status() == True):
if (os.path.isfile("/sys/class/gpio/psuLedAmber/value")):
if (os.path.isfile("/sys/class/gpio/psuLedGreen/value")):
if oldpsu != 0x1:
self._set_i2c_register("/sys/class/gpio/psuLedAmber/value", 0)
self._set_i2c_register("/sys/class/gpio/psuLedGreen/value", 1)
oldpsu = 0x1
else:
oldpsu = 0xf
else:
if (os.path.isfile("/sys/class/gpio/psuLedGreen/value")):
if (os.path.isfile("/sys/class/gpio/psuLedAmber/value")):
if oldpsu != 0x0:
self._set_i2c_register("/sys/class/gpio/psuLedGreen/value", 0)
self._set_i2c_register("/sys/class/gpio/psuLedAmber/value", 1)
oldpsu = 0x0
else:
oldpsu = 0xf

time.sleep(6)

# Helper method to map SONiC port name to index
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,22 @@ def get_serial(self):
"""
return self._eeprom.serial_number_str()

def get_revision(self):
"""
Retrieves the hardware revision of the chassis
Returns:
string: Revision value of chassis
"""
if smbus_present == 0: # called from host
cmdstatus, value = cmd.getstatusoutput('sudo i2cget -y 0 0x41 0x0')
else:
bus = smbus.SMBus(0)
DEVICE_ADDRESS = 0x41
DEVICE_REG = 0x0
value = bus.read_byte_data(DEVICE_ADDRESS, DEVICE_REG)
return str(value)

def get_system_eeprom_info(self):
"""
Retrieves the full content of system EEPROM information for the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Fan(FanBase):

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

if not self.is_psu_fan:
# Fan is 1-based in Nokia platforms
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ def get_model(self):
"""
return self.eeprom.modelstr()


def get_serial(self):
"""
Retrieves the serial number of the PSU
Expand All @@ -124,6 +123,14 @@ def get_serial(self):
"""
return self.eeprom.serial_number_str()

def get_revision(self):
"""
Retrieves the HW revision of the PSU
Returns:
string: HW revision of PSU
"""
return self.eeprom.part_number_str()

def get_part_number(self):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ def main():

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

print(" Chassis revision: {}".format(chassis.get_revision()))

print(" Chassis status: {}".format(chassis.get_status()))

print(" Chassis base_mac: {}".format(chassis.get_base_mac()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class Thermal(ThermalBase):
I2C_CLASS_DIR = "/sys/class/i2c-adapter/"
I2C_DEV_MAPPING = (['i2c-0/0-004a/hwmon/', 1],
['i2c-0/0-004b/hwmon/', 1],
['i2c-0/0-002e/', 1],
['i2c-0/0-002e/', 2],
['i2c-0/0-002e/', 3])
['i2c-0/0-002e/hwmon/', 1],
['i2c-0/0-002e/hwmon/', 2],
['i2c-0/0-002e/hwmon/', 3])

HWMON_CLASS_DIR = "/sys/class/hwmon/"

Expand Down Expand Up @@ -55,7 +55,8 @@ def __init__(self, thermal_index):
sensor_index = self.I2C_DEV_MAPPING[self.index - 1][1]
sensor_max_suffix = "max"
sensor_crit_suffix = "crit"
self.SENSOR_DIR = i2c_path
hwmon_node = os.listdir(i2c_path)[0]
self.SENSOR_DIR = i2c_path + hwmon_node + '/'

# Armada 38x SOC temperature sensor
else:
Expand Down

0 comments on commit ffdb7ae

Please sign in to comment.