75 lines · c
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 10struct mtk_vcodec_dec_dev;11struct mtk_vcodec_dec_ctx;12 13/*14 * enum mtk_vdec_dbgfs_log_index - used to get different debug information15 */16enum 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 inst24 * @node: list node for each inst25 * @vcodec_ctx: struct mtk_vcodec_dec_ctx26 * @inst_id: index of the context that the same with ctx->id27 */28struct 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 information36 * @dbgfs_head: list head used to link each instance37 * @vcodec_root: vcodec dbgfs entry38 * @dbgfs_lock: dbgfs lock used to protect dbgfs_buf39 * @dbgfs_buf: dbgfs buf used to store dbgfs cmd40 * @buf_size: buffer size of dbgfs41 * @inst_count: the count of total instance42 */43struct 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)53void mtk_vcodec_dbgfs_create(struct mtk_vcodec_dec_ctx *ctx);54void mtk_vcodec_dbgfs_remove(struct mtk_vcodec_dec_dev *vcodec_dev, int ctx_id);55void mtk_vcodec_dbgfs_init(void *vcodec_dev, bool is_encode);56void mtk_vcodec_dbgfs_deinit(struct mtk_vcodec_dbgfs *dbgfs);57#else58static inline void mtk_vcodec_dbgfs_create(struct mtk_vcodec_dec_ctx *ctx)59{60}61 62static inline void mtk_vcodec_dbgfs_remove(struct mtk_vcodec_dec_dev *vcodec_dev, int ctx_id)63{64}65 66static inline void mtk_vcodec_dbgfs_init(void *vcodec_dev, bool is_encode)67{68}69 70static inline void mtk_vcodec_dbgfs_deinit(struct mtk_vcodec_dbgfs *dbgfs)71{72}73#endif74#endif75