diff options
Diffstat (limited to 'drivers/video/fbdev/mbx/mbxdebugfs.c')
-rw-r--r-- | drivers/video/fbdev/mbx/mbxdebugfs.c | 251 |
1 files changed, 251 insertions, 0 deletions
diff --git a/drivers/video/fbdev/mbx/mbxdebugfs.c b/drivers/video/fbdev/mbx/mbxdebugfs.c new file mode 100644 index 000000000000..4449f249b0e7 --- /dev/null +++ b/drivers/video/fbdev/mbx/mbxdebugfs.c | |||
@@ -0,0 +1,251 @@ | |||
1 | #include <linux/debugfs.h> | ||
2 | #include <linux/slab.h> | ||
3 | |||
4 | #define BIG_BUFFER_SIZE (1024) | ||
5 | |||
6 | static char big_buffer[BIG_BUFFER_SIZE]; | ||
7 | |||
8 | struct mbxfb_debugfs_data { | ||
9 | struct dentry *dir; | ||
10 | struct dentry *sysconf; | ||
11 | struct dentry *clock; | ||
12 | struct dentry *display; | ||
13 | struct dentry *gsctl; | ||
14 | struct dentry *sdram; | ||
15 | struct dentry *misc; | ||
16 | }; | ||
17 | |||
18 | static int open_file_generic(struct inode *inode, struct file *file) | ||
19 | { | ||
20 | file->private_data = inode->u.generic_ip; | ||
21 | return 0; | ||
22 | } | ||
23 | |||
24 | static ssize_t write_file_dummy(struct file *file, const char __user *buf, | ||
25 | size_t count, loff_t *ppos) | ||
26 | { | ||
27 | return count; | ||
28 | } | ||
29 | |||
30 | static ssize_t sysconf_read_file(struct file *file, char __user *userbuf, | ||
31 | size_t count, loff_t *ppos) | ||
32 | { | ||
33 | char * s = big_buffer; | ||
34 | |||
35 | s += sprintf(s, "SYSCFG = %08x\n", readl(SYSCFG)); | ||
36 | s += sprintf(s, "PFBASE = %08x\n", readl(PFBASE)); | ||
37 | s += sprintf(s, "PFCEIL = %08x\n", readl(PFCEIL)); | ||
38 | s += sprintf(s, "POLLFLAG = %08x\n", readl(POLLFLAG)); | ||
39 | s += sprintf(s, "SYSRST = %08x\n", readl(SYSRST)); | ||
40 | |||
41 | return simple_read_from_buffer(userbuf, count, ppos, | ||
42 | big_buffer, s-big_buffer); | ||
43 | } | ||
44 | |||
45 | |||
46 | static ssize_t gsctl_read_file(struct file *file, char __user *userbuf, | ||
47 | size_t count, loff_t *ppos) | ||
48 | { | ||
49 | char * s = big_buffer; | ||
50 | |||
51 | s += sprintf(s, "GSCTRL = %08x\n", readl(GSCTRL)); | ||
52 | s += sprintf(s, "VSCTRL = %08x\n", readl(VSCTRL)); | ||
53 | s += sprintf(s, "GBBASE = %08x\n", readl(GBBASE)); | ||
54 | s += sprintf(s, "VBBASE = %08x\n", readl(VBBASE)); | ||
55 | s += sprintf(s, "GDRCTRL = %08x\n", readl(GDRCTRL)); | ||
56 | s += sprintf(s, "VCMSK = %08x\n", readl(VCMSK)); | ||
57 | s += sprintf(s, "GSCADR = %08x\n", readl(GSCADR)); | ||
58 | s += sprintf(s, "VSCADR = %08x\n", readl(VSCADR)); | ||
59 | s += sprintf(s, "VUBASE = %08x\n", readl(VUBASE)); | ||
60 | s += sprintf(s, "VVBASE = %08x\n", readl(VVBASE)); | ||
61 | s += sprintf(s, "GSADR = %08x\n", readl(GSADR)); | ||
62 | s += sprintf(s, "VSADR = %08x\n", readl(VSADR)); | ||
63 | s += sprintf(s, "HCCTRL = %08x\n", readl(HCCTRL)); | ||
64 | s += sprintf(s, "HCSIZE = %08x\n", readl(HCSIZE)); | ||
65 | s += sprintf(s, "HCPOS = %08x\n", readl(HCPOS)); | ||
66 | s += sprintf(s, "HCBADR = %08x\n", readl(HCBADR)); | ||
67 | s += sprintf(s, "HCCKMSK = %08x\n", readl(HCCKMSK)); | ||
68 | s += sprintf(s, "GPLUT = %08x\n", readl(GPLUT)); | ||
69 | |||
70 | return simple_read_from_buffer(userbuf, count, ppos, | ||
71 | big_buffer, s-big_buffer); | ||
72 | } | ||
73 | |||
74 | static ssize_t display_read_file(struct file *file, char __user *userbuf, | ||
75 | size_t count, loff_t *ppos) | ||
76 | { | ||
77 | char * s = big_buffer; | ||
78 | |||
79 | s += sprintf(s, "DSCTRL = %08x\n", readl(DSCTRL)); | ||
80 | s += sprintf(s, "DHT01 = %08x\n", readl(DHT01)); | ||
81 | s += sprintf(s, "DHT02 = %08x\n", readl(DHT02)); | ||
82 | s += sprintf(s, "DHT03 = %08x\n", readl(DHT03)); | ||
83 | s += sprintf(s, "DVT01 = %08x\n", readl(DVT01)); | ||
84 | s += sprintf(s, "DVT02 = %08x\n", readl(DVT02)); | ||
85 | s += sprintf(s, "DVT03 = %08x\n", readl(DVT03)); | ||
86 | s += sprintf(s, "DBCOL = %08x\n", readl(DBCOL)); | ||
87 | s += sprintf(s, "BGCOLOR = %08x\n", readl(BGCOLOR)); | ||
88 | s += sprintf(s, "DINTRS = %08x\n", readl(DINTRS)); | ||
89 | s += sprintf(s, "DINTRE = %08x\n", readl(DINTRE)); | ||
90 | s += sprintf(s, "DINTRCNT = %08x\n", readl(DINTRCNT)); | ||
91 | s += sprintf(s, "DSIG = %08x\n", readl(DSIG)); | ||
92 | s += sprintf(s, "DMCTRL = %08x\n", readl(DMCTRL)); | ||
93 | s += sprintf(s, "CLIPCTRL = %08x\n", readl(CLIPCTRL)); | ||
94 | s += sprintf(s, "SPOCTRL = %08x\n", readl(SPOCTRL)); | ||
95 | s += sprintf(s, "SVCTRL = %08x\n", readl(SVCTRL)); | ||
96 | s += sprintf(s, "DLSTS = %08x\n", readl(DLSTS)); | ||
97 | s += sprintf(s, "DLLCTRL = %08x\n", readl(DLLCTRL)); | ||
98 | s += sprintf(s, "DVLNUM = %08x\n", readl(DVLNUM)); | ||
99 | s += sprintf(s, "DUCTRL = %08x\n", readl(DUCTRL)); | ||
100 | s += sprintf(s, "DVECTRL = %08x\n", readl(DVECTRL)); | ||
101 | s += sprintf(s, "DHDET = %08x\n", readl(DHDET)); | ||
102 | s += sprintf(s, "DVDET = %08x\n", readl(DVDET)); | ||
103 | s += sprintf(s, "DODMSK = %08x\n", readl(DODMSK)); | ||
104 | s += sprintf(s, "CSC01 = %08x\n", readl(CSC01)); | ||
105 | s += sprintf(s, "CSC02 = %08x\n", readl(CSC02)); | ||
106 | s += sprintf(s, "CSC03 = %08x\n", readl(CSC03)); | ||
107 | s += sprintf(s, "CSC04 = %08x\n", readl(CSC04)); | ||
108 | s += sprintf(s, "CSC05 = %08x\n", readl(CSC05)); | ||
109 | |||
110 | return simple_read_from_buffer(userbuf, count, ppos, | ||
111 | big_buffer, s-big_buffer); | ||
112 | } | ||
113 | |||
114 | static ssize_t clock_read_file(struct file *file, char __user *userbuf, | ||
115 | size_t count, loff_t *ppos) | ||
116 | { | ||
117 | char * s = big_buffer; | ||
118 | |||
119 | s += sprintf(s, "SYSCLKSRC = %08x\n", readl(SYSCLKSRC)); | ||
120 | s += sprintf(s, "PIXCLKSRC = %08x\n", readl(PIXCLKSRC)); | ||
121 | s += sprintf(s, "CLKSLEEP = %08x\n", readl(CLKSLEEP)); | ||
122 | s += sprintf(s, "COREPLL = %08x\n", readl(COREPLL)); | ||
123 | s += sprintf(s, "DISPPLL = %08x\n", readl(DISPPLL)); | ||
124 | s += sprintf(s, "PLLSTAT = %08x\n", readl(PLLSTAT)); | ||
125 | s += sprintf(s, "VOVRCLK = %08x\n", readl(VOVRCLK)); | ||
126 | s += sprintf(s, "PIXCLK = %08x\n", readl(PIXCLK)); | ||
127 | s += sprintf(s, "MEMCLK = %08x\n", readl(MEMCLK)); | ||
128 | s += sprintf(s, "M24CLK = %08x\n", readl(M24CLK)); | ||
129 | s += sprintf(s, "MBXCLK = %08x\n", readl(MBXCLK)); | ||
130 | s += sprintf(s, "SDCLK = %08x\n", readl(SDCLK)); | ||
131 | s += sprintf(s, "PIXCLKDIV = %08x\n", readl(PIXCLKDIV)); | ||
132 | |||
133 | return simple_read_from_buffer(userbuf, count, ppos, | ||
134 | big_buffer, s-big_buffer); | ||
135 | } | ||
136 | |||
137 | static ssize_t sdram_read_file(struct file *file, char __user *userbuf, | ||
138 | size_t count, loff_t *ppos) | ||
139 | { | ||
140 | char * s = big_buffer; | ||
141 | |||
142 | s += sprintf(s, "LMRST = %08x\n", readl(LMRST)); | ||
143 | s += sprintf(s, "LMCFG = %08x\n", readl(LMCFG)); | ||
144 | s += sprintf(s, "LMPWR = %08x\n", readl(LMPWR)); | ||
145 | s += sprintf(s, "LMPWRSTAT = %08x\n", readl(LMPWRSTAT)); | ||
146 | s += sprintf(s, "LMCEMR = %08x\n", readl(LMCEMR)); | ||
147 | s += sprintf(s, "LMTYPE = %08x\n", readl(LMTYPE)); | ||
148 | s += sprintf(s, "LMTIM = %08x\n", readl(LMTIM)); | ||
149 | s += sprintf(s, "LMREFRESH = %08x\n", readl(LMREFRESH)); | ||
150 | s += sprintf(s, "LMPROTMIN = %08x\n", readl(LMPROTMIN)); | ||
151 | s += sprintf(s, "LMPROTMAX = %08x\n", readl(LMPROTMAX)); | ||
152 | s += sprintf(s, "LMPROTCFG = %08x\n", readl(LMPROTCFG)); | ||
153 | s += sprintf(s, "LMPROTERR = %08x\n", readl(LMPROTERR)); | ||
154 | |||
155 | return simple_read_from_buffer(userbuf, count, ppos, | ||
156 | big_buffer, s-big_buffer); | ||
157 | } | ||
158 | |||
159 | static ssize_t misc_read_file(struct file *file, char __user *userbuf, | ||
160 | size_t count, loff_t *ppos) | ||
161 | { | ||
162 | char * s = big_buffer; | ||
163 | |||
164 | s += sprintf(s, "LCD_CONFIG = %08x\n", readl(LCD_CONFIG)); | ||
165 | s += sprintf(s, "ODFBPWR = %08x\n", readl(ODFBPWR)); | ||
166 | s += sprintf(s, "ODFBSTAT = %08x\n", readl(ODFBSTAT)); | ||
167 | s += sprintf(s, "ID = %08x\n", readl(ID)); | ||
168 | |||
169 | return simple_read_from_buffer(userbuf, count, ppos, | ||
170 | big_buffer, s-big_buffer); | ||
171 | } | ||
172 | |||
173 | |||
174 | static const struct file_operations sysconf_fops = { | ||
175 | .read = sysconf_read_file, | ||
176 | .write = write_file_dummy, | ||
177 | .open = open_file_generic, | ||
178 | .llseek = default_llseek, | ||
179 | }; | ||
180 | |||
181 | static const struct file_operations clock_fops = { | ||
182 | .read = clock_read_file, | ||
183 | .write = write_file_dummy, | ||
184 | .open = open_file_generic, | ||
185 | .llseek = default_llseek, | ||
186 | }; | ||
187 | |||
188 | static const struct file_operations display_fops = { | ||
189 | .read = display_read_file, | ||
190 | .write = write_file_dummy, | ||
191 | .open = open_file_generic, | ||
192 | .llseek = default_llseek, | ||
193 | }; | ||
194 | |||
195 | static const struct file_operations gsctl_fops = { | ||
196 | .read = gsctl_read_file, | ||
197 | .write = write_file_dummy, | ||
198 | .open = open_file_generic, | ||
199 | .llseek = default_llseek, | ||
200 | }; | ||
201 | |||
202 | static const struct file_operations sdram_fops = { | ||
203 | .read = sdram_read_file, | ||
204 | .write = write_file_dummy, | ||
205 | .open = open_file_generic, | ||
206 | .llseek = default_llseek, | ||
207 | }; | ||
208 | |||
209 | static const struct file_operations misc_fops = { | ||
210 | .read = misc_read_file, | ||
211 | .write = write_file_dummy, | ||
212 | .open = open_file_generic, | ||
213 | .llseek = default_llseek, | ||
214 | }; | ||
215 | |||
216 | static void mbxfb_debugfs_init(struct fb_info *fbi) | ||
217 | { | ||
218 | struct mbxfb_info *mfbi = fbi->par; | ||
219 | struct mbxfb_debugfs_data *dbg; | ||
220 | |||
221 | dbg = kzalloc(sizeof(struct mbxfb_debugfs_data), GFP_KERNEL); | ||
222 | mfbi->debugfs_data = dbg; | ||
223 | |||
224 | dbg->dir = debugfs_create_dir("mbxfb", NULL); | ||
225 | dbg->sysconf = debugfs_create_file("sysconf", 0444, dbg->dir, | ||
226 | fbi, &sysconf_fops); | ||
227 | dbg->clock = debugfs_create_file("clock", 0444, dbg->dir, | ||
228 | fbi, &clock_fops); | ||
229 | dbg->display = debugfs_create_file("display", 0444, dbg->dir, | ||
230 | fbi, &display_fops); | ||
231 | dbg->gsctl = debugfs_create_file("gsctl", 0444, dbg->dir, | ||
232 | fbi, &gsctl_fops); | ||
233 | dbg->sdram = debugfs_create_file("sdram", 0444, dbg->dir, | ||
234 | fbi, &sdram_fops); | ||
235 | dbg->misc = debugfs_create_file("misc", 0444, dbg->dir, | ||
236 | fbi, &misc_fops); | ||
237 | } | ||
238 | |||
239 | static void mbxfb_debugfs_remove(struct fb_info *fbi) | ||
240 | { | ||
241 | struct mbxfb_info *mfbi = fbi->par; | ||
242 | struct mbxfb_debugfs_data *dbg = mfbi->debugfs_data; | ||
243 | |||
244 | debugfs_remove(dbg->misc); | ||
245 | debugfs_remove(dbg->sdram); | ||
246 | debugfs_remove(dbg->gsctl); | ||
247 | debugfs_remove(dbg->display); | ||
248 | debugfs_remove(dbg->clock); | ||
249 | debugfs_remove(dbg->sysconf); | ||
250 | debugfs_remove(dbg->dir); | ||
251 | } | ||