From fec007d9630e010062cf5699a08460f71f46b527 Mon Sep 17 00:00:00 2001
From: Kienan Stewart <kstewart@efficios.com>
Date: Mon, 25 Mar 2024 08:54:42 -0400
Subject: [PATCH 1/4] Fix: ASoC snd_doc_dapm on linux 6.9-rc1

See upstream commit:

    commit 7df3eb4cdb6bbfa482f51548b9fd47c2723c68ba
    Author: Luca Ceresoli <luca.ceresoli@bootlin.com>
    Date:   Wed Mar 6 10:30:01 2024 +0100

        ASoC: trace: add event to snd_soc_dapm trace events

        Add the event value to the snd_soc_dapm_start and snd_soc_dapm_done trace
        events to make them more informative.

        Trace before:

                   aplay-229   [000]   250.140309: snd_soc_dapm_start:   card=vscn-2046
                   aplay-229   [000]   250.167531: snd_soc_dapm_done:    card=vscn-2046
                   aplay-229   [000]   251.169588: snd_soc_dapm_start:   card=vscn-2046
                   aplay-229   [000]   251.195245: snd_soc_dapm_done:    card=vscn-2046

        Trace after:

                   aplay-214   [000]   693.290612: snd_soc_dapm_start:   card=vscn-2046 event=1
                   aplay-214   [000]   693.315508: snd_soc_dapm_done:    card=vscn-2046 event=1
                   aplay-214   [000]   694.537349: snd_soc_dapm_start:   card=vscn-2046 event=2
                   aplay-214   [000]   694.563241: snd_soc_dapm_done:    card=vscn-2046 event=2

Upstream-Status: Backport [88c4e0fe Fix: ASoC snd_doc_dapm on linux 6.9-rc1]

Change-Id: If0d33544b8dd1dfb3d12ca9390892190fc0444b0
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
---
 include/instrumentation/events/asoc.h | 33 +++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/include/instrumentation/events/asoc.h b/include/instrumentation/events/asoc.h
index 21d13a0f..5126d4c1 100644
--- a/include/instrumentation/events/asoc.h
+++ b/include/instrumentation/events/asoc.h
@@ -51,6 +51,38 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(asoc_snd_soc_card, snd_soc_bias_level_done,
 
 )
 
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,9,0))
+LTTNG_TRACEPOINT_EVENT_CLASS(asoc_snd_soc_dapm_basic,
+
+	TP_PROTO(struct snd_soc_card *card, int event),
+
+	TP_ARGS(card, event),
+
+	TP_FIELDS(
+		ctf_string(name, card->name)
+		ctf_integer(int, event, event)
+	)
+)
+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(asoc_snd_soc_dapm_basic, snd_soc_dapm_start,
+
+	asoc_snd_soc_dapm_start,
+
+	TP_PROTO(struct snd_soc_card *card, int event),
+
+	TP_ARGS(card, event)
+
+)
+
+LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(asoc_snd_soc_dapm_basic, snd_soc_dapm_done,
+
+	asoc_snd_soc_dapm_done,
+
+	TP_PROTO(struct snd_soc_card *card, int event),
+
+	TP_ARGS(card, event)
+
+)
+#else
 LTTNG_TRACEPOINT_EVENT_CLASS(asoc_snd_soc_dapm_basic,
 
 	TP_PROTO(struct snd_soc_card *card),
@@ -81,6 +113,7 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(asoc_snd_soc_dapm_basic, snd_soc_dapm_done,
 	TP_ARGS(card)
 
 )
+#endif
 
 LTTNG_TRACEPOINT_EVENT_CLASS(asoc_snd_soc_dapm_widget,
 
-- 
2.39.2

