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 #ifndef __DAL_HW_FACTORY_H__
27 #define __DAL_HW_FACTORY_H__
28 
29 struct hw_gpio_pin;
30 struct hw_hpd;
31 struct hw_ddc;
32 struct hw_generic;
33 struct gpio;
34 
35 struct hw_factory {
36 	uint32_t number_of_pins[GPIO_ID_COUNT];
37 
38 	const struct hw_factory_funcs {
39 		void (*init_ddc_data)(
40 				struct hw_ddc **hw_ddc,
41 				struct dc_context *ctx,
42 				enum gpio_id id,
43 				uint32_t en);
44 		void (*init_generic)(
45 				struct hw_generic **hw_generic,
46 				struct dc_context *ctx,
47 				enum gpio_id id,
48 				uint32_t en);
49 		void (*init_hpd)(
50 				struct hw_hpd **hw_hpd,
51 				struct dc_context *ctx,
52 				enum gpio_id id,
53 				uint32_t en);
54 		struct hw_gpio_pin *(*get_hpd_pin)(
55 				struct gpio *gpio);
56 		struct hw_gpio_pin *(*get_ddc_pin)(
57 				struct gpio *gpio);
58 		struct hw_gpio_pin *(*get_generic_pin)(
59 				struct gpio *gpio);
60 		void (*define_hpd_registers)(
61 				struct hw_gpio_pin *pin,
62 				uint32_t en);
63 		void (*define_ddc_registers)(
64 				struct hw_gpio_pin *pin,
65 				uint32_t en);
66 		void (*define_generic_registers)(
67 				struct hw_gpio_pin *pin,
68 				uint32_t en);
69 	} *funcs;
70 };
71 
72 bool dal_hw_factory_init(
73 	struct hw_factory *factory,
74 	enum dce_version dce_version,
75 	enum dce_environment dce_environment);
76 
77 #endif
78