Skip to content

Commit c035e73

Browse files
kubalewskikuba-moo
authored andcommitted
dpll: add phase-offset-monitor feature to netlink spec
Add enum dpll_feature_state for control over features. Add dpll device level attribute: DPLL_A_PHASE_OFFSET_MONITOR - to allow control over a phase offset monitor feature. Attribute is present and shall return current state of a feature (enum dpll_feature_state), if the device driver provides such capability, otherwie attribute shall not be present. Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com> Reviewed-by: Milena Olech <milena.olech@intel.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Signed-off-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com> Acked-by: Vadim Fedorenko <vadim.fedorenko@linux.dev> Link: https://patch.msgid.link/20250612152835.1703397-2-arkadiusz.kubalewski@intel.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent bd1d76a commit c035e73

File tree

4 files changed

+57
-2
lines changed

4 files changed

+57
-2
lines changed

Documentation/driver-api/dpll.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,24 @@ offset values are fractional with 3-digit decimal places and shell be
214214
divided with ``DPLL_PIN_PHASE_OFFSET_DIVIDER`` to get integer part and
215215
modulo divided to get fractional part.
216216

217+
Phase offset monitor
218+
====================
219+
220+
Phase offset measurement is typically performed against the current active
221+
source. However, some DPLL (Digital Phase-Locked Loop) devices may offer
222+
the capability to monitor phase offsets across all available inputs.
223+
The attribute and current feature state shall be included in the response
224+
message of the ``DPLL_CMD_DEVICE_GET`` command for supported DPLL devices.
225+
In such cases, users can also control the feature using the
226+
``DPLL_CMD_DEVICE_SET`` command by setting the ``enum dpll_feature_state``
227+
values for the attribute.
228+
Once enabled the phase offset measurements for the input shall be returned
229+
in the ``DPLL_A_PIN_PHASE_OFFSET`` attribute.
230+
231+
=============================== ========================
232+
``DPLL_A_PHASE_OFFSET_MONITOR`` attr state of a feature
233+
=============================== ========================
234+
217235
Embedded SYNC
218236
=============
219237

Documentation/netlink/specs/dpll.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,20 @@ definitions:
240240
integer part of a measured phase offset value.
241241
Value of (DPLL_A_PHASE_OFFSET % DPLL_PHASE_OFFSET_DIVIDER) is a
242242
fractional part of a measured phase offset value.
243+
-
244+
type: enum
245+
name: feature-state
246+
doc: |
247+
Allow control (enable/disable) and status checking over features.
248+
entries:
249+
-
250+
name: disable
251+
doc: |
252+
feature shall be disabled
253+
-
254+
name: enable
255+
doc: |
256+
feature shall be enabled
243257
244258
attribute-sets:
245259
-
@@ -293,6 +307,14 @@ attribute-sets:
293307
be put to message multiple times to indicate possible parallel
294308
quality levels (e.g. one specified by ITU option 1 and another
295309
one specified by option 2).
310+
-
311+
name: phase-offset-monitor
312+
type: u32
313+
enum: feature-state
314+
doc: Receive or request state of phase offset monitor feature.
315+
If enabled, dpll device shall monitor and notify all currently
316+
available inputs for changes of their phase offset against the
317+
dpll device.
296318
-
297319
name: pin
298320
enum-name: dpll_a_pin
@@ -483,6 +505,7 @@ operations:
483505
- temp
484506
- clock-id
485507
- type
508+
- phase-offset-monitor
486509

487510
dump:
488511
reply: *dev-attrs
@@ -499,6 +522,7 @@ operations:
499522
request:
500523
attributes:
501524
- id
525+
- phase-offset-monitor
502526
-
503527
name: device-create-ntf
504528
doc: Notification about device appearing

drivers/dpll/dpll_nl.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ static const struct nla_policy dpll_device_get_nl_policy[DPLL_A_ID + 1] = {
3737
};
3838

3939
/* DPLL_CMD_DEVICE_SET - do */
40-
static const struct nla_policy dpll_device_set_nl_policy[DPLL_A_ID + 1] = {
40+
static const struct nla_policy dpll_device_set_nl_policy[DPLL_A_PHASE_OFFSET_MONITOR + 1] = {
4141
[DPLL_A_ID] = { .type = NLA_U32, },
42+
[DPLL_A_PHASE_OFFSET_MONITOR] = NLA_POLICY_MAX(NLA_U32, 1),
4243
};
4344

4445
/* DPLL_CMD_PIN_ID_GET - do */
@@ -105,7 +106,7 @@ static const struct genl_split_ops dpll_nl_ops[] = {
105106
.doit = dpll_nl_device_set_doit,
106107
.post_doit = dpll_post_doit,
107108
.policy = dpll_device_set_nl_policy,
108-
.maxattr = DPLL_A_ID,
109+
.maxattr = DPLL_A_PHASE_OFFSET_MONITOR,
109110
.flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
110111
},
111112
{

include/uapi/linux/dpll.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,17 @@ enum dpll_pin_capabilities {
192192

193193
#define DPLL_PHASE_OFFSET_DIVIDER 1000
194194

195+
/**
196+
* enum dpll_feature_state - Allow control (enable/disable) and status checking
197+
* over features.
198+
* @DPLL_FEATURE_STATE_DISABLE: feature shall be disabled
199+
* @DPLL_FEATURE_STATE_ENABLE: feature shall be enabled
200+
*/
201+
enum dpll_feature_state {
202+
DPLL_FEATURE_STATE_DISABLE,
203+
DPLL_FEATURE_STATE_ENABLE,
204+
};
205+
195206
enum dpll_a {
196207
DPLL_A_ID = 1,
197208
DPLL_A_MODULE_NAME,
@@ -204,6 +215,7 @@ enum dpll_a {
204215
DPLL_A_TYPE,
205216
DPLL_A_LOCK_STATUS_ERROR,
206217
DPLL_A_CLOCK_QUALITY_LEVEL,
218+
DPLL_A_PHASE_OFFSET_MONITOR,
207219

208220
__DPLL_A_MAX,
209221
DPLL_A_MAX = (__DPLL_A_MAX - 1)

0 commit comments

Comments
 (0)