ALSA: hda - add hdac stream trace
PATCH 1/3 ALSA: hda - add hdac stream trace
From: Libin Yang <[email protected]>
Add the trace of snd_hdac_stream_start and snd_hdac_stream_stop.
--- sound/hda/hdac_stream.c | 5 +++++ sound/hda/trace.h | 27 +++++++++++++++++++++++++++ 2 files changed, 32 insertions(+)
sound/hda/hdac_stream.c +5 -0
@@ -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 );
sound/hda/trace.h +27 -0
@@ -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 */
Signature · 1 line
1.9.1
PATCH 2/3 ALSA: hda - rename hda_intel_trace.h to hda_controller_trace.h
From: Libin Yang <[email protected]>
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.
--- 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
sound/pci/hda/hda_controller.c +5 -1
@@ -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;
sound/pci/hda/hda_controller_trace.h new file +98 -0
98 lines not on this page · raw message
sound/pci/hda/hda_intel_trace.h +0 -62
62 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH 3/3 ALSA: hda - add hda_intel_trace.h
In reply to [email protected]From: Libin Yang <[email protected]>
This patch creates hda_intel_trace.h to add some pm trace functions used in hda_intel.c
--- 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(+)
sound/pci/hda/Makefile +1 -0
@@ -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
sound/pci/hda/hda_intel.c +9 -0
@@ -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 ; }
sound/pci/hda/hda_intel_trace.h +53 -0
53 lines not on this page · raw message
Signature · 1 line
1.9.1
Takashi Iwai
AppliedAt Tue, 12 May 2015 09:43:20 +0800,
Quoted 6 lines · [email protected] wrote:
From: Libin Yang <[email protected]>
Add the trace of
snd_hdac_stream_startandsnd_hdac_stream_stop.Signed-off-by Libin Yang <[email protected]>
Applied all three patches. Thanks.
Takashi
Quoted 76 lines
--- sound/hda/hdac_stream.c | 5 +++++ sound/hda/trace.h | 27 +++++++++++++++++++++++++++ 2 files changed, 32 insertions(+)sound/hda/hdac_stream.c +5
-0@@ -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 );sound/hda/trace.h +27
-0@@ -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 */ Signature · 1 line
1.9.1