pinconf.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. #include <linux/pinctrl/machine.h>
  16. struct pinctrl_dev;
  17. struct seq_file;
  18. /**
  19. * struct pinconf_ops - pin config operations, to be implemented by
  20. * pin configuration capable drivers.
  21. * @is_generic: for pin controllers that want to use the generic interface,
  22. * this flag tells the framework that it's generic.
  23. * @pin_config_get: get the config of a certain pin, if the requested config
  24. * is not available on this controller this should return -ENOTSUPP
  25. * and if it is available but disabled it should return -EINVAL
  26. * @pin_config_set: configure an individual pin
  27. * @pin_config_group_get: get configurations for an entire pin group
  28. * @pin_config_group_set: configure all pins in a group
  29. * @pin_config_dbg_parse_modify: optional debugfs to modify a pin configuration
  30. * @pin_config_dbg_show: optional debugfs display hook that will provide
  31. * per-device info for a certain pin in debugfs
  32. * @pin_config_group_dbg_show: optional debugfs display hook that will provide
  33. * per-device info for a certain group in debugfs
  34. * @pin_config_config_dbg_show: optional debugfs display hook that will decode
  35. * and display a driver's pin configuration parameter
  36. */
  37. struct pinconf_ops {
  38. #ifdef CONFIG_GENERIC_PINCONF
  39. bool is_generic;
  40. #endif
  41. int (*pin_config_get) (struct pinctrl_dev *pctldev,
  42. unsigned pin,
  43. unsigned long *config);
  44. int (*pin_config_set) (struct pinctrl_dev *pctldev,
  45. unsigned pin,
  46. unsigned long *configs,
  47. unsigned num_configs);
  48. int (*pin_config_group_get) (struct pinctrl_dev *pctldev,
  49. unsigned selector,
  50. unsigned long *config);
  51. int (*pin_config_group_set) (struct pinctrl_dev *pctldev,
  52. unsigned selector,
  53. unsigned long *configs,
  54. unsigned num_configs);
  55. int (*pin_config_dbg_parse_modify) (struct pinctrl_dev *pctldev,
  56. const char *arg,
  57. unsigned long *config);
  58. void (*pin_config_dbg_show) (struct pinctrl_dev *pctldev,
  59. struct seq_file *s,
  60. unsigned offset);
  61. void (*pin_config_group_dbg_show) (struct pinctrl_dev *pctldev,
  62. struct seq_file *s,
  63. unsigned selector);
  64. void (*pin_config_config_dbg_show) (struct pinctrl_dev *pctldev,
  65. struct seq_file *s,
  66. unsigned long config);
  67. };
  68. #endif
  69. #endif /* __LINUX_PINCTRL_PINCONF_H */