pinctrl-intel.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*
  2. * Core pinctrl/GPIO driver for Intel GPIO controllers
  3. *
  4. * Copyright (C) 2015, Intel Corporation
  5. * Authors: Mathias Nyman <mathias.nyman@linux.intel.com>
  6. * Mika Westerberg <mika.westerberg@linux.intel.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #ifndef PINCTRL_INTEL_H
  13. #define PINCTRL_INTEL_H
  14. struct pinctrl_pin_desc;
  15. struct platform_device;
  16. struct device;
  17. /**
  18. * struct intel_pingroup - Description about group of pins
  19. * @name: Name of the groups
  20. * @pins: All pins in this group
  21. * @npins: Number of pins in this groups
  22. * @mode: Native mode in which the group is muxed out @pins
  23. */
  24. struct intel_pingroup {
  25. const char *name;
  26. const unsigned *pins;
  27. size_t npins;
  28. unsigned short mode;
  29. };
  30. /**
  31. * struct intel_function - Description about a function
  32. * @name: Name of the function
  33. * @groups: An array of groups for this function
  34. * @ngroups: Number of groups in @groups
  35. */
  36. struct intel_function {
  37. const char *name;
  38. const char * const *groups;
  39. size_t ngroups;
  40. };
  41. /**
  42. * struct intel_community - Intel pin community description
  43. * @barno: MMIO BAR number where registers for this community reside
  44. * @padown_offset: Register offset of PAD_OWN register from @regs. If %0
  45. * then there is no support for owner.
  46. * @padcfglock_offset: Register offset of PADCFGLOCK from @regs. If %0 then
  47. * locking is not supported.
  48. * @hostown_offset: Register offset of HOSTSW_OWN from @regs. If %0 then it
  49. * is assumed that the host owns the pin (rather than
  50. * ACPI).
  51. * @ie_offset: Register offset of GPI_IE from @regs.
  52. * @pin_base: Starting pin of pins in this community
  53. * @gpp_size: Maximum number of pads in each group, such as PADCFGLOCK,
  54. * HOSTSW_OWN, GPI_IS, GPI_IE, etc.
  55. * @npins: Number of pins in this community
  56. * @regs: Community specific common registers (reserved for core driver)
  57. * @pad_regs: Community specific pad registers (reserved for core driver)
  58. * @ngpps: Number of groups (hw groups) in this community (reserved for
  59. * core driver)
  60. */
  61. struct intel_community {
  62. unsigned barno;
  63. unsigned padown_offset;
  64. unsigned padcfglock_offset;
  65. unsigned hostown_offset;
  66. unsigned ie_offset;
  67. unsigned pin_base;
  68. unsigned gpp_size;
  69. size_t npins;
  70. void __iomem *regs;
  71. void __iomem *pad_regs;
  72. size_t ngpps;
  73. };
  74. #define PIN_GROUP(n, p, m) \
  75. { \
  76. .name = (n), \
  77. .pins = (p), \
  78. .npins = ARRAY_SIZE((p)), \
  79. .mode = (m), \
  80. }
  81. #define FUNCTION(n, g) \
  82. { \
  83. .name = (n), \
  84. .groups = (g), \
  85. .ngroups = ARRAY_SIZE((g)), \
  86. }
  87. /**
  88. * struct intel_pinctrl_soc_data - Intel pin controller per-SoC configuration
  89. * @uid: ACPI _UID for the probe driver use if needed
  90. * @pins: Array if pins this pinctrl controls
  91. * @npins: Number of pins in the array
  92. * @groups: Array of pin groups
  93. * @ngroups: Number of groups in the array
  94. * @functions: Array of functions
  95. * @nfunctions: Number of functions in the array
  96. * @communities: Array of communities this pinctrl handles
  97. * @ncommunities: Number of communities in the array
  98. *
  99. * The @communities is used as a template by the core driver. It will make
  100. * copy of all communities and fill in rest of the information.
  101. */
  102. struct intel_pinctrl_soc_data {
  103. const char *uid;
  104. const struct pinctrl_pin_desc *pins;
  105. size_t npins;
  106. const struct intel_pingroup *groups;
  107. size_t ngroups;
  108. const struct intel_function *functions;
  109. size_t nfunctions;
  110. const struct intel_community *communities;
  111. size_t ncommunities;
  112. };
  113. int intel_pinctrl_probe(struct platform_device *pdev,
  114. const struct intel_pinctrl_soc_data *soc_data);
  115. int intel_pinctrl_remove(struct platform_device *pdev);
  116. #ifdef CONFIG_PM_SLEEP
  117. int intel_pinctrl_suspend(struct device *dev);
  118. int intel_pinctrl_resume(struct device *dev);
  119. #endif
  120. #endif /* PINCTRL_INTEL_H */