public inbox for alsa-devel@alsa-project.org
 help / color / mirror / Atom feed
* [PATCH 1/3] ALSA: hda - add hdac stream trace
@ 2015-05-12  1:43 libin.yang
  2015-05-12  1:43 ` [PATCH 2/3] ALSA: hda - rename hda_intel_trace.h to hda_controller_trace.h libin.yang
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: libin.yang @ 2015-05-12  1:43 UTC (permalink / raw)
  To: alsa-devel, tiwai; +Cc: Libin Yang

From: Libin Yang <libin.yang@intel.com>

Add the trace of snd_hdac_stream_start and snd_hdac_stream_stop.

Signed-off-by: Libin Yang <libin.yang@intel.com>
---
 sound/hda/hdac_stream.c |  5 +++++
 sound/hda/trace.h       | 27 +++++++++++++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/sound/hda/hdac_stream.c b/sound/hda/hdac_stream.c
index 1ba0462..52a894f 100644
--- a/sound/hda/hdac_stream.c
+++ b/sound/hda/hdac_stream.c
@@ -10,6 +10,7 @@
 #include <sound/pcm.h>
 #include <sound/hdaudio.h>
 #include <sound/hda_register.h>
+#include "trace.h"
 
 /**
  * snd_hdac_stream_init - initialize each stream (aka device)
@@ -48,6 +49,8 @@ void snd_hdac_stream_start(struct hdac_stream *azx_dev, bool fresh_start)
 {
 	struct hdac_bus *bus = azx_dev->bus;
 
+	trace_snd_hdac_stream_start(bus, azx_dev);
+
 	azx_dev->start_wallclk = snd_hdac_chip_readl(bus, WALLCLK);
 	if (!fresh_start)
 		azx_dev->start_wallclk -= azx_dev->period_wallclk;
@@ -82,6 +85,8 @@ EXPORT_SYMBOL_GPL(snd_hdac_stream_clear);
  */
 void snd_hdac_stream_stop(struct hdac_stream *azx_dev)
 {
+	trace_snd_hdac_stream_stop(azx_dev->bus, azx_dev);
+
 	snd_hdac_stream_clear(azx_dev);
 	/* disable SIE */
 	snd_hdac_chip_updatel(azx_dev->bus, INTCTL, 1 << azx_dev->index, 0);
diff --git a/sound/hda/trace.h b/sound/hda/trace.h
index 33a7eb5..e27e2c0 100644
--- a/sound/hda/trace.h
+++ b/sound/hda/trace.h
@@ -50,6 +50,33 @@ TRACE_EVENT(hda_unsol_event,
 	),
 	TP_printk("%s", __get_str(msg))
 );
+
+DECLARE_EVENT_CLASS(hdac_stream,
+	TP_PROTO(struct hdac_bus *bus, struct hdac_stream *azx_dev),
+
+	TP_ARGS(bus, azx_dev),
+
+	TP_STRUCT__entry(
+		__field(unsigned char, stream_tag)
+	),
+
+	TP_fast_assign(
+		__entry->stream_tag = (azx_dev)->stream_tag;
+	),
+
+	TP_printk("stream_tag: %d", __entry->stream_tag)
+);
+
+DEFINE_EVENT(hdac_stream, snd_hdac_stream_start,
+	TP_PROTO(struct hdac_bus *bus, struct hdac_stream *azx_dev),
+	TP_ARGS(bus, azx_dev)
+);
+
+DEFINE_EVENT(hdac_stream, snd_hdac_stream_stop,
+	TP_PROTO(struct hdac_bus *bus, struct hdac_stream *azx_dev),
+	TP_ARGS(bus, azx_dev)
+);
+
 #endif /* __HDAC_TRACE_H */
 
 /* This part must be outside protection */
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] ALSA: hda - rename hda_intel_trace.h to hda_controller_trace.h
  2015-05-12  1:43 [PATCH 1/3] ALSA: hda - add hdac stream trace libin.yang
@ 2015-05-12  1:43 ` libin.yang
  2015-05-12  1:43 ` [PATCH 3/3] ALSA: hda - add hda_intel_trace.h libin.yang
  2015-05-18  8:11 ` [PATCH 1/3] ALSA: hda - add hdac stream trace Takashi Iwai
  2 siblings, 0 replies; 4+ messages in thread
From: libin.yang @ 2015-05-12  1:43 UTC (permalink / raw)
  To: alsa-devel, tiwai; +Cc: Libin Yang

From: Libin Yang <libin.yang@intel.com>

This patch does:

1. Rename the hda_intel_trace.h to hda_controller_trace.h as
this trace is used in hda_controller.c

2. Add some trace function for pcm flow.

Signed-off-by: Libin Yang <libin.yang@intel.com>
---
 sound/pci/hda/hda_controller.c       |  6 ++-
 sound/pci/hda/hda_controller_trace.h | 98 ++++++++++++++++++++++++++++++++++++
 sound/pci/hda/hda_intel_trace.h      | 62 -----------------------
 3 files changed, 103 insertions(+), 63 deletions(-)
 create mode 100644 sound/pci/hda/hda_controller_trace.h

diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c
index 120854e..9444559 100644
--- a/sound/pci/hda/hda_controller.c
+++ b/sound/pci/hda/hda_controller.c
@@ -32,7 +32,7 @@
 #include "hda_controller.h"
 
 #define CREATE_TRACE_POINTS
-#include "hda_intel_trace.h"
+#include "hda_controller_trace.h"
 
 /* DSP lock helpers */
 #define dsp_lock(dev)		snd_hdac_dsp_lock(azx_stream(dev))
@@ -95,6 +95,7 @@ static int azx_pcm_close(struct snd_pcm_substream *substream)
 	struct azx *chip = apcm->chip;
 	struct azx_dev *azx_dev = get_azx_dev(substream);
 
+	trace_azx_pcm_close(chip, azx_dev);
 	mutex_lock(&chip->open_mutex);
 	azx_release_device(azx_dev);
 	if (hinfo->ops.close)
@@ -113,6 +114,7 @@ static int azx_pcm_hw_params(struct snd_pcm_substream *substream,
 	struct azx_dev *azx_dev = get_azx_dev(substream);
 	int ret;
 
+	trace_azx_pcm_hw_params(chip, azx_dev);
 	dsp_lock(azx_dev);
 	if (dsp_is_locked(azx_dev)) {
 		ret = -EBUSY;
@@ -163,6 +165,7 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream)
 		snd_hda_spdif_out_of_nid(apcm->codec, hinfo->nid);
 	unsigned short ctls = spdif ? spdif->ctls : 0;
 
+	trace_azx_pcm_prepare(chip, azx_dev);
 	dsp_lock(azx_dev);
 	if (dsp_is_locked(azx_dev)) {
 		err = -EBUSY;
@@ -403,6 +406,7 @@ static int azx_pcm_open(struct snd_pcm_substream *substream)
 	snd_hda_codec_pcm_get(apcm->info);
 	mutex_lock(&chip->open_mutex);
 	azx_dev = azx_assign_device(chip, substream);
+	trace_azx_pcm_open(chip, azx_dev);
 	if (azx_dev == NULL) {
 		err = -EBUSY;
 		goto unlock;
diff --git a/sound/pci/hda/hda_controller_trace.h b/sound/pci/hda/hda_controller_trace.h
new file mode 100644
index 0000000..3e18d99
--- /dev/null
+++ b/sound/pci/hda/hda_controller_trace.h
@@ -0,0 +1,98 @@
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM hda_controller
+#define TRACE_INCLUDE_FILE hda_controller_trace
+
+#if !defined(_TRACE_HDA_CONTROLLER_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_HDA_CONTROLLER_H
+
+#include <linux/tracepoint.h>
+
+struct azx;
+struct azx_dev;
+
+TRACE_EVENT(azx_pcm_trigger,
+
+	TP_PROTO(struct azx *chip, struct azx_dev *dev, int cmd),
+
+	TP_ARGS(chip, dev, cmd),
+
+	TP_STRUCT__entry(
+		__field( int, card )
+		__field( int, idx )
+		__field( int, cmd )
+	),
+
+	TP_fast_assign(
+		__entry->card = (chip)->card->number;
+		__entry->idx = (dev)->core.index;
+		__entry->cmd = cmd;
+	),
+
+	TP_printk("[%d:%d] cmd=%d", __entry->card, __entry->idx, __entry->cmd)
+);
+
+TRACE_EVENT(azx_get_position,
+
+    TP_PROTO(struct azx *chip, struct azx_dev *dev, unsigned int pos, unsigned int delay),
+
+	    TP_ARGS(chip, dev, pos, delay),
+
+	TP_STRUCT__entry(
+		__field( int, card )
+		__field( int, idx )
+		__field( unsigned int, pos )
+		__field( unsigned int, delay )
+	),
+
+	TP_fast_assign(
+		__entry->card = (chip)->card->number;
+		__entry->idx = (dev)->core.index;
+		__entry->pos = pos;
+		__entry->delay = delay;
+	),
+
+	TP_printk("[%d:%d] pos=%u, delay=%u", __entry->card, __entry->idx, __entry->pos, __entry->delay)
+);
+
+DECLARE_EVENT_CLASS(azx_pcm,
+	TP_PROTO(struct azx *chip, struct azx_dev *azx_dev),
+
+	TP_ARGS(chip, azx_dev),
+
+	TP_STRUCT__entry(
+		__field( unsigned char, stream_tag )
+	),
+
+	TP_fast_assign(
+		__entry->stream_tag = (azx_dev)->core.stream_tag;
+	),
+
+	TP_printk("stream_tag: %d", __entry->stream_tag)
+);
+
+DEFINE_EVENT(azx_pcm, azx_pcm_open,
+	TP_PROTO(struct azx *chip, struct azx_dev *azx_dev),
+	TP_ARGS(chip, azx_dev)
+);
+
+DEFINE_EVENT(azx_pcm, azx_pcm_close,
+	TP_PROTO(struct azx *chip, struct azx_dev *azx_dev),
+	TP_ARGS(chip, azx_dev)
+);
+
+DEFINE_EVENT(azx_pcm, azx_pcm_hw_params,
+	TP_PROTO(struct azx *chip, struct azx_dev *azx_dev),
+	TP_ARGS(chip, azx_dev)
+);
+
+DEFINE_EVENT(azx_pcm, azx_pcm_prepare,
+	TP_PROTO(struct azx *chip, struct azx_dev *azx_dev),
+	TP_ARGS(chip, azx_dev)
+);
+
+#endif /* _TRACE_HDA_CONTROLLER_H */
+
+/* This part must be outside protection */
+#undef TRACE_INCLUDE_PATH
+#define TRACE_INCLUDE_PATH .
+#include <trace/define_trace.h>
diff --git a/sound/pci/hda/hda_intel_trace.h b/sound/pci/hda/hda_intel_trace.h
index ae00473..e69de29 100644
--- a/sound/pci/hda/hda_intel_trace.h
+++ b/sound/pci/hda/hda_intel_trace.h
@@ -1,62 +0,0 @@
-#undef TRACE_SYSTEM
-#define TRACE_SYSTEM hda_intel
-#define TRACE_INCLUDE_FILE hda_intel_trace
-
-#if !defined(_TRACE_HDA_INTEL_H) || defined(TRACE_HEADER_MULTI_READ)
-#define _TRACE_HDA_INTEL_H
-
-#include <linux/tracepoint.h>
-
-struct azx;
-struct azx_dev;
-
-TRACE_EVENT(azx_pcm_trigger,
-
-	TP_PROTO(struct azx *chip, struct azx_dev *dev, int cmd),
-
-	TP_ARGS(chip, dev, cmd),
-
-	TP_STRUCT__entry(
-		__field( int, card )
-		__field( int, idx )
-		__field( int, cmd )
-	),
-
-	TP_fast_assign(
-		__entry->card = (chip)->card->number;
-		__entry->idx = (dev)->core.index;
-		__entry->cmd = cmd;
-	),
-
-	TP_printk("[%d:%d] cmd=%d", __entry->card, __entry->idx, __entry->cmd)
-);
-
-TRACE_EVENT(azx_get_position,
-
-    TP_PROTO(struct azx *chip, struct azx_dev *dev, unsigned int pos, unsigned int delay),
-
-	    TP_ARGS(chip, dev, pos, delay),
-
-	TP_STRUCT__entry(
-		__field( int, card )
-		__field( int, idx )
-		__field( unsigned int, pos )
-		__field( unsigned int, delay )
-	),
-
-	TP_fast_assign(
-		__entry->card = (chip)->card->number;
-		__entry->idx = (dev)->core.index;
-		__entry->pos = pos;
-		__entry->delay = delay;
-	),
-
-	TP_printk("[%d:%d] pos=%u, delay=%u", __entry->card, __entry->idx, __entry->pos, __entry->delay)
-);
-
-#endif /* _TRACE_HDA_INTEL_H */
-
-/* This part must be outside protection */
-#undef TRACE_INCLUDE_PATH
-#define TRACE_INCLUDE_PATH .
-#include <trace/define_trace.h>
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] ALSA: hda - add hda_intel_trace.h
  2015-05-12  1:43 [PATCH 1/3] ALSA: hda - add hdac stream trace libin.yang
  2015-05-12  1:43 ` [PATCH 2/3] ALSA: hda - rename hda_intel_trace.h to hda_controller_trace.h libin.yang
@ 2015-05-12  1:43 ` libin.yang
  2015-05-18  8:11 ` [PATCH 1/3] ALSA: hda - add hdac stream trace Takashi Iwai
  2 siblings, 0 replies; 4+ messages in thread
From: libin.yang @ 2015-05-12  1:43 UTC (permalink / raw)
  To: alsa-devel, tiwai; +Cc: Libin Yang

From: Libin Yang <libin.yang@intel.com>

This patch creates hda_intel_trace.h to add some pm trace functions
used in hda_intel.c

Signed-off-by: Libin Yang <libin.yang@intel.com>
---
 sound/pci/hda/Makefile          |  1 +
 sound/pci/hda/hda_intel.c       |  9 +++++++
 sound/pci/hda/hda_intel_trace.h | 53 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 63 insertions(+)

diff --git a/sound/pci/hda/Makefile b/sound/pci/hda/Makefile
index c5e6651..9c259ce 100644
--- a/sound/pci/hda/Makefile
+++ b/sound/pci/hda/Makefile
@@ -11,6 +11,7 @@ snd-hda-codec-$(CONFIG_SND_HDA_INPUT_BEEP) += hda_beep.o
 
 # for trace-points
 CFLAGS_hda_controller.o := -I$(src)
+CFLAGS_hda_intel.o := -I$(src)
 
 snd-hda-codec-generic-objs :=	hda_generic.o
 snd-hda-codec-realtek-objs :=	patch_realtek.o
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 706879a..5c84d40 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -64,6 +64,9 @@
 #include "hda_controller.h"
 #include "hda_intel.h"
 
+#define CREATE_TRACE_POINTS
+#include "hda_intel_trace.h"
+
 /* position fix mode */
 enum {
 	POS_FIX_AUTO,
@@ -831,6 +834,8 @@ static int azx_suspend(struct device *dev)
 	if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL
 		&& hda->need_i915_power)
 		hda_display_power(hda, false);
+
+	trace_azx_suspend(chip);
 	return 0;
 }
 
@@ -864,6 +869,8 @@ static int azx_resume(struct device *dev)
 	hda_intel_init_chip(chip, true);
 
 	snd_power_change_state(card, SNDRV_CTL_POWER_D0);
+
+	trace_azx_resume(chip);
 	return 0;
 }
 #endif /* CONFIG_PM_SLEEP || SUPPORT_VGA_SWITCHEROO */
@@ -897,6 +904,7 @@ static int azx_runtime_suspend(struct device *dev)
 		&& hda->need_i915_power)
 		hda_display_power(hda, false);
 
+	trace_azx_runtime_suspend(chip);
 	return 0;
 }
 
@@ -945,6 +953,7 @@ static int azx_runtime_resume(struct device *dev)
 	azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) &
 			~STATESTS_INT_MASK);
 
+	trace_azx_runtime_resume(chip);
 	return 0;
 }
 
diff --git a/sound/pci/hda/hda_intel_trace.h b/sound/pci/hda/hda_intel_trace.h
index e69de29..0922d8b 100644
--- a/sound/pci/hda/hda_intel_trace.h
+++ b/sound/pci/hda/hda_intel_trace.h
@@ -0,0 +1,53 @@
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM hda_intel
+#define TRACE_INCLUDE_FILE hda_intel_trace
+
+#if !defined(_TRACE_HDA_INTEL_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_HDA_INTEL_H
+
+#include <linux/tracepoint.h>
+
+DECLARE_EVENT_CLASS(hda_pm,
+	TP_PROTO(struct azx *chip),
+
+	TP_ARGS(chip),
+
+	TP_STRUCT__entry(
+		__field(int, dev_index)
+	),
+
+	TP_fast_assign(
+		__entry->dev_index = (chip)->dev_index;
+	),
+
+	TP_printk("card index: %d", __entry->dev_index)
+);
+
+DEFINE_EVENT(hda_pm, azx_suspend,
+	TP_PROTO(struct azx *chip),
+	TP_ARGS(chip)
+);
+
+DEFINE_EVENT(hda_pm, azx_resume,
+	TP_PROTO(struct azx *chip),
+	TP_ARGS(chip)
+);
+
+#ifdef CONFIG_PM
+DEFINE_EVENT(hda_pm, azx_runtime_suspend,
+	TP_PROTO(struct azx *chip),
+	TP_ARGS(chip)
+);
+
+DEFINE_EVENT(hda_pm, azx_runtime_resume,
+	TP_PROTO(struct azx *chip),
+	TP_ARGS(chip)
+);
+#endif
+
+#endif /* _TRACE_HDA_INTEL_H */
+
+/* This part must be outside protection */
+#undef TRACE_INCLUDE_PATH
+#define TRACE_INCLUDE_PATH .
+#include <trace/define_trace.h>
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/3] ALSA: hda - add hdac stream trace
  2015-05-12  1:43 [PATCH 1/3] ALSA: hda - add hdac stream trace libin.yang
  2015-05-12  1:43 ` [PATCH 2/3] ALSA: hda - rename hda_intel_trace.h to hda_controller_trace.h libin.yang
  2015-05-12  1:43 ` [PATCH 3/3] ALSA: hda - add hda_intel_trace.h libin.yang
@ 2015-05-18  8:11 ` Takashi Iwai
  2 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2015-05-18  8:11 UTC (permalink / raw)
  To: libin.yang; +Cc: alsa-devel

At Tue, 12 May 2015 09:43:20 +0800,
libin.yang@intel.com wrote:
> 
> From: Libin Yang <libin.yang@intel.com>
> 
> Add the trace of snd_hdac_stream_start and snd_hdac_stream_stop.
> 
> Signed-off-by: Libin Yang <libin.yang@intel.com>

Applied all three patches.  Thanks.


Takashi

> ---
>  sound/hda/hdac_stream.c |  5 +++++
>  sound/hda/trace.h       | 27 +++++++++++++++++++++++++++
>  2 files changed, 32 insertions(+)
> 
> diff --git a/sound/hda/hdac_stream.c b/sound/hda/hdac_stream.c
> index 1ba0462..52a894f 100644
> --- a/sound/hda/hdac_stream.c
> +++ b/sound/hda/hdac_stream.c
> @@ -10,6 +10,7 @@
>  #include <sound/pcm.h>
>  #include <sound/hdaudio.h>
>  #include <sound/hda_register.h>
> +#include "trace.h"
>  
>  /**
>   * snd_hdac_stream_init - initialize each stream (aka device)
> @@ -48,6 +49,8 @@ void snd_hdac_stream_start(struct hdac_stream *azx_dev, bool fresh_start)
>  {
>  	struct hdac_bus *bus = azx_dev->bus;
>  
> +	trace_snd_hdac_stream_start(bus, azx_dev);
> +
>  	azx_dev->start_wallclk = snd_hdac_chip_readl(bus, WALLCLK);
>  	if (!fresh_start)
>  		azx_dev->start_wallclk -= azx_dev->period_wallclk;
> @@ -82,6 +85,8 @@ EXPORT_SYMBOL_GPL(snd_hdac_stream_clear);
>   */
>  void snd_hdac_stream_stop(struct hdac_stream *azx_dev)
>  {
> +	trace_snd_hdac_stream_stop(azx_dev->bus, azx_dev);
> +
>  	snd_hdac_stream_clear(azx_dev);
>  	/* disable SIE */
>  	snd_hdac_chip_updatel(azx_dev->bus, INTCTL, 1 << azx_dev->index, 0);
> diff --git a/sound/hda/trace.h b/sound/hda/trace.h
> index 33a7eb5..e27e2c0 100644
> --- a/sound/hda/trace.h
> +++ b/sound/hda/trace.h
> @@ -50,6 +50,33 @@ TRACE_EVENT(hda_unsol_event,
>  	),
>  	TP_printk("%s", __get_str(msg))
>  );
> +
> +DECLARE_EVENT_CLASS(hdac_stream,
> +	TP_PROTO(struct hdac_bus *bus, struct hdac_stream *azx_dev),
> +
> +	TP_ARGS(bus, azx_dev),
> +
> +	TP_STRUCT__entry(
> +		__field(unsigned char, stream_tag)
> +	),
> +
> +	TP_fast_assign(
> +		__entry->stream_tag = (azx_dev)->stream_tag;
> +	),
> +
> +	TP_printk("stream_tag: %d", __entry->stream_tag)
> +);
> +
> +DEFINE_EVENT(hdac_stream, snd_hdac_stream_start,
> +	TP_PROTO(struct hdac_bus *bus, struct hdac_stream *azx_dev),
> +	TP_ARGS(bus, azx_dev)
> +);
> +
> +DEFINE_EVENT(hdac_stream, snd_hdac_stream_stop,
> +	TP_PROTO(struct hdac_bus *bus, struct hdac_stream *azx_dev),
> +	TP_ARGS(bus, azx_dev)
> +);
> +
>  #endif /* __HDAC_TRACE_H */
>  
>  /* This part must be outside protection */
> -- 
> 1.9.1
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-05-18  8:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-12  1:43 [PATCH 1/3] ALSA: hda - add hdac stream trace libin.yang
2015-05-12  1:43 ` [PATCH 2/3] ALSA: hda - rename hda_intel_trace.h to hda_controller_trace.h libin.yang
2015-05-12  1:43 ` [PATCH 3/3] ALSA: hda - add hda_intel_trace.h libin.yang
2015-05-18  8:11 ` [PATCH 1/3] ALSA: hda - add hdac stream trace Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox