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_GPIO_INTERFACE_H__ 274562236bSHarry Wentland #define __DAL_GPIO_INTERFACE_H__ 284562236bSHarry Wentland 294562236bSHarry Wentland #include "gpio_types.h" 304562236bSHarry Wentland #include "grph_object_defs.h" 314562236bSHarry Wentland 324562236bSHarry Wentland struct gpio; 334562236bSHarry Wentland 344562236bSHarry Wentland /* Open the handle for future use */ 354562236bSHarry Wentland enum gpio_result dal_gpio_open( 364562236bSHarry Wentland struct gpio *gpio, 374562236bSHarry Wentland enum gpio_mode mode); 384562236bSHarry Wentland 394562236bSHarry Wentland enum gpio_result dal_gpio_open_ex( 404562236bSHarry Wentland struct gpio *gpio, 414562236bSHarry Wentland enum gpio_mode mode); 424562236bSHarry Wentland 434562236bSHarry Wentland /* Get high or low from the pin */ 444562236bSHarry Wentland enum gpio_result dal_gpio_get_value( 454562236bSHarry Wentland const struct gpio *gpio, 464562236bSHarry Wentland uint32_t *value); 474562236bSHarry Wentland 484562236bSHarry Wentland /* Set pin high or low */ 494562236bSHarry Wentland enum gpio_result dal_gpio_set_value( 504562236bSHarry Wentland const struct gpio *gpio, 514562236bSHarry Wentland uint32_t value); 524562236bSHarry Wentland 534562236bSHarry Wentland /* Get current mode */ 544562236bSHarry Wentland enum gpio_mode dal_gpio_get_mode( 554562236bSHarry Wentland const struct gpio *gpio); 564562236bSHarry Wentland 574562236bSHarry Wentland /* Change mode of the handle */ 584562236bSHarry Wentland enum gpio_result dal_gpio_change_mode( 594562236bSHarry Wentland struct gpio *gpio, 604562236bSHarry Wentland enum gpio_mode mode); 614562236bSHarry Wentland 62ac627cafSChiawen Huang /* Lock Pin */ 63ac627cafSChiawen Huang enum gpio_result dal_gpio_lock_pin( 64ac627cafSChiawen Huang struct gpio *gpio); 65ac627cafSChiawen Huang 66ac627cafSChiawen Huang /* Unlock Pin */ 67ac627cafSChiawen Huang enum gpio_result dal_gpio_unlock_pin( 68ac627cafSChiawen Huang struct gpio *gpio); 69ac627cafSChiawen Huang 704562236bSHarry Wentland /* Get the GPIO id */ 714562236bSHarry Wentland enum gpio_id dal_gpio_get_id( 724562236bSHarry Wentland const struct gpio *gpio); 734562236bSHarry Wentland 744562236bSHarry Wentland /* Get the GPIO enum */ 754562236bSHarry Wentland uint32_t dal_gpio_get_enum( 764562236bSHarry Wentland const struct gpio *gpio); 774562236bSHarry Wentland 784562236bSHarry Wentland /* Set the GPIO pin configuration */ 794562236bSHarry Wentland enum gpio_result dal_gpio_set_config( 804562236bSHarry Wentland struct gpio *gpio, 814562236bSHarry Wentland const struct gpio_config_data *config_data); 824562236bSHarry Wentland 834562236bSHarry Wentland /* Obtain GPIO pin info */ 844562236bSHarry Wentland enum gpio_result dal_gpio_get_pin_info( 854562236bSHarry Wentland const struct gpio *gpio, 864562236bSHarry Wentland struct gpio_pin_info *pin_info); 874562236bSHarry Wentland 884562236bSHarry Wentland /* Obtain GPIO sync source */ 894562236bSHarry Wentland enum sync_source dal_gpio_get_sync_source( 904562236bSHarry Wentland const struct gpio *gpio); 914562236bSHarry Wentland 924562236bSHarry Wentland /* Obtain GPIO pin output state (active low or active high) */ 934562236bSHarry Wentland enum gpio_pin_output_state dal_gpio_get_output_state( 944562236bSHarry Wentland const struct gpio *gpio); 954562236bSHarry Wentland 96*91db9311SSu Sung Chung struct hw_ddc *dal_gpio_get_ddc(struct gpio *gpio); 97*91db9311SSu Sung Chung 98*91db9311SSu Sung Chung struct hw_hpd *dal_gpio_get_hpd(struct gpio *gpio); 99*91db9311SSu Sung Chung 100*91db9311SSu Sung Chung struct hw_generic *dal_gpio_get_generic(struct gpio *gpio); 101*91db9311SSu Sung Chung 1024562236bSHarry Wentland /* Close the handle */ 1034562236bSHarry Wentland void dal_gpio_close( 1044562236bSHarry Wentland struct gpio *gpio); 1054562236bSHarry Wentland 106*91db9311SSu Sung Chung 107*91db9311SSu Sung Chung 108*91db9311SSu Sung Chung 1094562236bSHarry Wentland #endif 110