mpm: bist: fix temp and fan tests for e320, n3xx, x4xx

Use HwmonTempSensors based tests for bist tests.
This commit is contained in:
Jörg Hofrichter 2026-06-11 15:44:18 +02:00
parent 8d2addaf1f
commit 521dc737a7
4 changed files with 28 additions and 8 deletions

View File

@ -371,7 +371,7 @@ class E320BIST(bist.UsrpBIST):
assert "temp" in self.tests_to_run
if self.args.dry_run:
return True, {"internal": 30000}
result = bist.get_temp_sensor_value(lambda device: TEMP_SENSOR_MAP[device.sys_name])
result = bist.get_hwmon_temp_sensor_values(dev_filter={"OF_NAME": "embedded-controller"})
if len(result) < 1:
result["error_msg"] = "No temperature sensors found!"
return "error_msg" not in result, result
@ -389,7 +389,7 @@ class E320BIST(bist.UsrpBIST):
assert "fan" in self.tests_to_run
if self.args.dry_run:
return True, {"cooling_device0": 10000}
result = bist.get_fan_values()
result = bist.get_hwmon_fan_sensor_values(dev_filter={"OF_NAME": "embedded-controller"})
return len(result) == 1, result
def bist_link_up(self):

View File

@ -513,9 +513,7 @@ class N3XXBIST(bist.UsrpBIST):
assert "temp" in self.tests_to_run
if self.args.dry_run:
return True, {"fpga-thermal-zone": 30000}
result = bist.get_temp_sensor_value(
lambda device: device.attributes.get("type").decode("ascii")
)
result = bist.get_hwmon_temp_sensor_values(dev_filter={"OF_NAME": "embedded-controller"})
if len(result) < 1:
result["error_msg"] = "No temperature sensors found!"
return "error_msg" not in result, result
@ -533,7 +531,7 @@ class N3XXBIST(bist.UsrpBIST):
assert "fan" in self.tests_to_run
if self.args.dry_run:
return True, {"cooling_device0": 10000, "cooling_device1": 10000}
result = bist.get_fan_values()
result = bist.get_hwmon_fan_sensor_values(dev_filter={"OF_NAME": "embedded-controller"})
return len(result) == 2, result
def bist_whiterabbit(self):

View File

@ -389,6 +389,28 @@ def get_temp_sensor_value(temp_sensor_map):
}
def get_hwmon_fan_sensor_values(dev_filter=None):
"""
Read a fan sensor value from the system using the "hwmon" subsystem and
return a dictionary of the form {fan_sensor_lookup(device): $speed}
"""
from usrp_mpm.sys_utils.sysfs_hwmon import HwmonTempSensors
sensors = HwmonTempSensors(sensor_list=["fan"], dev_filter=dev_filter)
return {name: int(sensors.read_raw_sensor_value(name)) for name in sensors.get_sensor_names()}
def get_hwmon_temp_sensor_values(dev_filter=None):
"""
Read a temp sensor value from the system using the "hwmon" subsystem and
return a dictionary of the form {temp_sensor_lookup(device): $temp}
"""
from usrp_mpm.sys_utils.sysfs_hwmon import HwmonTempSensors
sensors = HwmonTempSensors(sensor_list=["temp"], dev_filter=dev_filter)
return {name: int(sensors.read_raw_sensor_value(name)) for name in sensors.get_sensor_names()}
def get_iio_temp_sensor_values():
"""
Read all devices in the IIO subsystem that can report a temperature and

View File

@ -880,7 +880,7 @@ class X4XXBIST(bist.UsrpBIST):
"TMP464 Internal": 47000,
}
result = bist.get_iio_temp_sensor_values()
result = bist.get_hwmon_temp_sensor_values(dev_filter={"OF_NAME": "cros-ec"})
if len(result) < 1:
result["error_msg"] = "No temperature sensors found!"
@ -900,7 +900,7 @@ class X4XXBIST(bist.UsrpBIST):
assert "fan" in self.tests_to_run
if self.args.dry_run:
return True, {"fan0": 10000, "fan1": 10000}
result = bist.get_ectool_fan_values()
result = bist.get_hwmon_fan_sensor_values(dev_filter={"OF_NAME": "cros-ec"})
return len(result) == 2, result
def _db_flash_init(self, db_flash):