pinctrl-amdisp.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * AMD ISP Pinctrl Driver
  4. *
  5. * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved.
  6. *
  7. */
  8. static const struct pinctrl_pin_desc amdisp_pins[] = {
  9. PINCTRL_PIN(0, "GPIO_0"), /* sensor0 control */
  10. PINCTRL_PIN(1, "GPIO_1"), /* sensor1 control */
  11. PINCTRL_PIN(2, "GPIO_2"), /* sensor2 control */
  12. };
  13. #define AMDISP_GPIO_PINS(pin) \
  14. static const unsigned int gpio##pin##_pins[] = { pin }
  15. AMDISP_GPIO_PINS(0);
  16. AMDISP_GPIO_PINS(1);
  17. AMDISP_GPIO_PINS(2);
  18. static const unsigned int amdisp_range_pins[] = {
  19. 0, 1, 2
  20. };
  21. static const char * const amdisp_range_pins_name[] = {
  22. "gpio0", "gpio1", "gpio2"
  23. };
  24. enum amdisp_functions {
  25. mux_gpio,
  26. mux_NA
  27. };
  28. static const char * const gpio_groups[] = {
  29. "gpio0", "gpio1", "gpio2"
  30. };
  31. /**
  32. * struct amdisp_function - a pinmux function
  33. * @name: Name of the pinmux function.
  34. * @groups: List of pingroups for this function.
  35. * @ngroups: Number of entries in @groups.
  36. */
  37. struct amdisp_function {
  38. const char *name;
  39. const char * const *groups;
  40. unsigned int ngroups;
  41. };
  42. #define FUNCTION(fname) \
  43. [mux_##fname] = { \
  44. .name = #fname, \
  45. .groups = fname##_groups, \
  46. .ngroups = ARRAY_SIZE(fname##_groups), \
  47. }
  48. static const struct amdisp_function amdisp_functions[] = {
  49. FUNCTION(gpio),
  50. };
  51. /**
  52. * struct amdisp_pingroup - a pinmux group
  53. * @name: Name of the pinmux group.
  54. * @pins: List of pins for this group.
  55. * @npins: Number of entries in @pins.
  56. * @funcs: List of functions belongs to this group.
  57. * @nfuncs: Number of entries in @funcs.
  58. * @offset: Group offset in amdisp pinmux groups.
  59. */
  60. struct amdisp_pingroup {
  61. const char *name;
  62. const unsigned int *pins;
  63. unsigned int npins;
  64. unsigned int *funcs;
  65. unsigned int nfuncs;
  66. unsigned int offset;
  67. };
  68. #define PINGROUP(id, f0) \
  69. { \
  70. .name = "gpio" #id, \
  71. .pins = gpio##id##_pins, \
  72. .npins = ARRAY_SIZE(gpio##id##_pins), \
  73. .funcs = (int[]){ \
  74. mux_##f0, \
  75. }, \
  76. .nfuncs = 1, \
  77. .offset = id, \
  78. }
  79. static const struct amdisp_pingroup amdisp_groups[] = {
  80. PINGROUP(0, gpio),
  81. PINGROUP(1, gpio),
  82. PINGROUP(2, gpio),
  83. };