1 /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
16 #include "dpu_hw_catalog.h"
17 #include "dpu_hw_mdss.h"
18 #include "dpu_hw_util.h"
19 #include "dpu_hw_blk.h"
24 * struct traffic_shaper_cfg: traffic shaper configuration
25 * @en : enable/disable traffic shaper
26 * @rd_client : true if read client; false if write client
27 * @client_id : client identifier
28 * @bpc_denom : denominator of byte per clk
29 * @bpc_numer : numerator of byte per clk
31 struct traffic_shaper_cfg {
40 * struct split_pipe_cfg - pipe configuration for dual display panels
41 * @en : Enable/disable dual pipe confguration
42 * @mode : Panel interface mode
43 * @intf : Interface id for main control path
44 * @split_flush_en: Allows both the paths to be flushed when master path is
47 struct split_pipe_cfg {
49 enum dpu_intf_mode mode;
55 * struct cdm_output_cfg: output configuration for cdm
56 * @intf_en : enable/disable interface output
58 struct cdm_output_cfg {
63 * struct dpu_danger_safe_status: danger and safe status signals
64 * @mdp: top level status
65 * @sspp: source pipe status
67 struct dpu_danger_safe_status {
73 * struct dpu_vsync_source_cfg - configure vsync source and configure the
74 * watchdog timers if required.
75 * @pp_count: number of ping pongs active
76 * @frame_rate: Display frame rate
77 * @ppnumber: ping pong index array
78 * @vsync_source: vsync source selection
80 struct dpu_vsync_source_cfg {
83 u32 ppnumber[PINGPONG_MAX];
88 * struct dpu_hw_mdp_ops - interface to the MDP TOP Hw driver functions
89 * Assumption is these functions will be called after clocks are enabled.
90 * @setup_split_pipe : Programs the pipe control registers
91 * @setup_pp_split : Programs the pp split control registers
92 * @setup_cdm_output : programs cdm control
93 * @setup_traffic_shaper : programs traffic shaper control
95 struct dpu_hw_mdp_ops {
96 /** setup_split_pipe() : Regsiters are not double buffered, thisk
97 * function should be called before timing control enable
98 * @mdp : mdp top context driver
99 * @cfg : upper and lower part of pipe configuration
101 void (*setup_split_pipe)(struct dpu_hw_mdp *mdp,
102 struct split_pipe_cfg *p);
105 * setup_cdm_output() : Setup selection control of the cdm data path
106 * @mdp : mdp top context driver
107 * @cfg : cdm output configuration
109 void (*setup_cdm_output)(struct dpu_hw_mdp *mdp,
110 struct cdm_output_cfg *cfg);
113 * setup_traffic_shaper() : Setup traffic shaper control
114 * @mdp : mdp top context driver
115 * @cfg : traffic shaper configuration
117 void (*setup_traffic_shaper)(struct dpu_hw_mdp *mdp,
118 struct traffic_shaper_cfg *cfg);
121 * setup_clk_force_ctrl - set clock force control
122 * @mdp: mdp top context driver
123 * @clk_ctrl: clock to be controlled
124 * @enable: force on enable
125 * @return: if the clock is forced-on by this function
127 bool (*setup_clk_force_ctrl)(struct dpu_hw_mdp *mdp,
128 enum dpu_clk_ctrl_type clk_ctrl, bool enable);
131 * get_danger_status - get danger status
132 * @mdp: mdp top context driver
133 * @status: Pointer to danger safe status
135 void (*get_danger_status)(struct dpu_hw_mdp *mdp,
136 struct dpu_danger_safe_status *status);
139 * setup_vsync_source - setup vsync source configuration details
140 * @mdp: mdp top context driver
141 * @cfg: vsync source selection configuration
143 void (*setup_vsync_source)(struct dpu_hw_mdp *mdp,
144 struct dpu_vsync_source_cfg *cfg);
147 * get_safe_status - get safe status
148 * @mdp: mdp top context driver
149 * @status: Pointer to danger safe status
151 void (*get_safe_status)(struct dpu_hw_mdp *mdp,
152 struct dpu_danger_safe_status *status);
155 * reset_ubwc - reset top level UBWC configuration
156 * @mdp: mdp top context driver
157 * @m: pointer to mdss catalog data
159 void (*reset_ubwc)(struct dpu_hw_mdp *mdp, struct dpu_mdss_cfg *m);
162 * intf_audio_select - select the external interface for audio
163 * @mdp: mdp top context driver
165 void (*intf_audio_select)(struct dpu_hw_mdp *mdp);
169 struct dpu_hw_blk base;
170 struct dpu_hw_blk_reg_map hw;
174 const struct dpu_mdp_cfg *caps;
177 struct dpu_hw_mdp_ops ops;
181 * to_dpu_hw_mdp - convert base object dpu_hw_base to container
182 * @hw: Pointer to base hardware block
183 * return: Pointer to hardware block container
185 static inline struct dpu_hw_mdp *to_dpu_hw_mdp(struct dpu_hw_blk *hw)
187 return container_of(hw, struct dpu_hw_mdp, base);
191 * dpu_hw_mdptop_init - initializes the top driver for the passed idx
192 * @idx: Interface 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_mdp *dpu_hw_mdptop_init(enum dpu_mdp idx,
198 const struct dpu_mdss_cfg *m);
200 void dpu_hw_mdp_destroy(struct dpu_hw_mdp *mdp);
202 #endif /*_DPU_HW_TOP_H */