hw/sensor: Add SB-TSI Temperature Sensor Interface
PATCH 1/1 hw/sensor: Add SB-TSI Temperature Sensor Interface
SB Temperature Sensor Interface (SB-TSI) is an SMBus compatible interface that reports AMD SoC's Ttcl (normalized temperature), and resembles a typical 8-pin remote temperature sensor's I2C interface to BMC.
This patch implements a basic AMD SB-TSI sensor that is compatible with the open-source data sheet from AMD and Linux kernel driver.
Reference:
Linux kernel driver:
https://lkml.org/lkml/2020/12/11/968
Register Map:
https://developer.amd.com/wp-content/resources/56255_3_03.PDF
(Chapter 6)
Signed-off-by Hao Wu <[email protected]>
Reviewed-by Doug Evans <[email protected]>
--- hw/sensor/Kconfig | 4 + hw/sensor/meson.build | 1 + hw/sensor/tmp_sbtsi.c | 393 +++++++++++++++++++++++++++++++++++ hw/sensor/trace-events | 5 + hw/sensor/trace.h | 1 + meson.build | 1 + tests/qtest/meson.build | 1 + tests/qtest/tmp_sbtsi-test.c | 180 ++++++++++++++++ 8 files changed, 586 insertions(+) create mode 100644 hw/sensor/tmp_sbtsi.c create mode 100644 hw/sensor/trace-events create mode 100644 hw/sensor/trace.h create mode 100644 tests/qtest/tmp_sbtsi-test.c
hw/sensor/Kconfig +4 -0
@@ -17,3 +17,7 @@ config ADM1272 config MAX34451 bool depends on I2C + +config AMDSBTSI + bool + depends on I2C
hw/sensor/meson.build +1 -0
@@ -3,3 +3,4 @@ softmmu_ss.add(when: 'CONFIG_TMP421', if_true: files('tmp421.c')) softmmu_ss.add(when: 'CONFIG_EMC141X', if_true: files('emc141x.c')) softmmu_ss.add(when: 'CONFIG_ADM1272', if_true: files('adm1272.c')) softmmu_ss.add(when: 'CONFIG_MAX34451', if_true: files('max34451.c')) +softmmu_ss.add(when: 'CONFIG_AMDSBTSI', if_true: files('tmp_sbtsi.c'))
hw/sensor/tmp_sbtsi.c new file +393 -0
393 lines not on this page · raw message
hw/sensor/trace-events new file +5 -0
@@ -0,0 +1,5 @@ +# See docs/devel/tracing.rst for syntax documentation. + +# tmp_sbtsi.c +tmp_sbtsi_write_data(uint8_t addr, uint8_t value) "SBTSI write addr:0x%02x data: 0x%02x" +tmp_sbtsi_read_data(uint8_t addr, uint8_t value) "SBTSI read addr:0x%02x data: 0x%02x"
hw/sensor/trace.h new file +1 -0
@@ -0,0 +1 @@ +#include "trace/trace-hw_sensor.h"
meson.build +1 -0
@@ -2138,6 +2138,7 @@ if have_system 'hw/rtc', 'hw/s390x', 'hw/scsi', + 'hw/sensor', 'hw/sd', 'hw/sparc', 'hw/sparc64',
tests/qtest/meson.build +1 -0
@@ -222,6 +222,7 @@ qos_test_ss.add( 'spapr-phb-test.c', 'tmp105-test.c', 'emc141x-test.c', + 'tmp_sbtsi-test.c', 'usb-hcd-ohci-test.c', 'virtio-test.c', 'virtio-blk-test.c',
tests/qtest/tmp_sbtsi-test.c new file +180 -0
180 lines not on this page · raw message
Signature · 1 line
2.33.0.rc1.237.g0d66db33f3-goog