xref: /linux/drivers/gpu/drm/amd/display/include/gpio_service_interface.h (revision be709d48329a500621d2a05835283150ae137b45)
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_major,
46 	enum dce_version dce_version_minor,
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 ddc *dal_gpio_create_ddc(
55 	struct gpio_service *service,
56 	uint32_t offset,
57 	uint32_t mask,
58 	struct gpio_ddc_hw_info *info);
59 
60 
61 void dal_gpio_destroy_ddc(
62 	struct ddc **ddc);
63 
64 void dal_gpio_service_destroy(
65 	struct gpio_service **ptr);
66 
67 enum dc_irq_source dal_irq_get_source(
68 	const struct gpio *irq);
69 
70 enum dc_irq_source dal_irq_get_rx_source(
71 	const struct gpio *irq);
72 
73 enum gpio_result dal_irq_setup_hpd_filter(
74 	struct gpio *irq,
75 	struct gpio_hpd_config *config);
76 
77 struct gpio *dal_gpio_create_irq(
78 	struct gpio_service *service,
79 	enum gpio_id id,
80 	uint32_t en);
81 
82 void dal_gpio_destroy_irq(
83 	struct gpio **ptr);
84 
85 
86 enum gpio_result dal_ddc_open(
87 	struct ddc *ddc,
88 	enum gpio_mode mode,
89 	enum gpio_ddc_config_type config_type);
90 
91 enum gpio_result dal_ddc_change_mode(
92 	struct ddc *ddc,
93 	enum gpio_mode mode);
94 
95 enum gpio_ddc_line dal_ddc_get_line(
96 	const struct ddc *ddc);
97 
98 enum gpio_result dal_ddc_set_config(
99 	struct ddc *ddc,
100 	enum gpio_ddc_config_type config_type);
101 
102 void dal_ddc_close(
103 	struct ddc *ddc);
104 
105 #endif
106