Repository navigation
pwm: add support for PWMIOC_FAULTS_FETCH_AND_CLEAR ioctl - #15912
Merged
Merged
Conversation
This ioctl clears the active fault inputs. Some faults can be latched (still active even if the source is not active anymore), so they have to be cleared from the software. The argument is a pointer to unsigned long bitmask variable. This bitmask specifies which faults are to be cleared. The ioctl also can fetch the faults active prior to the clear. These faults are saved to the argument specifying which faults are to be cleared. Therefore passing zero bitmask means the driver will only return active faults and clear none. Passing NULL pointer means the driver will clear all active and return none. The implementation of this ioctl is per driver. Signed-off-by: Michal Lenc <[email protected]>
This ioctl fetches and clears PWM faults. Signed-off-by: Michal Lenc <[email protected]>
Contributor
Author
|
@raiden00pl Hi, what do you think? I know it may not be the best time for it because of possible future PWM API rewrite, but it is completely separated from characteristics set, so it should not cause any troubles in the future. Also ping to @ppisa |
Contributor
|
I agree with implementation. Thank for the enhancement. I ping @zdebanos , he would have use for IOCTL as well on SaMoCon. |
raiden00pl
approved these changes
Feb 27, 2025
jerpelea
approved these changes
Feb 27, 2025
This file contains hidden or 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
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.
Summary
This ioctl clears the active fault inputs. Some faults can be latched (still active even if the source is not active anymore), so they have to be cleared from the software. The argument is a pointer to unsigned long bitmask variable. This bitmask specifies which faults are to be cleared.
The ioctl also can fetch the faults active prior to the clear. These faults are saved to the argument specifying which faults are to be
cleared. Therefore passing zero bitmask means the driver will only return active faults and clear none. Passing NULL pointer means the driver will clear all active and return none.
The other commit implements the ioctl to samv7 PWM driver.
Impact
None to current implementations as this is a new ioctl call. Documentation updated with a proper description. Drivers not implementing the ioctl will returns -ENOTTY as usual.
Testing
Tested on SAMv7 custom board. The ioctl successfully reads currently active faults and the value is changed if the fault becomes active (and remains active if the fault is latched). All cases (passing
NULLto clear all,0to read only and specific bitmask to clear some) tested.The PWM becomes active again once the faults are cleared.