pinmux.h 2.5 KB

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