pinconf.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * Interface the pinconfig portions of the pinctrl subsystem
  3. *
  4. * Copyright (C) 2011 ST-Ericsson SA
  5. * Written on behalf of Linaro for ST-Ericsson
  6. * This interface is used in the core to keep track of pins.
  7. *
  8. * Author: Linus Walleij <linus.walleij@linaro.org>
  9. *
  10. * License terms: GNU General Public License (GPL) version 2
  11. */
  12. #ifndef __LINUX_PINCTRL_PINCONF_H
  13. #define __LINUX_PINCTRL_PINCONF_H
  14. #ifdef CONFIG_PINCONF
  15. struct pinctrl_dev;
  16. /**
  17. * struct pinconf_ops - pin config operations, to be implemented by
  18. * pin configuration capable drivers.
  19. * @pin_config_get: get the config of a certain pin, if the requested config
  20. * is not available on this controller this should return -ENOTSUPP
  21. * and if it is available but disabled it should return -EINVAL
  22. * @pin_config_get: get the config of a certain pin
  23. * @pin_config_set: configure an individual pin
  24. * @pin_config_group_get: get configurations for an entire pin group
  25. * @pin_config_group_set: configure all pins in a group
  26. * @pin_config_dbg_show: optional debugfs display hook that will provide
  27. * per-device info for a certain pin in debugfs
  28. * @pin_config_group_dbg_show: optional debugfs display hook that will provide
  29. * per-device info for a certain group in debugfs
  30. */
  31. struct pinconf_ops {
  32. int (*pin_config_get) (struct pinctrl_dev *pctldev,
  33. unsigned pin,
  34. unsigned long *config);
  35. int (*pin_config_set) (struct pinctrl_dev *pctldev,
  36. unsigned pin,
  37. unsigned long config);
  38. int (*pin_config_group_get) (struct pinctrl_dev *pctldev,
  39. unsigned selector,
  40. unsigned long *config);
  41. int (*pin_config_group_set) (struct pinctrl_dev *pctldev,
  42. unsigned selector,
  43. unsigned long config);
  44. void (*pin_config_dbg_show) (struct pinctrl_dev *pctldev,
  45. struct seq_file *s,
  46. unsigned offset);
  47. void (*pin_config_group_dbg_show) (struct pinctrl_dev *pctldev,
  48. struct seq_file *s,
  49. unsigned selector);
  50. };
  51. extern int pin_config_get(struct pinctrl_dev *pctldev, const char *name,
  52. unsigned long *config);
  53. extern int pin_config_set(struct pinctrl_dev *pctldev, const char *name,
  54. unsigned long config);
  55. extern int pin_config_group_get(struct pinctrl_dev *pctldev,
  56. const char *pin_group,
  57. unsigned long *config);
  58. extern int pin_config_group_set(struct pinctrl_dev *pctldev,
  59. const char *pin_group,
  60. unsigned long config);
  61. #else
  62. static inline int pin_config_get(struct pinctrl_dev *pctldev, const char *name,
  63. unsigned long *config)
  64. {
  65. return 0;
  66. }
  67. static inline int pin_config_set(struct pinctrl_dev *pctldev, const char *name,
  68. unsigned long config)
  69. {
  70. return 0;
  71. }
  72. static inline int pin_config_group_get(struct pinctrl_dev *pctldev,
  73. const char *pin_group,
  74. unsigned long *config)
  75. {
  76. return 0;
  77. }
  78. static inline int pin_config_group_set(struct pinctrl_dev *pctldev,
  79. const char *pin_group,
  80. unsigned long config)
  81. {
  82. return 0;
  83. }
  84. #endif
  85. #endif /* __LINUX_PINCTRL_PINCONF_H */