Repository navigation
opto_ac5: bring the driver back, ported to uspace - #4883
Merged
Merged
Conversation
BsAtHome
reviewed
Nov 22, 2026
Contributor
Yes, please do. Also, if we need this driver tested in the future, may we ask you again?
Yes, please do. |
The Opto22 PCI-AC5 driver was removed in dd394d9 because it only built for RTAI kernels and nobody was known to use or be able to test it. It is in daily use on a milling machine here, so port it instead. The PCI discovery and mapping change: pci_get_device() / ioremap_nocache() become a rtapi_pci driver (probe/remove, rtapi_pci_ioremap_bar), and readl()/writel() go through ac5_read() / ac5_write(), which keep readl()/writel() in a kernel build and do a volatile 32 bit access on the mapped BAR in uspace. hal_export_functf() follows the current signature. The uspace rtapi_pci matches subvendor/subdevice exactly (no PCI_ANY_ID), so the id table lists the subsystem IDs the card reports (148a:ac05). From review: each HAL pin and the invert parameter are read once per cycle, and the sources use spaces only with consistent spacing. The driver is built like hal_gm, for uspace and RTAI. Its docs, man page, component-list row and index entry are restored. The doc page is renamed opto_ac5.adoc to match the driver, and both docs now give the real pin names (opto-ac5.N.portP...), bool types, IN for the LED pins, RW for the invert parameter and the actual meaning of -not and -invert.
Josbleuet
force-pushed
the
opto_ac5-uspace
branch
from
November 23, 2026 01:23
2319ee2 to
a4982e6
Compare
Contributor
Author
|
Yes, sure, I can test it anytime. I have been using LinuxCNC for free for 16 years now, it's a wonderful project and I'm very proud of my small contribution to it. Squashed and force-pushed, with your review in:
Rebuilt and retested on the machine. |
grandixximo
approved these changes
Nov 23, 2026
grandixximo
left a comment
Contributor
There was a problem hiding this comment.
Thanks for porting and testing this on your machine. The docs now match the pins the driver creates. Looks good to me.
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.
Follow-up to #4880.
The Opto22 PCI-AC5 driver was removed in #4513 because nobody was known to use or test it. I use one on my milling machine, so this brings it back, ported to rtapi_pci so it builds and runs on uspace.
Tested on Debian 13, 6.12 PREEMPT_RT, i7-2600, base thread at 90 us, master run-in-place with my full machine config: e-stop, home all on X/Y/Z/A, jog on every axis, spindle CW/CCW and speed changes. in/in-not checked in halrun on all port 1 inputs. For the invert param itself I have nothing to look at on the hardware, none of my outputs use it.
I can keep testing on the machine during the review.