pinconf.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 config);
  47. int (*pin_config_group_get) (struct pinctrl_dev *pctldev,
  48. unsigned selector,
  49. unsigned long *config);
  50. int (*pin_config_group_set) (struct pinctrl_dev *pctldev,
  51. unsigned selector,
  52. unsigned long config);
  53. int (*pin_config_dbg_parse_modify) (struct pinctrl_dev *pctldev,
  54. const char *arg,
  55. unsigned long *config);
  56. void (*pin_config_dbg_show) (struct pinctrl_dev *pctldev,
  57. struct seq_file *s,
  58. unsigned offset);
  59. void (*pin_config_group_dbg_show) (struct pinctrl_dev *pctldev,
  60. struct seq_file *s,
  61. unsigned selector);
  62. void (*pin_config_config_dbg_show) (struct pinctrl_dev *pctldev,
  63. struct seq_file *s,
  64. unsigned long config);
  65. };
  66. #endif
  67. #endif /* __LINUX_PINCTRL_PINCONF_H */