Skip to content

iio: adc: adrv902x: add init cal and status attrs - #3526

Open
RaulGeo289 wants to merge 2 commits into
mainfrom
staging/initial_calibrations_madura
Open

RaulGeo289 wants to merge 2 commits into
mainfrom
staging/initial_calibrations_madura

Conversation

@RaulGeo289

@RaulGeo289 RaulGeo289 commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

This PR implements the initial calibration IIO attributes and the
status functions for both initial and tracking calibrations.

adi_adrv9025_InitCalsDetailedStatusGet() gives the error code, how
many microseconds the last calibration took, what ran last time,
and what calibrations ran since power up. The last two are
per-channel bitmasks, decoded against
adi_adrv9025_InitCalibrations_e, which can be found in
adi_adrv9025_cals_types.h.

adi_adrv9025_TrackingCalAllStateGet() gives a 32-bit mask with one
bit per calibration instance, flagging which ones are in the error
state, plus the state of each of the 32 tracking calibrations
(8 types across 4 channels).

adi_adrv9025_InitCalsCheckCompleteGet() can be used to verify if
the init calibrations are completed. It returns a running flag,
which is 0 when the ARM has completed the calibrations or never
ran them and 1 while they are currently running, and separately a
3-bit ARM error code.

When the calibration is successful, the error code should always
be 0.

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 compiled my changes, including the documentation
  • I have tested the changes on the relevant hardware
  • I have updated the documentation outside this repo accordingly
  • I have provided links for the relevant upstream lore

@RaulGeo289 RaulGeo289 changed the title iio: adc: adrv9025: add init cal and status attrs iio: adc: adrv902x: add init cal and status attrs Sep 8, 2026
@RaulGeo289
RaulGeo289 force-pushed the staging/initial_calibrations_madura branch from d8550db to 3656416 Compare September 8, 2026 09:10
@RaulGeo289
RaulGeo289 marked this pull request as draft September 8, 2026 09:10
@RaulGeo289
RaulGeo289 marked this pull request as ready for review September 8, 2026 10:31

@stefpopa stefpopa left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few minor comments from my side.

Comment thread drivers/iio/adc/adrv902x/adrv9025.c Outdated
Comment thread drivers/iio/adc/adrv902x/adrv9025.c Outdated
Comment thread drivers/iio/adc/adrv902x/adrv9025.c Outdated
Comment thread drivers/iio/adc/adrv902x/adrv9025.c
Comment thread drivers/iio/adc/adrv902x/adrv9025.c Outdated
Comment thread drivers/iio/adc/adrv902x/adrv9025.c Outdated
Comment thread drivers/iio/adc/adrv902x/adrv9025.c Outdated
@RaulGeo289
RaulGeo289 force-pushed the staging/initial_calibrations_madura branch 2 times, most recently from d8e8c59 to 4086a57 Compare September 18, 2026 10:05
Expose the init calibration status readbacks through sysfs so a run
can be inspected from userspace without a debugger.

New read-only status attributes:

  init_cals_complete_check   adi_adrv9025_InitCalsCheckCompleteGet()
  init_cals_all_status       adi_adrv9025_InitCalsDetailedStatusGet()

Both are registered for adrv9026 and adrv9029.

While here, propagate the error code from adrv9025_dev_err() at the
two existing call sites in adrv9025_phy_write_raw() that dropped it
and returned the raw ADI status instead of an errno.

Signed-off-by: Georgian Raul <Raul.Georgian@analog.com>
Add tracking_cals_all_status, a read-only sysfs attribute backed by
adi_adrv9025_TrackingCalAllStateGet(), so the per-channel tracking
calibration states and the aggregate calError can be read from
userspace without a debugger.

Add four more calibration enables, each setting its bit in the mask
run by adi_adrv9025_InitCalsRun():

  calibrate_orx_qec_en       ADI_ADRV9025_ORX_QEC_INIT
  calibrate_orx_lo_delay_en  ADI_ADRV9025_ORX_LO_DELAY
  calibrate_adc_en           ADI_ADRV9025_ADC_TUNER
  calibrate_orx_adc_en       ADI_ADRV9025_ORX_TIA

All five are registered for adrv9026 and adrv9029.

Signed-off-by: Georgian Raul <Raul.Georgian@analog.com>
@RaulGeo289
RaulGeo289 force-pushed the staging/initial_calibrations_madura branch from 4086a57 to f6c457c Compare September 18, 2026 10:39
@RaulGeo289

Copy link
Copy Markdown
Collaborator Author

Changelog v1:
-implemented the remarks
-split the commit in 2, so it can be easier to review
-one commit for init cals and one for tracking cals

@stefpopa stefpopa left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

This branch has not been deployed

No deployments
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