pinconf.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. void pinconf_show_map(struct seq_file *s, struct pinctrl_map const *map);
  21. void pinconf_show_setting(struct seq_file *s,
  22. struct pinctrl_setting const *setting);
  23. void pinconf_init_device_debugfs(struct dentry *devroot,
  24. struct pinctrl_dev *pctldev);
  25. /*
  26. * You will only be interested in these if you're using PINCONF
  27. * so don't supply any stubs for these.
  28. */
  29. int pin_config_get_for_pin(struct pinctrl_dev *pctldev, unsigned pin,
  30. unsigned long *config);
  31. int pin_config_group_get(const char *dev_name, const char *pin_group,
  32. unsigned long *config);
  33. #else
  34. static inline int pinconf_check_ops(struct pinctrl_dev *pctldev)
  35. {
  36. return 0;
  37. }
  38. static inline int pinconf_validate_map(struct pinctrl_map const *map, int i)
  39. {
  40. return 0;
  41. }
  42. static inline int pinconf_map_to_setting(struct pinctrl_map const *map,
  43. struct pinctrl_setting *setting)
  44. {
  45. return 0;
  46. }
  47. static inline void pinconf_free_setting(struct pinctrl_setting const *setting)
  48. {
  49. }
  50. static inline int pinconf_apply_setting(struct pinctrl_setting const *setting)
  51. {
  52. return 0;
  53. }
  54. static inline void pinconf_show_map(struct seq_file *s,
  55. struct pinctrl_map const *map)
  56. {
  57. }
  58. static inline void pinconf_show_setting(struct seq_file *s,
  59. struct pinctrl_setting const *setting)
  60. {
  61. }
  62. static inline void pinconf_init_device_debugfs(struct dentry *devroot,
  63. struct pinctrl_dev *pctldev)
  64. {
  65. }
  66. #endif
  67. /*
  68. * The following functions are available if the driver uses the generic
  69. * pin config.
  70. */
  71. #ifdef CONFIG_GENERIC_PINCONF
  72. void pinconf_generic_dump_pin(struct pinctrl_dev *pctldev,
  73. struct seq_file *s, unsigned pin);
  74. void pinconf_generic_dump_group(struct pinctrl_dev *pctldev,
  75. struct seq_file *s, const char *gname);
  76. #else
  77. static inline void pinconf_generic_dump_pin(struct pinctrl_dev *pctldev,
  78. struct seq_file *s,
  79. unsigned pin)
  80. {
  81. return;
  82. }
  83. static inline void pinconf_generic_dump_group(struct pinctrl_dev *pctldev,
  84. struct seq_file *s,
  85. const char *gname)
  86. {
  87. return;
  88. }
  89. #endif