pinconf.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Interface the pinconfig portions of the pinctrl subsystem
  4. *
  5. * Copyright (C) 2011 ST-Ericsson SA
  6. * Written on behalf of Linaro for ST-Ericsson
  7. * This interface is used in the core to keep track of pins.
  8. *
  9. * Author: Linus Walleij <[email protected]>
  10. */
  11. #ifndef __LINUX_PINCTRL_PINCONF_H
  12. #define __LINUX_PINCTRL_PINCONF_H
  13. #include <linux/types.h>
  14. struct pinctrl_dev;
  15. struct seq_file;
  16. /**
  17. * struct pinconf_ops - pin config operations, to be implemented by
  18. * pin configuration capable drivers.
  19. * @is_generic: for pin controllers that want to use the generic interface,
  20. * this flag tells the framework that it's generic.
  21. * @pin_config_get: get the config of a certain pin, if the requested config
  22. * is not available on this controller this should return -ENOTSUPP
  23. * and if it is available but disabled it should return -EINVAL
  24. * @pin_config_set: configure an individual pin
  25. * @pin_config_group_get: get configurations for an entire pin group; should
  26. * return -ENOTSUPP and -EINVAL using the same rules as pin_config_get.
  27. * @pin_config_group_set: configure all pins in a group
  28. * @pin_config_dbg_show: optional debugfs display hook that will provide
  29. * per-device info for a certain pin in debugfs
  30. * @pin_config_group_dbg_show: optional debugfs display hook that will provide
  31. * per-device info for a certain group in debugfs
  32. * @pin_config_config_dbg_show: optional debugfs display hook that will decode
  33. * and display a driver's pin configuration parameter
  34. */
  35. struct pinconf_ops {
  36. #ifdef CONFIG_GENERIC_PINCONF
  37. bool is_generic;
  38. #endif
  39. int (*pin_config_get) (struct pinctrl_dev *pctldev,
  40. unsigned pin,
  41. unsigned long *config);
  42. int (*pin_config_set) (struct pinctrl_dev *pctldev,
  43. unsigned pin,
  44. unsigned long *configs,
  45. unsigned num_configs);
  46. int (*pin_config_group_get) (struct pinctrl_dev *pctldev,
  47. unsigned selector,
  48. unsigned long *config);
  49. int (*pin_config_group_set) (struct pinctrl_dev *pctldev,
  50. unsigned selector,
  51. unsigned long *configs,
  52. unsigned num_configs);
  53. void (*pin_config_dbg_show) (struct pinctrl_dev *pctldev,
  54. struct seq_file *s,
  55. unsigned offset);
  56. void (*pin_config_group_dbg_show) (struct pinctrl_dev *pctldev,
  57. struct seq_file *s,
  58. unsigned selector);
  59. void (*pin_config_config_dbg_show) (struct pinctrl_dev *pctldev,
  60. struct seq_file *s,
  61. unsigned long config);
  62. };
  63. #endif /* __LINUX_PINCTRL_PINCONF_H */