xref: /dflybsd-src/sys/dev/drm/amd/display/dc/gpio/hw_factory.h (revision 789731325bde747251c28a37e0a00ed4efb88c46)
1b843c749SSergey Zigachev /*
2b843c749SSergey Zigachev  * Copyright 2012-15 Advanced Micro Devices, Inc.
3b843c749SSergey Zigachev  *
4b843c749SSergey Zigachev  * Permission is hereby granted, free of charge, to any person obtaining a
5b843c749SSergey Zigachev  * copy of this software and associated documentation files (the "Software"),
6b843c749SSergey Zigachev  * to deal in the Software without restriction, including without limitation
7b843c749SSergey Zigachev  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8b843c749SSergey Zigachev  * and/or sell copies of the Software, and to permit persons to whom the
9b843c749SSergey Zigachev  * Software is furnished to do so, subject to the following conditions:
10b843c749SSergey Zigachev  *
11b843c749SSergey Zigachev  * The above copyright notice and this permission notice shall be included in
12b843c749SSergey Zigachev  * all copies or substantial portions of the Software.
13b843c749SSergey Zigachev  *
14b843c749SSergey Zigachev  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15b843c749SSergey Zigachev  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16b843c749SSergey Zigachev  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17b843c749SSergey Zigachev  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18b843c749SSergey Zigachev  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19b843c749SSergey Zigachev  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20b843c749SSergey Zigachev  * OTHER DEALINGS IN THE SOFTWARE.
21b843c749SSergey Zigachev  *
22b843c749SSergey Zigachev  * Authors: AMD
23b843c749SSergey Zigachev  *
24b843c749SSergey Zigachev  */
25b843c749SSergey Zigachev 
26b843c749SSergey Zigachev #ifndef __DAL_HW_FACTORY_H__
27b843c749SSergey Zigachev #define __DAL_HW_FACTORY_H__
28b843c749SSergey Zigachev 
29b843c749SSergey Zigachev struct hw_gpio_pin;
30b843c749SSergey Zigachev struct hw_hpd;
31b843c749SSergey Zigachev 
32b843c749SSergey Zigachev struct hw_factory {
33b843c749SSergey Zigachev 	uint32_t number_of_pins[GPIO_ID_COUNT];
34b843c749SSergey Zigachev 
35b843c749SSergey Zigachev 	const struct hw_factory_funcs {
36b843c749SSergey Zigachev 		struct hw_gpio_pin *(*create_ddc_data)(
37b843c749SSergey Zigachev 			struct dc_context *ctx,
38b843c749SSergey Zigachev 			enum gpio_id id,
39b843c749SSergey Zigachev 			uint32_t en);
40b843c749SSergey Zigachev 		struct hw_gpio_pin *(*create_ddc_clock)(
41b843c749SSergey Zigachev 			struct dc_context *ctx,
42b843c749SSergey Zigachev 			enum gpio_id id,
43b843c749SSergey Zigachev 			uint32_t en);
44b843c749SSergey Zigachev 		struct hw_gpio_pin *(*create_generic)(
45b843c749SSergey Zigachev 			struct dc_context *ctx,
46b843c749SSergey Zigachev 			enum gpio_id id,
47b843c749SSergey Zigachev 			uint32_t en);
48b843c749SSergey Zigachev 		struct hw_gpio_pin *(*create_hpd)(
49b843c749SSergey Zigachev 			struct dc_context *ctx,
50b843c749SSergey Zigachev 			enum gpio_id id,
51b843c749SSergey Zigachev 			uint32_t en);
52b843c749SSergey Zigachev 		struct hw_gpio_pin *(*create_sync)(
53b843c749SSergey Zigachev 			struct dc_context *ctx,
54b843c749SSergey Zigachev 			enum gpio_id id,
55b843c749SSergey Zigachev 			uint32_t en);
56b843c749SSergey Zigachev 		struct hw_gpio_pin *(*create_gsl)(
57b843c749SSergey Zigachev 			struct dc_context *ctx,
58b843c749SSergey Zigachev 			enum gpio_id id,
59b843c749SSergey Zigachev 			uint32_t en);
60b843c749SSergey Zigachev 		void (*define_hpd_registers)(
61b843c749SSergey Zigachev 				struct hw_gpio_pin *pin,
62b843c749SSergey Zigachev 				uint32_t en);
63b843c749SSergey Zigachev 		void (*define_ddc_registers)(
64b843c749SSergey Zigachev 				struct hw_gpio_pin *pin,
65b843c749SSergey Zigachev 				uint32_t en);
66b843c749SSergey Zigachev 	} *funcs;
67b843c749SSergey Zigachev };
68b843c749SSergey Zigachev 
69b843c749SSergey Zigachev bool dal_hw_factory_init(
70b843c749SSergey Zigachev 	struct hw_factory *factory,
71b843c749SSergey Zigachev 	enum dce_version dce_version,
72b843c749SSergey Zigachev 	enum dce_environment dce_environment);
73b843c749SSergey Zigachev 
74*78973132SSergey Zigachev void dal_hw_factory_destroy(
75*78973132SSergey Zigachev 	struct dc_context *ctx,
76*78973132SSergey Zigachev 	struct hw_factory **factory);
77b843c749SSergey Zigachev #endif
78