mirror of
https://github.com/torvalds/linux.git
synced 2024-12-11 05:33:09 +00:00
ALSA: hda - Add basic tracepoints
Add a few tracepoints to HD-audio driver. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
c3540b81ee
commit
d66fee5d65
@ -6,6 +6,9 @@ snd-hda-codec-$(CONFIG_PROC_FS) += hda_proc.o
|
||||
snd-hda-codec-$(CONFIG_SND_HDA_HWDEP) += hda_hwdep.o
|
||||
snd-hda-codec-$(CONFIG_SND_HDA_INPUT_BEEP) += hda_beep.o
|
||||
|
||||
# for trace-points
|
||||
CFLAGS_hda_codec.o := -I$(src)
|
||||
|
||||
snd-hda-codec-realtek-objs := patch_realtek.o
|
||||
snd-hda-codec-cmedia-objs := patch_cmedia.o
|
||||
snd-hda-codec-analog-objs := patch_analog.o
|
||||
|
@ -34,6 +34,9 @@
|
||||
#include "hda_beep.h"
|
||||
#include <sound/hda_hwdep.h>
|
||||
|
||||
#define CREATE_TRACE_POINTS
|
||||
#include "hda_trace.h"
|
||||
|
||||
/*
|
||||
* vendor / preset table
|
||||
*/
|
||||
@ -208,15 +211,19 @@ static int codec_exec_verb(struct hda_codec *codec, unsigned int cmd,
|
||||
again:
|
||||
snd_hda_power_up(codec);
|
||||
mutex_lock(&bus->cmd_mutex);
|
||||
trace_hda_send_cmd(codec, cmd);
|
||||
err = bus->ops.command(bus, cmd);
|
||||
if (!err && res)
|
||||
if (!err && res) {
|
||||
*res = bus->ops.get_response(bus, codec->addr);
|
||||
trace_hda_get_response(codec, *res);
|
||||
}
|
||||
mutex_unlock(&bus->cmd_mutex);
|
||||
snd_hda_power_down(codec);
|
||||
if (res && *res == -1 && bus->rirb_error) {
|
||||
if (bus->response_reset) {
|
||||
snd_printd("hda_codec: resetting BUS due to "
|
||||
"fatal communication error\n");
|
||||
trace_hda_bus_reset(bus);
|
||||
bus->ops.bus_reset(bus);
|
||||
}
|
||||
goto again;
|
||||
@ -4083,6 +4090,7 @@ static void hda_power_work(struct work_struct *work)
|
||||
return;
|
||||
}
|
||||
|
||||
trace_hda_power_down(codec);
|
||||
hda_call_codec_suspend(codec);
|
||||
if (bus->ops.pm_notify)
|
||||
bus->ops.pm_notify(bus);
|
||||
@ -4121,6 +4129,7 @@ void snd_hda_power_up(struct hda_codec *codec)
|
||||
if (codec->power_on || codec->power_transition)
|
||||
return;
|
||||
|
||||
trace_hda_power_up(codec);
|
||||
snd_hda_update_power_acct(codec);
|
||||
codec->power_on = 1;
|
||||
codec->power_jiffies = jiffies;
|
||||
|
95
sound/pci/hda/hda_trace.h
Normal file
95
sound/pci/hda/hda_trace.h
Normal file
@ -0,0 +1,95 @@
|
||||
#undef TRACE_SYSTEM
|
||||
#define TRACE_SYSTEM hda
|
||||
#define TRACE_INCLUDE_FILE hda_trace
|
||||
|
||||
#if !defined(_TRACE_HDA_H) || defined(TRACE_HEADER_MULTI_READ)
|
||||
#define _TRACE_HDA_H
|
||||
|
||||
#include <linux/tracepoint.h>
|
||||
|
||||
struct hda_bus;
|
||||
struct hda_codec;
|
||||
|
||||
DECLARE_EVENT_CLASS(hda_cmd,
|
||||
|
||||
TP_PROTO(struct hda_codec *codec, unsigned int val),
|
||||
|
||||
TP_ARGS(codec, val),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field( unsigned int, card )
|
||||
__field( unsigned int, addr )
|
||||
__field( unsigned int, val )
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->card = (codec)->bus->card->number;
|
||||
__entry->addr = (codec)->addr;
|
||||
__entry->val = (val);
|
||||
),
|
||||
|
||||
TP_printk("[%d:%d] val=%x", __entry->card, __entry->addr, __entry->val)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(hda_cmd, hda_send_cmd,
|
||||
TP_PROTO(struct hda_codec *codec, unsigned int val),
|
||||
TP_ARGS(codec, val)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(hda_cmd, hda_get_response,
|
||||
TP_PROTO(struct hda_codec *codec, unsigned int val),
|
||||
TP_ARGS(codec, val)
|
||||
);
|
||||
|
||||
TRACE_EVENT(hda_bus_reset,
|
||||
|
||||
TP_PROTO(struct hda_bus *bus),
|
||||
|
||||
TP_ARGS(bus),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field( unsigned int, card )
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->card = (bus)->card->number;
|
||||
),
|
||||
|
||||
TP_printk("[%d]", __entry->card)
|
||||
);
|
||||
|
||||
DECLARE_EVENT_CLASS(hda_power,
|
||||
|
||||
TP_PROTO(struct hda_codec *codec),
|
||||
|
||||
TP_ARGS(codec),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field( unsigned int, card )
|
||||
__field( unsigned int, addr )
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->card = (codec)->bus->card->number;
|
||||
__entry->addr = (codec)->addr;
|
||||
),
|
||||
|
||||
TP_printk("[%d:%d]", __entry->card, __entry->addr)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(hda_power, hda_power_down,
|
||||
TP_PROTO(struct hda_codec *codec),
|
||||
TP_ARGS(codec)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(hda_power, hda_power_up,
|
||||
TP_PROTO(struct hda_codec *codec),
|
||||
TP_ARGS(codec)
|
||||
);
|
||||
|
||||
#endif /* _TRACE_HDA_H */
|
||||
|
||||
/* This part must be outside protection */
|
||||
#undef TRACE_INCLUDE_PATH
|
||||
#define TRACE_INCLUDE_PATH .
|
||||
#include <trace/define_trace.h>
|
Loading…
Reference in New Issue
Block a user