summaryrefslogtreecommitdiff
path: root/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.h
blob: 241ff8197e73069b20a2a67f3206924741002f9d (plain)
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
71
72
73
74
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright (c) 2023 MediaTek Inc.
 * Author: Yunfei Dong <yunfei.dong@mediatek.com>
 */

#ifndef __MTK_VCODEC_DBGFS_H__
#define __MTK_VCODEC_DBGFS_H__

struct mtk_vcodec_dev;
struct mtk_vcodec_ctx;

/*
 * enum mtk_vdec_dbgfs_log_index  - used to get different debug information
 */
enum mtk_vdec_dbgfs_log_index {
	MTK_VDEC_DBGFS_PICINFO,
	MTK_VDEC_DBGFS_FORMAT,
	MTK_VDEC_DBGFS_MAX,
};

/**
 * struct mtk_vcodec_dbgfs_inst  - debugfs information for each inst
 * @node:       list node for each inst
 * @vcodec_ctx: struct mtk_vcodec_ctx
 * @inst_id:    index of the context that the same with ctx->id
 */
struct mtk_vcodec_dbgfs_inst {
	struct list_head node;
	struct mtk_vcodec_ctx *vcodec_ctx;
	int inst_id;
};

/**
 * struct mtk_vcodec_dbgfs  - dbgfs information
 * @dbgfs_head:  list head used to link each instance
 * @vcodec_root: vcodec dbgfs entry
 * @dbgfs_lock:  dbgfs lock used to protect dbgfs_buf
 * @dbgfs_buf:   dbgfs buf used to store dbgfs cmd
 * @buf_size:    buffer size of dbgfs
 * @inst_count:  the count of total instance
 */
struct mtk_vcodec_dbgfs {
	struct list_head dbgfs_head;
	struct dentry *vcodec_root;
	struct mutex dbgfs_lock;
	char dbgfs_buf[1024];
	int buf_size;
	int inst_count;
};

#if defined(CONFIG_DEBUG_FS)
void mtk_vcodec_dbgfs_create(struct mtk_vcodec_ctx *ctx);
void mtk_vcodec_dbgfs_remove(struct mtk_vcodec_dev *vcodec_dev, int ctx_id);
void mtk_vcodec_dbgfs_init(struct mtk_vcodec_dev *vcodec_dev, bool is_encode);
void mtk_vcodec_dbgfs_deinit(struct mtk_vcodec_dev *vcodec_dev);
#else
static inline void mtk_vcodec_dbgfs_create(struct mtk_vcodec_ctx *ctx)
{
}

static inline void mtk_vcodec_dbgfs_remove(struct mtk_vcodec_dev *vcodec_dev, int ctx_id)
{
}

static inline void mtk_vcodec_dbgfs_init(struct mtk_vcodec_dev *vcodec_dev, bool is_encode)
{
}

static inline void mtk_vcodec_dbgfs_deinit(struct mtk_vcodec_dev *vcodec_dev)
{
}
#endif
#endif