• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (c) 2023 MediaTek Inc.
4  * Author: Yunfei Dong <yunfei.dong@mediatek.com>
5  */
6 
7 #ifndef __MTK_VCODEC_DBGFS_H__
8 #define __MTK_VCODEC_DBGFS_H__
9 
10 struct mtk_vcodec_dec_dev;
11 struct mtk_vcodec_dec_ctx;
12 
13 /*
14  * enum mtk_vdec_dbgfs_log_index  - used to get different debug information
15  */
16 enum mtk_vdec_dbgfs_log_index {
17 	MTK_VDEC_DBGFS_PICINFO,
18 	MTK_VDEC_DBGFS_FORMAT,
19 	MTK_VDEC_DBGFS_MAX,
20 };
21 
22 /**
23  * struct mtk_vcodec_dbgfs_inst  - debugfs information for each inst
24  * @node:       list node for each inst
25  * @vcodec_ctx: struct mtk_vcodec_dec_ctx
26  * @inst_id:    index of the context that the same with ctx->id
27  */
28 struct mtk_vcodec_dbgfs_inst {
29 	struct list_head node;
30 	struct mtk_vcodec_dec_ctx *vcodec_ctx;
31 	int inst_id;
32 };
33 
34 /**
35  * struct mtk_vcodec_dbgfs  - dbgfs information
36  * @dbgfs_head:  list head used to link each instance
37  * @vcodec_root: vcodec dbgfs entry
38  * @dbgfs_lock:  dbgfs lock used to protect dbgfs_buf
39  * @dbgfs_buf:   dbgfs buf used to store dbgfs cmd
40  * @buf_size:    buffer size of dbgfs
41  * @inst_count:  the count of total instance
42  */
43 struct mtk_vcodec_dbgfs {
44 	struct list_head dbgfs_head;
45 	struct dentry *vcodec_root;
46 	struct mutex dbgfs_lock;
47 	char dbgfs_buf[1024];
48 	int buf_size;
49 	int inst_count;
50 };
51 
52 #if defined(CONFIG_DEBUG_FS)
53 void mtk_vcodec_dbgfs_create(struct mtk_vcodec_dec_ctx *ctx);
54 void mtk_vcodec_dbgfs_remove(struct mtk_vcodec_dec_dev *vcodec_dev, int ctx_id);
55 void mtk_vcodec_dbgfs_init(void *vcodec_dev, bool is_encode);
56 void mtk_vcodec_dbgfs_deinit(struct mtk_vcodec_dbgfs *dbgfs);
57 #else
mtk_vcodec_dbgfs_create(struct mtk_vcodec_dec_ctx * ctx)58 static inline void mtk_vcodec_dbgfs_create(struct mtk_vcodec_dec_ctx *ctx)
59 {
60 }
61 
mtk_vcodec_dbgfs_remove(struct mtk_vcodec_dec_dev * vcodec_dev,int ctx_id)62 static inline void mtk_vcodec_dbgfs_remove(struct mtk_vcodec_dec_dev *vcodec_dev, int ctx_id)
63 {
64 }
65 
mtk_vcodec_dbgfs_init(void * vcodec_dev,bool is_encode)66 static inline void mtk_vcodec_dbgfs_init(void *vcodec_dev, bool is_encode)
67 {
68 }
69 
mtk_vcodec_dbgfs_deinit(struct mtk_vcodec_dbgfs * dbgfs)70 static inline void mtk_vcodec_dbgfs_deinit(struct mtk_vcodec_dbgfs *dbgfs)
71 {
72 }
73 #endif
74 #endif
75