diff --git a/device/nokia/armhf-nokia_ixs7215_52x-r0/plugins/led_control.py b/device/nokia/armhf-nokia_ixs7215_52x-r0/plugins/led_control.py index 935343a84ce1..55d5c74808d0 100644 --- a/device/nokia/armhf-nokia_ixs7215_52x-r0/plugins/led_control.py +++ b/device/nokia/armhf-nokia_ixs7215_52x-r0/plugins/led_control.py @@ -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: @@ -73,18 +73,19 @@ 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) @@ -92,9 +93,9 @@ def _initSystemLed(self): 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) @@ -102,13 +103,14 @@ def _initSystemLed(self): 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 diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/chassis.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/chassis.py index cf67a7bb30ac..eb507a49ef17 100755 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/chassis.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/chassis.py @@ -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 diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/fan.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/fan.py index b8fd335930d6..71334ca48585 100644 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/fan.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/fan.py @@ -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 diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/psu.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/psu.py index 6217555f0d58..383eb2481f68 100644 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/psu.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/psu.py @@ -114,7 +114,6 @@ def get_model(self): """ return self.eeprom.modelstr() - def get_serial(self): """ Retrieves the serial number of the PSU @@ -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): """ diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-chassis.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-chassis.py index 53c047ca2329..93dfcaac3d05 100755 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-chassis.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/test/test-chassis.py @@ -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())) diff --git a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/thermal.py b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/thermal.py index 20fdec61f38e..c7e408c3f3e9 100644 --- a/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/thermal.py +++ b/platform/marvell-armhf/sonic-platform-nokia/7215/sonic_platform/thermal.py @@ -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/" @@ -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: