From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"Andrew Jeffery" <andrew@aj.id.au>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
qemu-arm@nongnu.org, "Joel Stanley" <joel@jms.id.au>,
"Cédric Le Goater" <clg@kaod.org>
Subject: [PATCH v3 3/7] hw/misc/led: Emit a trace event when LED intensity has changed
Date: Sun, 21 Jun 2020 01:07:15 +0200 [thread overview]
Message-ID: <20200620230719.32139-4-f4bug@amsat.org> (raw)
In-Reply-To: <20200620230719.32139-1-f4bug@amsat.org>
Track the LED intensity, and emit a trace event when it changes.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
include/hw/misc/led.h | 1 +
hw/misc/led.c | 5 +++++
hw/misc/trace-events | 1 +
3 files changed, 7 insertions(+)
diff --git a/include/hw/misc/led.h b/include/hw/misc/led.h
index 883006bb8f..df5b32a2db 100644
--- a/include/hw/misc/led.h
+++ b/include/hw/misc/led.h
@@ -35,6 +35,7 @@ typedef struct LEDState {
DeviceState parent_obj;
/* Public */
+ uint16_t current_intensity;
qemu_irq irq;
/* Properties */
diff --git a/hw/misc/led.c b/hw/misc/led.c
index 8503dde777..37d9f1f3d2 100644
--- a/hw/misc/led.c
+++ b/hw/misc/led.c
@@ -32,6 +32,11 @@ void led_set_intensity(LEDState *s, uint16_t new_intensity)
{
trace_led_set_intensity(s->description ? s->description : "n/a",
s->color, new_intensity);
+ if (new_intensity != s->current_intensity) {
+ trace_led_change_intensity(s->description ? s->description : "n/a",
+ s->color,
+ s->current_intensity, new_intensity);
+ }
s->current_intensity = new_intensity;
}
diff --git a/hw/misc/trace-events b/hw/misc/trace-events
index f58853d367..57d39bf9b9 100644
--- a/hw/misc/trace-events
+++ b/hw/misc/trace-events
@@ -209,6 +209,7 @@ grlib_apb_pnp_read(uint64_t addr, uint32_t value) "APB PnP read addr:0x%03"PRIx6
# led.c
led_set_intensity(const char *color, const char *desc, uint16_t intensity) "LED desc:'%s' color:%s intensity: 0x%04"PRIx16
+led_change_intensity(const char *color, const char *desc, uint16_t old_intensity, uint16_t new_intensity) "LED desc:'%s' color:%s intensity 0x%04"PRIx16" -> 0x%04"PRIx16""
# pca9552.c
pca9552_gpio_status(const char *description, const char *buf) "%s GPIOs 0-15 [%s]"
--
2.21.3
next prev parent reply other threads:[~2020-06-20 23:08 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-20 23:07 [PATCH v3 0/7] hw/misc: Add LED device Philippe Mathieu-Daudé
2020-06-20 23:07 ` [PATCH v3 1/7] hw/misc: Add a " Philippe Mathieu-Daudé
2020-06-21 2:00 ` Richard Henderson
2020-06-21 20:35 ` Philippe Mathieu-Daudé
2020-06-21 20:50 ` Richard Henderson
2020-06-20 23:07 ` [PATCH v3 2/7] hw/misc/led: Add helper to connect LED to GPIO output Philippe Mathieu-Daudé
2020-06-21 19:09 ` Richard Henderson
2020-06-20 23:07 ` Philippe Mathieu-Daudé [this message]
2020-06-21 19:23 ` [PATCH v3 3/7] hw/misc/led: Emit a trace event when LED intensity has changed Richard Henderson
2020-06-21 22:25 ` Philippe Mathieu-Daudé
2020-06-22 16:48 ` Richard Henderson
2020-06-23 7:45 ` Philippe Mathieu-Daudé
2020-06-20 23:07 ` [PATCH v3 4/7] hw/arm/aspeed: Add the 3 front LEDs drived by the PCA9552 #1 Philippe Mathieu-Daudé
2020-06-21 20:51 ` Richard Henderson
2020-06-20 23:07 ` [PATCH v3 5/7] hw/misc/mps2-fpgaio: Use the LED device Philippe Mathieu-Daudé
2020-06-21 21:00 ` Richard Henderson
2020-06-21 21:09 ` Philippe Mathieu-Daudé
2020-06-20 23:07 ` [PATCH v3 6/7] hw/misc/mps2-scc: " Philippe Mathieu-Daudé
2020-06-21 17:31 ` Philippe Mathieu-Daudé
2020-06-21 21:05 ` Richard Henderson
2020-06-20 23:07 ` [PATCH v3 7/7] hw/arm/tosa: Replace fprintf() calls by LED devices Philippe Mathieu-Daudé
2020-06-21 16:52 ` Philippe Mathieu-Daudé
2020-06-20 23:58 ` [PATCH v3 0/7] hw/misc: Add LED device no-reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200620230719.32139-4-f4bug@amsat.org \
--to=f4bug@amsat.org \
--cc=andrew@aj.id.au \
--cc=clg@kaod.org \
--cc=joel@jms.id.au \
--cc=peter.maydell@linaro.org \
--cc=philmd@redhat.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).