Commit | Line | Data |
---|---|---|
4e43d779 | 1 | // SPDX-License-Identifier: GPL-2.0-only |
aa27badd SD |
2 | /* |
3 | * Intel MIC Platform Software Stack (MPSS) | |
4 | * | |
5 | * Copyright(c) 2013 Intel Corporation. | |
6 | * | |
aa27badd SD |
7 | * Disclaimer: The codes contained in these modules may be specific to |
8 | * the Intel Software Development Platform codenamed: Knights Ferry, and | |
9 | * the Intel product codenamed: Knights Corner, and are not backward | |
10 | * compatible with other Intel products. Additionally, Intel will NOT | |
11 | * support the codes or instruction set in future products. | |
12 | * | |
13 | * Intel MIC Card driver. | |
aa27badd SD |
14 | */ |
15 | #include <linux/debugfs.h> | |
16 | #include <linux/delay.h> | |
17 | #include <linux/seq_file.h> | |
18 | #include <linux/interrupt.h> | |
19 | #include <linux/device.h> | |
20 | ||
4aa79961 | 21 | #include "../common/mic_dev.h" |
aa27badd SD |
22 | #include "mic_device.h" |
23 | ||
24 | /* Debugfs parent dir */ | |
25 | static struct dentry *mic_dbg; | |
26 | ||
49f093f4 | 27 | /* |
2796b43f | 28 | * mic_intr_show - Send interrupts to host. |
aa27badd | 29 | */ |
2796b43f | 30 | static int mic_intr_show(struct seq_file *s, void *unused) |
aa27badd SD |
31 | { |
32 | struct mic_driver *mdrv = s->private; | |
33 | struct mic_device *mdev = &mdrv->mdev; | |
34 | ||
35 | mic_send_intr(mdev, 0); | |
36 | msleep(1000); | |
37 | mic_send_intr(mdev, 1); | |
38 | msleep(1000); | |
39 | mic_send_intr(mdev, 2); | |
40 | msleep(1000); | |
41 | mic_send_intr(mdev, 3); | |
42 | msleep(1000); | |
43 | ||
44 | return 0; | |
45 | } | |
46 | ||
2796b43f | 47 | DEFINE_SHOW_ATTRIBUTE(mic_intr); |
aa27badd | 48 | |
49f093f4 | 49 | /* |
aa27badd SD |
50 | * mic_create_card_debug_dir - Initialize MIC debugfs entries. |
51 | */ | |
52 | void __init mic_create_card_debug_dir(struct mic_driver *mdrv) | |
53 | { | |
aa27badd SD |
54 | if (!mic_dbg) |
55 | return; | |
56 | ||
57 | mdrv->dbg_dir = debugfs_create_dir(mdrv->name, mic_dbg); | |
aa27badd | 58 | |
7e9f02a7 GKH |
59 | debugfs_create_file("intr_test", 0444, mdrv->dbg_dir, mdrv, |
60 | &mic_intr_fops); | |
aa27badd SD |
61 | } |
62 | ||
49f093f4 | 63 | /* |
aa27badd SD |
64 | * mic_delete_card_debug_dir - Uninitialize MIC debugfs entries. |
65 | */ | |
66 | void mic_delete_card_debug_dir(struct mic_driver *mdrv) | |
67 | { | |
aa27badd SD |
68 | debugfs_remove_recursive(mdrv->dbg_dir); |
69 | } | |
70 | ||
49f093f4 | 71 | /* |
aa27badd SD |
72 | * mic_init_card_debugfs - Initialize global debugfs entry. |
73 | */ | |
74 | void __init mic_init_card_debugfs(void) | |
75 | { | |
76 | mic_dbg = debugfs_create_dir(KBUILD_MODNAME, NULL); | |
aa27badd SD |
77 | } |
78 | ||
49f093f4 | 79 | /* |
aa27badd SD |
80 | * mic_exit_card_debugfs - Uninitialize global debugfs entry |
81 | */ | |
82 | void mic_exit_card_debugfs(void) | |
83 | { | |
84 | debugfs_remove(mic_dbg); | |
85 | } |