1061bfa06SHarry Wentland /*
2061bfa06SHarry Wentland  * Copyright 2017 Advanced Micro Devices, Inc.
3061bfa06SHarry Wentland  *
4061bfa06SHarry Wentland  * Permission is hereby granted, free of charge, to any person obtaining a
5061bfa06SHarry Wentland  * copy of this software and associated documentation files (the "Software"),
6061bfa06SHarry Wentland  * to deal in the Software without restriction, including without limitation
7061bfa06SHarry Wentland  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8061bfa06SHarry Wentland  * and/or sell copies of the Software, and to permit persons to whom the
9061bfa06SHarry Wentland  * Software is furnished to do so, subject to the following conditions:
10061bfa06SHarry Wentland  *
11061bfa06SHarry Wentland  * The above copyright notice and this permission notice shall be included in
12061bfa06SHarry Wentland  * all copies or substantial portions of the Software.
13061bfa06SHarry Wentland  *
14061bfa06SHarry Wentland  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15061bfa06SHarry Wentland  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16061bfa06SHarry Wentland  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17061bfa06SHarry Wentland  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18061bfa06SHarry Wentland  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19061bfa06SHarry Wentland  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20061bfa06SHarry Wentland  * OTHER DEALINGS IN THE SOFTWARE.
21061bfa06SHarry Wentland  *
22061bfa06SHarry Wentland  * Authors: AMD
23061bfa06SHarry Wentland  *
24061bfa06SHarry Wentland  */
25061bfa06SHarry Wentland #ifndef __DISPLAY_MODE_LIB_H__
26061bfa06SHarry Wentland #define __DISPLAY_MODE_LIB_H__
27061bfa06SHarry Wentland 
286d04ee9dSDmytro Laktyushkin 
29061bfa06SHarry Wentland #include "dml_common_defs.h"
30776c1f56SLeo Li #ifdef CONFIG_DRM_AMD_DC_DCN2_0
31728c0698SHarry Wentland #include "display_mode_vba.h"
32776c1f56SLeo Li #endif
33061bfa06SHarry Wentland 
34061bfa06SHarry Wentland enum dml_project {
35061bfa06SHarry Wentland 	DML_PROJECT_UNDEFINED,
36728c0698SHarry Wentland 	DML_PROJECT_RAVEN1,
37728c0698SHarry Wentland #ifdef CONFIG_DRM_AMD_DC_DCN2_0
38728c0698SHarry Wentland 	DML_PROJECT_NAVI10,
39728c0698SHarry Wentland #endif
40728c0698SHarry Wentland };
41728c0698SHarry Wentland 
42776c1f56SLeo Li struct display_mode_lib;
43776c1f56SLeo Li 
44728c0698SHarry Wentland struct dml_funcs {
45728c0698SHarry Wentland 	void (*rq_dlg_get_dlg_reg)(
46728c0698SHarry Wentland 			struct display_mode_lib *mode_lib,
47728c0698SHarry Wentland 			display_dlg_regs_st *dlg_regs,
48728c0698SHarry Wentland 			display_ttu_regs_st *ttu_regs,
49728c0698SHarry Wentland 			display_e2e_pipe_params_st *e2e_pipe_param,
50728c0698SHarry Wentland 			const unsigned int num_pipes,
51728c0698SHarry Wentland 			const unsigned int pipe_idx,
52728c0698SHarry Wentland 			const bool cstate_en,
53728c0698SHarry Wentland 			const bool pstate_en);
54728c0698SHarry Wentland 	void (*rq_dlg_get_rq_reg)(
55728c0698SHarry Wentland 		struct display_mode_lib *mode_lib,
56728c0698SHarry Wentland 		display_rq_regs_st *rq_regs,
57728c0698SHarry Wentland 		const display_pipe_params_st pipe_param);
58728c0698SHarry Wentland 	void (*recalculate)(struct display_mode_lib *mode_lib);
59728c0698SHarry Wentland 	void (*validate)(struct display_mode_lib *mode_lib);
60061bfa06SHarry Wentland };
61061bfa06SHarry Wentland 
62061bfa06SHarry Wentland struct display_mode_lib {
63061bfa06SHarry Wentland 	struct _vcs_dpi_ip_params_st ip;
64061bfa06SHarry Wentland 	struct _vcs_dpi_soc_bounding_box_st soc;
65061bfa06SHarry Wentland 	enum dml_project project;
66728c0698SHarry Wentland #ifdef CONFIG_DRM_AMD_DC_DCN2_0
67728c0698SHarry Wentland 	struct vba_vars_st vba;
68728c0698SHarry Wentland #endif
69061bfa06SHarry Wentland 	struct dal_logger *logger;
70728c0698SHarry Wentland 	struct dml_funcs funcs;
71061bfa06SHarry Wentland };
72061bfa06SHarry Wentland 
73fbaf207fSDmytro Laktyushkin void dml_init_instance(struct display_mode_lib *lib,
740f1a6ad7SJun Lei 		const struct _vcs_dpi_soc_bounding_box_st *soc_bb,
750f1a6ad7SJun Lei 		const struct _vcs_dpi_ip_params_st *ip_params,
760f1a6ad7SJun Lei 		enum dml_project project);
770f1a6ad7SJun Lei 
7838684e46SEric Bernstein const char *dml_get_status_message(enum dm_validation_status status);
7938684e46SEric Bernstein 
80061bfa06SHarry Wentland #endif
81