From fa614ff47902543d29f9ac1c570c8626760d4719 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20Olguy=20Can=C3=A9us?= Date: Mon, 2 Nov 2020 14:17:34 -0800 Subject: [PATCH] ELBERT: Tune TH4 MAX6581 Temp sensor (#180) (#104) Summary: * ELBERT: Tune TH4 MAX6581 Temp sensor Tune Temp sensor on TH4 Diode accoring to HW measurements. This sensor is being moved to the dts of elbert instead of setup_i2c. - Resistance Cancellation register 0x4A = 0x03 - Transistor Ideality register 0x4B = 0x1F - Ideality Select register 0x4C = 0x03 root@bmc-oob:~# sensors max6581-i2c-4-4d max6581-i2c-4-4d Adapter: 1e78a280.i2c-bus SMB T: +29.6 C (high = +90.0 C, crit = +80.0 C) TH4 Die Temp 0: +35.9 C (high = +127.0 C, crit = +110.0 C) TH4 Die Temp 1: +35.8 C (high = +127.0 C, crit = +110.0 C) SMB R: +27.0 C (high = +100.0 C, crit = +127.0 C) SMB U: +27.8 C (high = +100.0 C, crit = +90.0 C) SMB L: +28.1 C (high = +100.0 C, crit = +90.0 C) * Moved TH4 MAX6581 to dts with tuned configs Pull Request resolved: https://github.com/facebookexternal/openbmc.arista/pull/104 Test Plan: Imported from GitHub, without a `Test Plan:` line. Test in summary Reviewed By: mikechoifb fbshipit-source-id: a2d6a08102 --- .../openbmc-utils/files/setup_i2c.sh | 2 - .../tests/elbert/test_sensor_calibration.py | 41 +++++++++++++++++++ 2 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 tests2/tests/elbert/test_sensor_calibration.py diff --git a/meta-facebook/meta-elbert/recipes-utils/openbmc-utils/files/setup_i2c.sh b/meta-facebook/meta-elbert/recipes-utils/openbmc-utils/files/setup_i2c.sh index 1c09e37c73d9..95b0d0346144 100644 --- a/meta-facebook/meta-elbert/recipes-utils/openbmc-utils/files/setup_i2c.sh +++ b/meta-facebook/meta-elbert/recipes-utils/openbmc-utils/files/setup_i2c.sh @@ -57,8 +57,6 @@ hwmon_device_add() { # long or is in bad shape # Supvervisor Inlet hwmon_device_add 11 0x4c max6658 -# TH4 and board temp sensor -hwmon_device_add 4 0x4d max6581 # SMBus 0 # Currently not using I2C TPM diff --git a/tests2/tests/elbert/test_sensor_calibration.py b/tests2/tests/elbert/test_sensor_calibration.py new file mode 100644 index 000000000000..5ac8cc74611c --- /dev/null +++ b/tests2/tests/elbert/test_sensor_calibration.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python3 +# +# Copyright 2020-present Facebook. All Rights Reserved. +# +# This program file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# +import unittest + +from utils.cit_logger import Logger +from utils.shell_util import run_shell_cmd + + +class SensorCalibrationTest(unittest.TestCase): + def setUp(self): + Logger.start(name=self._testMethodName) + + def tearDown(self): + Logger.info("Finished logging for {}".format(self._testMethodName)) + pass + + def test_max6581_tuned(self): + # Test the IMP port state register + data = run_shell_cmd("i2cget -f -y 4 0x4d 0x4a").split("\n") + self.assertIn("0x03", data[0], "unexpected value in MAX6581 0x4A") + data = run_shell_cmd("i2cget -f -y 4 0x4d 0x4b").split("\n") + self.assertIn("0x1f", data[0], "unexpected value in MAX6581 0x4B") + data = run_shell_cmd("i2cget -f -y 4 0x4d 0x4c").split("\n") + self.assertIn("0x03", data[0], "unexpected value in MAX6581 0x4C")