Home | History | Annotate | Line # | Download | only in include
      1 /*	$NetBSD: gpio_service_interface.h,v 1.3 2021/12/19 11:22:32 riastradh Exp $	*/
      2 
      3 /*
      4  * Copyright 2012-15 Advanced Micro Devices, Inc.
      5  *
      6  * Permission is hereby granted, free of charge, to any person obtaining a
      7  * copy of this software and associated documentation files (the "Software"),
      8  * to deal in the Software without restriction, including without limitation
      9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
     10  * and/or sell copies of the Software, and to permit persons to whom the
     11  * Software is furnished to do so, subject to the following conditions:
     12  *
     13  * The above copyright notice and this permission notice shall be included in
     14  * all copies or substantial portions of the Software.
     15  *
     16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
     19  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
     20  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
     21  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
     22  * OTHER DEALINGS IN THE SOFTWARE.
     23  *
     24  * Authors: AMD
     25  *
     26  */
     27 
     28 #ifndef __DAL_GPIO_SERVICE_INTERFACE_H__
     29 #define __DAL_GPIO_SERVICE_INTERFACE_H__
     30 
     31 #include "gpio_types.h"
     32 #include "gpio_interface.h"
     33 #include "hw/gpio.h"
     34 
     35 struct gpio_service;
     36 
     37 struct gpio *dal_gpio_create(
     38 	struct gpio_service *service,
     39 	enum gpio_id id,
     40 	uint32_t en,
     41 	enum gpio_pin_output_state output_state);
     42 
     43 void dal_gpio_destroy(
     44 	struct gpio **ptr);
     45 
     46 struct gpio_service *dal_gpio_service_create(
     47 	enum dce_version dce_version_major,
     48 	enum dce_environment dce_version_minor,
     49 	struct dc_context *ctx);
     50 
     51 struct gpio *dal_gpio_service_create_irq(
     52 	struct gpio_service *service,
     53 	uint32_t offset,
     54 	uint32_t mask);
     55 
     56 struct gpio *dal_gpio_service_create_generic_mux(
     57 	struct gpio_service *service,
     58 	uint32_t offset,
     59 	uint32_t mask);
     60 
     61 void dal_gpio_destroy_generic_mux(
     62 	struct gpio **mux);
     63 
     64 enum gpio_result dal_mux_setup_config(
     65 	struct gpio *mux,
     66 	struct gpio_generic_mux_config *config);
     67 
     68 struct gpio_pin_info dal_gpio_get_generic_pin_info(
     69 	struct gpio_service *service,
     70 	enum gpio_id id,
     71 	uint32_t en);
     72 
     73 struct ddc *dal_gpio_create_ddc(
     74 	struct gpio_service *service,
     75 	uint32_t offset,
     76 	uint32_t mask,
     77 	struct gpio_ddc_hw_info *info);
     78 
     79 void dal_gpio_destroy_ddc(
     80 	struct ddc **ddc);
     81 
     82 void dal_gpio_service_destroy(
     83 	struct gpio_service **ptr);
     84 
     85 enum dc_irq_source dal_irq_get_source(
     86 	const struct gpio *irq);
     87 
     88 enum dc_irq_source dal_irq_get_rx_source(
     89 	const struct gpio *irq);
     90 
     91 enum gpio_result dal_irq_setup_hpd_filter(
     92 	struct gpio *irq,
     93 	struct gpio_hpd_config *config);
     94 
     95 struct gpio *dal_gpio_create_irq(
     96 	struct gpio_service *service,
     97 	enum gpio_id id,
     98 	uint32_t en);
     99 
    100 void dal_gpio_destroy_irq(
    101 	struct gpio **ptr);
    102 
    103 
    104 enum gpio_result dal_ddc_open(
    105 	struct ddc *ddc,
    106 	enum gpio_mode mode,
    107 	enum gpio_ddc_config_type config_type);
    108 
    109 enum gpio_result dal_ddc_change_mode(
    110 	struct ddc *ddc,
    111 	enum gpio_mode mode);
    112 
    113 enum gpio_ddc_line dal_ddc_get_line(
    114 	const struct ddc *ddc);
    115 
    116 enum gpio_result dal_ddc_set_config(
    117 	struct ddc *ddc,
    118 	enum gpio_ddc_config_type config_type);
    119 
    120 void dal_ddc_close(
    121 	struct ddc *ddc);
    122 
    123 #endif
    124