pinconf.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*
  2. * Internal interface between the core pin control system and the
  3. * pin config portions
  4. *
  5. * Copyright (C) 2011 ST-Ericsson SA
  6. * Written on behalf of Linaro for ST-Ericsson
  7. * Based on bits of regulator core, gpio core and clk core
  8. *
  9. * Author: Linus Walleij <linus.walleij@linaro.org>
  10. *
  11. * License terms: GNU General Public License (GPL) version 2
  12. */
  13. #ifdef CONFIG_PINCONF
  14. int pinconf_check_ops(struct pinctrl_dev *pctldev);
  15. int pinconf_validate_map(struct pinctrl_map const *map, int i);
  16. int pinconf_map_to_setting(struct pinctrl_map const *map,
  17. struct pinctrl_setting *setting);
  18. void pinconf_free_setting(struct pinctrl_setting const *setting);
  19. int pinconf_apply_setting(struct pinctrl_setting const *setting);
  20. /*
  21. * You will only be interested in these if you're using PINCONF
  22. * so don't supply any stubs for these.
  23. */
  24. int pin_config_get_for_pin(struct pinctrl_dev *pctldev, unsigned pin,
  25. unsigned long *config);
  26. int pin_config_group_get(const char *dev_name, const char *pin_group,
  27. unsigned long *config);
  28. #else
  29. static inline int pinconf_check_ops(struct pinctrl_dev *pctldev)
  30. {
  31. return 0;
  32. }
  33. static inline int pinconf_validate_map(struct pinctrl_map const *map, int i)
  34. {
  35. return 0;
  36. }
  37. static inline int pinconf_map_to_setting(struct pinctrl_map const *map,
  38. struct pinctrl_setting *setting)
  39. {
  40. return 0;
  41. }
  42. static inline void pinconf_free_setting(struct pinctrl_setting const *setting)
  43. {
  44. }
  45. static inline int pinconf_apply_setting(struct pinctrl_setting const *setting)
  46. {
  47. return 0;
  48. }
  49. #endif
  50. #if defined(CONFIG_PINCONF) && defined(CONFIG_DEBUG_FS)
  51. void pinconf_show_map(struct seq_file *s, struct pinctrl_map const *map);
  52. void pinconf_show_setting(struct seq_file *s,
  53. struct pinctrl_setting const *setting);
  54. void pinconf_init_device_debugfs(struct dentry *devroot,
  55. struct pinctrl_dev *pctldev);
  56. #else
  57. static inline void pinconf_show_map(struct seq_file *s,
  58. struct pinctrl_map const *map)
  59. {
  60. }
  61. static inline void pinconf_show_setting(struct seq_file *s,
  62. struct pinctrl_setting const *setting)
  63. {
  64. }
  65. static inline void pinconf_init_device_debugfs(struct dentry *devroot,
  66. struct pinctrl_dev *pctldev)
  67. {
  68. }
  69. #endif
  70. /*
  71. * The following functions are available if the driver uses the generic
  72. * pin config.
  73. */
  74. #if defined(CONFIG_GENERIC_PINCONF) && defined(CONFIG_DEBUG_FS)
  75. void pinconf_generic_dump_pins(struct pinctrl_dev *pctldev,
  76. struct seq_file *s, const char *gname,
  77. unsigned pin);
  78. void pinconf_generic_dump_config(struct pinctrl_dev *pctldev,
  79. struct seq_file *s, unsigned long config);
  80. #else
  81. static inline void pinconf_generic_dump_pins(struct pinctrl_dev *pctldev,
  82. struct seq_file *s,
  83. const char *gname, unsigned pin)
  84. {
  85. return;
  86. }
  87. static inline void pinconf_generic_dump_config(struct pinctrl_dev *pctldev,
  88. struct seq_file *s,
  89. unsigned long config)
  90. {
  91. return;
  92. }
  93. #endif
  94. #if defined(CONFIG_GENERIC_PINCONF) && defined(CONFIG_OF)
  95. int pinconf_generic_parse_dt_config(struct device_node *np,
  96. struct pinctrl_dev *pctldev,
  97. unsigned long **configs,
  98. unsigned int *nconfigs);
  99. #endif