Lines Matching +full:comp +full:- +full:int
1 /* SPDX-License-Identifier: GPL-2.0-only */
11 #include <linux/soc/mediatek/mtk-cmdq.h>
12 #include <linux/soc/mediatek/mtk-mmsys.h>
13 #include <linux/soc/mediatek/mtk-mutex.h>
52 int (*power_on)(struct device *dev);
54 int (*clk_enable)(struct device *dev);
56 void (*config)(struct device *dev, unsigned int w,
57 unsigned int h, unsigned int vrefresh,
58 unsigned int bpc, struct cmdq_pkt *cmdq_pkt);
67 unsigned int (*supported_rotations)(struct device *dev);
68 unsigned int (*layer_nr)(struct device *dev);
69 int (*layer_check)(struct device *dev,
70 unsigned int idx,
72 void (*layer_config)(struct device *dev, unsigned int idx,
75 unsigned int (*gamma_get_lut_size)(struct device *dev);
86 void (*connect)(struct device *dev, struct device *mmsys_dev, unsigned int next);
87 void (*disconnect)(struct device *dev, struct device *mmsys_dev, unsigned int next);
90 unsigned int (*encoder_index)(struct device *dev);
96 int irq;
97 unsigned int id;
98 int encoder_index;
102 static inline int mtk_ddp_comp_power_on(struct mtk_ddp_comp *comp) in mtk_ddp_comp_power_on() argument
104 if (comp->funcs && comp->funcs->power_on) in mtk_ddp_comp_power_on()
105 return comp->funcs->power_on(comp->dev); in mtk_ddp_comp_power_on()
107 return pm_runtime_resume_and_get(comp->dev); in mtk_ddp_comp_power_on()
111 static inline void mtk_ddp_comp_power_off(struct mtk_ddp_comp *comp) in mtk_ddp_comp_power_off() argument
113 if (comp->funcs && comp->funcs->power_off) in mtk_ddp_comp_power_off()
114 comp->funcs->power_off(comp->dev); in mtk_ddp_comp_power_off()
116 pm_runtime_put(comp->dev); in mtk_ddp_comp_power_off()
119 static inline int mtk_ddp_comp_clk_enable(struct mtk_ddp_comp *comp) in mtk_ddp_comp_clk_enable() argument
121 if (comp->funcs && comp->funcs->clk_enable) in mtk_ddp_comp_clk_enable()
122 return comp->funcs->clk_enable(comp->dev); in mtk_ddp_comp_clk_enable()
127 static inline void mtk_ddp_comp_clk_disable(struct mtk_ddp_comp *comp) in mtk_ddp_comp_clk_disable() argument
129 if (comp->funcs && comp->funcs->clk_disable) in mtk_ddp_comp_clk_disable()
130 comp->funcs->clk_disable(comp->dev); in mtk_ddp_comp_clk_disable()
134 enum drm_mode_status mtk_ddp_comp_mode_valid(struct mtk_ddp_comp *comp, in mtk_ddp_comp_mode_valid() argument
137 if (comp && comp->funcs && comp->funcs->mode_valid) in mtk_ddp_comp_mode_valid()
138 return comp->funcs->mode_valid(comp->dev, mode); in mtk_ddp_comp_mode_valid()
142 static inline void mtk_ddp_comp_config(struct mtk_ddp_comp *comp, in mtk_ddp_comp_config() argument
143 unsigned int w, unsigned int h, in mtk_ddp_comp_config()
144 unsigned int vrefresh, unsigned int bpc, in mtk_ddp_comp_config()
147 if (comp->funcs && comp->funcs->config) in mtk_ddp_comp_config()
148 comp->funcs->config(comp->dev, w, h, vrefresh, bpc, cmdq_pkt); in mtk_ddp_comp_config()
151 static inline void mtk_ddp_comp_start(struct mtk_ddp_comp *comp) in mtk_ddp_comp_start() argument
153 if (comp->funcs && comp->funcs->start) in mtk_ddp_comp_start()
154 comp->funcs->start(comp->dev); in mtk_ddp_comp_start()
157 static inline void mtk_ddp_comp_stop(struct mtk_ddp_comp *comp) in mtk_ddp_comp_stop() argument
159 if (comp->funcs && comp->funcs->stop) in mtk_ddp_comp_stop()
160 comp->funcs->stop(comp->dev); in mtk_ddp_comp_stop()
163 static inline void mtk_ddp_comp_register_vblank_cb(struct mtk_ddp_comp *comp, in mtk_ddp_comp_register_vblank_cb() argument
167 if (comp->funcs && comp->funcs->register_vblank_cb) in mtk_ddp_comp_register_vblank_cb()
168 comp->funcs->register_vblank_cb(comp->dev, vblank_cb, in mtk_ddp_comp_register_vblank_cb()
172 static inline void mtk_ddp_comp_unregister_vblank_cb(struct mtk_ddp_comp *comp) in mtk_ddp_comp_unregister_vblank_cb() argument
174 if (comp->funcs && comp->funcs->unregister_vblank_cb) in mtk_ddp_comp_unregister_vblank_cb()
175 comp->funcs->unregister_vblank_cb(comp->dev); in mtk_ddp_comp_unregister_vblank_cb()
178 static inline void mtk_ddp_comp_enable_vblank(struct mtk_ddp_comp *comp) in mtk_ddp_comp_enable_vblank() argument
180 if (comp->funcs && comp->funcs->enable_vblank) in mtk_ddp_comp_enable_vblank()
181 comp->funcs->enable_vblank(comp->dev); in mtk_ddp_comp_enable_vblank()
184 static inline void mtk_ddp_comp_disable_vblank(struct mtk_ddp_comp *comp) in mtk_ddp_comp_disable_vblank() argument
186 if (comp->funcs && comp->funcs->disable_vblank) in mtk_ddp_comp_disable_vblank()
187 comp->funcs->disable_vblank(comp->dev); in mtk_ddp_comp_disable_vblank()
191 unsigned int mtk_ddp_comp_supported_rotations(struct mtk_ddp_comp *comp) in mtk_ddp_comp_supported_rotations() argument
193 if (comp->funcs && comp->funcs->supported_rotations) in mtk_ddp_comp_supported_rotations()
194 return comp->funcs->supported_rotations(comp->dev); in mtk_ddp_comp_supported_rotations()
203 static inline unsigned int mtk_ddp_comp_layer_nr(struct mtk_ddp_comp *comp) in mtk_ddp_comp_layer_nr() argument
205 if (comp->funcs && comp->funcs->layer_nr) in mtk_ddp_comp_layer_nr()
206 return comp->funcs->layer_nr(comp->dev); in mtk_ddp_comp_layer_nr()
211 static inline int mtk_ddp_comp_layer_check(struct mtk_ddp_comp *comp, in mtk_ddp_comp_layer_check() argument
212 unsigned int idx, in mtk_ddp_comp_layer_check()
215 if (comp->funcs && comp->funcs->layer_check) in mtk_ddp_comp_layer_check()
216 return comp->funcs->layer_check(comp->dev, idx, state); in mtk_ddp_comp_layer_check()
220 static inline void mtk_ddp_comp_layer_config(struct mtk_ddp_comp *comp, in mtk_ddp_comp_layer_config() argument
221 unsigned int idx, in mtk_ddp_comp_layer_config()
225 if (comp->funcs && comp->funcs->layer_config) in mtk_ddp_comp_layer_config()
226 comp->funcs->layer_config(comp->dev, idx, state, cmdq_pkt); in mtk_ddp_comp_layer_config()
229 static inline unsigned int mtk_ddp_gamma_get_lut_size(struct mtk_ddp_comp *comp) in mtk_ddp_gamma_get_lut_size() argument
231 if (comp->funcs && comp->funcs->gamma_get_lut_size) in mtk_ddp_gamma_get_lut_size()
232 return comp->funcs->gamma_get_lut_size(comp->dev); in mtk_ddp_gamma_get_lut_size()
237 static inline void mtk_ddp_gamma_set(struct mtk_ddp_comp *comp, in mtk_ddp_gamma_set() argument
240 if (comp->funcs && comp->funcs->gamma_set) in mtk_ddp_gamma_set()
241 comp->funcs->gamma_set(comp->dev, state); in mtk_ddp_gamma_set()
244 static inline void mtk_ddp_comp_bgclr_in_on(struct mtk_ddp_comp *comp) in mtk_ddp_comp_bgclr_in_on() argument
246 if (comp->funcs && comp->funcs->bgclr_in_on) in mtk_ddp_comp_bgclr_in_on()
247 comp->funcs->bgclr_in_on(comp->dev); in mtk_ddp_comp_bgclr_in_on()
250 static inline void mtk_ddp_comp_bgclr_in_off(struct mtk_ddp_comp *comp) in mtk_ddp_comp_bgclr_in_off() argument
252 if (comp->funcs && comp->funcs->bgclr_in_off) in mtk_ddp_comp_bgclr_in_off()
253 comp->funcs->bgclr_in_off(comp->dev); in mtk_ddp_comp_bgclr_in_off()
256 static inline void mtk_ddp_ctm_set(struct mtk_ddp_comp *comp, in mtk_ddp_ctm_set() argument
259 if (comp->funcs && comp->funcs->ctm_set) in mtk_ddp_ctm_set()
260 comp->funcs->ctm_set(comp->dev, state); in mtk_ddp_ctm_set()
263 static inline struct device *mtk_ddp_comp_dma_dev_get(struct mtk_ddp_comp *comp) in mtk_ddp_comp_dma_dev_get() argument
265 if (comp->funcs && comp->funcs->dma_dev_get) in mtk_ddp_comp_dma_dev_get()
266 return comp->funcs->dma_dev_get(comp->dev); in mtk_ddp_comp_dma_dev_get()
267 return comp->dev; in mtk_ddp_comp_dma_dev_get()
271 u32 mtk_ddp_comp_get_blend_modes(struct mtk_ddp_comp *comp) in mtk_ddp_comp_get_blend_modes() argument
273 if (comp->funcs && comp->funcs->get_blend_modes) in mtk_ddp_comp_get_blend_modes()
274 return comp->funcs->get_blend_modes(comp->dev); in mtk_ddp_comp_get_blend_modes()
280 const u32 *mtk_ddp_comp_get_formats(struct mtk_ddp_comp *comp) in mtk_ddp_comp_get_formats() argument
282 if (comp->funcs && comp->funcs->get_formats) in mtk_ddp_comp_get_formats()
283 return comp->funcs->get_formats(comp->dev); in mtk_ddp_comp_get_formats()
289 size_t mtk_ddp_comp_get_num_formats(struct mtk_ddp_comp *comp) in mtk_ddp_comp_get_num_formats() argument
291 if (comp->funcs && comp->funcs->get_num_formats) in mtk_ddp_comp_get_num_formats()
292 return comp->funcs->get_num_formats(comp->dev); in mtk_ddp_comp_get_num_formats()
297 static inline bool mtk_ddp_comp_add(struct mtk_ddp_comp *comp, struct mtk_mutex *mutex) in mtk_ddp_comp_add() argument
299 if (comp->funcs && comp->funcs->add) { in mtk_ddp_comp_add()
300 comp->funcs->add(comp->dev, mutex); in mtk_ddp_comp_add()
306 static inline bool mtk_ddp_comp_remove(struct mtk_ddp_comp *comp, struct mtk_mutex *mutex) in mtk_ddp_comp_remove() argument
308 if (comp->funcs && comp->funcs->remove) { in mtk_ddp_comp_remove()
309 comp->funcs->remove(comp->dev, mutex); in mtk_ddp_comp_remove()
315 static inline bool mtk_ddp_comp_connect(struct mtk_ddp_comp *comp, struct device *mmsys_dev, in mtk_ddp_comp_connect() argument
316 unsigned int next) in mtk_ddp_comp_connect()
318 if (comp->funcs && comp->funcs->connect) { in mtk_ddp_comp_connect()
319 comp->funcs->connect(comp->dev, mmsys_dev, next); in mtk_ddp_comp_connect()
325 static inline bool mtk_ddp_comp_disconnect(struct mtk_ddp_comp *comp, struct device *mmsys_dev, in mtk_ddp_comp_disconnect() argument
326 unsigned int next) in mtk_ddp_comp_disconnect()
328 if (comp->funcs && comp->funcs->disconnect) { in mtk_ddp_comp_disconnect()
329 comp->funcs->disconnect(comp->dev, mmsys_dev, next); in mtk_ddp_comp_disconnect()
335 static inline void mtk_ddp_comp_encoder_index_set(struct mtk_ddp_comp *comp) in mtk_ddp_comp_encoder_index_set() argument
337 if (comp->funcs && comp->funcs->encoder_index) in mtk_ddp_comp_encoder_index_set()
338 comp->encoder_index = (int)comp->funcs->encoder_index(comp->dev); in mtk_ddp_comp_encoder_index_set()
341 int mtk_ddp_comp_get_id(struct device_node *node,
343 int mtk_find_possible_crtcs(struct drm_device *drm, struct device *dev);
344 int mtk_ddp_comp_init(struct device_node *comp_node, struct mtk_ddp_comp *comp,
345 unsigned int comp_id);
346 enum mtk_ddp_comp_type mtk_ddp_comp_get_type(unsigned int comp_id);
347 void mtk_ddp_write(struct cmdq_pkt *cmdq_pkt, unsigned int value,
349 unsigned int offset);
350 void mtk_ddp_write_relaxed(struct cmdq_pkt *cmdq_pkt, unsigned int value,
352 unsigned int offset);
353 void mtk_ddp_write_mask(struct cmdq_pkt *cmdq_pkt, unsigned int value,
355 unsigned int offset, unsigned int mask);