• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * vendor/amlogic/media/common/ge2d/ge2d_log.h
3  *
4  * Copyright (C) 2017 Amlogic, Inc. All rights reserved.
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 as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
14  * more details.
15  *
16  */
17 
18 #ifndef _GE2D_LOG_H_
19 #define _GE2D_LOG_H_
20 
21 #include <stdarg.h>
22 #include <linux/printk.h>
23 
24 #define GE2D_LOG_TAG "[GE2D]"
25 #define GE2D_LOG_LEVEL_NULL 0
26 #define GE2D_LOG_LEVEL_DEBUG 1
27 #define GE2D_LOG_LEVEL_DEBUG2 2
28 
29 extern unsigned int ge2d_log_level;
30 #undef pr_fmt
31 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
32 #define ge2d_log_info(fmt, ...) pr_info(fmt, ##__VA_ARGS__)
33 
34 #define ge2d_log_err(fmt, ...) pr_err(fmt, ##__VA_ARGS__)
35 
36 #define ge2d_log_dbg(fmt, ...)                                                                                         \
37     do {                                                                                                               \
38         if (ge2d_log_level >= GE2D_LOG_LEVEL_DEBUG) {                                                                  \
39             pr_info(fmt, ##__VA_ARGS__);                                                                               \
40         }                                                                                                              \
41     } while (0)
42 
43 #define ge2d_log_dbg2(fmt, ...)                                                                                        \
44     do {                                                                                                               \
45         if (ge2d_log_level >= GE2D_LOG_LEVEL_DEBUG2) {                                                                 \
46             pr_info(fmt, ##__VA_ARGS__);                                                                               \
47         }                                                                                                              \
48     } while (0)
49 
50 #endif
51