Skip to content

projects: ad9361: add getter for TX sampling frequency#3100

Open
cristina-suteu wants to merge 3 commits into
mainfrom
ad9361-fix-tx-sampl-freq
Open

projects: ad9361: add getter for TX sampling frequency#3100
cristina-suteu wants to merge 3 commits into
mainfrom
ad9361-fix-tx-sampl-freq

Conversation

@cristina-suteu

@cristina-suteu cristina-suteu commented May 18, 2026

Copy link
Copy Markdown
Collaborator

Pull Request Description

This ensures that the correct value for sampling frequency is read by tx_dac devices.

PR Type

  • Bug fix (change that fixes an issue)
  • New feature (change that adds new functionality)
  • Breaking change (has dependencies in other repos or will cause CI to fail)

PR Checklist

  • I have followed the Coding style guidelines
  • I have complied with the Submission Checklist
  • I have performed a self-review of the changes
  • I have commented my code, at least hard-to-understand parts
  • I have build all projects affected by the changes in this PR
  • I have tested in hardware affected projects, at the relevant boards
  • I have signed off all commits from this PR
  • I have updated the documentation (wiki pages, ReadMe etc), if applies

@amiclaus amiclaus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

some comments on my side.

if (!phy || !sampling_freq_hz)
return -EINVAL;

freq = (uint32_t)clk_get_rate(phy, phy->ref_clk_scale[TX_SAMPL_CLK]);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

isn't the return type of clk_get_rate uint32_t?

uint32_t clk_get_rate(struct ad9361_rf_phy *phy,

* @param dev - The AXI DAC device (unused, uses global ad9361_phy).
* @param chan - Channel number (unused, AD9361 has single RX sample rate).
* @param sampling_freq_hz - Output sampling frequency in Hz.
* @return 0.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we return 0 always?

Comment thread projects/ad9361/src/main.c Outdated
/**
* @brief Get TX sampling frequency callback for iio_axi_dac.
* @param dev - The AXI DAC device (unused, uses global ad9361_phy).
* @param chan - Channel number (unused, AD9361 has single RX sample rate).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

RX or TX?

iio_axi_dac_init_par = (struct iio_axi_dac_init_param) {
.tx_dac = ad9361_phy->tx_dac,
.tx_dmac = tx_dmac,
.get_sampling_frequency = ad9361_iio_axi_dac_get_sampling_freq,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

do we even have get_sampling_frequency in axi_dac_init_param? I see it only in axi_adc

added sampling frequency getter implementation
if a project implements a custom sampling freq getter, that will be used
if not, an error code is returned as before

Signed-off-by: Cristina Suteu <cristina.suteu@analog.com>
add error handling for ad9361_get_tx_sampling_freq

Signed-off-by: Cristina Suteu <cristina.suteu@analog.com>
added sampling frequency getter to make sure the correct
sampling frequency is read by tx_dac devices

Signed-off-by: Cristina Suteu <cristina.suteu@analog.com>
@cristina-suteu
cristina-suteu force-pushed the ad9361-fix-tx-sampl-freq branch from ea84971 to afc7c48 Compare July 13, 2026 04:11
@cristina-suteu

Copy link
Copy Markdown
Collaborator Author

v2:

  • added implementation in iio_axi_dac for sampling frequency getters. if the project to build, has a custom sampling freq getter (like ad9361), the custom implementation will be used. otherwise, the same error code will be returned.
  • fixed typo in param description in projects/ad9361/src/main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants