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

samv7/adc: fix handling of ANIOC_TRIGGER ioctl #15675

Merged
merged 1 commit into from
Jan 23, 2025

Conversation

michallenc
Copy link
Contributor

Summary

ADC peripheral can be configured also for PWM trigger, so the ifdef should depend only on CONFIG_SAMV7_AFEC_SWTRIG. Also handle the situation when ANIOC_TRIGGER is called and the peripheral is not configured for SW trigger (but the other one may be, so config option is set).

Trigger values saved to the private structure are also changed to enums for better code clarity.

Impact

Handling of ANIOC_TRIGGER ioctl is now fixed.

Testing

Tested on SAMv7 board, CI passes for different trigger combinations.

ADC peripheral can be configured also for PWM trigger, so the ifdef
should depend only on CONFIG_SAMV7_AFEC_SWTRIG. Also handle the
situation when ANIOC_TRIGGER is called and the peripheral is not
configured for SW trigger (but the other one may be, so config option
is set).

Trigger values saved to the private structure are also changed to
enums for better code clarity.

Signed-off-by: Michal Lenc <[email protected]>
@github-actions github-actions bot added Arch: arm Issues related to ARM (32-bit) architecture Size: S The size of the change in this PR is small labels Jan 23, 2025
@nuttxpr
Copy link

nuttxpr commented Jan 23, 2025

[Experimental Bot, please feedback here]

Yes, this PR appears to meet the NuttX requirements, although some sections could be more detailed. Here's a breakdown:

Strengths:

  • Clear Summary: The summary explains the "why," "what," and "how" of the change. The reference to code clarity with enums is a good addition.
  • Impact Addresses Key Areas: The impact section covers most relevant areas. The explicit mention of the ANIOC_TRIGGER fix is helpful.
  • Testing Mentions Platform and CI: Referencing the SAMv7 board and CI passing is positive.

Areas for Improvement (While Concise, More Detail Would Be Helpful):

  • Summary - Missing Issue References: If this relates to any existing NuttX issues, those should be linked. Even if there isn't a directly related issue, mentioning that ("No related issue") is good practice.
  • Impact - Be More Specific: While "Handling of ANIOC_TRIGGER ioctl is now fixed" is good, elaborating on the previous incorrect behavior and how this change fixes it would improve clarity. For other "NO" impact items, consider briefly stating why there's no impact (e.g., "Impact on build: NO (This change only affects driver code, not the build system)").
  • Testing - Insufficient Logs: Providing actual test logs (even if abbreviated) is crucial for reviewers. "CI passes" is useful, but seeing specific before/after output helps validate the claims. Describe the tests performed. What was the expected behavior before? What is the expected behavior after? Did the logs demonstrate that change? Also, be more specific about the "different trigger combinations" tested in CI.

Example Improvements for Testing:

Testing Host: Linux, x86_64, GCC 12.2
Target: SAMV71-Xplained-Ultra, CONFIG_SAMV7_AFEC0_ADC=y, CONFIG_SAMV7_AFEC0_SWTRIG=y, CONFIG_SAMV7_AFEC0_PWMT=n 

Testing logs before change:

ioctl(fd, ANIOC_TRIGGER, 0) returned -EINVAL (Invalid Argument) <- This demonstrates the bug


Testing logs after change:

ioctl(fd, ANIOC_TRIGGER, 0) returned OK
ADC conversion completed successfully (verified via reading ADC data register)


CI tests included the following trigger combinations:
* SW Trigger only
* PWM Trigger Only
* Both SW and PWM Triggers
* No Triggers


By adding these details, the PR becomes much stronger and easier for reviewers to assess.  Even with the need for these improvements, the PR seems to generally meet the NuttX requirements in terms of structure and content areas covered.

@xiaoxiang781216 xiaoxiang781216 merged commit 758b3ba into apache:master Jan 23, 2025
25 checks passed
@michallenc michallenc deleted the samv7-afec-sw-trig branch January 29, 2025 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arch: arm Issues related to ARM (32-bit) architecture Size: S The size of the change in this PR is small
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants