hw/sensors: Add temperature SI705x sensor
PATCH 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
@@ -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
@@ -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
@@ -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
@@ -0,0 +1 @@ +#include "trace/trace-hw_sensor.h"
meson.build +1 -0
@@ -3330,6 +3330,7 @@ if have_system 'hw/watchdog', 'hw/xen', 'hw/gpio', + 'hw/sensor', 'migration', 'net', 'system',
Signature · 1 line
2.34.1