pinctrl-ma35.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (C) 2024 Nuvoton Technology Corp.
  4. *
  5. * Author: Shan-Chun Hung <schung@nuvoton.com>
  6. * * Jacky Huang <ychuang3@nuvoton.com>
  7. */
  8. #ifndef __PINCTRL_MA35_H
  9. #define __PINCTRL_MA35_H
  10. #include <linux/pinctrl/pinconf-generic.h>
  11. #include <linux/pinctrl/pinmux.h>
  12. #include <linux/platform_device.h>
  13. struct ma35_mux_desc {
  14. const char *name;
  15. u32 muxval;
  16. };
  17. struct ma35_pin_data {
  18. u32 offset;
  19. u32 shift;
  20. struct ma35_mux_desc *muxes;
  21. };
  22. struct ma35_pinctrl_soc_info {
  23. const struct pinctrl_pin_desc *pins;
  24. unsigned int npins;
  25. int (*get_pin_num)(int offset, int shift);
  26. };
  27. #define MA35_PIN(num, n, o, s, ...) { \
  28. .number = num, \
  29. .name = #n, \
  30. .drv_data = &(struct ma35_pin_data) { \
  31. .offset = o, \
  32. .shift = s, \
  33. .muxes = (struct ma35_mux_desc[]) { \
  34. __VA_ARGS__, { } }, \
  35. }, \
  36. }
  37. #define MA35_MUX(_val, _name) { \
  38. .name = _name, \
  39. .muxval = _val, \
  40. }
  41. int ma35_pinctrl_probe(struct platform_device *pdev, const struct ma35_pinctrl_soc_info *info);
  42. int ma35_pinctrl_suspend(struct device *dev);
  43. int ma35_pinctrl_resume(struct device *dev);
  44. #endif /* __PINCTRL_MA35_H */