aboutsummaryrefslogtreecommitdiff
path: root/hw/sensor/tmp105.c
diff options
context:
space:
mode:
authorBernhard Beschow <shentey@gmail.com>2024-11-05 10:10:00 +0000
committerPeter Maydell <peter.maydell@linaro.org>2024-11-05 10:10:00 +0000
commit3647dca9fbf4fb267c401cdd94519b7a60af0b0b (patch)
tree26914620de1840548083d0dede30072468dd277b /hw/sensor/tmp105.c
parentfe06088b3c5b3bd1a31b499db38b9542deaa2a3e (diff)
hw/sensor/tmp105: Convert printf() to trace event, add tracing for read/write access
printf() unconditionally prints to the console which disturbs `-serial stdio`. Fix that by converting into a trace event. While at it, add some tracing for read and write access. Fixes: 7e7c5e4c1ba5 "Nokia N800 machine support (ARM)." Signed-off-by: Bernhard Beschow <shentey@gmail.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-id: 20241103143330.123596-5-shentey@gmail.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/sensor/tmp105.c')
-rw-r--r--hw/sensor/tmp105.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/hw/sensor/tmp105.c b/hw/sensor/tmp105.c
index 9d7b911f59..ef2824f3e1 100644
--- a/hw/sensor/tmp105.c
+++ b/hw/sensor/tmp105.c
@@ -27,6 +27,7 @@
#include "qapi/visitor.h"
#include "qemu/module.h"
#include "hw/registerfields.h"
+#include "trace.h"
FIELD(CONFIG, SHUTDOWN_MODE, 0, 1)
FIELD(CONFIG, THERMOSTAT_MODE, 1, 1)
@@ -150,17 +151,21 @@ static void tmp105_read(TMP105State *s)
s->buf[s->len++] = ((uint16_t) s->limit[1]) >> 0;
break;
}
+
+ trace_tmp105_read(s->i2c.address, s->pointer);
}
static void tmp105_write(TMP105State *s)
{
+ trace_tmp105_write(s->i2c.address, s->pointer);
+
switch (s->pointer & 3) {
case TMP105_REG_TEMPERATURE:
break;
case TMP105_REG_CONFIG:
if (FIELD_EX8(s->buf[0] & ~s->config, CONFIG, SHUTDOWN_MODE)) {
- printf("%s: TMP105 shutdown\n", __func__);
+ trace_tmp105_write_shutdown(s->i2c.address);
}
s->config = FIELD_DP8(s->buf[0], CONFIG, ONE_SHOT, 0);
s->faults = tmp105_faultq[FIELD_EX8(s->config, CONFIG, FAULT_QUEUE)];