pinmux.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. * Internal interface between the core pin control system and the
  3. * pinmux 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_PINMUX
  14. int pinmux_check_ops(struct pinctrl_dev *pctldev);
  15. int pinmux_validate_map(struct pinctrl_map const *map, int i);
  16. int pinmux_request_gpio(struct pinctrl_dev *pctldev,
  17. struct pinctrl_gpio_range *range,
  18. unsigned pin, unsigned gpio);
  19. void pinmux_free_gpio(struct pinctrl_dev *pctldev, unsigned pin,
  20. struct pinctrl_gpio_range *range);
  21. int pinmux_gpio_direction(struct pinctrl_dev *pctldev,
  22. struct pinctrl_gpio_range *range,
  23. unsigned pin, bool input);
  24. int pinmux_map_to_setting(struct pinctrl_map const *map,
  25. struct pinctrl_setting *setting);
  26. void pinmux_free_setting(struct pinctrl_setting const *setting);
  27. int pinmux_enable_setting(struct pinctrl_setting const *setting);
  28. void pinmux_disable_setting(struct pinctrl_setting const *setting);
  29. #else
  30. static inline int pinmux_check_ops(struct pinctrl_dev *pctldev)
  31. {
  32. return 0;
  33. }
  34. static inline int pinmux_validate_map(struct pinctrl_map const *map, int i)
  35. {
  36. return 0;
  37. }
  38. static inline int pinmux_request_gpio(struct pinctrl_dev *pctldev,
  39. struct pinctrl_gpio_range *range,
  40. unsigned pin, unsigned gpio)
  41. {
  42. return 0;
  43. }
  44. static inline void pinmux_free_gpio(struct pinctrl_dev *pctldev,
  45. unsigned pin,
  46. struct pinctrl_gpio_range *range)
  47. {
  48. }
  49. static inline int pinmux_gpio_direction(struct pinctrl_dev *pctldev,
  50. struct pinctrl_gpio_range *range,
  51. unsigned pin, bool input)
  52. {
  53. return 0;
  54. }
  55. static inline int pinmux_map_to_setting(struct pinctrl_map const *map,
  56. struct pinctrl_setting *setting)
  57. {
  58. return 0;
  59. }
  60. static inline void pinmux_free_setting(struct pinctrl_setting const *setting)
  61. {
  62. }
  63. static inline int pinmux_enable_setting(struct pinctrl_setting const *setting)
  64. {
  65. return 0;
  66. }
  67. static inline void pinmux_disable_setting(
  68. struct pinctrl_setting const *setting)
  69. {
  70. }
  71. #endif
  72. #if defined(CONFIG_PINMUX) && defined(CONFIG_DEBUG_FS)
  73. void pinmux_show_map(struct seq_file *s, struct pinctrl_map const *map);
  74. void pinmux_show_setting(struct seq_file *s,
  75. struct pinctrl_setting const *setting);
  76. void pinmux_init_device_debugfs(struct dentry *devroot,
  77. struct pinctrl_dev *pctldev);
  78. #else
  79. static inline void pinmux_show_map(struct seq_file *s,
  80. struct pinctrl_map const *map)
  81. {
  82. }
  83. static inline void pinmux_show_setting(struct seq_file *s,
  84. struct pinctrl_setting const *setting)
  85. {
  86. }
  87. static inline void pinmux_init_device_debugfs(struct dentry *devroot,
  88. struct pinctrl_dev *pctldev)
  89. {
  90. }
  91. #endif