staging: csr: Remove unneeded UF_NETIF_TX_* macros
[linux-2.6.git] / drivers / staging / omapdrm / omap_debugfs.c
blob2f122e00b51da07ad7c29e7c4f868ad2bb4ce7b7
1 /*
2 * drivers/staging/omapdrm/omap_debugfs.c
4 * Copyright (C) 2011 Texas Instruments
5 * Author: Rob Clark <rob.clark@linaro.org>
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
16 * You should have received a copy of the GNU General Public License along with
17 * this program. If not, see <http://www.gnu.org/licenses/>.
20 #include "omap_drv.h"
21 #include "omap_dmm_tiler.h"
23 #include "drm_fb_helper.h"
26 #ifdef CONFIG_DEBUG_FS
28 static int gem_show(struct seq_file *m, void *arg)
30 struct drm_info_node *node = (struct drm_info_node *) m->private;
31 struct drm_device *dev = node->minor->dev;
32 struct omap_drm_private *priv = dev->dev_private;
33 int ret;
35 ret = mutex_lock_interruptible(&dev->struct_mutex);
36 if (ret)
37 return ret;
39 seq_printf(m, "All Objects:\n");
40 omap_gem_describe_objects(&priv->obj_list, m);
42 mutex_unlock(&dev->struct_mutex);
44 return 0;
47 static int mm_show(struct seq_file *m, void *arg)
49 struct drm_info_node *node = (struct drm_info_node *) m->private;
50 struct drm_device *dev = node->minor->dev;
51 return drm_mm_dump_table(m, dev->mm_private);
54 static int fb_show(struct seq_file *m, void *arg)
56 struct drm_info_node *node = (struct drm_info_node *) m->private;
57 struct drm_device *dev = node->minor->dev;
58 struct omap_drm_private *priv = dev->dev_private;
59 struct drm_framebuffer *fb;
60 int ret;
62 ret = mutex_lock_interruptible(&dev->mode_config.mutex);
63 if (ret)
64 return ret;
66 ret = mutex_lock_interruptible(&dev->struct_mutex);
67 if (ret) {
68 mutex_unlock(&dev->mode_config.mutex);
69 return ret;
72 seq_printf(m, "fbcon ");
73 omap_framebuffer_describe(priv->fbdev->fb, m);
75 list_for_each_entry(fb, &dev->mode_config.fb_list, head) {
76 if (fb == priv->fbdev->fb)
77 continue;
79 seq_printf(m, "user ");
80 omap_framebuffer_describe(fb, m);
83 mutex_unlock(&dev->struct_mutex);
84 mutex_unlock(&dev->mode_config.mutex);
86 return 0;
89 /* list of debufs files that are applicable to all devices */
90 static struct drm_info_list omap_debugfs_list[] = {
91 {"gem", gem_show, 0},
92 {"mm", mm_show, 0},
93 {"fb", fb_show, 0},
96 /* list of debugfs files that are specific to devices with dmm/tiler */
97 static struct drm_info_list omap_dmm_debugfs_list[] = {
98 {"tiler_map", tiler_map_show, 0},
101 int omap_debugfs_init(struct drm_minor *minor)
103 struct drm_device *dev = minor->dev;
104 int ret;
106 ret = drm_debugfs_create_files(omap_debugfs_list,
107 ARRAY_SIZE(omap_debugfs_list),
108 minor->debugfs_root, minor);
110 if (ret) {
111 dev_err(dev->dev, "could not install omap_debugfs_list\n");
112 return ret;
115 if (dmm_is_available())
116 ret = drm_debugfs_create_files(omap_dmm_debugfs_list,
117 ARRAY_SIZE(omap_dmm_debugfs_list),
118 minor->debugfs_root, minor);
120 if (ret) {
121 dev_err(dev->dev, "could not install omap_dmm_debugfs_list\n");
122 return ret;
125 return ret;
128 void omap_debugfs_cleanup(struct drm_minor *minor)
130 drm_debugfs_remove_files(omap_debugfs_list,
131 ARRAY_SIZE(omap_debugfs_list), minor);
132 if (dmm_is_available())
133 drm_debugfs_remove_files(omap_dmm_debugfs_list,
134 ARRAY_SIZE(omap_dmm_debugfs_list), minor);
137 #endif