pinctrl-adi2.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * Pinctrl Driver for ADI GPIO2 controller
  3. *
  4. * Copyright 2007-2013 Analog Devices Inc.
  5. *
  6. * Licensed under the GPLv2 or later
  7. */
  8. #ifndef PINCTRL_PINCTRL_ADI2_H
  9. #define PINCTRL_PINCTRL_ADI2_H
  10. #include <linux/pinctrl/pinctrl.h>
  11. /**
  12. * struct adi_pin_group - describes a pin group
  13. * @name: the name of this pin group
  14. * @pins: an array of pins
  15. * @num: the number of pins in this array
  16. */
  17. struct adi_pin_group {
  18. const char *name;
  19. const unsigned *pins;
  20. const unsigned num;
  21. const unsigned short *mux;
  22. };
  23. #define ADI_PIN_GROUP(n, p, m) \
  24. { \
  25. .name = n, \
  26. .pins = p, \
  27. .num = ARRAY_SIZE(p), \
  28. .mux = m, \
  29. }
  30. /**
  31. * struct adi_pmx_func - describes function mux setting of pin groups
  32. * @name: the name of this function mux setting
  33. * @groups: an array of pin groups
  34. * @num_groups: the number of pin groups in this array
  35. * @mux: the function mux setting array, end by zero
  36. */
  37. struct adi_pmx_func {
  38. const char *name;
  39. const char * const *groups;
  40. const unsigned num_groups;
  41. };
  42. #define ADI_PMX_FUNCTION(n, g) \
  43. { \
  44. .name = n, \
  45. .groups = g, \
  46. .num_groups = ARRAY_SIZE(g), \
  47. }
  48. /**
  49. * struct adi_pinctrl_soc_data - ADI pin controller per-SoC configuration
  50. * @functions: The functions supported on this SoC.
  51. * @nfunction: The number of entries in @functions.
  52. * @groups: An array describing all pin groups the pin SoC supports.
  53. * @ngroups: The number of entries in @groups.
  54. * @pins: An array describing all pins the pin controller affects.
  55. * @npins: The number of entries in @pins.
  56. */
  57. struct adi_pinctrl_soc_data {
  58. const struct adi_pmx_func *functions;
  59. int nfunctions;
  60. const struct adi_pin_group *groups;
  61. int ngroups;
  62. const struct pinctrl_pin_desc *pins;
  63. int npins;
  64. };
  65. void adi_pinctrl_soc_init(const struct adi_pinctrl_soc_data **soc);
  66. #endif /* PINCTRL_PINCTRL_ADI2_H */