-
Notifications
You must be signed in to change notification settings - Fork 808
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
New adis support #2411
base: main
Are you sure you want to change the base?
New adis support #2411
Conversation
rbolboac
commented
Jan 25, 2024
- add support for ADIS16501 in adis16475 driver
- add support for ADIS1657X family in adis16475 driver
- add FIFO support for ADIS1657X family
c11f232
to
eee4ba8
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.
Alright, initial review done. I guess most important thing for now is to split some changes in preparatory patches so it#s easier to review things.
a19a6ba
to
ab05734
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.
Looks better. I think we need to re-think that burst_request handling...
2ff961f
to
6bb0677
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.
Some more comments. Almost there, but the kzalloc() on every sample is a no-go IMO
drivers/iio/imu/adis16475.c
Outdated
struct adis *adis = &st->adis; | ||
|
||
adis->burst_req_msb = burst_req; | ||
adis_update_scan_mode(indio_dev, indio_dev->active_scan_mask); |
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, If I'm not missing nothing the only thing we wanna change is the burst_req command right? So, doing kfree() plus kzalloc() on every sample is definitely too much... I would just change the byte in adis->xfer[0]
and then restore it after burst_req
is done. Note that we're already directly messing with the transfer size in adis16475_burst32_check() anyways. I admit is not that pretty but better than the allocation overhead. At some point (if we get another driver needing stuff like this) we may think in moving this to a better API in the lib. But for now, I would just do it in here...
With the above, I guess you can drop the patch for adis->burst_req_msb
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.
so changing the byte in adis->xfer[0] is a little tricky because tx_buff is const void *, so I had to use the same lines of code as in adis_update_scan_mode_burst, I hope this is alright. do you have another suggestion?
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.
Just some minor comments.
AFAICT, this is fine to go upstream.. It took some iterations but I think we have a better end result :)
drivers/iio/imu/adis16475.c
Outdated
struct iio_dev *indio_dev = pf->indio_dev; | ||
struct adis16475 *st = iio_priv(indio_dev); | ||
struct adis *adis = &st->adis; | ||
u8 *tx = adis->buffer + adis->data->burst_max_len; |
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.
Yeps, exactly what I had in mind. But, are we guaranteed to always have adis->data->burst_max_len
? We handle it a bit different in update_scan_mode_burst().
Also, see below...
drivers/iio/imu/adis16475.c
Outdated
|
||
tx[0] = ADIS_READ_REG(burst_req); | ||
tx[1] = 0; | ||
adis->xfer[0].tx_buf = tx; |
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 do not think we need the above two lines. Just tx[0] = ADIS_READ_REG(burst_req);
should be enough. The pointer is the same. We're just changing the first byte under the wood :)
I admit this is not pretty as it should be the lib to handle this internal data. When upstreaming, feel free to purpose something like adis_update_burst_request()
... The only thing I don't like with having it in the lib is that we just have one user for it. Up to you anyways.
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.
This LGTM... Not approving just because this should be upstreamed first and I don't want to give the idea that this can be merged now.
Sure, currently I am waiting for some feedback from the MEMS team to make sure nothing has changed in the meanwhile. |
Update ADIS16475 existing documentation with documentation for ADIS16501 device. Signed-off-by: Ramona Gradinariu <ramona.gradinariu@analog.com>
Add support for ADIS16501 device in already existing ADIS16475 driver. Datasheet: TBD Signed-off-by: Ramona Gradinariu <ramona.gradinariu@analog.com>
Re-define ADIS16475_DATA such that it takes _burst_max_len and _burst_max_speed_hz as parameters. Signed-off-by: Ramona Gradinariu <ramona.gradinariu@analog.com>
Add new API called devm_adis_setup_buffer_and_trigger_with_attrs() which also takes buffer attributes as a parameter. Rewrite devm_adis_setup_buffer_and_trigger() implementation such that it calls devm_adis_setup_buffer_and_trigger_with_attrs() with buffer attributes parameter NULL. Signed-off-by: Ramona Gradinariu <ramona.gradinariu@analog.com>
Create push single sample API reposnsible for pushing a single sample into the buffer. This is a preparation patch for FIFO support where more than one sample has to be pushed in the trigger handler. Signed-off-by: Ramona Gradinariu <ramona.gradinariu@analog.com>
Update ADIS16475 existing documentation with documentation for ADIS1657X family devices. Signed-off-by: Ramona Gradinariu <ramona.gradinariu@analog.com>
Add support for ADIS1657X family devices in already exiting ADIS16475 driver. Datasheet: TBD Signed-off-by: Ramona Gradinariu <ramona.gradinariu@analog.com>
|