Home | History | Annotate | Line # | Download | only in include
      1 /*	$NetBSD: gpio_interface.h,v 1.2 2021/12/18 23:45:07 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_INTERFACE_H__
     29 #define __DAL_GPIO_INTERFACE_H__
     30 
     31 #include "gpio_types.h"
     32 #include "grph_object_defs.h"
     33 
     34 struct gpio;
     35 
     36 /* Open the handle for future use */
     37 enum gpio_result dal_gpio_open(
     38 	struct gpio *gpio,
     39 	enum gpio_mode mode);
     40 
     41 enum gpio_result dal_gpio_open_ex(
     42 	struct gpio *gpio,
     43 	enum gpio_mode mode);
     44 
     45 /* Get high or low from the pin */
     46 enum gpio_result dal_gpio_get_value(
     47 	const struct gpio *gpio,
     48 	uint32_t *value);
     49 
     50 /* Set pin high or low */
     51 enum gpio_result dal_gpio_set_value(
     52 	const struct gpio *gpio,
     53 	uint32_t value);
     54 
     55 /* Get current mode */
     56 enum gpio_mode dal_gpio_get_mode(
     57 	const struct gpio *gpio);
     58 
     59 /* Change mode of the handle */
     60 enum gpio_result dal_gpio_change_mode(
     61 	struct gpio *gpio,
     62 	enum gpio_mode mode);
     63 
     64 /* Lock Pin */
     65 enum gpio_result dal_gpio_lock_pin(
     66 	struct gpio *gpio);
     67 
     68 /* Unlock Pin */
     69 enum gpio_result dal_gpio_unlock_pin(
     70 	struct gpio *gpio);
     71 
     72 /* Get the GPIO id */
     73 enum gpio_id dal_gpio_get_id(
     74 	const struct gpio *gpio);
     75 
     76 /* Get the GPIO enum */
     77 uint32_t dal_gpio_get_enum(
     78 	const struct gpio *gpio);
     79 
     80 /* Set the GPIO pin configuration */
     81 enum gpio_result dal_gpio_set_config(
     82 	struct gpio *gpio,
     83 	const struct gpio_config_data *config_data);
     84 
     85 /* Obtain GPIO pin info */
     86 enum gpio_result dal_gpio_get_pin_info(
     87 	const struct gpio *gpio,
     88 	struct gpio_pin_info *pin_info);
     89 
     90 /* Obtain GPIO sync source */
     91 enum sync_source dal_gpio_get_sync_source(
     92 	const struct gpio *gpio);
     93 
     94 /* Obtain GPIO pin output state (active low or active high) */
     95 enum gpio_pin_output_state dal_gpio_get_output_state(
     96 	const struct gpio *gpio);
     97 
     98 struct hw_ddc *dal_gpio_get_ddc(struct gpio *gpio);
     99 
    100 struct hw_hpd *dal_gpio_get_hpd(struct gpio *gpio);
    101 
    102 struct hw_generic *dal_gpio_get_generic(struct gpio *gpio);
    103 
    104 /* Close the handle */
    105 void dal_gpio_close(
    106 	struct gpio *gpio);
    107 
    108 
    109 
    110 
    111 #endif
    112