xref: /linux/drivers/gpu/drm/amd/display/include/gpio_service_interface.h (revision 8c994eff8fcfe8ecb1f1dbebed25b4d7bb75be12)
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_GPIO_SERVICE_INTERFACE_H__
27 #define __DAL_GPIO_SERVICE_INTERFACE_H__
28 
29 #include "gpio_types.h"
30 #include "gpio_interface.h"
31 #include "hw/gpio.h"
32 
33 struct gpio_service;
34 
35 struct gpio *dal_gpio_create(
36 	struct gpio_service *service,
37 	enum gpio_id id,
38 	uint32_t en,
39 	enum gpio_pin_output_state output_state);
40 
41 void dal_gpio_destroy(
42 	struct gpio **ptr);
43 
44 struct gpio_service *dal_gpio_service_create(
45 	enum dce_version dce_version,
46 	enum dce_environment dce_environment,
47 	struct dc_context *ctx);
48 
49 struct gpio *dal_gpio_service_create_irq(
50 	struct gpio_service *service,
51 	uint32_t offset,
52 	uint32_t mask);
53 
54 struct gpio *dal_gpio_service_create_generic_mux(
55 	struct gpio_service *service,
56 	uint32_t offset,
57 	uint32_t mask);
58 
59 void dal_gpio_destroy_generic_mux(
60 	struct gpio **mux);
61 
62 enum gpio_result dal_mux_setup_config(
63 	struct gpio *mux,
64 	struct gpio_generic_mux_config *config);
65 
66 struct gpio_pin_info dal_gpio_get_generic_pin_info(
67 	struct gpio_service *service,
68 	enum gpio_id id,
69 	uint32_t en);
70 
71 struct ddc *dal_gpio_create_ddc(
72 	struct gpio_service *service,
73 	uint32_t offset,
74 	uint32_t mask,
75 	struct gpio_ddc_hw_info *info);
76 
77 void dal_gpio_destroy_ddc(
78 	struct ddc **ddc);
79 
80 void dal_gpio_service_destroy(
81 	struct gpio_service **ptr);
82 
83 enum dc_irq_source dal_irq_get_source(
84 	const struct gpio *irq);
85 
86 enum dc_irq_source dal_irq_get_rx_source(
87 	const struct gpio *irq);
88 
89 enum gpio_result dal_irq_setup_hpd_filter(
90 	struct gpio *irq,
91 	struct gpio_hpd_config *config);
92 
93 struct gpio *dal_gpio_create_irq(
94 	struct gpio_service *service,
95 	enum gpio_id id,
96 	uint32_t en);
97 
98 void dal_gpio_destroy_irq(
99 	struct gpio **ptr);
100 
101 
102 enum gpio_result dal_ddc_open(
103 	struct ddc *ddc,
104 	enum gpio_mode mode,
105 	enum gpio_ddc_config_type config_type);
106 
107 enum gpio_result dal_ddc_change_mode(
108 	struct ddc *ddc,
109 	enum gpio_mode mode);
110 
111 enum gpio_ddc_line dal_ddc_get_line(
112 	const struct ddc *ddc);
113 
114 enum gpio_result dal_ddc_set_config(
115 	struct ddc *ddc,
116 	enum gpio_ddc_config_type config_type);
117 
118 void dal_ddc_close(
119 	struct ddc *ddc);
120 
121 #endif
122