17866e124SYunfei Dong /* SPDX-License-Identifier: GPL-2.0 */ 27866e124SYunfei Dong /* 37866e124SYunfei Dong * Copyright (c) 2023 MediaTek Inc. 47866e124SYunfei Dong * Author: Yunfei Dong <yunfei.dong@mediatek.com> 57866e124SYunfei Dong */ 67866e124SYunfei Dong 77866e124SYunfei Dong #ifndef __MTK_VCODEC_DBGFS_H__ 87866e124SYunfei Dong #define __MTK_VCODEC_DBGFS_H__ 97866e124SYunfei Dong 10*31272a39SYunfei Dong struct mtk_vcodec_dec_dev; 1101abf5fbSYunfei Dong struct mtk_vcodec_dec_ctx; 125e488a4fSYunfei Dong 1307b7e505SYunfei Dong /* 1407b7e505SYunfei Dong * enum mtk_vdec_dbgfs_log_index - used to get different debug information 1507b7e505SYunfei Dong */ 1607b7e505SYunfei Dong enum mtk_vdec_dbgfs_log_index { 1707b7e505SYunfei Dong MTK_VDEC_DBGFS_PICINFO, 186d5aea13SYunfei Dong MTK_VDEC_DBGFS_FORMAT, 1907b7e505SYunfei Dong MTK_VDEC_DBGFS_MAX, 2007b7e505SYunfei Dong }; 2107b7e505SYunfei Dong 225e488a4fSYunfei Dong /** 235e488a4fSYunfei Dong * struct mtk_vcodec_dbgfs_inst - debugfs information for each inst 245e488a4fSYunfei Dong * @node: list node for each inst 2501abf5fbSYunfei Dong * @vcodec_ctx: struct mtk_vcodec_dec_ctx 265e488a4fSYunfei Dong * @inst_id: index of the context that the same with ctx->id 275e488a4fSYunfei Dong */ 285e488a4fSYunfei Dong struct mtk_vcodec_dbgfs_inst { 295e488a4fSYunfei Dong struct list_head node; 3001abf5fbSYunfei Dong struct mtk_vcodec_dec_ctx *vcodec_ctx; 315e488a4fSYunfei Dong int inst_id; 325e488a4fSYunfei Dong }; 337866e124SYunfei Dong 347866e124SYunfei Dong /** 357866e124SYunfei Dong * struct mtk_vcodec_dbgfs - dbgfs information 365e488a4fSYunfei Dong * @dbgfs_head: list head used to link each instance 377866e124SYunfei Dong * @vcodec_root: vcodec dbgfs entry 385e488a4fSYunfei Dong * @dbgfs_lock: dbgfs lock used to protect dbgfs_buf 395e488a4fSYunfei Dong * @dbgfs_buf: dbgfs buf used to store dbgfs cmd 405e488a4fSYunfei Dong * @buf_size: buffer size of dbgfs 415e488a4fSYunfei Dong * @inst_count: the count of total instance 427866e124SYunfei Dong */ 437866e124SYunfei Dong struct mtk_vcodec_dbgfs { 445e488a4fSYunfei Dong struct list_head dbgfs_head; 457866e124SYunfei Dong struct dentry *vcodec_root; 465e488a4fSYunfei Dong struct mutex dbgfs_lock; 475e488a4fSYunfei Dong char dbgfs_buf[1024]; 485e488a4fSYunfei Dong int buf_size; 495e488a4fSYunfei Dong int inst_count; 507866e124SYunfei Dong }; 517866e124SYunfei Dong 527866e124SYunfei Dong #if defined(CONFIG_DEBUG_FS) 5301abf5fbSYunfei Dong void mtk_vcodec_dbgfs_create(struct mtk_vcodec_dec_ctx *ctx); 54*31272a39SYunfei Dong void mtk_vcodec_dbgfs_remove(struct mtk_vcodec_dec_dev *vcodec_dev, int ctx_id); 55*31272a39SYunfei Dong void mtk_vcodec_dbgfs_init(void *vcodec_dev, bool is_encode); 56*31272a39SYunfei Dong void mtk_vcodec_dbgfs_deinit(struct mtk_vcodec_dbgfs *dbgfs); 577866e124SYunfei Dong #else mtk_vcodec_dbgfs_create(struct mtk_vcodec_dec_ctx * ctx)5801abf5fbSYunfei Dongstatic inline void mtk_vcodec_dbgfs_create(struct mtk_vcodec_dec_ctx *ctx) 595e488a4fSYunfei Dong { 605e488a4fSYunfei Dong } 615e488a4fSYunfei Dong mtk_vcodec_dbgfs_remove(struct mtk_vcodec_dec_dev * vcodec_dev,int ctx_id)62*31272a39SYunfei Dongstatic inline void mtk_vcodec_dbgfs_remove(struct mtk_vcodec_dec_dev *vcodec_dev, int ctx_id) 635e488a4fSYunfei Dong { 645e488a4fSYunfei Dong } 655e488a4fSYunfei Dong mtk_vcodec_dbgfs_init(void * vcodec_dev,bool is_encode)66*31272a39SYunfei Dongstatic inline void mtk_vcodec_dbgfs_init(void *vcodec_dev, bool is_encode) 677866e124SYunfei Dong { 687866e124SYunfei Dong } 697866e124SYunfei Dong mtk_vcodec_dbgfs_deinit(struct mtk_vcodec_dbgfs * dbgfs)70*31272a39SYunfei Dongstatic inline void mtk_vcodec_dbgfs_deinit(struct mtk_vcodec_dbgfs *dbgfs) 717866e124SYunfei Dong { 727866e124SYunfei Dong } 737866e124SYunfei Dong #endif 747866e124SYunfei Dong #endif 75