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