-
Notifications
You must be signed in to change notification settings - Fork 904
iio: frequency: ad9172: implement sysref oneshot sequence #2906
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
base: main
Are you sure you want to change the base?
Conversation
Add devicetree property for setting allowed sysref jitter. Signed-off-by: Tomas Melin <tomas.melin@vaisala.com>
Hi @vai-tomme, thank you for the contribution! Please ignore the modpost error, was fixed on #2920 (1)! (1) a cleaner run can be then created by either closing and opening the pr, or pushing a commit, to update the base branch head. |
db276db
to
baf8214
Compare
Hi @gastmaier, thanks! I updated one occurance of uint8 to u8, but I kept the h == NULL style since that is the style used througout the file for that particular driver. |
Update description with further details about testing. Please let me know if more information or any changes still required |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please just do kernel style null and error checking where you can
drivers/iio/frequency/ad9172.c
Outdated
|
||
ad917x_jesd_set_sysref_enable(&st->dac_h, !!st->jesd_subclass); | ||
|
||
if (lnk->subclass == JESD204_SUBCLASS_1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was going to suggest to add a devicetree entry to oneshot_sync, but I see that for ad9081 it is done as well
drivers/iio/frequency/ad9172.c
Outdated
|
||
if (lnk->subclass == JESD204_SUBCLASS_1) { | ||
ret = ad917x_jesd_oneshot_sync(&st->dac_h, st->sysref_err_win); | ||
if (ret != 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!ret)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated as suggested, assuming if (ret)
format was proposed here
|
||
*done = (mode & AD917X_SYNC_ROTATION_DONE); | ||
|
||
return API_ERROR_OK; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return API_ERROR_OK; | |
return 0; |
We avoid the api defines at the linux driver layer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now returning 0.
if (err != API_ERROR_OK) | ||
return err; | ||
|
||
*done = (mode & AD917X_SYNC_ROTATION_DONE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if having *done
brings much value. Why not just
if (!(mode & AD917X_SYNC_ROTATION_DONE))
return API_SOME_ERROR;
return API_ERROR_OK; //or 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does provide chance to differentiate between error handling read request and the actual done value.
Similar approach is used also in other locations in this driver, see e.g. ad917x_jesd_get_sysref_enable.
I propose keeping done value and following current approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't see the point tbh. Put the logs inside the API and you have the same effect. That's pretty much the reason you have for having done as an output parameter. To print an error log, nothing else.
Having said the above, I don't really have strong feelings it so up to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm ok, since we this API it would not be straight to have the logs inside. Does not make it better though :)
baf8214
to
0695937
Compare
Addressed comments up til now. |
Support for performing oneshot sequence as laid out in section "jesd204b serial data interface" and sync procedure of datasheet rev C [1] for device. In addition to the already implemented sysref_enable step, the other steps are also required for a sync to take place. Feature is here implemented for subclass 1 operation with jesd-fsm enabled. [1] https://www.analog.com/media/en/technical-documentation/data-sheets/ad9171.pdf Signed-off-by: Tomas Melin <tomas.melin@vaisala.com>
0695937
to
063e015
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still don't agree with that done
argument but as I said, up to you :)
@gastmaier now implemented, please check! |
PR Description
Support for performing oneshot sequence as laid out in section "jesd204b serial data interface" and sync procedure of datasheet rev C [1] for device. In addition to the already implemented sysref_enable step, the other steps are also required for a sync to take place.
Feature is here implemented for subclass 1 operation with jesd-fsm enabled.
[1] https://www.analog.com/media/en/technical-documentation/data-sheets/ad9171.pdf
PR Type
PR Checklist
Testing
Tested with zcu102 + ad9171-fmc-ebz combination and branch xilinx-v2023.2 with these patches applied.
For testing, custom built hdl with jesd mode 3 and configured devicetree accordingly since prebuilt hdl and dt for ad9171 eval board is not readily available.
devicetree settings for zynqmp-zcu102-rev10-ad9171-fmc-ebz-mode3.dts