Repository navigation
Conversation
`gpio scan` answers "what changes": it loops until Ctrl-C and lists only pins already muxed to GPIO. `gpio mux` writes. Neither answers "what is this board's GPIO state", which is the question when one firmware drives a peripheral and another does not. Comparing a stock Xiongmai N51813L with its OpenIPC sibling needed a hand-merged `reginfo` and a `gpio scan` that had to be killed by PID, because stock busybox has no `timeout`. `ipctool gpio dump [--json]` prints, for every pin of every PL061 bank, the function its pad carries now. Where that is the GPIO, or the table has no row for the pad, it also prints the direction and level. It reads each bank once, writes nothing and exits. `--json` gives one object per pin, so two cameras diff directly. SigmaStar and Novatek keep GPIO state outside these banks, so they are refused rather than misreported.
Pad the function column only when a direction and level follow it, so no line ends in spaces and two dumps diff cleanly.
PR Summary by QodoAdd read-only GPIO dump with per-pin mux and level
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
Code Review by Qodo
1.
|
…ad errors Review fixes (Qodo on #279): - 0 from ipchw_padmux_get() is a selector the table does not name. It is now reported as mux "unknown" with no GPIO state, instead of being taken as GPIO. - IPCHW_PADMUX_NO_PAD is the pad with no mux row: nothing can select another function onto it, so it is the GPIO, as mux "none" with its direction and level. GPIO8_x and GPIO11_7 on Hi3518CV100 used to lose their state. - GPIO-ness comes from IPCHW_PADMUX_F_GPIO, the documented flag, not a name comparison. - An unreadable bank or mux register is reported on stderr and makes the exit status a failure. The dump is still printed, as well-formed JSON with an "error" field on affected GPIO pins, but never passes as complete. A SoC with no pin-mux table is refused up front. JSON gains a "mux" field: gpio, function, unknown, none or unreadable.
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.
ipctool gpio dump [--json]: for every pin of every GPIO bank, the function its pad carries now and, where that is the GPIO, the direction and level. It reads each bank once, writes nothing and exits.Why
The existing GPIO commands don't answer "what is this board's GPIO state":
gpio scananswers "what changes". It loops until Ctrl-C and lists only pins already muxed to GPIO.gpio muxwrites.That question comes up when one firmware drives a peripheral and another doesn't. Comparing a stock Xiongmai N51813L with its OpenIPC sibling needed a hand-merged
reginfoplus agpio scankilled by PID, because stock busybox has notimeout(and notr). With this command it is one run per camera and adiff.Behaviour
GPIO2_2 pad 18 GPIO2_2 out 0. A pad muxed to another function prints just that function, with no state and no trailing padding.--json: an array with one object per pin:gpio,pad,mux(gpio,function,unknown,noneorunreadable),function,gpio_muxed, anddirandvaluewhen it is a GPIO.IPCHW_PADMUX_NO_PAD): these are always the GPIO. They show as[none]with their state, as GPIO8_x and GPIO11_7 do on Hi3518CV100.[unknown], with no GPIO state.not supported on this SoC yet) rather than misreported.Testing
cYAML_test,reginfo_testandsensors_testpass./tmp.diffof the two units' output gives exactly the 7 pins already found by hand:Note for anyone testing on a V1 part: a binary built with a Cortex-A7-defaulting toolchain segfaults on every command on ARM926. CI's hi3516cv100 toolchain targets ARMv5, so the CI artefact is fine.
Review
The four Qodo findings are fixed in 7eb85ce, and the re-review marks all four resolved:
ipchw_padmux_get()'s documented return values and theIPCHW_PADMUX_F_GPIOflag.That commit was re-run on both units: exit 0, 96 pins each, the same 7-pin diff, and no stderr output.