gpio_service_interface.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. #ifndef __DAL_GPIO_SERVICE_INTERFACE_H__
  26. #define __DAL_GPIO_SERVICE_INTERFACE_H__
  27. #include "gpio_types.h"
  28. #include "gpio_interface.h"
  29. #include "hw/gpio.h"
  30. struct gpio_service;
  31. struct gpio *dal_gpio_create(
  32. struct gpio_service *service,
  33. enum gpio_id id,
  34. uint32_t en,
  35. enum gpio_pin_output_state output_state);
  36. void dal_gpio_destroy(
  37. struct gpio **ptr);
  38. struct gpio_service *dal_gpio_service_create(
  39. enum dce_version dce_version_major,
  40. enum dce_version dce_version_minor,
  41. struct dc_context *ctx);
  42. struct gpio *dal_gpio_service_create_irq(
  43. struct gpio_service *service,
  44. uint32_t offset,
  45. uint32_t mask);
  46. struct ddc *dal_gpio_create_ddc(
  47. struct gpio_service *service,
  48. uint32_t offset,
  49. uint32_t mask,
  50. struct gpio_ddc_hw_info *info);
  51. void dal_gpio_destroy_ddc(
  52. struct ddc **ddc);
  53. void dal_gpio_service_destroy(
  54. struct gpio_service **ptr);
  55. enum dc_irq_source dal_irq_get_source(
  56. const struct gpio *irq);
  57. enum dc_irq_source dal_irq_get_rx_source(
  58. const struct gpio *irq);
  59. enum gpio_result dal_irq_setup_hpd_filter(
  60. struct gpio *irq,
  61. struct gpio_hpd_config *config);
  62. struct gpio *dal_gpio_create_irq(
  63. struct gpio_service *service,
  64. enum gpio_id id,
  65. uint32_t en);
  66. void dal_gpio_destroy_irq(
  67. struct gpio **ptr);
  68. enum gpio_result dal_ddc_open(
  69. struct ddc *ddc,
  70. enum gpio_mode mode,
  71. enum gpio_ddc_config_type config_type);
  72. enum gpio_result dal_ddc_change_mode(
  73. struct ddc *ddc,
  74. enum gpio_mode mode);
  75. enum gpio_ddc_line dal_ddc_get_line(
  76. const struct ddc *ddc);
  77. enum gpio_result dal_ddc_set_config(
  78. struct ddc *ddc,
  79. enum gpio_ddc_config_type config_type);
  80. void dal_ddc_close(
  81. struct ddc *ddc);
  82. #endif