File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -179,7 +179,23 @@ Phase offset measurement and adjustment
179179Device may provide ability to measure a phase difference between signals
180180on a pin and its parent dpll device. If pin-dpll phase offset measurement
181181is supported, it shall be provided with ``DPLL_A_PIN_PHASE_OFFSET ``
182- attribute for each parent dpll device.
182+ attribute for each parent dpll device. The reported phase offset may be
183+ computed as the average of prior values and the current measurement, using
184+ the following formula:
185+
186+ .. math ::
187+ curr\_avg = prev\_avg * \frac {2 ^N-1 }{2 ^N} + new\_val * \frac {1 }{2 ^N}
188+
189+ where `curr_avg ` is the current reported phase offset, `prev_avg ` is the
190+ previously reported value, `new_val ` is the current measurement, and `N ` is
191+ the averaging factor. Configured averaging factor value is provided with
192+ ``DPLL_A_PHASE_OFFSET_AVG_FACTOR `` attribute of a device and value change can
193+ be requested with the same attribute with ``DPLL_CMD_DEVICE_SET `` command.
194+
195+ ================================== ======================================
196+ ``DPLL_A_PHASE_OFFSET_AVG_FACTOR `` attr configured value of phase offset
197+ averaging factor
198+ ================================== ======================================
183199
184200Device may also provide ability to adjust a signal phase on a pin.
185201If pin phase adjustment is supported, minimal and maximal values that pin
Original file line number Diff line number Diff line change @@ -315,6 +315,10 @@ attribute-sets:
315315 If enabled, dpll device shall monitor and notify all currently
316316 available inputs for changes of their phase offset against the
317317 dpll device.
318+ -
319+ name : phase-offset-avg-factor
320+ type : u32
321+ doc : Averaging factor applied to calculation of reported phase offset.
318322 -
319323 name : pin
320324 enum-name : dpll_a_pin
@@ -523,6 +527,7 @@ operations:
523527 - clock-id
524528 - type
525529 - phase-offset-monitor
530+ - phase-offset-avg-factor
526531
527532 dump :
528533 reply : *dev-attrs
@@ -540,6 +545,7 @@ operations:
540545 attributes :
541546 - id
542547 - phase-offset-monitor
548+ - phase-offset-avg-factor
543549 -
544550 name : device-create-ntf
545551 doc : Notification about device appearing
Original file line number Diff line number Diff line change @@ -42,9 +42,10 @@ static const struct nla_policy dpll_device_get_nl_policy[DPLL_A_ID + 1] = {
4242};
4343
4444/* DPLL_CMD_DEVICE_SET - do */
45- static const struct nla_policy dpll_device_set_nl_policy [DPLL_A_PHASE_OFFSET_MONITOR + 1 ] = {
45+ static const struct nla_policy dpll_device_set_nl_policy [DPLL_A_PHASE_OFFSET_AVG_FACTOR + 1 ] = {
4646 [DPLL_A_ID ] = { .type = NLA_U32 , },
4747 [DPLL_A_PHASE_OFFSET_MONITOR ] = NLA_POLICY_MAX (NLA_U32 , 1 ),
48+ [DPLL_A_PHASE_OFFSET_AVG_FACTOR ] = { .type = NLA_U32 , },
4849};
4950
5051/* DPLL_CMD_PIN_ID_GET - do */
@@ -112,7 +113,7 @@ static const struct genl_split_ops dpll_nl_ops[] = {
112113 .doit = dpll_nl_device_set_doit ,
113114 .post_doit = dpll_post_doit ,
114115 .policy = dpll_device_set_nl_policy ,
115- .maxattr = DPLL_A_PHASE_OFFSET_MONITOR ,
116+ .maxattr = DPLL_A_PHASE_OFFSET_AVG_FACTOR ,
116117 .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO ,
117118 },
118119 {
Original file line number Diff line number Diff line change @@ -216,6 +216,7 @@ enum dpll_a {
216216 DPLL_A_LOCK_STATUS_ERROR ,
217217 DPLL_A_CLOCK_QUALITY_LEVEL ,
218218 DPLL_A_PHASE_OFFSET_MONITOR ,
219+ DPLL_A_PHASE_OFFSET_AVG_FACTOR ,
219220
220221 __DPLL_A_MAX ,
221222 DPLL_A_MAX = (__DPLL_A_MAX - 1 )
You can’t perform that action at this time.
0 commit comments