1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
8 #include "dpu_hw_mdss.h"
9 #include "dpu_hw_util.h"
10 #include "dpu_hw_catalog.h"
11 #include "dpu_hw_sspp.h"
12 #include "dpu_hw_blk.h"
15 * dpu_ctl_mode_sel: Interface mode selection
16 * DPU_CTL_MODE_SEL_VID: Video mode interface
17 * DPU_CTL_MODE_SEL_CMD: Command mode interface
19 enum dpu_ctl_mode_sel {
20 DPU_CTL_MODE_SEL_VID = 0,
26 * struct dpu_hw_stage_cfg - blending stage cfg
27 * @stage : SSPP_ID at each stage
28 * @multirect_index: index of the rectangle of SSPP.
30 struct dpu_hw_stage_cfg {
31 enum dpu_sspp stage[DPU_STAGE_MAX][PIPES_PER_STAGE];
32 enum dpu_sspp_multirect_index multirect_index
33 [DPU_STAGE_MAX][PIPES_PER_STAGE];
37 * struct dpu_hw_intf_cfg :Describes how the DPU writes data to output interface
38 * @intf : Interface id
39 * @mode_3d: 3d mux configuration
40 * @intf_mode_sel: Interface mode, cmd / vid
41 * @stream_sel: Stream selection for multi-stream interfaces
43 struct dpu_hw_intf_cfg {
45 enum dpu_3d_blend_mode mode_3d;
46 enum dpu_ctl_mode_sel intf_mode_sel;
51 * struct dpu_hw_ctl_ops - Interface to the wb Hw driver functions
52 * Assumption is these functions will be called after clocks are enabled
54 struct dpu_hw_ctl_ops {
56 * kickoff hw operation for Sw controlled interfaces
57 * DSI cmd mode and WB interface are SW controlled
58 * @ctx : ctl path ctx pointer
60 void (*trigger_start)(struct dpu_hw_ctl *ctx);
63 * kickoff prepare is in progress hw operation for sw
64 * controlled interfaces: DSI cmd mode and WB interface
66 * @ctx : ctl path ctx pointer
68 void (*trigger_pending)(struct dpu_hw_ctl *ctx);
71 * Clear the value of the cached pending_flush_mask
72 * No effect on hardware
73 * @ctx : ctl path ctx pointer
75 void (*clear_pending_flush)(struct dpu_hw_ctl *ctx);
78 * Query the value of the cached pending_flush_mask
79 * No effect on hardware
80 * @ctx : ctl path ctx pointer
82 u32 (*get_pending_flush)(struct dpu_hw_ctl *ctx);
85 * OR in the given flushbits to the cached pending_flush_mask
86 * No effect on hardware
87 * @ctx : ctl path ctx pointer
88 * @flushbits : module flushmask
90 void (*update_pending_flush)(struct dpu_hw_ctl *ctx,
94 * Write the value of the pending_flush_mask to hardware
95 * @ctx : ctl path ctx pointer
97 void (*trigger_flush)(struct dpu_hw_ctl *ctx);
100 * Read the value of the flush register
101 * @ctx : ctl path ctx pointer
102 * @Return: value of the ctl flush register.
104 u32 (*get_flush_register)(struct dpu_hw_ctl *ctx);
107 * Setup ctl_path interface config
109 * @cfg : interface config structure pointer
111 void (*setup_intf_cfg)(struct dpu_hw_ctl *ctx,
112 struct dpu_hw_intf_cfg *cfg);
114 int (*reset)(struct dpu_hw_ctl *c);
117 * wait_reset_status - checks ctl reset status
118 * @ctx : ctl path ctx pointer
120 * This function checks the ctl reset status bit.
121 * If the reset bit is set, it keeps polling the status till the hw
123 * Returns: 0 on success or -error if reset incomplete within interval
125 int (*wait_reset_status)(struct dpu_hw_ctl *ctx);
127 uint32_t (*get_bitmask_sspp)(struct dpu_hw_ctl *ctx,
130 uint32_t (*get_bitmask_mixer)(struct dpu_hw_ctl *ctx,
133 int (*get_bitmask_intf)(struct dpu_hw_ctl *ctx,
138 * Set all blend stages to disabled
139 * @ctx : ctl path ctx pointer
141 void (*clear_all_blendstages)(struct dpu_hw_ctl *ctx);
144 * Configure layer mixer to pipe configuration
145 * @ctx : ctl path ctx pointer
146 * @lm : layer mixer enumeration
147 * @cfg : blend stage configuration
149 void (*setup_blendstage)(struct dpu_hw_ctl *ctx,
150 enum dpu_lm lm, struct dpu_hw_stage_cfg *cfg);
154 * struct dpu_hw_ctl : CTL PATH driver object
155 * @base: hardware block base structure
156 * @hw: block register map object
157 * @idx: control path index
158 * @caps: control path capabilities
159 * @mixer_count: number of mixers
160 * @mixer_hw_caps: mixer hardware capabilities
161 * @pending_flush_mask: storage for pending ctl_flush managed via ops
162 * @ops: operation list
165 struct dpu_hw_blk base;
166 struct dpu_hw_blk_reg_map hw;
170 const struct dpu_ctl_cfg *caps;
172 const struct dpu_lm_cfg *mixer_hw_caps;
173 u32 pending_flush_mask;
176 struct dpu_hw_ctl_ops ops;
180 * dpu_hw_ctl - convert base object dpu_hw_base to container
181 * @hw: Pointer to base hardware block
182 * return: Pointer to hardware block container
184 static inline struct dpu_hw_ctl *to_dpu_hw_ctl(struct dpu_hw_blk *hw)
186 return container_of(hw, struct dpu_hw_ctl, base);
190 * dpu_hw_ctl_init(): Initializes the ctl_path hw driver object.
191 * should be called before accessing every ctl path registers.
192 * @idx: ctl_path index for which driver object is required
193 * @addr: mapped register io address of MDP
194 * @m : pointer to mdss catalog data
196 struct dpu_hw_ctl *dpu_hw_ctl_init(enum dpu_ctl idx,
198 struct dpu_mdss_cfg *m);
201 * dpu_hw_ctl_destroy(): Destroys ctl driver context
202 * should be called to free the context
204 void dpu_hw_ctl_destroy(struct dpu_hw_ctl *ctx);
206 #endif /*_DPU_HW_CTL_H */