1e47616dfSKalyan Thota /* SPDX-License-Identifier: GPL-2.0-only */
2e47616dfSKalyan Thota /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
3e47616dfSKalyan Thota  */
4e47616dfSKalyan Thota 
5e47616dfSKalyan Thota #ifndef _DPU_HW_DSPP_H
6e47616dfSKalyan Thota #define _DPU_HW_DSPP_H
7e47616dfSKalyan Thota 
8e47616dfSKalyan Thota #include "dpu_hw_blk.h"
9e47616dfSKalyan Thota 
10e47616dfSKalyan Thota struct dpu_hw_dspp;
11e47616dfSKalyan Thota 
12e47616dfSKalyan Thota /**
13e47616dfSKalyan Thota  * struct dpu_hw_dspp_ops - interface to the dspp hardware driver functions
14e47616dfSKalyan Thota  * Caller must call the init function to get the dspp context for each dspp
15e47616dfSKalyan Thota  * Assumption is these functions will be called after clocks are enabled
16e47616dfSKalyan Thota  */
17e47616dfSKalyan Thota struct dpu_hw_dspp_ops {
18e47616dfSKalyan Thota 
19e47616dfSKalyan Thota 	void (*dummy)(struct dpu_hw_dspp *ctx);
20e47616dfSKalyan Thota };
21e47616dfSKalyan Thota 
22e47616dfSKalyan Thota /**
23e47616dfSKalyan Thota  * struct dpu_hw_dspp - dspp description
24e47616dfSKalyan Thota  * @base: Hardware block base structure
25e47616dfSKalyan Thota  * @hw: Block hardware details
26e47616dfSKalyan Thota  * @idx: DSPP index
27e47616dfSKalyan Thota  * @cap: Pointer to layer_cfg
28e47616dfSKalyan Thota  * @ops: Pointer to operations possible for this DSPP
29e47616dfSKalyan Thota  */
30e47616dfSKalyan Thota struct dpu_hw_dspp {
31e47616dfSKalyan Thota 	struct dpu_hw_blk base;
32e47616dfSKalyan Thota 	struct dpu_hw_blk_reg_map hw;
33e47616dfSKalyan Thota 
34e47616dfSKalyan Thota 	/* dspp */
35e47616dfSKalyan Thota 	int idx;
36e47616dfSKalyan Thota 	const struct dpu_dspp_cfg *cap;
37e47616dfSKalyan Thota 
38e47616dfSKalyan Thota 	/* Ops */
39e47616dfSKalyan Thota 	struct dpu_hw_dspp_ops ops;
40e47616dfSKalyan Thota };
41e47616dfSKalyan Thota 
42e47616dfSKalyan Thota /**
43e47616dfSKalyan Thota  * dpu_hw_dspp - convert base object dpu_hw_base to container
44e47616dfSKalyan Thota  * @hw: Pointer to base hardware block
45e47616dfSKalyan Thota  * return: Pointer to hardware block container
46e47616dfSKalyan Thota  */
47e47616dfSKalyan Thota static inline struct dpu_hw_dspp *to_dpu_hw_dspp(struct dpu_hw_blk *hw)
48e47616dfSKalyan Thota {
49e47616dfSKalyan Thota 	return container_of(hw, struct dpu_hw_dspp, base);
50e47616dfSKalyan Thota }
51e47616dfSKalyan Thota 
52e47616dfSKalyan Thota /**
53e47616dfSKalyan Thota  * dpu_hw_dspp_init - initializes the dspp hw driver object.
54e47616dfSKalyan Thota  * should be called once before accessing every dspp.
55e47616dfSKalyan Thota  * @idx:  DSPP index for which driver object is required
56e47616dfSKalyan Thota  * @addr: Mapped register io address of MDP
57e47616dfSKalyan Thota  * @Return: pointer to structure or ERR_PTR
58e47616dfSKalyan Thota  */
59e47616dfSKalyan Thota struct dpu_hw_dspp *dpu_hw_dspp_init(enum dpu_dspp idx,
60e47616dfSKalyan Thota 	void __iomem *addr, const struct dpu_mdss_cfg *m);
61e47616dfSKalyan Thota 
62e47616dfSKalyan Thota /**
63e47616dfSKalyan Thota  * dpu_hw_dspp_destroy(): Destroys DSPP driver context
64e47616dfSKalyan Thota  * @dspp: Pointer to DSPP driver context
65e47616dfSKalyan Thota  */
66e47616dfSKalyan Thota void dpu_hw_dspp_destroy(struct dpu_hw_dspp *dspp);
67e47616dfSKalyan Thota 
68e47616dfSKalyan Thota #endif /*_DPU_HW_DSPP_H */
69e47616dfSKalyan Thota 
70