dpll_nl.c 5.5 KB

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