blob: 54739b08c3083d413c70981fc0f0ca095cec0716 [file] [log] [blame]
Bing Zhaofb784f02009-06-02 14:29:37 -07001/**
2 * Marvell Bluetooth driver: debugfs related functions
3 *
4 * Copyright (C) 2009, Marvell International Ltd.
5 *
6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
8 * (the "License"). You may use, redistribute and/or modify this File in
9 * accordance with the terms and conditions of the License, a copy of which
10 * is available by writing to the Free Software Foundation, Inc.,
11 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
12 * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
13 *
14 *
15 * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
17 * ARE EXPRESSLY DISCLAIMED. The License provides additional details about
18 * this warranty disclaimer.
19 **/
20
21#include <linux/debugfs.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090022#include <linux/slab.h>
Bing Zhaofb784f02009-06-02 14:29:37 -070023
24#include <net/bluetooth/bluetooth.h>
25#include <net/bluetooth/hci_core.h>
26
27#include "btmrvl_drv.h"
28
29struct btmrvl_debugfs_data {
Marcel Holtmannb914a252010-02-08 16:47:04 +010030 struct dentry *config_dir;
31 struct dentry *status_dir;
Bing Zhaofb784f02009-06-02 14:29:37 -070032
33 /* config */
Bing Zhaofb784f02009-06-02 14:29:37 -070034 struct dentry *psmode;
35 struct dentry *pscmd;
36 struct dentry *hsmode;
37 struct dentry *hscmd;
38 struct dentry *gpiogap;
39 struct dentry *hscfgcmd;
40
41 /* status */
42 struct dentry *curpsmode;
43 struct dentry *hsstate;
44 struct dentry *psstate;
45 struct dentry *txdnldready;
46};
47
48static int btmrvl_open_generic(struct inode *inode, struct file *file)
49{
50 file->private_data = inode->i_private;
51 return 0;
52}
53
54static ssize_t btmrvl_hscfgcmd_write(struct file *file,
Marcel Holtmann54239902009-06-09 15:48:35 +020055 const char __user *ubuf, size_t count, loff_t *ppos)
Bing Zhaofb784f02009-06-02 14:29:37 -070056{
Marcel Holtmann54239902009-06-09 15:48:35 +020057 struct btmrvl_private *priv = file->private_data;
Bing Zhaofb784f02009-06-02 14:29:37 -070058 char buf[16];
Marcel Holtmann54239902009-06-09 15:48:35 +020059 long result, ret;
Bing Zhaofb784f02009-06-02 14:29:37 -070060
61 memset(buf, 0, sizeof(buf));
62
Marcel Holtmann54239902009-06-09 15:48:35 +020063 if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count)))
Bing Zhaofb784f02009-06-02 14:29:37 -070064 return -EFAULT;
65
66 ret = strict_strtol(buf, 10, &result);
67
68 priv->btmrvl_dev.hscfgcmd = result;
69
70 if (priv->btmrvl_dev.hscfgcmd) {
71 btmrvl_prepare_command(priv);
72 wake_up_interruptible(&priv->main_thread.wait_q);
73 }
74
75 return count;
76}
77
Marcel Holtmann54239902009-06-09 15:48:35 +020078static ssize_t btmrvl_hscfgcmd_read(struct file *file, char __user *userbuf,
79 size_t count, loff_t *ppos)
Bing Zhaofb784f02009-06-02 14:29:37 -070080{
Marcel Holtmann54239902009-06-09 15:48:35 +020081 struct btmrvl_private *priv = file->private_data;
Bing Zhaofb784f02009-06-02 14:29:37 -070082 char buf[16];
Marcel Holtmann54239902009-06-09 15:48:35 +020083 int ret;
Bing Zhaofb784f02009-06-02 14:29:37 -070084
85 ret = snprintf(buf, sizeof(buf) - 1, "%d\n",
Marcel Holtmann54239902009-06-09 15:48:35 +020086 priv->btmrvl_dev.hscfgcmd);
Bing Zhaofb784f02009-06-02 14:29:37 -070087
88 return simple_read_from_buffer(userbuf, count, ppos, buf, ret);
89}
90
91static const struct file_operations btmrvl_hscfgcmd_fops = {
Marcel Holtmann54239902009-06-09 15:48:35 +020092 .read = btmrvl_hscfgcmd_read,
93 .write = btmrvl_hscfgcmd_write,
94 .open = btmrvl_open_generic,
Bing Zhaofb784f02009-06-02 14:29:37 -070095};
96
97static ssize_t btmrvl_psmode_write(struct file *file, const char __user *ubuf,
Marcel Holtmann54239902009-06-09 15:48:35 +020098 size_t count, loff_t *ppos)
Bing Zhaofb784f02009-06-02 14:29:37 -070099{
Marcel Holtmann54239902009-06-09 15:48:35 +0200100 struct btmrvl_private *priv = file->private_data;
Bing Zhaofb784f02009-06-02 14:29:37 -0700101 char buf[16];
Marcel Holtmann54239902009-06-09 15:48:35 +0200102 long result, ret;
Bing Zhaofb784f02009-06-02 14:29:37 -0700103
104 memset(buf, 0, sizeof(buf));
105
Marcel Holtmann54239902009-06-09 15:48:35 +0200106 if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count)))
Bing Zhaofb784f02009-06-02 14:29:37 -0700107 return -EFAULT;
108
109 ret = strict_strtol(buf, 10, &result);
110
111 priv->btmrvl_dev.psmode = result;
112
113 return count;
114}
115
Marcel Holtmann54239902009-06-09 15:48:35 +0200116static ssize_t btmrvl_psmode_read(struct file *file, char __user *userbuf,
117 size_t count, loff_t *ppos)
Bing Zhaofb784f02009-06-02 14:29:37 -0700118{
Marcel Holtmann54239902009-06-09 15:48:35 +0200119 struct btmrvl_private *priv = file->private_data;
Bing Zhaofb784f02009-06-02 14:29:37 -0700120 char buf[16];
Marcel Holtmann54239902009-06-09 15:48:35 +0200121 int ret;
Bing Zhaofb784f02009-06-02 14:29:37 -0700122
123 ret = snprintf(buf, sizeof(buf) - 1, "%d\n",
Marcel Holtmann54239902009-06-09 15:48:35 +0200124 priv->btmrvl_dev.psmode);
Bing Zhaofb784f02009-06-02 14:29:37 -0700125
126 return simple_read_from_buffer(userbuf, count, ppos, buf, ret);
127}
128
129static const struct file_operations btmrvl_psmode_fops = {
Marcel Holtmann54239902009-06-09 15:48:35 +0200130 .read = btmrvl_psmode_read,
131 .write = btmrvl_psmode_write,
132 .open = btmrvl_open_generic,
Bing Zhaofb784f02009-06-02 14:29:37 -0700133};
134
135static ssize_t btmrvl_pscmd_write(struct file *file, const char __user *ubuf,
Marcel Holtmann54239902009-06-09 15:48:35 +0200136 size_t count, loff_t *ppos)
Bing Zhaofb784f02009-06-02 14:29:37 -0700137{
Marcel Holtmann54239902009-06-09 15:48:35 +0200138 struct btmrvl_private *priv = file->private_data;
Bing Zhaofb784f02009-06-02 14:29:37 -0700139 char buf[16];
Marcel Holtmann54239902009-06-09 15:48:35 +0200140 long result, ret;
Bing Zhaofb784f02009-06-02 14:29:37 -0700141
142 memset(buf, 0, sizeof(buf));
143
Marcel Holtmann54239902009-06-09 15:48:35 +0200144 if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count)))
Bing Zhaofb784f02009-06-02 14:29:37 -0700145 return -EFAULT;
146
147 ret = strict_strtol(buf, 10, &result);
148
149 priv->btmrvl_dev.pscmd = result;
150
151 if (priv->btmrvl_dev.pscmd) {
152 btmrvl_prepare_command(priv);
153 wake_up_interruptible(&priv->main_thread.wait_q);
154 }
155
156 return count;
157
158}
159
Marcel Holtmann54239902009-06-09 15:48:35 +0200160static ssize_t btmrvl_pscmd_read(struct file *file, char __user *userbuf,
161 size_t count, loff_t *ppos)
Bing Zhaofb784f02009-06-02 14:29:37 -0700162{
Marcel Holtmann54239902009-06-09 15:48:35 +0200163 struct btmrvl_private *priv = file->private_data;
Bing Zhaofb784f02009-06-02 14:29:37 -0700164 char buf[16];
Marcel Holtmann54239902009-06-09 15:48:35 +0200165 int ret;
Bing Zhaofb784f02009-06-02 14:29:37 -0700166
167 ret = snprintf(buf, sizeof(buf) - 1, "%d\n", priv->btmrvl_dev.pscmd);
168
169 return simple_read_from_buffer(userbuf, count, ppos, buf, ret);
170}
171
172static const struct file_operations btmrvl_pscmd_fops = {
173 .read = btmrvl_pscmd_read,
174 .write = btmrvl_pscmd_write,
175 .open = btmrvl_open_generic,
176};
177
178static ssize_t btmrvl_gpiogap_write(struct file *file, const char __user *ubuf,
Marcel Holtmann54239902009-06-09 15:48:35 +0200179 size_t count, loff_t *ppos)
Bing Zhaofb784f02009-06-02 14:29:37 -0700180{
Marcel Holtmann54239902009-06-09 15:48:35 +0200181 struct btmrvl_private *priv = file->private_data;
Bing Zhaofb784f02009-06-02 14:29:37 -0700182 char buf[16];
Marcel Holtmann54239902009-06-09 15:48:35 +0200183 long result, ret;
Bing Zhaofb784f02009-06-02 14:29:37 -0700184
185 memset(buf, 0, sizeof(buf));
186
Marcel Holtmann54239902009-06-09 15:48:35 +0200187 if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count)))
Bing Zhaofb784f02009-06-02 14:29:37 -0700188 return -EFAULT;
189
190 ret = strict_strtol(buf, 16, &result);
191
192 priv->btmrvl_dev.gpio_gap = result;
193
194 return count;
195}
196
Marcel Holtmann54239902009-06-09 15:48:35 +0200197static ssize_t btmrvl_gpiogap_read(struct file *file, char __user *userbuf,
198 size_t count, loff_t *ppos)
Bing Zhaofb784f02009-06-02 14:29:37 -0700199{
Marcel Holtmann54239902009-06-09 15:48:35 +0200200 struct btmrvl_private *priv = file->private_data;
Bing Zhaofb784f02009-06-02 14:29:37 -0700201 char buf[16];
Marcel Holtmann54239902009-06-09 15:48:35 +0200202 int ret;
Bing Zhaofb784f02009-06-02 14:29:37 -0700203
204 ret = snprintf(buf, sizeof(buf) - 1, "0x%x\n",
Marcel Holtmann54239902009-06-09 15:48:35 +0200205 priv->btmrvl_dev.gpio_gap);
Bing Zhaofb784f02009-06-02 14:29:37 -0700206
207 return simple_read_from_buffer(userbuf, count, ppos, buf, ret);
208}
209
210static const struct file_operations btmrvl_gpiogap_fops = {
Marcel Holtmann54239902009-06-09 15:48:35 +0200211 .read = btmrvl_gpiogap_read,
212 .write = btmrvl_gpiogap_write,
213 .open = btmrvl_open_generic,
Bing Zhaofb784f02009-06-02 14:29:37 -0700214};
215
216static ssize_t btmrvl_hscmd_write(struct file *file, const char __user *ubuf,
Marcel Holtmann54239902009-06-09 15:48:35 +0200217 size_t count, loff_t *ppos)
Bing Zhaofb784f02009-06-02 14:29:37 -0700218{
Joe Perchesbe60b942010-07-12 13:49:57 -0700219 struct btmrvl_private *priv = file->private_data;
Bing Zhaofb784f02009-06-02 14:29:37 -0700220 char buf[16];
Marcel Holtmann54239902009-06-09 15:48:35 +0200221 long result, ret;
Bing Zhaofb784f02009-06-02 14:29:37 -0700222
223 memset(buf, 0, sizeof(buf));
224
Marcel Holtmann54239902009-06-09 15:48:35 +0200225 if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count)))
Bing Zhaofb784f02009-06-02 14:29:37 -0700226 return -EFAULT;
227
228 ret = strict_strtol(buf, 10, &result);
229
230 priv->btmrvl_dev.hscmd = result;
231 if (priv->btmrvl_dev.hscmd) {
232 btmrvl_prepare_command(priv);
233 wake_up_interruptible(&priv->main_thread.wait_q);
234 }
235
236 return count;
237}
238
Marcel Holtmann54239902009-06-09 15:48:35 +0200239static ssize_t btmrvl_hscmd_read(struct file *file, char __user *userbuf,
240 size_t count, loff_t *ppos)
Bing Zhaofb784f02009-06-02 14:29:37 -0700241{
Marcel Holtmann54239902009-06-09 15:48:35 +0200242 struct btmrvl_private *priv = file->private_data;
Bing Zhaofb784f02009-06-02 14:29:37 -0700243 char buf[16];
Marcel Holtmann54239902009-06-09 15:48:35 +0200244 int ret;
Bing Zhaofb784f02009-06-02 14:29:37 -0700245
246 ret = snprintf(buf, sizeof(buf) - 1, "%d\n", priv->btmrvl_dev.hscmd);
247
248 return simple_read_from_buffer(userbuf, count, ppos, buf, ret);
249}
250
251static const struct file_operations btmrvl_hscmd_fops = {
Marcel Holtmann54239902009-06-09 15:48:35 +0200252 .read = btmrvl_hscmd_read,
253 .write = btmrvl_hscmd_write,
254 .open = btmrvl_open_generic,
Bing Zhaofb784f02009-06-02 14:29:37 -0700255};
256
257static ssize_t btmrvl_hsmode_write(struct file *file, const char __user *ubuf,
Marcel Holtmann54239902009-06-09 15:48:35 +0200258 size_t count, loff_t *ppos)
Bing Zhaofb784f02009-06-02 14:29:37 -0700259{
Marcel Holtmann54239902009-06-09 15:48:35 +0200260 struct btmrvl_private *priv = file->private_data;
Bing Zhaofb784f02009-06-02 14:29:37 -0700261 char buf[16];
Marcel Holtmann54239902009-06-09 15:48:35 +0200262 long result, ret;
Bing Zhaofb784f02009-06-02 14:29:37 -0700263
264 memset(buf, 0, sizeof(buf));
265
Marcel Holtmann54239902009-06-09 15:48:35 +0200266 if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count)))
Bing Zhaofb784f02009-06-02 14:29:37 -0700267 return -EFAULT;
268
269 ret = strict_strtol(buf, 10, &result);
270
271 priv->btmrvl_dev.hsmode = result;
272
273 return count;
274}
275
276static ssize_t btmrvl_hsmode_read(struct file *file, char __user * userbuf,
Marcel Holtmann54239902009-06-09 15:48:35 +0200277 size_t count, loff_t *ppos)
Bing Zhaofb784f02009-06-02 14:29:37 -0700278{
Marcel Holtmann54239902009-06-09 15:48:35 +0200279 struct btmrvl_private *priv = file->private_data;
Bing Zhaofb784f02009-06-02 14:29:37 -0700280 char buf[16];
Marcel Holtmann54239902009-06-09 15:48:35 +0200281 int ret;
Bing Zhaofb784f02009-06-02 14:29:37 -0700282
Marcel Holtmann54239902009-06-09 15:48:35 +0200283 ret = snprintf(buf, sizeof(buf) - 1, "%d\n", priv->btmrvl_dev.hsmode);
Bing Zhaofb784f02009-06-02 14:29:37 -0700284
285 return simple_read_from_buffer(userbuf, count, ppos, buf, ret);
286}
287
288static const struct file_operations btmrvl_hsmode_fops = {
Marcel Holtmann54239902009-06-09 15:48:35 +0200289 .read = btmrvl_hsmode_read,
290 .write = btmrvl_hsmode_write,
291 .open = btmrvl_open_generic,
Bing Zhaofb784f02009-06-02 14:29:37 -0700292};
293
Marcel Holtmann54239902009-06-09 15:48:35 +0200294static ssize_t btmrvl_curpsmode_read(struct file *file, char __user *userbuf,
295 size_t count, loff_t *ppos)
Bing Zhaofb784f02009-06-02 14:29:37 -0700296{
Marcel Holtmann54239902009-06-09 15:48:35 +0200297 struct btmrvl_private *priv = file->private_data;
Bing Zhaofb784f02009-06-02 14:29:37 -0700298 char buf[16];
Marcel Holtmann54239902009-06-09 15:48:35 +0200299 int ret;
Bing Zhaofb784f02009-06-02 14:29:37 -0700300
301 ret = snprintf(buf, sizeof(buf) - 1, "%d\n", priv->adapter->psmode);
302
303 return simple_read_from_buffer(userbuf, count, ppos, buf, ret);
304}
305
306static const struct file_operations btmrvl_curpsmode_fops = {
Marcel Holtmann54239902009-06-09 15:48:35 +0200307 .read = btmrvl_curpsmode_read,
308 .open = btmrvl_open_generic,
Bing Zhaofb784f02009-06-02 14:29:37 -0700309};
310
311static ssize_t btmrvl_psstate_read(struct file *file, char __user * userbuf,
Marcel Holtmann54239902009-06-09 15:48:35 +0200312 size_t count, loff_t *ppos)
Bing Zhaofb784f02009-06-02 14:29:37 -0700313{
Marcel Holtmann54239902009-06-09 15:48:35 +0200314 struct btmrvl_private *priv = file->private_data;
Bing Zhaofb784f02009-06-02 14:29:37 -0700315 char buf[16];
Marcel Holtmann54239902009-06-09 15:48:35 +0200316 int ret;
Bing Zhaofb784f02009-06-02 14:29:37 -0700317
Marcel Holtmann54239902009-06-09 15:48:35 +0200318 ret = snprintf(buf, sizeof(buf) - 1, "%d\n", priv->adapter->ps_state);
Bing Zhaofb784f02009-06-02 14:29:37 -0700319
320 return simple_read_from_buffer(userbuf, count, ppos, buf, ret);
321}
322
323static const struct file_operations btmrvl_psstate_fops = {
Marcel Holtmann54239902009-06-09 15:48:35 +0200324 .read = btmrvl_psstate_read,
325 .open = btmrvl_open_generic,
Bing Zhaofb784f02009-06-02 14:29:37 -0700326};
327
Marcel Holtmann54239902009-06-09 15:48:35 +0200328static ssize_t btmrvl_hsstate_read(struct file *file, char __user *userbuf,
329 size_t count, loff_t *ppos)
Bing Zhaofb784f02009-06-02 14:29:37 -0700330{
Marcel Holtmann54239902009-06-09 15:48:35 +0200331 struct btmrvl_private *priv = file->private_data;
Bing Zhaofb784f02009-06-02 14:29:37 -0700332 char buf[16];
Marcel Holtmann54239902009-06-09 15:48:35 +0200333 int ret;
Bing Zhaofb784f02009-06-02 14:29:37 -0700334
Marcel Holtmann54239902009-06-09 15:48:35 +0200335 ret = snprintf(buf, sizeof(buf) - 1, "%d\n", priv->adapter->hs_state);
Bing Zhaofb784f02009-06-02 14:29:37 -0700336
337 return simple_read_from_buffer(userbuf, count, ppos, buf, ret);
338}
339
340static const struct file_operations btmrvl_hsstate_fops = {
Marcel Holtmann54239902009-06-09 15:48:35 +0200341 .read = btmrvl_hsstate_read,
342 .open = btmrvl_open_generic,
Bing Zhaofb784f02009-06-02 14:29:37 -0700343};
344
Marcel Holtmann54239902009-06-09 15:48:35 +0200345static ssize_t btmrvl_txdnldready_read(struct file *file, char __user *userbuf,
346 size_t count, loff_t *ppos)
Bing Zhaofb784f02009-06-02 14:29:37 -0700347{
Marcel Holtmann54239902009-06-09 15:48:35 +0200348 struct btmrvl_private *priv = file->private_data;
Bing Zhaofb784f02009-06-02 14:29:37 -0700349 char buf[16];
Marcel Holtmann54239902009-06-09 15:48:35 +0200350 int ret;
Bing Zhaofb784f02009-06-02 14:29:37 -0700351
352 ret = snprintf(buf, sizeof(buf) - 1, "%d\n",
Marcel Holtmann54239902009-06-09 15:48:35 +0200353 priv->btmrvl_dev.tx_dnld_rdy);
Bing Zhaofb784f02009-06-02 14:29:37 -0700354
355 return simple_read_from_buffer(userbuf, count, ppos, buf, ret);
356}
357
358static const struct file_operations btmrvl_txdnldready_fops = {
Marcel Holtmann54239902009-06-09 15:48:35 +0200359 .read = btmrvl_txdnldready_read,
360 .open = btmrvl_open_generic,
Bing Zhaofb784f02009-06-02 14:29:37 -0700361};
362
363void btmrvl_debugfs_init(struct hci_dev *hdev)
364{
Marcel Holtmann54239902009-06-09 15:48:35 +0200365 struct btmrvl_private *priv = hdev->driver_data;
Bing Zhaofb784f02009-06-02 14:29:37 -0700366 struct btmrvl_debugfs_data *dbg;
367
Marcel Holtmannb914a252010-02-08 16:47:04 +0100368 if (!hdev->debugfs)
369 return;
370
Bing Zhaofb784f02009-06-02 14:29:37 -0700371 dbg = kzalloc(sizeof(*dbg), GFP_KERNEL);
372 priv->debugfs_data = dbg;
373
374 if (!dbg) {
375 BT_ERR("Can not allocate memory for btmrvl_debugfs_data.");
376 return;
377 }
378
Marcel Holtmannb914a252010-02-08 16:47:04 +0100379 dbg->config_dir = debugfs_create_dir("config", hdev->debugfs);
Bing Zhaofb784f02009-06-02 14:29:37 -0700380
381 dbg->psmode = debugfs_create_file("psmode", 0644, dbg->config_dir,
Marcel Holtmann54239902009-06-09 15:48:35 +0200382 hdev->driver_data, &btmrvl_psmode_fops);
383 dbg->pscmd = debugfs_create_file("pscmd", 0644, dbg->config_dir,
Bing Zhaofb784f02009-06-02 14:29:37 -0700384 hdev->driver_data, &btmrvl_pscmd_fops);
Marcel Holtmann54239902009-06-09 15:48:35 +0200385 dbg->gpiogap = debugfs_create_file("gpiogap", 0644, dbg->config_dir,
Bing Zhaofb784f02009-06-02 14:29:37 -0700386 hdev->driver_data, &btmrvl_gpiogap_fops);
Marcel Holtmann54239902009-06-09 15:48:35 +0200387 dbg->hsmode = debugfs_create_file("hsmode", 0644, dbg->config_dir,
Bing Zhaofb784f02009-06-02 14:29:37 -0700388 hdev->driver_data, &btmrvl_hsmode_fops);
Marcel Holtmann54239902009-06-09 15:48:35 +0200389 dbg->hscmd = debugfs_create_file("hscmd", 0644, dbg->config_dir,
Bing Zhaofb784f02009-06-02 14:29:37 -0700390 hdev->driver_data, &btmrvl_hscmd_fops);
Marcel Holtmann54239902009-06-09 15:48:35 +0200391 dbg->hscfgcmd = debugfs_create_file("hscfgcmd", 0644, dbg->config_dir,
Bing Zhaofb784f02009-06-02 14:29:37 -0700392 hdev->driver_data, &btmrvl_hscfgcmd_fops);
393
Marcel Holtmannb914a252010-02-08 16:47:04 +0100394 dbg->status_dir = debugfs_create_dir("status", hdev->debugfs);
Bing Zhaofb784f02009-06-02 14:29:37 -0700395 dbg->curpsmode = debugfs_create_file("curpsmode", 0444,
396 dbg->status_dir,
397 hdev->driver_data,
398 &btmrvl_curpsmode_fops);
Marcel Holtmann54239902009-06-09 15:48:35 +0200399 dbg->psstate = debugfs_create_file("psstate", 0444, dbg->status_dir,
Bing Zhaofb784f02009-06-02 14:29:37 -0700400 hdev->driver_data, &btmrvl_psstate_fops);
Marcel Holtmann54239902009-06-09 15:48:35 +0200401 dbg->hsstate = debugfs_create_file("hsstate", 0444, dbg->status_dir,
Bing Zhaofb784f02009-06-02 14:29:37 -0700402 hdev->driver_data, &btmrvl_hsstate_fops);
Marcel Holtmann54239902009-06-09 15:48:35 +0200403 dbg->txdnldready = debugfs_create_file("txdnldready", 0444,
404 dbg->status_dir,
405 hdev->driver_data,
406 &btmrvl_txdnldready_fops);
Bing Zhaofb784f02009-06-02 14:29:37 -0700407}
408
409void btmrvl_debugfs_remove(struct hci_dev *hdev)
410{
Marcel Holtmann54239902009-06-09 15:48:35 +0200411 struct btmrvl_private *priv = hdev->driver_data;
Bing Zhaofb784f02009-06-02 14:29:37 -0700412 struct btmrvl_debugfs_data *dbg = priv->debugfs_data;
413
414 if (!dbg)
415 return;
416
417 debugfs_remove(dbg->psmode);
418 debugfs_remove(dbg->pscmd);
419 debugfs_remove(dbg->gpiogap);
420 debugfs_remove(dbg->hsmode);
421 debugfs_remove(dbg->hscmd);
422 debugfs_remove(dbg->hscfgcmd);
423 debugfs_remove(dbg->config_dir);
424
425 debugfs_remove(dbg->curpsmode);
426 debugfs_remove(dbg->psstate);
427 debugfs_remove(dbg->hsstate);
428 debugfs_remove(dbg->txdnldready);
429 debugfs_remove(dbg->status_dir);
430
Bing Zhaofb784f02009-06-02 14:29:37 -0700431 kfree(dbg);
432}