GNU Linux-libre 5.19-rc6-gnu
[releases.git] / drivers / media / platform / mediatek / vcodec / mtk_vcodec_dec_hw.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (c) 2021 MediaTek Inc.
4  * Author: Yunfei Dong <yunfei.dong@mediatek.com>
5  */
6
7 #ifndef _MTK_VCODEC_DEC_HW_H_
8 #define _MTK_VCODEC_DEC_HW_H_
9
10 #include <linux/io.h>
11 #include <linux/platform_device.h>
12
13 #include "mtk_vcodec_drv.h"
14
15 #define VDEC_HW_ACTIVE 0x10
16 #define VDEC_IRQ_CFG 0x11
17 #define VDEC_IRQ_CLR 0x10
18 #define VDEC_IRQ_CFG_REG 0xa4
19
20 /**
21  * enum mtk_vdec_hw_reg_idx - subdev hardware register base index
22  * @VDEC_HW_SYS : vdec soc register index
23  * @VDEC_HW_MISC: vdec misc register index
24  * @VDEC_HW_MAX : vdec supported max register index
25  */
26 enum mtk_vdec_hw_reg_idx {
27         VDEC_HW_SYS,
28         VDEC_HW_MISC,
29         VDEC_HW_MAX
30 };
31
32 /**
33  * struct mtk_vdec_hw_dev - vdec hardware driver data
34  * @plat_dev: platform device
35  * @main_dev: main device
36  * @reg_base: mapped address of MTK Vcodec registers.
37  *
38  * @curr_ctx: the context that is waiting for codec hardware
39  *
40  * @dec_irq : decoder irq resource
41  * @pm      : power management control
42  * @hw_idx  : each hardware index
43  */
44 struct mtk_vdec_hw_dev {
45         struct platform_device *plat_dev;
46         struct mtk_vcodec_dev *main_dev;
47         void __iomem *reg_base[VDEC_HW_MAX];
48
49         struct mtk_vcodec_ctx *curr_ctx;
50
51         int dec_irq;
52         struct mtk_vcodec_pm pm;
53         int hw_idx;
54 };
55
56 #endif /* _MTK_VCODEC_DEC_HW_H_ */