Skip to contentSkip to conversation

hw/sensors: Add temperature SI705x sensor

PATCH RESEND New Ilya Chichkov 1 participant 1 message Feb 20, 2025 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 hw/sensors: Add temperature SI705x sensor

Add SI705x temperature sensor with I2C interface and allow setting temperature, VDD status and measurement resolution through properties. This commit adds support for interfacing with it and implements functionality for sensor's commands.

Datasheet: https://www.integrated-circuit.com/pdf/502/391/4.pdf

---
 hw/sensor/Kconfig      |   5 +
 hw/sensor/meson.build  |   1 +
 hw/sensor/tmp_si705x.c | 359 +++++++++++++++++++++++++++++++++++++++++
 hw/sensor/trace-events |   9 ++
 hw/sensor/trace.h      |   1 +
 meson.build            |   1 +
 6 files changed, 376 insertions(+)
 create mode 100644 hw/sensor/tmp_si705x.c
 create mode 100644 hw/sensor/trace-events
 create mode 100644 hw/sensor/trace.h
hw/sensor/Kconfig +5 -0
index bc6331b4ab..554ccbc5f6 100644
@@ -43,3 +43,8 @@ config ISL_PMBUS_VR
 config MAX31785
     bool
     depends on PMBUS
+
+config SI705X
+    bool
+    depends on I2C
+    default y if I2C_DEVICES
hw/sensor/meson.build +1 -0
index 420fdc3359..fba9ccd255 100644
@@ -8,3 +8,4 @@ system_ss.add(when: 'CONFIG_MAX34451', if_true: files('max34451.c'))
 system_ss.add(when: 'CONFIG_LSM303DLHC_MAG', if_true: files('lsm303dlhc_mag.c'))
 system_ss.add(when: 'CONFIG_ISL_PMBUS_VR', if_true: files('isl_pmbus_vr.c'))
 system_ss.add(when: 'CONFIG_MAX31785', if_true: files('max31785.c'))
+system_ss.add(when: 'CONFIG_SI705X', if_true: files('tmp_si705x.c'))
hw/sensor/tmp_si705x.c new file +359 -0

359 lines not on this page · raw message

hw/sensor/trace-events new file +9 -0
new file mode 100644
index 0000000000..42e19da98e
@@ -0,0 +1,9 @@
+# See docs/devel/tracing.rst for syntax documentation.
+
+# tmp_si705x.c
+si705x_write(uint8_t index, uint8_t buf_len, uint8_t data) "index: [%d/%d], data: 0x%x"
+si705x_read(uint8_t cmd) "Command: 0x%x"
+si705x_rx(uint8_t data) "Read RX: 0x%x"
+si705x_event(uint8_t event) "Event: 0x%x"
+si705x_init(void)
+si705x_reset(void)
hw/sensor/trace.h new file +1 -0
new file mode 100644
index 0000000000..e4721560b0
@@ -0,0 +1 @@
+#include "trace/trace-hw_sensor.h"
meson.build +1 -0
index d0329966f1..385c903253 100644
@@ -3330,6 +3330,7 @@ if have_system
     'hw/watchdog',
     'hw/xen',
     'hw/gpio',
+    'hw/sensor',
     'migration',
     'net',
     'system',
Signature · 1 line
2.34.1