summaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorDima Zavin <dima@android.com>2010-11-08 13:58:04 -0800
committerDima Zavin <dima@android.com>2010-11-09 18:48:07 -0800
commit5b5e9b563d64abf9ecbbb1c3fa5804ed5493bb8b (patch)
treef9c948ca17d47cedfe2ab66fe479132e85a8dfd9 /drivers/media
parent1ce38cb459a3178a48d10cc42102733782114594 (diff)
media: video: tegra: add debugfs entry for tegra_rpc
For now just includes the existing ports, the peer owners, and the port and peer state. Change-Id: I2c6b603ca02dc48acc1c763380ff0f1cb66f482b Signed-off-by: Dima Zavin <dima@android.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/tegra/avp/tegra_rpc.c58
-rw-r--r--drivers/media/video/tegra/avp/trpc.h3
2 files changed, 61 insertions, 0 deletions
diff --git a/drivers/media/video/tegra/avp/tegra_rpc.c b/drivers/media/video/tegra/avp/tegra_rpc.c
index c4e707e9a89e..f7fe78d5d5d2 100644
--- a/drivers/media/video/tegra/avp/tegra_rpc.c
+++ b/drivers/media/video/tegra/avp/tegra_rpc.c
@@ -18,6 +18,7 @@
*
*/
+#include <linux/debugfs.h>
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/kref.h>
@@ -26,6 +27,7 @@
#include <linux/mutex.h>
#include <linux/rbtree.h>
#include <linux/sched.h>
+#include <linux/seq_file.h>
#include <linux/slab.h>
#include <linux/tegra_rpc.h>
#include <linux/types.h>
@@ -92,6 +94,7 @@ struct trpc_msg {
};
static struct tegra_rpc_info *tegra_rpc;
+static struct dentry *trpc_debug_root;
static struct trpc_msg *dequeue_msg_locked(struct trpc_endpoint *ep);
@@ -704,6 +707,59 @@ void trpc_node_unregister(struct trpc_node *node)
mutex_unlock(&info->node_lock);
}
+static int trpc_debug_ports_show(struct seq_file *s, void *data)
+{
+ struct tegra_rpc_info *info = s->private;
+ struct rb_node *n;
+ unsigned long flags;
+ int i;
+
+ spin_lock_irqsave(&info->ports_lock, flags);
+ for (n = rb_first(&info->ports); n; n = rb_next(n)) {
+ struct trpc_port *port = rb_entry(n, struct trpc_port, rb_node);
+ seq_printf(s, "port: %s\n closed:%s\n", port->name,
+ port->closed ? "yes" : "no");
+
+ spin_lock(&port->lock);
+ for (i = 0; i < ARRAY_SIZE(port->peers); i++) {
+ struct trpc_endpoint *ep = &port->peers[i];
+ seq_printf(s, " peer%d: %s\n ready:%s\n", i,
+ ep->owner ? ep->owner->name: "<none>",
+ ep->ready ? "yes" : "no");
+ if (ep->ops && ep->ops->show)
+ ep->ops->show(s, ep);
+ }
+ spin_unlock(&port->lock);
+ }
+ spin_unlock_irqrestore(&info->ports_lock, flags);
+
+ return 0;
+}
+
+static int trpc_debug_ports_open(struct inode *inode, struct file *file)
+{
+ return single_open(file, trpc_debug_ports_show, inode->i_private);
+}
+
+static struct file_operations trpc_debug_ports_fops = {
+ .open = trpc_debug_ports_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
+};
+
+static void trpc_debug_init(struct tegra_rpc_info *info)
+{
+ trpc_debug_root = debugfs_create_dir("tegra_rpc", NULL);
+ if (IS_ERR_OR_NULL(trpc_debug_root)) {
+ pr_err("%s: couldn't create debug files\n", __func__);
+ return;
+ }
+
+ debugfs_create_file("ports", 0664, trpc_debug_root, info,
+ &trpc_debug_ports_fops);
+}
+
static int __init tegra_rpc_init(void)
{
struct tegra_rpc_info *rpc_info;
@@ -726,6 +782,8 @@ static int __init tegra_rpc_init(void)
ret = -ENOMEM;
goto err_kmem_cache;
}
+
+ trpc_debug_init(rpc_info);
tegra_rpc = rpc_info;
return 0;
diff --git a/drivers/media/video/tegra/avp/trpc.h b/drivers/media/video/tegra/avp/trpc.h
index 859c94e7460c..e7b0d2d55788 100644
--- a/drivers/media/video/tegra/avp/trpc.h
+++ b/drivers/media/video/tegra/avp/trpc.h
@@ -19,6 +19,7 @@
#define __ARM_MACH_TEGRA_RPC_H
#include <linux/list.h>
+#include <linux/seq_file.h>
#include <linux/tegra_rpc.h>
struct trpc_endpoint;
@@ -29,6 +30,8 @@ struct trpc_ep_ops {
void (*notify_recv)(struct trpc_endpoint *ep);
/* close is allowed to sleep */
void (*close)(struct trpc_endpoint *ep);
+ /* not allowed to sleep, not allowed to call back into trpc */
+ void (*show)(struct seq_file *s, struct trpc_endpoint *ep);
};
enum {