Linux 5.1.15
[linux/fpc-iii.git] / drivers / misc / mic / card / mic_debugfs.c
blob7a4140874888f13c17e724fbb707e05ee80c5a7b
1 /*
2 * Intel MIC Platform Software Stack (MPSS)
4 * Copyright(c) 2013 Intel Corporation.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License, version 2, as
8 * published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * The full GNU General Public License is included in this distribution in
16 * the file called "COPYING".
18 * Disclaimer: The codes contained in these modules may be specific to
19 * the Intel Software Development Platform codenamed: Knights Ferry, and
20 * the Intel product codenamed: Knights Corner, and are not backward
21 * compatible with other Intel products. Additionally, Intel will NOT
22 * support the codes or instruction set in future products.
24 * Intel MIC Card driver.
27 #include <linux/debugfs.h>
28 #include <linux/delay.h>
29 #include <linux/seq_file.h>
30 #include <linux/interrupt.h>
31 #include <linux/device.h>
33 #include "../common/mic_dev.h"
34 #include "mic_device.h"
36 /* Debugfs parent dir */
37 static struct dentry *mic_dbg;
39 /**
40 * mic_intr_show - Send interrupts to host.
42 static int mic_intr_show(struct seq_file *s, void *unused)
44 struct mic_driver *mdrv = s->private;
45 struct mic_device *mdev = &mdrv->mdev;
47 mic_send_intr(mdev, 0);
48 msleep(1000);
49 mic_send_intr(mdev, 1);
50 msleep(1000);
51 mic_send_intr(mdev, 2);
52 msleep(1000);
53 mic_send_intr(mdev, 3);
54 msleep(1000);
56 return 0;
59 DEFINE_SHOW_ATTRIBUTE(mic_intr);
61 /**
62 * mic_create_card_debug_dir - Initialize MIC debugfs entries.
64 void __init mic_create_card_debug_dir(struct mic_driver *mdrv)
66 struct dentry *d;
68 if (!mic_dbg)
69 return;
71 mdrv->dbg_dir = debugfs_create_dir(mdrv->name, mic_dbg);
72 if (!mdrv->dbg_dir) {
73 dev_err(mdrv->dev, "Cant create dbg_dir %s\n", mdrv->name);
74 return;
77 d = debugfs_create_file("intr_test", 0444, mdrv->dbg_dir,
78 mdrv, &mic_intr_fops);
80 if (!d) {
81 dev_err(mdrv->dev,
82 "Cant create dbg intr_test %s\n", mdrv->name);
83 return;
87 /**
88 * mic_delete_card_debug_dir - Uninitialize MIC debugfs entries.
90 void mic_delete_card_debug_dir(struct mic_driver *mdrv)
92 if (!mdrv->dbg_dir)
93 return;
95 debugfs_remove_recursive(mdrv->dbg_dir);
98 /**
99 * mic_init_card_debugfs - Initialize global debugfs entry.
101 void __init mic_init_card_debugfs(void)
103 mic_dbg = debugfs_create_dir(KBUILD_MODNAME, NULL);
104 if (!mic_dbg)
105 pr_err("can't create debugfs dir\n");
109 * mic_exit_card_debugfs - Uninitialize global debugfs entry
111 void mic_exit_card_debugfs(void)
113 debugfs_remove(mic_dbg);