hw/misc/led: Emit a trace event when LED intensity has changed
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>
Sat, 20 Jun 2020 16:47:17 +0000 (18:47 +0200)
committerPhilippe Mathieu-Daudé <f4bug@amsat.org>
Mon, 26 Oct 2020 12:44:58 +0000 (13:44 +0100)
Track the LED intensity, and emit a trace event when it changes.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20200912134041.946260-4-f4bug@amsat.org>

hw/misc/led.c
hw/misc/trace-events

index c5fa09a613a4d7ac4c153eb62cf4ef2ab8ce0cb5..5266d026d0b07267505996acb93c2aaab09f3d49 100644 (file)
@@ -41,6 +41,10 @@ void led_set_intensity(LEDState *s, unsigned intensity_percent)
         intensity_percent = LED_INTENSITY_PERCENT_MAX;
     }
     trace_led_set_intensity(s->description, s->color, intensity_percent);
+    if (intensity_percent != s->intensity_percent) {
+        trace_led_change_intensity(s->description, s->color,
+                                   s->intensity_percent, intensity_percent);
+    }
     s->intensity_percent = intensity_percent;
 }
 
index 2b6310dbe4b0121720c7a4e861163598882a5812..6bf7ce863fb80bc996ddd82ecb46c38fd7e7ef13 100644 (file)
@@ -225,6 +225,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, uint8_t intensity_percent) "LED desc:'%s' color:%s intensity: %u%%"
+led_change_intensity(const char *color, const char *desc, uint8_t old_intensity_percent, uint8_t new_intensity_percent) "LED desc:'%s' color:%s intensity %u%% -> %u%%"
 
 # pca9552.c
 pca955x_gpio_status(const char *description, const char *buf) "%s GPIOs 0-15 [%s]"