Skip to content

ADF4030 TDC improvements#2984

Merged
nunojsa merged 2 commits intomainfrom
staging/xlnx/adf4030-tdc-improvs
Oct 14, 2025
Merged

ADF4030 TDC improvements#2984
nunojsa merged 2 commits intomainfrom
staging/xlnx/adf4030-tdc-improvs

Conversation

@nunojsa
Copy link
Copy Markdown
Collaborator

@nunojsa nunojsa commented Oct 14, 2025

PR Description

Migrate frequency storage from u32 Hz to u64 µHz for sub-Hz precision control. This enables more accurate frequency configuration for JESD204 applications requiring precise rates. Additionally, enhance error messages in TDC measurement and autoalignment functions.

PR Type

  • Bug fix (a change that fixes an issue)
  • New feature (a change that adds new functionality)
  • Breaking change (a change that affects other repos or cause CIs to fail)

PR Checklist

  • I have conducted a self-review of my own code changes
  • I have tested the changes on the relevant hardware
  • I have updated the documentation outside this repo accordingly (if there is the case)

Migrate frequency storage from u32 Hz to u64 µHz for sub-Hz precision
control. This enables more accurate frequency configuration for JESD204
applications requiring precise rates.

Key changes:
- Change bsync_freq_odiv_a/b from u32 (Hz) to u64 (µHz) with renamed
  fields to reflect the unit change
- Add support for new device tree properties adi,bsync-frequency-uhz
  and adi,bsync-secondary-frequency-uhz with backward compatibility
  for existing -hz properties
- Avoid potential overflow in TDC measurement calculations by replacing
  div_s64() chain with mul_u64_u64_div_u64() and proper sign handling

The TDC measurement now uses sub-Hz precision and prevents overflow
when computing:
  (time_diff * 10^12) / 2^24 / freq
by using 64-bit multiplication helpers instead of chained divisions.

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Enhance error messages in TDC measurement and autoalignment functions
to include channel information. This makes debugging easier by
identifying which specific channels are involved when operations fail
due to TDC_BUSY or FSM_BUSY timeout conditions.

Updated functions:
- adf4030_tdc_measure(): Now reports source and destination channels
- adf4030_duty_cycle_measure(): Now reports the channel being measured
- adf4030_auto_align_single_channel(): Now reports both channels involved

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Nuno Sá <nuno.sa@analog.com>
@nunojsa nunojsa merged commit 6de5bad into main Oct 14, 2025
33 checks passed
@nunojsa nunojsa deleted the staging/xlnx/adf4030-tdc-improvs branch October 14, 2025 10:24
github-actions Bot pushed a commit that referenced this pull request Oct 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants