• Arkadiusz Kubalewski's avatar
    ice: dpll: fix phase offset value · 8278a6a4
    Arkadiusz Kubalewski authored
    Stop dividing the phase_offset value received from firmware. This fault
    is present since the initial implementation.
    The phase_offset value received from firmware is in 0.01ps resolution.
    Dpll subsystem is using the value in 0.001ps, raw value is adjusted
    before providing it to the user.
    
    The user can observe the value of phase offset with response to
    `pin-get` netlink message of dpll subsystem for an active pin:
    $ ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/dpll.yaml \
    	--do pin-get --json '{"id":2}'
    
    Where example of correct response would be:
    {'board-label': 'C827_0-RCLKA',
     'capabilities': 6,
     'clock-id': 4658613174691613800,
     'frequency': 1953125,
     'id': 2,
     'module-name': 'ice',
     'parent-device': [{'direction': 'input',
                        'parent-id': 6,
                        'phase-offset': -216839550,
                        'prio': 9,
                        'state': 'connected'},
                       {'direction': 'input',
                        'parent-id': 7,
                        'phase-offset': -42930,
                        'prio': 8,
                        'state': 'connected'}],
     'phase-adjust': 0,
     'phase-adjust-max': 16723,
     'phase-adjust-min': -16723,
     'type': 'mux'}
    
    Provided phase-offset value (-42930) shall be divided by the user with
    DPLL_PHASE_OFFSET_DIVIDER to get actual value of -42.930 ps.
    
    Before the fix, the response was not correct:
    {'board-label': 'C827_0-RCLKA',
     'capabilities': 6,
     'clock-id': 4658613174691613800,
     'frequency': 1953125,
     'id': 2,
     'module-name': 'ice',
     'parent-device': [{'direction': 'input',
                        'parent-id': 6,
                        'phase-offset': -216839,
                        'prio': 9,
                        'state': 'connected'},
                       {'direction': 'input',
                        'parent-id': 7,
                        'phase-offset': -42,
                        'prio': 8,
                        'state': 'connected'}],
     'phase-adjust': 0,
     'phase-adjust-max': 16723,
     'phase-adjust-min': -16723,
     'type': 'mux'}
    
    Where phase-offset value (-42), after division
    (DPLL_PHASE_OFFSET_DIVIDER) would be: -0.042 ps.
    
    Fixes: 8a3a565f ("ice: add admin commands to access cgu configuration")
    Fixes: 90e1c907 ("ice: dpll: implement phase related callbacks")
    Reviewed-by: default avatarAleksandr Loktionov <aleksandr.loktionov@intel.com>
    Reviewed-by: default avatarPrzemek Kitszel <przemyslaw.kitszel@intel.com>
    Signed-off-by: default avatarArkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
    Reviewed-by: default avatarPaul Menzel <pmenzel@molgen.mpg.de>
    Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
    Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
    8278a6a4
ice_common.c 170 KB