File Index
Files and directories
Sign in
FILE

dpll_nl.c

File preview with syntax highlighting.

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