-
Notifications
You must be signed in to change notification settings - Fork 4
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
adc: iio: hardware: add buffering support to the powerboard ADC #27
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 tasks
Emantor
approved these changes
Sep 25, 2023
KarlK90
requested changes
Sep 25, 2023
This makes working with the channel constants a bit less unwieldy. Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
…able Under some circumstances it can happen that all steps of the ADC setup succeed but reading the first set of values fails. Currently this special case results in the thread waiting for the values busy-looping forever. Delay signaling "setup ready" until we avtually have a first reading. Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
... via the timestamp value. Previously the consumers of iio adc values were not notified about a iio thread that exited unexpectedly, meaning they only found out via e.g. timeouts (or not at all). Give the iio thread a way to tell the other threads about issues. Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
This is in preparation for the use of buffered iio for the powerboard ADC. This commit does not add the buffering yet but instead only splits the mainboard ADC handling and powerboard ADC handling into separate threads, as the two ADCs will work at independent sampling rates, which means reading values should not block on the respective other ADC. Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
This means the STM32/baseboard ADC and the powerboard ADC can share most of their setup routine. The main difference is that the powerboard ADC uses a software trigger (iio-trig-hrtimer) instead of a hardware timer like the STM32 ADC does. The software trigger has to first be created via the configs, making new_powerboard() a bit different from new_stm32(). Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
And 4x oversampling. The slower sampling rate and oversampling factor is still sufficient to keep the noise level low and reduces the CPU load a bit. Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
Previously the iio thread code contained a lot of .unwrap() calls and explicit panics. Now it contains a few less and gained some comments where it still .unwrap()s. Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
Emantor
approved these changes
Sep 27, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds buffering support to the powerboard ADC. The main benefit of this change is that voltage and current samples are now taken at the exact same point int time, enabling better instantaneous power measurements.
This feature relies on kernel support for buffering in the powerboard ADC and a fix to
libiio
to allow enabling the buffer for the ADC, both of which are not currently included inmeta-lxatac
.Related Pull Requests
meta-lxatac
PR that coordinates the kernel and libiio update, as well as adding this feature Add iio in-kernel buffering support for the powerboard ADC meta-lxatac#47