gpio.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * Copyright 2012-16 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_H__
  26. #define __DAL_GPIO_H__
  27. #include "gpio_types.h"
  28. struct gpio {
  29. struct gpio_service *service;
  30. struct hw_gpio_pin *pin;
  31. enum gpio_id id;
  32. uint32_t en;
  33. enum gpio_mode mode;
  34. /* when GPIO comes from VBIOS, it has defined output state */
  35. enum gpio_pin_output_state output_state;
  36. };
  37. #if 0
  38. struct gpio_funcs {
  39. struct hw_gpio_pin *(*create_ddc_data)(
  40. struct dc_context *ctx,
  41. enum gpio_id id,
  42. uint32_t en);
  43. struct hw_gpio_pin *(*create_ddc_clock)(
  44. struct dc_context *ctx,
  45. enum gpio_id id,
  46. uint32_t en);
  47. struct hw_gpio_pin *(*create_generic)(
  48. struct dc_context *ctx,
  49. enum gpio_id id,
  50. uint32_t en);
  51. struct hw_gpio_pin *(*create_hpd)(
  52. struct dc_context *ctx,
  53. enum gpio_id id,
  54. uint32_t en);
  55. struct hw_gpio_pin *(*create_gpio_pad)(
  56. struct dc_context *ctx,
  57. enum gpio_id id,
  58. uint32_t en);
  59. struct hw_gpio_pin *(*create_sync)(
  60. struct dc_context *ctx,
  61. enum gpio_id id,
  62. uint32_t en);
  63. struct hw_gpio_pin *(*create_gsl)(
  64. struct dc_context *ctx,
  65. enum gpio_id id,
  66. uint32_t en);
  67. /* HW translation */
  68. bool (*offset_to_id)(
  69. uint32_t offset,
  70. uint32_t mask,
  71. enum gpio_id *id,
  72. uint32_t *en);
  73. bool (*id_to_offset)(
  74. enum gpio_id id,
  75. uint32_t en,
  76. struct gpio_pin_info *info);
  77. };
  78. #endif
  79. #endif /* __DAL_GPIO__ */