Merge tag 'gpio-v5.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux...
[linux-2.6-microblaze.git] / drivers / gpu / drm / msm / disp / dpu1 / dpu_hw_blk.h
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
3  */
4
5 #ifndef _DPU_HW_BLK_H
6 #define _DPU_HW_BLK_H
7
8 #include <linux/types.h>
9 #include <linux/list.h>
10 #include <linux/atomic.h>
11
12 struct dpu_hw_blk;
13
14 /**
15  * struct dpu_hw_blk_ops - common hardware block operations
16  * @start: start operation on first get
17  * @stop: stop operation on last put
18  */
19 struct dpu_hw_blk_ops {
20         int (*start)(struct dpu_hw_blk *);
21         void (*stop)(struct dpu_hw_blk *);
22 };
23
24 /**
25  * struct dpu_hw_blk - definition of hardware block object
26  * @list: list of hardware blocks
27  * @type: hardware block type
28  * @id: instance id
29  * @refcount: reference/usage count
30  */
31 struct dpu_hw_blk {
32         struct list_head list;
33         u32 type;
34         int id;
35         atomic_t refcount;
36         struct dpu_hw_blk_ops ops;
37 };
38
39 void dpu_hw_blk_init(struct dpu_hw_blk *hw_blk, u32 type, int id,
40                 struct dpu_hw_blk_ops *ops);
41 void dpu_hw_blk_destroy(struct dpu_hw_blk *hw_blk);
42
43 struct dpu_hw_blk *dpu_hw_blk_get(struct dpu_hw_blk *hw_blk, u32 type, int id);
44 void dpu_hw_blk_put(struct dpu_hw_blk *hw_blk);
45 #endif /*_DPU_HW_BLK_H */