Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iio: frequency: ad9783: fix calibration array values #2608

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vai-tomme
Copy link
Contributor

PR Description

Run loop in accordance with the method described in section "building the array" of the datasheet[1] rev C. page 26. The loop shall be continued until the seek bit toggles, not until the seek bit goes low.

For the case where a value for SET or HLD is not found that would make the SEEK bit toggle, the value should be set to 15. The loop did not break out until HLD == 16, causing overflowing value to be written to the HLD field[0..3] of register 0x4.

[1] https://www.analog.com/media/en/technical-documentation/data-sheets/AD9780_9781_9783.pdf

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)

Run loop in accordance with the method described in section "building the
array" of the datasheet[1] rev C. page 26. The loop shall be continued
until the seek bit toggles, not until the seek bit goes low.

For the case where a value for SET or HLD is not found that would make
the SEEK bit toggle, the value should be set to 15. The loop did not break
out until HLD == 16, causing overflowing value to be written to the HLD
field[0..3] of register 0x4.

[1] https://www.analog.com/media/en/technical-documentation/data-sheets/AD9780_9781_9783.pdf

Signed-off-by: Tomas Melin <tomas.melin@vaisala.com>
Copy link
Collaborator

@nunojsa nunojsa left a comment

Choose a reason for hiding this comment

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

Hi,

Thanks for your contribution. Just a minor nitpick form my side...

@@ -250,7 +249,7 @@ static int ad9783_timing_adjust(struct ad9783_phy *phy)
if (ret < 0)
return ret;

} while (ret > 0 && set < AD9783_MAX_SET);
} while ((ret == table[smp][SEEK]) && set < (AD9783_MAX_SET - 1));
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: You don't need the extra parenthesis...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

checkpatch did not complain, and I find it somewhat more readable like this. So if OK with You, I would keep it as is.

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