lin
2025-02-25 a02983e50ab34c3e7366b27cdeca427a327faebd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
 * drivers/mpp/sunxi-mpp.c
 *
 * Copyright (c) 2014 softwinner.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */
 
#include <linux/init.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/cpu.h>
#include <linux/of.h>
#include <linux/debugfs.h>
#include <linux/err.h>
#include <linux/slab.h>
#include <linux/mpp.h>
 
enum {
   DEBUG_NONE = 0,
   DEBUG_MPP = 1,
};
static int debug_mask = DEBUG_NONE;
module_param(debug_mask, int, S_IRUGO | S_IWUSR | S_IWGRP);
#define MPP_DBG(mask, format, args...)                \
   do {                                \
       if (mask & debug_mask)                    \
           pr_info("[mpp] "format, ##args);        \
   } while (0)
 
#define MPP_ERR(format, args...) \
   pr_err("[mpp] error:"format, ##args)
 
#ifdef CONFIG_DEBUG_FS
struct dentry *debugfs_mpp_root;
EXPORT_SYMBOL(debugfs_mpp_root);
 
static int __init mpp_debugfs_init(void)
{
   MPP_DBG(DEBUG_MPP, "call %s.\n", __func__);
   WARN_ON(!debugfs_initialized());
 
   debugfs_mpp_root = debugfs_create_dir("mpp", 0);
   if (!debugfs_mpp_root)
       return -ENOMEM;
 
   return 0;
}
 
static void __exit mpp_debugfs_exit(void)
{
   MPP_DBG(DEBUG_MPP, "call %s.\n", __func__);
   debugfs_remove_recursive(debugfs_mpp_root);
}
 
subsys_initcall(mpp_debugfs_init);
module_exit(mpp_debugfs_exit);
#endif /* CONFIG_DEBUG_FS */
 
MODULE_DESCRIPTION("mpp driver for sunxi SOCs");
MODULE_LICENSE("GPL");