Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v5.2-rc2 114 lines 2.8 kB view raw
1/* 2 * Intel MIC Platform Software Stack (MPSS) 3 * 4 * Copyright(c) 2013 Intel Corporation. 5 * 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. 9 * 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. 14 * 15 * The full GNU General Public License is included in this distribution in 16 * the file called "COPYING". 17 * 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. 23 * 24 * Intel MIC Card driver. 25 * 26 */ 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> 32 33#include "../common/mic_dev.h" 34#include "mic_device.h" 35 36/* Debugfs parent dir */ 37static struct dentry *mic_dbg; 38 39/** 40 * mic_intr_show - Send interrupts to host. 41 */ 42static int mic_intr_show(struct seq_file *s, void *unused) 43{ 44 struct mic_driver *mdrv = s->private; 45 struct mic_device *mdev = &mdrv->mdev; 46 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); 55 56 return 0; 57} 58 59DEFINE_SHOW_ATTRIBUTE(mic_intr); 60 61/** 62 * mic_create_card_debug_dir - Initialize MIC debugfs entries. 63 */ 64void __init mic_create_card_debug_dir(struct mic_driver *mdrv) 65{ 66 struct dentry *d; 67 68 if (!mic_dbg) 69 return; 70 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; 75 } 76 77 d = debugfs_create_file("intr_test", 0444, mdrv->dbg_dir, 78 mdrv, &mic_intr_fops); 79 80 if (!d) { 81 dev_err(mdrv->dev, 82 "Cant create dbg intr_test %s\n", mdrv->name); 83 return; 84 } 85} 86 87/** 88 * mic_delete_card_debug_dir - Uninitialize MIC debugfs entries. 89 */ 90void mic_delete_card_debug_dir(struct mic_driver *mdrv) 91{ 92 if (!mdrv->dbg_dir) 93 return; 94 95 debugfs_remove_recursive(mdrv->dbg_dir); 96} 97 98/** 99 * mic_init_card_debugfs - Initialize global debugfs entry. 100 */ 101void __init mic_init_card_debugfs(void) 102{ 103 mic_dbg = debugfs_create_dir(KBUILD_MODNAME, NULL); 104 if (!mic_dbg) 105 pr_err("can't create debugfs dir\n"); 106} 107 108/** 109 * mic_exit_card_debugfs - Uninitialize global debugfs entry 110 */ 111void mic_exit_card_debugfs(void) 112{ 113 debugfs_remove(mic_dbg); 114}