aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorMarcin Slusarz <marcin.slusarz@gmail.com>2013-02-08 15:42:13 -0500
committerBen Skeggs <bskeggs@redhat.com>2013-02-20 05:46:34 -0500
commit33b903e82873ba9233bd89c44d016b87347ed158 (patch)
tree3e8e6a1cdcfc6bc07a22ad21e4d73e1924686dfb /drivers/gpu/drm
parenteff76ed7881842ffcd2d77cf217eabcb1134b38b (diff)
drm/nouveau: restore debugfs/vbios.rom support
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/nouveau/Makefile1
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_debugfs.c64
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_debugfs.h22
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drm.c6
4 files changed, 93 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/Makefile b/drivers/gpu/drm/nouveau/Makefile
index 51d09729fc56..90f9140eeefd 100644
--- a/drivers/gpu/drm/nouveau/Makefile
+++ b/drivers/gpu/drm/nouveau/Makefile
@@ -242,5 +242,6 @@ ifdef CONFIG_X86
242nouveau-$(CONFIG_ACPI) += nouveau_acpi.o 242nouveau-$(CONFIG_ACPI) += nouveau_acpi.o
243endif 243endif
244nouveau-$(CONFIG_DRM_NOUVEAU_BACKLIGHT) += nouveau_backlight.o 244nouveau-$(CONFIG_DRM_NOUVEAU_BACKLIGHT) += nouveau_backlight.o
245nouveau-$(CONFIG_DEBUG_FS) += nouveau_debugfs.o
245 246
246obj-$(CONFIG_DRM_NOUVEAU)+= nouveau.o 247obj-$(CONFIG_DRM_NOUVEAU)+= nouveau.o
diff --git a/drivers/gpu/drm/nouveau/nouveau_debugfs.c b/drivers/gpu/drm/nouveau/nouveau_debugfs.c
new file mode 100644
index 000000000000..5392e07edfc6
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nouveau_debugfs.c
@@ -0,0 +1,64 @@
1/*
2 * Copyright (C) 2009 Red Hat <bskeggs@redhat.com>
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sublicense, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the
13 * next paragraph) shall be included in all copies or substantial
14 * portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
20 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 *
24 */
25
26/*
27 * Authors:
28 * Ben Skeggs <bskeggs@redhat.com>
29 */
30
31#include "nouveau_debugfs.h"
32#include "nouveau_drm.h"
33
34static int
35nouveau_debugfs_vbios_image(struct seq_file *m, void *data)
36{
37 struct drm_info_node *node = (struct drm_info_node *) m->private;
38 struct nouveau_drm *drm = nouveau_drm(node->minor->dev);
39 int i;
40
41 for (i = 0; i < drm->vbios.length; i++)
42 seq_printf(m, "%c", drm->vbios.data[i]);
43 return 0;
44}
45
46static struct drm_info_list nouveau_debugfs_list[] = {
47 { "vbios.rom", nouveau_debugfs_vbios_image, 0, NULL },
48};
49#define NOUVEAU_DEBUGFS_ENTRIES ARRAY_SIZE(nouveau_debugfs_list)
50
51int
52nouveau_debugfs_init(struct drm_minor *minor)
53{
54 drm_debugfs_create_files(nouveau_debugfs_list, NOUVEAU_DEBUGFS_ENTRIES,
55 minor->debugfs_root, minor);
56 return 0;
57}
58
59void
60nouveau_debugfs_takedown(struct drm_minor *minor)
61{
62 drm_debugfs_remove_files(nouveau_debugfs_list, NOUVEAU_DEBUGFS_ENTRIES,
63 minor);
64}
diff --git a/drivers/gpu/drm/nouveau/nouveau_debugfs.h b/drivers/gpu/drm/nouveau/nouveau_debugfs.h
new file mode 100644
index 000000000000..a62af6fb5f99
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nouveau_debugfs.h
@@ -0,0 +1,22 @@
1#ifndef __NOUVEAU_DEBUGFS_H__
2#define __NOUVEAU_DEBUGFS_H__
3
4#include <drm/drmP.h>
5
6#if defined(CONFIG_DEBUG_FS)
7extern int nouveau_debugfs_init(struct drm_minor *);
8extern void nouveau_debugfs_takedown(struct drm_minor *);
9#else
10static inline int
11nouveau_debugfs_init(struct drm_minor *minor)
12{
13 return 0;
14}
15
16static inline void nouveau_debugfs_takedown(struct drm_minor *minor)
17{
18}
19
20#endif
21
22#endif
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index f9144910b78e..b1c4ce1cf2f2 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -50,6 +50,7 @@
50#include "nouveau_abi16.h" 50#include "nouveau_abi16.h"
51#include "nouveau_fbcon.h" 51#include "nouveau_fbcon.h"
52#include "nouveau_fence.h" 52#include "nouveau_fence.h"
53#include "nouveau_debugfs.h"
53 54
54MODULE_PARM_DESC(config, "option string to pass to driver core"); 55MODULE_PARM_DESC(config, "option string to pass to driver core");
55static char *nouveau_config; 56static char *nouveau_config;
@@ -667,6 +668,11 @@ driver = {
667 .postclose = nouveau_drm_postclose, 668 .postclose = nouveau_drm_postclose,
668 .lastclose = nouveau_vga_lastclose, 669 .lastclose = nouveau_vga_lastclose,
669 670
671#if defined(CONFIG_DEBUG_FS)
672 .debugfs_init = nouveau_debugfs_init,
673 .debugfs_cleanup = nouveau_debugfs_takedown,
674#endif
675
670 .irq_preinstall = nouveau_irq_preinstall, 676 .irq_preinstall = nouveau_irq_preinstall,
671 .irq_postinstall = nouveau_irq_postinstall, 677 .irq_postinstall = nouveau_irq_postinstall,
672 .irq_uninstall = nouveau_irq_uninstall, 678 .irq_uninstall = nouveau_irq_uninstall,