1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
3  */
4 
5 #ifndef _DPU_HW_MERGE3D_H
6 #define _DPU_HW_MERGE3D_H
7 
8 #include "dpu_hw_catalog.h"
9 #include "dpu_hw_mdss.h"
10 #include "dpu_hw_util.h"
11 #include "dpu_hw_blk.h"
12 
13 struct dpu_hw_merge_3d;
14 
15 /**
16  *
17  * struct dpu_hw_merge_3d_ops : Interface to the merge_3d Hw driver functions
18  *  Assumption is these functions will be called after clocks are enabled
19  *  @setup_3d_mode : enable 3D merge
20  */
21 struct dpu_hw_merge_3d_ops {
22 	void (*setup_3d_mode)(struct dpu_hw_merge_3d *merge_3d,
23 			enum dpu_3d_blend_mode mode_3d);
24 
25 };
26 
27 struct dpu_hw_merge_3d {
28 	struct dpu_hw_blk base;
29 	struct dpu_hw_blk_reg_map hw;
30 
31 	/* merge_3d */
32 	enum dpu_merge_3d idx;
33 	const struct dpu_merge_3d_cfg *caps;
34 
35 	/* ops */
36 	struct dpu_hw_merge_3d_ops ops;
37 };
38 
39 /**
40  * to_dpu_hw_merge_3d - convert base object dpu_hw_base to container
41  * @hw: Pointer to base hardware block
42  * return: Pointer to hardware block container
43  */
44 static inline struct dpu_hw_merge_3d *to_dpu_hw_merge_3d(struct dpu_hw_blk *hw)
45 {
46 	return container_of(hw, struct dpu_hw_merge_3d, base);
47 }
48 
49 /**
50  * dpu_hw_merge_3d_init - initializes the merge_3d driver for the passed
51  *	merge_3d idx.
52  * @idx:  Pingpong index for which driver object is required
53  * @addr: Mapped register io address of MDP
54  * @m:    Pointer to mdss catalog data
55  * Returns: Error code or allocated dpu_hw_merge_3d context
56  */
57 struct dpu_hw_merge_3d *dpu_hw_merge_3d_init(enum dpu_merge_3d idx,
58 		void __iomem *addr,
59 		const struct dpu_mdss_cfg *m);
60 
61 /**
62  * dpu_hw_merge_3d_destroy - destroys merge_3d driver context
63  *	should be called to free the context
64  * @pp:   Pointer to PP driver context returned by dpu_hw_merge_3d_init
65  */
66 void dpu_hw_merge_3d_destroy(struct dpu_hw_merge_3d *pp);
67 
68 #endif /*_DPU_HW_MERGE3D_H */
69