Linux-libre 5.3.12-gnu
[librecmc/linux-libre.git] / drivers / media / platform / mtk-mdp / mtk_mdp_comp.h
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (c) 2016 MediaTek Inc.
4  * Author: Ming Hsiu Tsai <minghsiu.tsai@mediatek.com>
5  */
6
7 #ifndef __MTK_MDP_COMP_H__
8 #define __MTK_MDP_COMP_H__
9
10 /**
11  * enum mtk_mdp_comp_type - the MDP component
12  * @MTK_MDP_RDMA:       Read DMA
13  * @MTK_MDP_RSZ:        Riszer
14  * @MTK_MDP_WDMA:       Write DMA
15  * @MTK_MDP_WROT:       Write DMA with rotation
16  */
17 enum mtk_mdp_comp_type {
18         MTK_MDP_RDMA,
19         MTK_MDP_RSZ,
20         MTK_MDP_WDMA,
21         MTK_MDP_WROT,
22         MTK_MDP_COMP_TYPE_MAX,
23 };
24
25 enum mtk_mdp_comp_id {
26         MTK_MDP_COMP_RDMA0,
27         MTK_MDP_COMP_RDMA1,
28         MTK_MDP_COMP_RSZ0,
29         MTK_MDP_COMP_RSZ1,
30         MTK_MDP_COMP_RSZ2,
31         MTK_MDP_COMP_WDMA,
32         MTK_MDP_COMP_WROT0,
33         MTK_MDP_COMP_WROT1,
34         MTK_MDP_COMP_ID_MAX,
35 };
36
37 /**
38  * struct mtk_mdp_comp - the MDP's function component data
39  * @dev_node:   component device node
40  * @clk:        clocks required for component
41  * @regs:       Mapped address of component registers.
42  * @larb_dev:   SMI device required for component
43  * @type:       component type
44  * @id:         component ID
45  */
46 struct mtk_mdp_comp {
47         struct device_node      *dev_node;
48         struct clk              *clk[2];
49         void __iomem            *regs;
50         struct device           *larb_dev;
51         enum mtk_mdp_comp_type  type;
52         enum mtk_mdp_comp_id    id;
53 };
54
55 int mtk_mdp_comp_init(struct device *dev, struct device_node *node,
56                       struct mtk_mdp_comp *comp, enum mtk_mdp_comp_id comp_id);
57 void mtk_mdp_comp_deinit(struct device *dev, struct mtk_mdp_comp *comp);
58 int mtk_mdp_comp_get_id(struct device *dev, struct device_node *node,
59                         enum mtk_mdp_comp_type comp_type);
60 void mtk_mdp_comp_clock_on(struct device *dev, struct mtk_mdp_comp *comp);
61 void mtk_mdp_comp_clock_off(struct device *dev, struct mtk_mdp_comp *comp);
62
63
64 #endif /* __MTK_MDP_COMP_H__ */