1 /*
2  * Copyright 2012-15 Advanced Micro Devices, Inc.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20  * OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * Authors: AMD
23  *
24  */
25 
26 /**
27  * DOC: overview
28  *
29  * Multiple Pipe/Plane Combiner (MPC) is a component in the hardware pipeline
30  * that performs blending of multiple planes, using global and per-pixel alpha.
31  * It also performs post-blending color correction operations according to the
32  * hardware capabilities, such as color transformation matrix and gamma 1D and
33  * 3D LUT.
34  *
35  * MPC receives output from all DPP pipes and combines them to multiple outputs
36  * supporting "M MPC inputs -> N MPC outputs" flexible composition
37  * architecture. It features:
38  *
39  * - Programmable blending structure to allow software controlled blending and
40  *   cascading;
41  * - Programmable window location of each DPP in active region of display;
42  * - Combining multiple DPP pipes in one active region when a single DPP pipe
43  *   cannot process very large surface;
44  * - Combining multiple DPP from different SLS with blending;
45  * - Stereo formats from single DPP in top-bottom or side-by-side modes;
46  * - Stereo formats from 2 DPPs;
47  * - Alpha blending of multiple layers from different DPP pipes;
48  * - Programmable background color;
49  */
50 
51 #ifndef __DC_MPCC_H__
52 #define __DC_MPCC_H__
53 
54 #include "dc_hw_types.h"
55 #include "hw_shared.h"
56 #include "transform.h"
57 
58 #define MAX_MPCC 6
59 #define MAX_OPP 6
60 
61 #define MAX_DWB		2
62 
63 enum mpc_output_csc_mode {
64 	MPC_OUTPUT_CSC_DISABLE = 0,
65 	MPC_OUTPUT_CSC_COEF_A,
66 	MPC_OUTPUT_CSC_COEF_B
67 };
68 
69 
70 enum mpcc_blend_mode {
71 	MPCC_BLEND_MODE_BYPASS,
72 	MPCC_BLEND_MODE_TOP_LAYER_PASSTHROUGH,
73 	MPCC_BLEND_MODE_TOP_LAYER_ONLY,
74 	MPCC_BLEND_MODE_TOP_BOT_BLENDING
75 };
76 
77 /**
78  * enum mpcc_alpha_blend_mode - define the alpha blend mode regarding pixel
79  * alpha and plane alpha values
80  */
81 enum mpcc_alpha_blend_mode {
82 	/**
83 	 * @MPCC_ALPHA_BLEND_MODE_PER_PIXEL_ALPHA: per pixel alpha using DPP
84 	 * alpha value
85 	 */
86 	MPCC_ALPHA_BLEND_MODE_PER_PIXEL_ALPHA,
87 	/**
88 	 * @MPCC_ALPHA_BLEND_MODE_PER_PIXEL_ALPHA_COMBINED_GLOBAL_GAIN: per
89 	 * pixel alpha using DPP alpha value multiplied by a global gain (plane
90 	 * alpha)
91 	 */
92 	MPCC_ALPHA_BLEND_MODE_PER_PIXEL_ALPHA_COMBINED_GLOBAL_GAIN,
93 	/**
94 	 * @MPCC_ALPHA_BLEND_MODE_GLOBAL_ALPHA: global alpha value, ignores
95 	 * pixel alpha and consider only plane alpha
96 	 */
97 	MPCC_ALPHA_BLEND_MODE_GLOBAL_ALPHA
98 };
99 
100 enum mpcc_movable_cm_location {
101 	MPCC_MOVABLE_CM_LOCATION_BEFORE,
102 	MPCC_MOVABLE_CM_LOCATION_AFTER,
103 };
104 
105 enum MCM_LUT_XABLE {
106 	MCM_LUT_DISABLE,
107 	MCM_LUT_DISABLED = MCM_LUT_DISABLE,
108 	MCM_LUT_ENABLE,
109 	MCM_LUT_ENABLED = MCM_LUT_ENABLE,
110 };
111 
112 enum MCM_LUT_ID {
113 	MCM_LUT_3DLUT,
114 	MCM_LUT_1DLUT,
115 	MCM_LUT_SHAPER
116 };
117 
118 union mcm_lut_params {
119 	const struct pwl_params *pwl;
120 	const struct tetrahedral_params *lut3d;
121 };
122 
123 /**
124  * struct mpcc_blnd_cfg - MPCC blending configuration
125  */
126 struct mpcc_blnd_cfg {
127 	/**
128 	 * @black_color: background color.
129 	 */
130 	struct tg_color black_color;
131 
132 	/**
133 	 * @alpha_mode: alpha blend mode (MPCC_ALPHA_BLND_MODE).
134 	 */
135 	enum mpcc_alpha_blend_mode alpha_mode;
136 
137 	/**
138 	 * @pre_multiplied_alpha:
139 	 * Whether pixel color values were pre-multiplied by the alpha channel
140 	 * (MPCC_ALPHA_MULTIPLIED_MODE).
141 	 */
142 	bool pre_multiplied_alpha;
143 
144 	/**
145 	 * @global_gain: Used when blend mode considers both pixel alpha and plane.
146 	 */
147 	int global_gain;
148 
149 	/**
150 	 * @global_alpha: Plane alpha value.
151 	 */
152 	int global_alpha;
153 
154 	/**
155 	 * @overlap_only: Whether overlapping of different planes is allowed.
156 	 */
157 	bool overlap_only;
158 
159 	/* MPCC top/bottom gain settings */
160 
161 	/**
162 	 * @bottom_gain_mode: Blend mode for bottom gain setting.
163 	 */
164 	int bottom_gain_mode;
165 
166 	/**
167 	 * @background_color_bpc: Background color for bpc.
168 	 */
169 	int background_color_bpc;
170 
171 	/**
172 	 * @top_gain: Top gain setting.
173 	 */
174 	int top_gain;
175 
176 	/**
177 	 * @bottom_inside_gain: Blend mode for bottom inside.
178 	 */
179 	int bottom_inside_gain;
180 
181 	/**
182 	 * @bottom_outside_gain: Blend mode for bottom outside.
183 	 */
184 	int bottom_outside_gain;
185 };
186 
187 struct mpc_grph_gamut_adjustment {
188 	struct fixed31_32 temperature_matrix[CSC_TEMPERATURE_MATRIX_SIZE];
189 	enum graphics_gamut_adjust_type gamut_adjust_type;
190 	enum mpcc_gamut_remap_id mpcc_gamut_remap_block_id;
191 };
192 
193 struct mpcc_sm_cfg {
194 	bool enable;
195 	/* 0-single plane,2-row subsampling,4-column subsampling,6-checkboard subsampling */
196 	int sm_mode;
197 	/* 0- disable frame alternate, 1- enable frame alternate */
198 	bool frame_alt;
199 	/* 0- disable field alternate, 1- enable field alternate */
200 	bool field_alt;
201 	/* 0-no force,2-force frame polarity from top,3-force frame polarity from bottom */
202 	int force_next_frame_porlarity;
203 	/* 0-no force,2-force field polarity from top,3-force field polarity from bottom */
204 	int force_next_field_polarity;
205 };
206 
207 struct mpc_denorm_clamp {
208 	int clamp_max_r_cr;
209 	int clamp_min_r_cr;
210 	int clamp_max_g_y;
211 	int clamp_min_g_y;
212 	int clamp_max_b_cb;
213 	int clamp_min_b_cb;
214 };
215 
216 struct mpc_dwb_flow_control {
217 	int flow_ctrl_mode;
218 	int flow_ctrl_cnt0;
219 	int flow_ctrl_cnt1;
220 };
221 
222 /**
223  * struct mpcc - MPCC connection and blending configuration for a single MPCC instance.
224  *
225  * This struct is used as a node in an MPC tree.
226  */
227 struct mpcc {
228 	/**
229 	 * @mpcc_id: MPCC physical instance.
230 	 */
231 	int mpcc_id;
232 
233 	/**
234 	 * @dpp_id: DPP input to this MPCC
235 	 */
236 	int dpp_id;
237 
238 	/**
239 	 * @mpcc_bot: Pointer to bottom layer MPCC. NULL when not connected.
240 	 */
241 	struct mpcc *mpcc_bot;
242 
243 	/**
244 	 * @blnd_cfg: The blending configuration for this MPCC.
245 	 */
246 	struct mpcc_blnd_cfg blnd_cfg;
247 
248 	/**
249 	 * @sm_cfg: stereo mix setting for this MPCC
250 	 */
251 	struct mpcc_sm_cfg sm_cfg;
252 
253 	/**
254 	 * @shared_bottom:
255 	 *
256 	 * If MPCC output to both OPP and DWB endpoints, true. Otherwise, false.
257 	 */
258 	bool shared_bottom;
259 };
260 
261 /**
262  * struct mpc_tree - MPC tree represents all MPCC connections for a pipe.
263  *
264  *
265  */
266 struct mpc_tree {
267 	/**
268 	 * @opp_id: The OPP instance that owns this MPC tree.
269 	 */
270 	int opp_id;
271 
272 	/**
273 	 * @opp_list: the top MPCC layer of the MPC tree that outputs to OPP endpoint
274 	 */
275 	struct mpcc *opp_list;
276 };
277 
278 struct mpc {
279 	const struct mpc_funcs *funcs;
280 	struct dc_context *ctx;
281 
282 	struct mpcc mpcc_array[MAX_MPCC];
283 	struct pwl_params blender_params;
284 	bool cm_bypass_mode;
285 };
286 
287 struct mpcc_state {
288 	uint32_t opp_id;
289 	uint32_t dpp_id;
290 	uint32_t bot_mpcc_id;
291 	uint32_t mode;
292 	uint32_t alpha_mode;
293 	uint32_t pre_multiplied_alpha;
294 	uint32_t overlap_only;
295 	uint32_t idle;
296 	uint32_t busy;
297 	uint32_t shaper_lut_mode;
298 	uint32_t lut3d_mode;
299 	uint32_t lut3d_bit_depth;
300 	uint32_t lut3d_size;
301 	uint32_t rgam_mode;
302 	uint32_t rgam_lut;
303 	struct mpc_grph_gamut_adjustment gamut_remap;
304 };
305 
306 /**
307  * struct mpc_funcs - funcs
308  */
309 struct mpc_funcs {
310 	/**
311 	* @read_mpcc_state:
312 	*
313 	* Read register content from given MPCC physical instance.
314 	*
315 	* Parameters:
316 	*
317 	* - [in/out] mpc - MPC context
318 	* - [in] mpcc_instance - MPC context instance
319 	* - [in] mpcc_state - MPC context state
320 	*
321 	* Return:
322 	*
323 	* void
324 	*/
325 	void (*read_mpcc_state)(
326 			struct mpc *mpc,
327 			int mpcc_inst,
328 			struct mpcc_state *s);
329 
330 	/**
331 	* @insert_plane:
332 	*
333 	* Insert DPP into MPC tree based on specified blending position.
334 	* Only used for planes that are part of blending chain for OPP output
335 	*
336 	* Parameters:
337 	*
338 	* - [in/out] mpc  - MPC context.
339 	* - [in/out] tree - MPC tree structure that plane will be added to.
340 	* - [in] blnd_cfg - MPCC blending configuration for the new blending layer.
341 	* - [in] sm_cfg   - MPCC stereo mix configuration for the new blending layer.
342 	*                   stereo mix must disable for the very bottom layer of the tree config.
343 	* - [in] insert_above_mpcc - Insert new plane above this MPCC.
344 	*                          If NULL, insert as bottom plane.
345 	* - [in] dpp_id  - DPP instance for the plane to be added.
346 	* - [in] mpcc_id - The MPCC physical instance to use for blending.
347 	*
348 	* Return:
349 	*
350 	* struct mpcc* - MPCC that was added.
351 	*/
352 	struct mpcc* (*insert_plane)(
353 			struct mpc *mpc,
354 			struct mpc_tree *tree,
355 			struct mpcc_blnd_cfg *blnd_cfg,
356 			struct mpcc_sm_cfg *sm_cfg,
357 			struct mpcc *insert_above_mpcc,
358 			int dpp_id,
359 			int mpcc_id);
360 
361 	/**
362 	* @remove_mpcc:
363 	*
364 	* Remove a specified MPCC from the MPC tree.
365 	*
366 	* Parameters:
367 	*
368 	* - [in/out] mpc   - MPC context.
369 	* - [in/out] tree  - MPC tree structure that plane will be removed from.
370 	* - [in/out] mpcc  - MPCC to be removed from tree.
371 	*
372 	* Return:
373 	*
374 	* void
375 	*/
376 	void (*remove_mpcc)(
377 			struct mpc *mpc,
378 			struct mpc_tree *tree,
379 			struct mpcc *mpcc);
380 
381 	/**
382 	* @mpc_init:
383 	*
384 	* Reset the MPCC HW status by disconnecting all muxes.
385 	*
386 	* Parameters:
387 	*
388 	* - [in/out] mpc - MPC context.
389 	*
390 	* Return:
391 	*
392 	* void
393 	*/
394 	void (*mpc_init)(struct mpc *mpc);
395 
396 	/**
397 	* @mpc_init_single_inst:
398 	*
399 	* Initialize given MPCC physical instance.
400 	*
401 	* Parameters:
402 	* - [in/out] mpc - MPC context.
403 	* - [in] mpcc_id - The MPCC physical instance to be initialized.
404 	*/
405 	void (*mpc_init_single_inst)(
406 			struct mpc *mpc,
407 			unsigned int mpcc_id);
408 
409 	/**
410 	* @update_blending:
411 	*
412 	* Update the blending configuration for a specified MPCC.
413 	*
414 	* Parameters:
415 	*
416 	* - [in/out] mpc - MPC context.
417 	* - [in] blnd_cfg - MPCC blending configuration.
418 	* - [in] mpcc_id  - The MPCC physical instance.
419 	*
420 	* Return:
421 	*
422 	* void
423 	*/
424 	void (*update_blending)(
425 		struct mpc *mpc,
426 		struct mpcc_blnd_cfg *blnd_cfg,
427 		int mpcc_id);
428 
429 	/**
430 	* @cursor_lock:
431 	*
432 	* Lock cursor updates for the specified OPP. OPP defines the set of
433 	* MPCC that are locked together for cursor.
434 	*
435 	* Parameters:
436 	*
437 	* - [in] mpc - MPC context.
438 	* - [in] opp_id  - The OPP to lock cursor updates on
439 	* - [in] lock - lock/unlock the OPP
440 	*
441 	* Return:
442 	*
443 	* void
444 	*/
445 	void (*cursor_lock)(
446 			struct mpc *mpc,
447 			int opp_id,
448 			bool lock);
449 
450 	/**
451 	* @insert_plane_to_secondary:
452 	*
453 	* Add DPP into secondary MPC tree based on specified blending
454 	* position.  Only used for planes that are part of blending chain for
455 	* DWB output
456 	*
457 	* Parameters:
458 	*
459 	* - [in/out] mpc  - MPC context.
460 	* - [in/out] tree - MPC tree structure that plane will be added to.
461 	* - [in] blnd_cfg - MPCC blending configuration for the new blending layer.
462 	* - [in] sm_cfg   - MPCC stereo mix configuration for the new blending layer.
463 	*	    stereo mix must disable for the very bottom layer of the tree config.
464 	* - [in] insert_above_mpcc - Insert new plane above this MPCC.  If
465 	*          NULL, insert as bottom plane.
466 	* - [in] dpp_id - DPP instance for the plane to be added.
467 	* - [in] mpcc_id - The MPCC physical instance to use for blending.
468 	*
469 	* Return:
470 	*
471 	* struct mpcc* - MPCC that was added.
472 	*/
473 	struct mpcc* (*insert_plane_to_secondary)(
474 			struct mpc *mpc,
475 			struct mpc_tree *tree,
476 			struct mpcc_blnd_cfg *blnd_cfg,
477 			struct mpcc_sm_cfg *sm_cfg,
478 			struct mpcc *insert_above_mpcc,
479 			int dpp_id,
480 			int mpcc_id);
481 
482 	/**
483 	* @remove_mpcc_from_secondary:
484 	*
485 	* Remove a specified DPP from the 'secondary' MPC tree.
486 	*
487 	* Parameters:
488 	*
489 	* - [in/out] mpc  - MPC context.
490 	* - [in/out] tree - MPC tree structure that plane will be removed from.
491 	* - [in]     mpcc - MPCC to be removed from tree.
492 	*
493 	* Return:
494 	*
495 	* void
496 	*/
497 	void (*remove_mpcc_from_secondary)(
498 			struct mpc *mpc,
499 			struct mpc_tree *tree,
500 			struct mpcc *mpcc);
501 
502 	/**
503 	* @get_mpcc_for_dpp_from_secondary:
504 	*
505 	* Find, if it exists, a MPCC from a given 'secondary' MPC tree that
506 	* is associated with specified plane.
507 	*
508 	* Parameters:
509 	* - [in/out] tree - MPC tree structure to search for plane.
510 	* - [in] dpp_id - DPP to be searched.
511 	*
512 	* Return:
513 	*
514 	* struct mpcc* - pointer to plane or NULL if no plane found.
515 	*/
516 	struct mpcc* (*get_mpcc_for_dpp_from_secondary)(
517 			struct mpc_tree *tree,
518 			int dpp_id);
519 
520 	/**
521 	* @get_mpcc_for_dpp:
522 	*
523 	* Find, if it exists, a MPCC from a given MPC tree that
524 	* is associated with specified plane.
525 	*
526 	* Parameters:
527 	* - [in/out] tree - MPC tree structure to search for plane.
528 	* - [in] dpp_id - DPP to be searched.
529 	*
530 	* Return:
531 	*
532 	* struct mpcc* - pointer to plane or NULL if no plane found.
533 	*/
534 	struct mpcc* (*get_mpcc_for_dpp)(
535 			struct mpc_tree *tree,
536 			int dpp_id);
537 
538 	/**
539 	* @wait_for_idle:
540 	*
541 	* Wait for a MPCC in MPC context to enter idle state.
542 	*
543 	* Parameters:
544 	* - [in/out] mpc - MPC Context.
545 	* - [in] id - MPCC to wait for idle state.
546 	*
547 	* Return:
548 	*
549 	* void
550 	*/
551 	void (*wait_for_idle)(struct mpc *mpc, int id);
552 
553 	/**
554 	* @assert_mpcc_idle_before_connect:
555 	*
556 	* Assert if MPCC in MPC context is in idle state.
557 	*
558 	* Parameters:
559 	* - [in/out] mpc - MPC context.
560 	* - [in] id - MPCC to assert idle state.
561 	*
562 	* Return:
563 	*
564 	* void
565 	*/
566 	void (*assert_mpcc_idle_before_connect)(struct mpc *mpc, int mpcc_id);
567 
568 	/**
569 	* @init_mpcc_list_from_hw:
570 	*
571 	* Iterate through the MPCC array from a given MPC context struct
572 	* and configure each MPCC according to its registers' values.
573 	*
574 	* Parameters:
575 	* - [in/out] mpc - MPC context to initialize MPCC array.
576 	* - [in/out] tree - MPC tree structure containing MPCC contexts to initialize.
577 	*
578 	* Return:
579 	*
580 	* void
581 	*/
582 	void (*init_mpcc_list_from_hw)(
583 		struct mpc *mpc,
584 		struct mpc_tree *tree);
585 
586 	/**
587 	* @set_denorm:
588 	*
589 	* Set corresponding OPP DENORM_CONTROL register value to specific denorm_mode
590 	* based on given color depth.
591 	*
592 	* Parameters:
593 	* - [in/out] mpc - MPC context.
594 	* - [in] opp_id - Corresponding OPP to update register.
595 	* - [in] output_depth - Arbitrary color depth to set denorm_mode.
596 	*
597 	* Return:
598 	*
599 	* void
600 	*/
601 	void (*set_denorm)(struct mpc *mpc,
602 			int opp_id,
603 			enum dc_color_depth output_depth);
604 
605 	/**
606 	* @set_denorm_clamp:
607 	*
608 	* Set denorm clamp values on corresponding OPP DENORM CONTROL register.
609 	*
610 	* Parameters:
611 	* - [in/out] mpc - MPC context.
612 	* - [in] opp_id - Corresponding OPP to update register.
613 	* - [in] denorm_clamp - Arbitrary denorm clamp to be set.
614 	*
615 	* Return:
616 	*
617 	* void
618 	*/
619 	void (*set_denorm_clamp)(
620 			struct mpc *mpc,
621 			int opp_id,
622 			struct mpc_denorm_clamp denorm_clamp);
623 
624 	/**
625 	* @set_output_csc:
626 	*
627 	* Set the Output Color Space Conversion matrix
628 	* with given values and mode.
629 	*
630 	* Parameters:
631 	* - [in/out] mpc - MPC context.
632 	* - [in] opp_id - Corresponding OPP to update register.
633 	* - [in] regval - Values to set in CSC matrix.
634 	* - [in] ocsc_mode - Mode to set CSC.
635 	*
636 	* Return:
637 	*
638 	* void
639 	*/
640 	void (*set_output_csc)(struct mpc *mpc,
641 			int opp_id,
642 			const uint16_t *regval,
643 			enum mpc_output_csc_mode ocsc_mode);
644 
645 	/**
646 	* @set_ocsc_default:
647 	*
648 	* Set the Output Color Space Conversion matrix
649 	* to default values according to color space.
650 	*
651 	* Parameters:
652 	* - [in/out] mpc - MPC context.
653 	* - [in] opp_id - Corresponding OPP to update register.
654 	* - [in] color_space - OCSC color space.
655 	* - [in] ocsc_mode - Mode to set CSC.
656 	*
657 	* Return:
658 	*
659 	* void
660 	*
661 	*/
662 	void (*set_ocsc_default)(struct mpc *mpc,
663 			int opp_id,
664 			enum dc_color_space color_space,
665 			enum mpc_output_csc_mode ocsc_mode);
666 
667 	/**
668 	* @set_output_gamma:
669 	*
670 	* Set Output Gamma with given curve parameters.
671 	*
672 	* Parameters:
673 	* - [in/out] mpc - MPC context.
674 	* - [in] mpcc_id - Corresponding MPC to update registers.
675 	* - [in] params - Parameters.
676 	*
677 	* Return:
678 	*
679 	* void
680 	*
681 	*/
682 	void (*set_output_gamma)(
683 			struct mpc *mpc,
684 			int mpcc_id,
685 			const struct pwl_params *params);
686 	/**
687 	* @power_on_mpc_mem_pwr:
688 	*
689 	* Power on/off memory LUT for given MPCC.
690 	* Powering on enables LUT to be updated.
691 	* Powering off allows entering low power mode.
692 	*
693 	* Parameters:
694 	* - [in/out] mpc - MPC context.
695 	* - [in] mpcc_id - MPCC to power on.
696 	* - [in] power_on
697 	*
698 	* Return:
699 	*
700 	* void
701 	*/
702 	void (*power_on_mpc_mem_pwr)(
703 			struct mpc *mpc,
704 			int mpcc_id,
705 			bool power_on);
706 	/**
707 	* @set_dwb_mux:
708 	*
709 	* Set corresponding Display Writeback mux
710 	* MPC register field to given MPCC id.
711 	*
712 	* Parameters:
713 	* - [in/out] mpc - MPC context.
714 	* - [in] dwb_id - DWB to be set.
715 	* - [in] mpcc_id - MPCC id to be stored in DWB mux register.
716 	*
717 	* Return:
718 	*
719 	* void
720 	*/
721 	void (*set_dwb_mux)(
722 			struct mpc *mpc,
723 			int dwb_id,
724 			int mpcc_id);
725 
726 	/**
727 	* @disable_dwb_mux:
728 	*
729 	* Reset corresponding Display Writeback mux
730 	* MPC register field.
731 	*
732 	* Parameters:
733 	* - [in/out] mpc - MPC context.
734 	* - [in] dwb_id - DWB to be set.
735 	*
736 	* Return:
737 	*
738 	* void
739 	*/
740 	void (*disable_dwb_mux)(
741 		struct mpc *mpc,
742 		int dwb_id);
743 
744 	/**
745 	* @is_dwb_idle:
746 	*
747 	* Check DWB status on MPC_DWB0_MUX_STATUS register field.
748 	* Return if it is null.
749 	*
750 	* Parameters:
751 	* - [in/out] mpc - MPC context.
752 	* - [in] dwb_id - DWB to be checked.
753 	*
754 	* Return:
755 	*
756 	* bool - wheter DWB is idle or not
757 	*/
758 	bool (*is_dwb_idle)(
759 		struct mpc *mpc,
760 		int dwb_id);
761 
762 	/**
763 	* @set_out_rate_control:
764 	*
765 	* Set display output rate control.
766 	*
767 	* Parameters:
768 	* - [in/out] mpc - MPC context.
769 	* - [in] opp_id - OPP to be set.
770 	* - [in] enable
771 	* - [in] rate_2x_mode
772 	* - [in] flow_control
773 	*
774 	* Return:
775 	*
776 	* void
777 	*/
778 	void (*set_out_rate_control)(
779 		struct mpc *mpc,
780 		int opp_id,
781 		bool enable,
782 		bool rate_2x_mode,
783 		struct mpc_dwb_flow_control *flow_control);
784 
785 	/**
786 	* @set_gamut_remap:
787 	*
788 	* Set post-blending CTM for given MPCC.
789 	*
790 	* Parameters:
791 	* - [in] mpc - MPC context.
792 	* - [in] mpcc_id - MPCC to set gamut map.
793 	* - [in] adjust
794 	*
795 	* Return:
796 	*
797 	* void
798 	*/
799 	void (*set_gamut_remap)(
800 			struct mpc *mpc,
801 			int mpcc_id,
802 			const struct mpc_grph_gamut_adjustment *adjust);
803 
804 	/**
805 	* @program_1dlut:
806 	*
807 	* Set 1 dimensional Lookup Table.
808 	*
809 	* Parameters:
810 	* - [in/out] mpc - MPC context
811 	* - [in] params - curve parameters for the LUT configuration
812 	* - [in] rmu_idx
813 	*
814 	* bool - wheter LUT was set (set with given parameters) or not (params is NULL and LUT is disabled).
815 	*/
816 	bool (*program_1dlut)(
817 			struct mpc *mpc,
818 			const struct pwl_params *params,
819 			uint32_t rmu_idx);
820 
821 	/**
822 	* @program_shaper:
823 	*
824 	* Set shaper.
825 	*
826 	* Parameters:
827 	* - [in/out] mpc - MPC context
828 	* - [in] params - curve parameters to be set
829 	* - [in] rmu_idx
830 	*
831 	* Return:
832 	*
833 	* bool - wheter shaper was set (set with given parameters) or not (params is NULL and LUT is disabled).
834 	*/
835 	bool (*program_shaper)(
836 			struct mpc *mpc,
837 			const struct pwl_params *params,
838 			uint32_t rmu_idx);
839 
840 	/**
841 	* @acquire_rmu:
842 	*
843 	* Set given MPCC to be multiplexed to given RMU unit.
844 	*
845 	* Parameters:
846 	* - [in/out] mpc - MPC context
847 	* - [in] mpcc_id - MPCC
848 	* - [in] rmu_idx - Given RMU unit to set MPCC to be multiplexed to.
849 	*
850 	* Return:
851 	*
852 	* unit32_t - rmu_idx if operation was successful, -1 else.
853 	*/
854 	uint32_t (*acquire_rmu)(struct mpc *mpc, int mpcc_id, int rmu_idx);
855 
856 	/**
857 	* @program_3dlut:
858 	*
859 	* Set 3 dimensional Lookup Table.
860 	*
861 	* Parameters:
862 	* - [in/out] mpc - MPC context
863 	* - [in] params - tetrahedral parameters for the LUT configuration
864 	* - [in] rmu_idx
865 	*
866 	* bool - wheter LUT was set (set with given parameters) or not (params is NULL and LUT is disabled).
867 	*/
868 	bool (*program_3dlut)(
869 			struct mpc *mpc,
870 			const struct tetrahedral_params *params,
871 			int rmu_idx);
872 
873 	/**
874 	* @release_rmu:
875 	*
876 	* For a given MPCC, release the RMU unit it muliplexes to.
877 	*
878 	* Parameters:
879 	* - [in/out] mpc - MPC context
880 	* - [in] mpcc_id - MPCC
881 	*
882 	* Return:
883 	*
884 	* int - a valid rmu_idx representing released RMU unit or -1 if there was no RMU unit to release.
885 	*/
886 	int (*release_rmu)(struct mpc *mpc, int mpcc_id);
887 
888 	/**
889 	* @get_mpc_out_mux:
890 	*
891 	* Return MPC out mux.
892 	*
893 	* Parameters:
894 	* - [in] mpc - MPC context.
895 	* - [in] opp_id - OPP
896 	*
897 	* Return:
898 	*
899 	* unsigned int - Out Mux
900 	*/
901 	unsigned int (*get_mpc_out_mux)(
902 				struct mpc *mpc,
903 				int opp_id);
904 
905 	/**
906 	* @set_bg_color:
907 	*
908 	* Find corresponding bottommost MPCC and
909 	* set its bg color.
910 	*
911 	* Parameters:
912 	* - [in/out] mpc - MPC context.
913 	* - [in] bg_color - background color to be set.
914 	* - [in] mpcc_id
915 	*
916 	* Return:
917 	*
918 	* void
919 	*/
920 	void (*set_bg_color)(struct mpc *mpc,
921 			struct tg_color *bg_color,
922 			int mpcc_id);
923 
924 	/**
925 	* @set_mpc_mem_lp_mode:
926 	*
927 	* Set mpc_mem_lp_mode.
928 	*
929 	* Parameters:
930 	* - [in/out] mpc - MPC context.
931 	*
932 	* Return:
933 	*
934 	* void
935 	*/
936 
937 	void (*set_mpc_mem_lp_mode)(struct mpc *mpc);
938 	/**
939 	* @set_movable_cm_location:
940 	*
941 	* Set Movable CM Location.
942 	*
943 	* Parameters:
944 	* - [in/out] mpc - MPC context.
945 	* - [in] location
946 	* - [in] mpcc_id
947 	*
948 	* Return:
949 	*
950 	* void
951 	*/
952 
953 	void (*set_movable_cm_location)(struct mpc *mpc, enum mpcc_movable_cm_location location, int mpcc_id);
954 	/**
955 	* @update_3dlut_fast_load_select:
956 	*
957 	* Update 3D LUT fast load select.
958 	*
959 	* Parameters:
960 	* - [in/out] mpc - MPC context.
961 	* - [in] mpcc_id
962 	* - [in] hubp_idx
963 	*
964 	* Return:
965 	*
966 	* void
967 	*/
968 
969 	void (*update_3dlut_fast_load_select)(struct mpc *mpc, int mpcc_id, int hubp_idx);
970 	/**
971 	* @get_3dlut_fast_load_status:
972 	*
973 	* Get 3D LUT fast load status and reference them with done, soft_underflow and hard_underflow pointers.
974 	*
975 	* Parameters:
976 	* - [in/out] mpc - MPC context.
977 	* - [in] mpcc_id
978 	* - [in/out] done
979 	* - [in/out] soft_underflow
980 	* - [in/out] hard_underflow
981 	*
982 	* Return:
983 	*
984 	* void
985 	*/
986 	void (*get_3dlut_fast_load_status)(struct mpc *mpc, int mpcc_id, uint32_t *done, uint32_t *soft_underflow, uint32_t *hard_underflow);
987 
988 	/**
989 	* @populate_lut:
990 	*
991 	* Populate LUT with given tetrahedral parameters.
992 	*
993 	* Parameters:
994 	* - [in/out] mpc - MPC context.
995 	* - [in] id
996 	* - [in] params
997 	* - [in] lut_bank_a
998 	* - [in] mpcc_id
999 	*
1000 	* Return:
1001 	*
1002 	* void
1003 	*/
1004 	void (*populate_lut)(struct mpc *mpc, const enum MCM_LUT_ID id, const union mcm_lut_params params,
1005 			bool lut_bank_a, int mpcc_id);
1006 
1007 	/**
1008 	* @program_lut_read_write_control:
1009 	*
1010 	* Program LUT RW control.
1011 	*
1012 	* Parameters:
1013 	* - [in/out] mpc - MPC context.
1014 	* - [in] id
1015 	* - [in] lut_bank_a
1016 	* - [in] mpcc_id
1017 	*
1018 	* Return:
1019 	*
1020 	* void
1021 	*/
1022 	void (*program_lut_read_write_control)(struct mpc *mpc, const enum MCM_LUT_ID id, bool lut_bank_a, int mpcc_id);
1023 
1024 	/**
1025 	* @program_lut_mode:
1026 	*
1027 	* Program LUT mode.
1028 	*
1029 	* Parameters:
1030 	* - [in/out] mpc - MPC context.
1031 	* - [in] id
1032 	* - [in] xable
1033 	* - [in] lut_bank_a
1034 	* - [in] mpcc_id
1035 	*
1036 	* Return:
1037 	*
1038 	* void
1039 	*/
1040 	void (*program_lut_mode)(struct mpc *mpc, const enum MCM_LUT_ID id, const enum MCM_LUT_XABLE xable,
1041 			bool lut_bank_a, int mpcc_id);
1042 	/**
1043 	* @program_3dlut_size:
1044 	*
1045 	* Program 3D LUT size.
1046 	*
1047 	* Parameters:
1048 	* - [in/out] mpc - MPC context.
1049 	* - [in] is_17x17x17 - is 3dlut 17x17x17
1050 	* - [in] mpcc_id
1051 	*
1052 	* Return:
1053 	*
1054 	* void
1055 	*/
1056 	void (*program_3dlut_size)(struct mpc *mpc, bool is_17x17x17, int mpcc_id);
1057 };
1058 
1059 #endif
1060