1 // SPDX-License-Identifier: MIT
2 //
3 // Copyright 2024 Advanced Micro Devices, Inc.
4 
5 #include "dml2_dpmm_factory.h"
6 #include "dml2_dpmm_dcn4.h"
7 #include "dml2_external_lib_deps.h"
8 
dummy_map_mode_to_soc_dpm(struct dml2_dpmm_map_mode_to_soc_dpm_params_in_out * in_out)9 static bool dummy_map_mode_to_soc_dpm(struct dml2_dpmm_map_mode_to_soc_dpm_params_in_out *in_out)
10 {
11 	return true;
12 }
13 
dummy_map_watermarks(struct dml2_dpmm_map_watermarks_params_in_out * in_out)14 static bool dummy_map_watermarks(struct dml2_dpmm_map_watermarks_params_in_out *in_out)
15 {
16 	return true;
17 }
18 
dml2_dpmm_create(enum dml2_project_id project_id,struct dml2_dpmm_instance * out)19 bool dml2_dpmm_create(enum dml2_project_id project_id, struct dml2_dpmm_instance *out)
20 {
21 	bool result = false;
22 
23 	if (out == 0)
24 		return false;
25 
26 	memset(out, 0, sizeof(struct dml2_dpmm_instance));
27 
28 	switch (project_id) {
29 	case dml2_project_dcn4x_stage1:
30 		out->map_mode_to_soc_dpm = &dummy_map_mode_to_soc_dpm;
31 		out->map_watermarks = &dummy_map_watermarks;
32 		result = true;
33 		break;
34 	case dml2_project_dcn4x_stage2:
35 		out->map_mode_to_soc_dpm = &dpmm_dcn3_map_mode_to_soc_dpm;
36 		out->map_watermarks = &dummy_map_watermarks;
37 		result = true;
38 		break;
39 	case dml2_project_dcn4x_stage2_auto_drr_svp:
40 		out->map_mode_to_soc_dpm = &dpmm_dcn4_map_mode_to_soc_dpm;
41 		out->map_watermarks = &dpmm_dcn4_map_watermarks;
42 		result = true;
43 		break;
44 	case dml2_project_invalid:
45 	default:
46 		break;
47 	}
48 
49 	return result;
50 }
51