Commit 3028eb8c authored by Mark Brown's avatar Mark Brown

ASoC: Add trace events for jack detection

As jack detection can trigger DAPM and the latency in debouncing can create
confusing windows in operation provide some trace events which will hopefully
help in diagnostics. The soc-jack core traces all reports that it gets and
the resulting notifications to upper layers. An event for jack IRQs is also
provided for instrumentation of debounce, and used in the GPIO jack code.
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
parent 1badabd9
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <linux/ktime.h> #include <linux/ktime.h>
#include <linux/tracepoint.h> #include <linux/tracepoint.h>
struct snd_soc_jack;
struct snd_soc_codec; struct snd_soc_codec;
struct snd_soc_card; struct snd_soc_card;
struct snd_soc_dapm_widget; struct snd_soc_dapm_widget;
...@@ -170,6 +171,64 @@ DEFINE_EVENT(snd_soc_dapm_widget, snd_soc_dapm_widget_event_done, ...@@ -170,6 +171,64 @@ DEFINE_EVENT(snd_soc_dapm_widget, snd_soc_dapm_widget_event_done,
); );
TRACE_EVENT(snd_soc_jack_irq,
TP_PROTO(const char *name),
TP_ARGS(name),
TP_STRUCT__entry(
__string( name, name )
),
TP_fast_assign(
__assign_str(name, name);
),
TP_printk("%s", __get_str(name))
);
TRACE_EVENT(snd_soc_jack_report,
TP_PROTO(struct snd_soc_jack *jack, int mask, int val),
TP_ARGS(jack, mask, val),
TP_STRUCT__entry(
__string( name, jack->jack->name )
__field( int, mask )
__field( int, val )
),
TP_fast_assign(
__assign_str(name, jack->jack->name);
__entry->mask = mask;
__entry->val = val;
),
TP_printk("jack=%s %x/%x", __get_str(name), (int)__entry->val,
(int)__entry->mask)
);
TRACE_EVENT(snd_soc_jack_notify,
TP_PROTO(struct snd_soc_jack *jack, int val),
TP_ARGS(jack, val),
TP_STRUCT__entry(
__string( name, jack->jack->name )
__field( int, val )
),
TP_fast_assign(
__assign_str(name, jack->jack->name);
__entry->val = val;
),
TP_printk("jack=%s %x", __get_str(name), (int)__entry->val)
);
#endif /* _TRACE_ASOC_H */ #endif /* _TRACE_ASOC_H */
/* This part must be outside protection */ /* This part must be outside protection */
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <sound/ac97_codec.h> #include <sound/ac97_codec.h>
#include <sound/core.h> #include <sound/core.h>
#include <sound/jack.h>
#include <sound/pcm.h> #include <sound/pcm.h>
#include <sound/pcm_params.h> #include <sound/pcm_params.h>
#include <sound/soc.h> #include <sound/soc.h>
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <trace/events/asoc.h>
/** /**
* snd_soc_jack_new - Create a new jack * snd_soc_jack_new - Create a new jack
...@@ -64,6 +65,8 @@ void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask) ...@@ -64,6 +65,8 @@ void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask)
int enable; int enable;
int oldstatus; int oldstatus;
trace_snd_soc_jack_report(jack, mask, status);
if (!jack) if (!jack)
return; return;
...@@ -82,6 +85,8 @@ void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask) ...@@ -82,6 +85,8 @@ void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask)
if (mask && (jack->status == oldstatus)) if (mask && (jack->status == oldstatus))
goto out; goto out;
trace_snd_soc_jack_notify(jack, status);
list_for_each_entry(pin, &jack->pins, list) { list_for_each_entry(pin, &jack->pins, list) {
enable = pin->mask & jack->status; enable = pin->mask & jack->status;
...@@ -210,6 +215,8 @@ static irqreturn_t gpio_handler(int irq, void *data) ...@@ -210,6 +215,8 @@ static irqreturn_t gpio_handler(int irq, void *data)
struct snd_soc_jack_gpio *gpio = data; struct snd_soc_jack_gpio *gpio = data;
struct device *dev = gpio->jack->codec->card->dev; struct device *dev = gpio->jack->codec->card->dev;
trace_snd_soc_jack_irq(gpio->name);
if (device_may_wakeup(dev)) if (device_may_wakeup(dev))
pm_wakeup_event(dev, gpio->debounce_time + 50); pm_wakeup_event(dev, gpio->debounce_time + 50);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment