14562236bSHarry Wentland /*
24562236bSHarry Wentland  * Copyright 2012-15 Advanced Micro Devices, Inc.
34562236bSHarry Wentland  *
44562236bSHarry Wentland  * Permission is hereby granted, free of charge, to any person obtaining a
54562236bSHarry Wentland  * copy of this software and associated documentation files (the "Software"),
64562236bSHarry Wentland  * to deal in the Software without restriction, including without limitation
74562236bSHarry Wentland  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
84562236bSHarry Wentland  * and/or sell copies of the Software, and to permit persons to whom the
94562236bSHarry Wentland  * Software is furnished to do so, subject to the following conditions:
104562236bSHarry Wentland  *
114562236bSHarry Wentland  * The above copyright notice and this permission notice shall be included in
124562236bSHarry Wentland  * all copies or substantial portions of the Software.
134562236bSHarry Wentland  *
144562236bSHarry Wentland  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
154562236bSHarry Wentland  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
164562236bSHarry Wentland  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
174562236bSHarry Wentland  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
184562236bSHarry Wentland  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
194562236bSHarry Wentland  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
204562236bSHarry Wentland  * OTHER DEALINGS IN THE SOFTWARE.
214562236bSHarry Wentland  *
224562236bSHarry Wentland  * Authors: AMD
234562236bSHarry Wentland  *
244562236bSHarry Wentland  */
254562236bSHarry Wentland 
264562236bSHarry Wentland #ifndef __DAL_HW_FACTORY_H__
274562236bSHarry Wentland #define __DAL_HW_FACTORY_H__
284562236bSHarry Wentland 
294562236bSHarry Wentland struct hw_gpio_pin;
304562236bSHarry Wentland struct hw_hpd;
3191db9311SSu Sung Chung struct hw_ddc;
3291db9311SSu Sung Chung struct hw_generic;
3391db9311SSu Sung Chung struct gpio;
344562236bSHarry Wentland 
354562236bSHarry Wentland struct hw_factory {
364562236bSHarry Wentland 	uint32_t number_of_pins[GPIO_ID_COUNT];
374562236bSHarry Wentland 
384562236bSHarry Wentland 	const struct hw_factory_funcs {
3991db9311SSu Sung Chung 		void (*init_ddc_data)(
4091db9311SSu Sung Chung 				struct hw_ddc **hw_ddc,
414562236bSHarry Wentland 				struct dc_context *ctx,
424562236bSHarry Wentland 				enum gpio_id id,
434562236bSHarry Wentland 				uint32_t en);
4491db9311SSu Sung Chung 		void (*init_generic)(
4591db9311SSu Sung Chung 				struct hw_generic **hw_generic,
464562236bSHarry Wentland 				struct dc_context *ctx,
474562236bSHarry Wentland 				enum gpio_id id,
484562236bSHarry Wentland 				uint32_t en);
4991db9311SSu Sung Chung 		void (*init_hpd)(
5091db9311SSu Sung Chung 				struct hw_hpd **hw_hpd,
514562236bSHarry Wentland 				struct dc_context *ctx,
524562236bSHarry Wentland 				enum gpio_id id,
534562236bSHarry Wentland 				uint32_t en);
5491db9311SSu Sung Chung 		struct hw_gpio_pin *(*get_hpd_pin)(
5591db9311SSu Sung Chung 				struct gpio *gpio);
5691db9311SSu Sung Chung 		struct hw_gpio_pin *(*get_ddc_pin)(
5791db9311SSu Sung Chung 				struct gpio *gpio);
5891db9311SSu Sung Chung 		struct hw_gpio_pin *(*get_generic_pin)(
5991db9311SSu Sung Chung 				struct gpio *gpio);
604562236bSHarry Wentland 		void (*define_hpd_registers)(
614562236bSHarry Wentland 				struct hw_gpio_pin *pin,
624562236bSHarry Wentland 				uint32_t en);
634562236bSHarry Wentland 		void (*define_ddc_registers)(
644562236bSHarry Wentland 				struct hw_gpio_pin *pin,
654562236bSHarry Wentland 				uint32_t en);
66d40605b6SMurton Liu 		void (*define_generic_registers)(
67d40605b6SMurton Liu 				struct hw_gpio_pin *pin,
68d40605b6SMurton Liu 				uint32_t en);
694562236bSHarry Wentland 	} *funcs;
704562236bSHarry Wentland };
714562236bSHarry Wentland 
724562236bSHarry Wentland bool dal_hw_factory_init(
734562236bSHarry Wentland 	struct hw_factory *factory,
744562236bSHarry Wentland 	enum dce_version dce_version,
754562236bSHarry Wentland 	enum dce_environment dce_environment);
764562236bSHarry Wentland 
774562236bSHarry Wentland #endif
78