pinmux.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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_request_gpio(struct pinctrl_dev *pctldev,
  16. struct pinctrl_gpio_range *range,
  17. unsigned pin, unsigned gpio);
  18. void pinmux_free_gpio(struct pinctrl_dev *pctldev, unsigned pin,
  19. struct pinctrl_gpio_range *range);
  20. int pinmux_gpio_direction(struct pinctrl_dev *pctldev,
  21. struct pinctrl_gpio_range *range,
  22. unsigned pin, bool input);
  23. static inline void pinmux_init_pinctrl_handle(struct pinctrl *p)
  24. {
  25. INIT_LIST_HEAD(&p->groups);
  26. }
  27. int pinmux_apply_muxmap(struct pinctrl_dev *pctldev,
  28. struct pinctrl *p,
  29. struct device *dev,
  30. const char *devname,
  31. struct pinctrl_map const *map);
  32. void pinmux_put(struct pinctrl *p);
  33. int pinmux_enable(struct pinctrl *p);
  34. void pinmux_disable(struct pinctrl *p);
  35. void pinmux_init_device_debugfs(struct dentry *devroot,
  36. struct pinctrl_dev *pctldev);
  37. void pinmux_dbg_show(struct seq_file *s, struct pinctrl *p);
  38. #else
  39. static inline int pinmux_check_ops(struct pinctrl_dev *pctldev)
  40. {
  41. return 0;
  42. }
  43. static inline int pinmux_request_gpio(struct pinctrl_dev *pctldev,
  44. struct pinctrl_gpio_range *range,
  45. unsigned pin, unsigned gpio)
  46. {
  47. return 0;
  48. }
  49. static inline void pinmux_free_gpio(struct pinctrl_dev *pctldev,
  50. unsigned pin,
  51. struct pinctrl_gpio_range *range)
  52. {
  53. }
  54. static inline int pinmux_gpio_direction(struct pinctrl_dev *pctldev,
  55. struct pinctrl_gpio_range *range,
  56. unsigned pin, bool input)
  57. {
  58. return 0;
  59. }
  60. static inline void pinmux_init_pinctrl_handle(struct pinctrl *p)
  61. {
  62. }
  63. static inline int pinmux_apply_muxmap(struct pinctrl_dev *pctldev,
  64. struct pinctrl *p,
  65. struct device *dev,
  66. const char *devname,
  67. struct pinctrl_map const *map)
  68. {
  69. return 0;
  70. }
  71. static inline void pinmux_put(struct pinctrl *p)
  72. {
  73. }
  74. static inline int pinmux_enable(struct pinctrl *p)
  75. {
  76. }
  77. static inline void pinmux_disable(struct pinctrl *p)
  78. {
  79. }
  80. static inline void pinmux_init_device_debugfs(struct dentry *devroot,
  81. struct pinctrl_dev *pctldev)
  82. {
  83. }
  84. static inline void pinmux_dbg_show(struct seq_file *s, struct pinctrl *p)
  85. {
  86. }
  87. #endif