GNU Linux-libre 4.19.286-gnu1
[releases.git] / drivers / media / platform / mtk-mdp / mtk_mdp_comp.h
1 /*
2  * Copyright (c) 2016 MediaTek Inc.
3  * Author: Ming Hsiu Tsai <minghsiu.tsai@mediatek.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  */
14
15 #ifndef __MTK_MDP_COMP_H__
16 #define __MTK_MDP_COMP_H__
17
18 /**
19  * enum mtk_mdp_comp_type - the MDP component
20  * @MTK_MDP_RDMA:       Read DMA
21  * @MTK_MDP_RSZ:        Riszer
22  * @MTK_MDP_WDMA:       Write DMA
23  * @MTK_MDP_WROT:       Write DMA with rotation
24  */
25 enum mtk_mdp_comp_type {
26         MTK_MDP_RDMA,
27         MTK_MDP_RSZ,
28         MTK_MDP_WDMA,
29         MTK_MDP_WROT,
30         MTK_MDP_COMP_TYPE_MAX,
31 };
32
33 enum mtk_mdp_comp_id {
34         MTK_MDP_COMP_RDMA0,
35         MTK_MDP_COMP_RDMA1,
36         MTK_MDP_COMP_RSZ0,
37         MTK_MDP_COMP_RSZ1,
38         MTK_MDP_COMP_RSZ2,
39         MTK_MDP_COMP_WDMA,
40         MTK_MDP_COMP_WROT0,
41         MTK_MDP_COMP_WROT1,
42         MTK_MDP_COMP_ID_MAX,
43 };
44
45 /**
46  * struct mtk_mdp_comp - the MDP's function component data
47  * @dev_node:   component device node
48  * @clk:        clocks required for component
49  * @regs:       Mapped address of component registers.
50  * @larb_dev:   SMI device required for component
51  * @type:       component type
52  * @id:         component ID
53  */
54 struct mtk_mdp_comp {
55         struct device_node      *dev_node;
56         struct clk              *clk[2];
57         void __iomem            *regs;
58         struct device           *larb_dev;
59         enum mtk_mdp_comp_type  type;
60         enum mtk_mdp_comp_id    id;
61 };
62
63 int mtk_mdp_comp_init(struct device *dev, struct device_node *node,
64                       struct mtk_mdp_comp *comp, enum mtk_mdp_comp_id comp_id);
65 void mtk_mdp_comp_deinit(struct device *dev, struct mtk_mdp_comp *comp);
66 int mtk_mdp_comp_get_id(struct device *dev, struct device_node *node,
67                         enum mtk_mdp_comp_type comp_type);
68 void mtk_mdp_comp_clock_on(struct device *dev, struct mtk_mdp_comp *comp);
69 void mtk_mdp_comp_clock_off(struct device *dev, struct mtk_mdp_comp *comp);
70
71
72 #endif /* __MTK_MDP_COMP_H__ */