dpll_nl.c 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. // SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
  2. /* Do not edit directly, auto-generated from: */
  3. /* Documentation/netlink/specs/dpll.yaml */
  4. /* YNL-GEN kernel source */
  5. #include <net/netlink.h>
  6. #include <net/genetlink.h>
  7. #include "dpll_nl.h"
  8. #include <uapi/linux/dpll.h>
  9. /* Common nested types */
  10. const struct nla_policy dpll_pin_parent_device_nl_policy[DPLL_A_PIN_PHASE_OFFSET + 1] = {
  11. [DPLL_A_PIN_PARENT_ID] = { .type = NLA_U32, },
  12. [DPLL_A_PIN_DIRECTION] = NLA_POLICY_RANGE(NLA_U32, 1, 2),
  13. [DPLL_A_PIN_PRIO] = { .type = NLA_U32, },
  14. [DPLL_A_PIN_STATE] = NLA_POLICY_RANGE(NLA_U32, 1, 3),
  15. [DPLL_A_PIN_PHASE_OFFSET] = { .type = NLA_S64, },
  16. };
  17. const struct nla_policy dpll_pin_parent_pin_nl_policy[DPLL_A_PIN_STATE + 1] = {
  18. [DPLL_A_PIN_PARENT_ID] = { .type = NLA_U32, },
  19. [DPLL_A_PIN_STATE] = NLA_POLICY_RANGE(NLA_U32, 1, 3),
  20. };
  21. /* DPLL_CMD_DEVICE_ID_GET - do */
  22. static const struct nla_policy dpll_device_id_get_nl_policy[DPLL_A_TYPE + 1] = {
  23. [DPLL_A_MODULE_NAME] = { .type = NLA_NUL_STRING, },
  24. [DPLL_A_CLOCK_ID] = { .type = NLA_U64, },
  25. [DPLL_A_TYPE] = NLA_POLICY_RANGE(NLA_U32, 1, 2),
  26. };
  27. /* DPLL_CMD_DEVICE_GET - do */
  28. static const struct nla_policy dpll_device_get_nl_policy[DPLL_A_ID + 1] = {
  29. [DPLL_A_ID] = { .type = NLA_U32, },
  30. };
  31. /* DPLL_CMD_DEVICE_SET - do */
  32. static const struct nla_policy dpll_device_set_nl_policy[DPLL_A_ID + 1] = {
  33. [DPLL_A_ID] = { .type = NLA_U32, },
  34. };
  35. /* DPLL_CMD_PIN_ID_GET - do */
  36. static const struct nla_policy dpll_pin_id_get_nl_policy[DPLL_A_PIN_TYPE + 1] = {
  37. [DPLL_A_PIN_MODULE_NAME] = { .type = NLA_NUL_STRING, },
  38. [DPLL_A_PIN_CLOCK_ID] = { .type = NLA_U64, },
  39. [DPLL_A_PIN_BOARD_LABEL] = { .type = NLA_NUL_STRING, },
  40. [DPLL_A_PIN_PANEL_LABEL] = { .type = NLA_NUL_STRING, },
  41. [DPLL_A_PIN_PACKAGE_LABEL] = { .type = NLA_NUL_STRING, },
  42. [DPLL_A_PIN_TYPE] = NLA_POLICY_RANGE(NLA_U32, 1, 5),
  43. };
  44. /* DPLL_CMD_PIN_GET - do */
  45. static const struct nla_policy dpll_pin_get_do_nl_policy[DPLL_A_PIN_ID + 1] = {
  46. [DPLL_A_PIN_ID] = { .type = NLA_U32, },
  47. };
  48. /* DPLL_CMD_PIN_GET - dump */
  49. static const struct nla_policy dpll_pin_get_dump_nl_policy[DPLL_A_PIN_ID + 1] = {
  50. [DPLL_A_PIN_ID] = { .type = NLA_U32, },
  51. };
  52. /* DPLL_CMD_PIN_SET - do */
  53. static const struct nla_policy dpll_pin_set_nl_policy[DPLL_A_PIN_ESYNC_FREQUENCY + 1] = {
  54. [DPLL_A_PIN_ID] = { .type = NLA_U32, },
  55. [DPLL_A_PIN_FREQUENCY] = { .type = NLA_U64, },
  56. [DPLL_A_PIN_DIRECTION] = NLA_POLICY_RANGE(NLA_U32, 1, 2),
  57. [DPLL_A_PIN_PRIO] = { .type = NLA_U32, },
  58. [DPLL_A_PIN_STATE] = NLA_POLICY_RANGE(NLA_U32, 1, 3),
  59. [DPLL_A_PIN_PARENT_DEVICE] = NLA_POLICY_NESTED(dpll_pin_parent_device_nl_policy),
  60. [DPLL_A_PIN_PARENT_PIN] = NLA_POLICY_NESTED(dpll_pin_parent_pin_nl_policy),
  61. [DPLL_A_PIN_PHASE_ADJUST] = { .type = NLA_S32, },
  62. [DPLL_A_PIN_ESYNC_FREQUENCY] = { .type = NLA_U64, },
  63. };
  64. /* Ops table for dpll */
  65. static const struct genl_split_ops dpll_nl_ops[] = {
  66. {
  67. .cmd = DPLL_CMD_DEVICE_ID_GET,
  68. .pre_doit = dpll_lock_doit,
  69. .doit = dpll_nl_device_id_get_doit,
  70. .post_doit = dpll_unlock_doit,
  71. .policy = dpll_device_id_get_nl_policy,
  72. .maxattr = DPLL_A_TYPE,
  73. .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
  74. },
  75. {
  76. .cmd = DPLL_CMD_DEVICE_GET,
  77. .pre_doit = dpll_pre_doit,
  78. .doit = dpll_nl_device_get_doit,
  79. .post_doit = dpll_post_doit,
  80. .policy = dpll_device_get_nl_policy,
  81. .maxattr = DPLL_A_ID,
  82. .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
  83. },
  84. {
  85. .cmd = DPLL_CMD_DEVICE_GET,
  86. .dumpit = dpll_nl_device_get_dumpit,
  87. .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DUMP,
  88. },
  89. {
  90. .cmd = DPLL_CMD_DEVICE_SET,
  91. .pre_doit = dpll_pre_doit,
  92. .doit = dpll_nl_device_set_doit,
  93. .post_doit = dpll_post_doit,
  94. .policy = dpll_device_set_nl_policy,
  95. .maxattr = DPLL_A_ID,
  96. .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
  97. },
  98. {
  99. .cmd = DPLL_CMD_PIN_ID_GET,
  100. .pre_doit = dpll_lock_doit,
  101. .doit = dpll_nl_pin_id_get_doit,
  102. .post_doit = dpll_unlock_doit,
  103. .policy = dpll_pin_id_get_nl_policy,
  104. .maxattr = DPLL_A_PIN_TYPE,
  105. .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
  106. },
  107. {
  108. .cmd = DPLL_CMD_PIN_GET,
  109. .pre_doit = dpll_pin_pre_doit,
  110. .doit = dpll_nl_pin_get_doit,
  111. .post_doit = dpll_pin_post_doit,
  112. .policy = dpll_pin_get_do_nl_policy,
  113. .maxattr = DPLL_A_PIN_ID,
  114. .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
  115. },
  116. {
  117. .cmd = DPLL_CMD_PIN_GET,
  118. .dumpit = dpll_nl_pin_get_dumpit,
  119. .policy = dpll_pin_get_dump_nl_policy,
  120. .maxattr = DPLL_A_PIN_ID,
  121. .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DUMP,
  122. },
  123. {
  124. .cmd = DPLL_CMD_PIN_SET,
  125. .pre_doit = dpll_pin_pre_doit,
  126. .doit = dpll_nl_pin_set_doit,
  127. .post_doit = dpll_pin_post_doit,
  128. .policy = dpll_pin_set_nl_policy,
  129. .maxattr = DPLL_A_PIN_ESYNC_FREQUENCY,
  130. .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
  131. },
  132. };
  133. static const struct genl_multicast_group dpll_nl_mcgrps[] = {
  134. [DPLL_NLGRP_MONITOR] = { "monitor", },
  135. };
  136. struct genl_family dpll_nl_family __ro_after_init = {
  137. .name = DPLL_FAMILY_NAME,
  138. .version = DPLL_FAMILY_VERSION,
  139. .netnsok = true,
  140. .parallel_ops = true,
  141. .module = THIS_MODULE,
  142. .split_ops = dpll_nl_ops,
  143. .n_split_ops = ARRAY_SIZE(dpll_nl_ops),
  144. .mcgrps = dpll_nl_mcgrps,
  145. .n_mcgrps = ARRAY_SIZE(dpll_nl_mcgrps),
  146. };