On 9/10/25 12:32, Ivan Vecera wrote:
The DPLL phase measurement block uses an exponential moving average, calculated using the following equation: 2^N - 1 1 curr_avg = prev_avg * --------- + new_val * ----- 2^N 2^N Where curr_avg is phase offset reported by the firmware to the driver, prev_avg is previous averaged value and new_val is currently measured value for particular reference. New measurements are taken approximately 40 Hz or at the frequency of the reference (whichever is lower). The driver currently uses the averaging factor N=2 which prioritizes a fast response time to track dynamic changes in the phase. But for applications requiring a very stable and precise reading of the average phase offset, and where rapid changes are not expected, a higher factor would be appropriate. Add devlink device parameter phase_offset_avg_factor to allow a user set tune the averaging factor via devlink interface. Tested-by: Prathosh Satish <Prathosh.Satish@xxxxxxxxxxxxx> Signed-off-by: Ivan Vecera <ivecera@xxxxxxxxxx> --- Documentation/networking/devlink/zl3073x.rst | 4 ++ drivers/dpll/zl3073x/core.c | 6 +- drivers/dpll/zl3073x/core.h | 8 ++- drivers/dpll/zl3073x/devlink.c | 67 ++++++++++++++++++++ 4 files changed, 82 insertions(+), 3 deletions(-)
looks good, Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@xxxxxxxxx>
+static int +zl3073x_devlink_param_phase_avg_factor_validate(struct devlink *devlink, u32 id, + union devlink_param_value val, + struct netlink_ext_ack *extack) +{ + return (val.vu8 < 16) ? 0 : -EINVAL;
nit: redundant params, not worth respining