Skip to content

arm/arm64: dts: adi: use ngpios DT property for port pin count#3371

Open
jiez wants to merge 2 commits into
adsp-6.18.31-yfrom
adsp-sc5xx-use-ngpios-dt-property
Open

arm/arm64: dts: adi: use ngpios DT property for port pin count#3371
jiez wants to merge 2 commits into
adsp-6.18.31-yfrom
adsp-sc5xx-use-ngpios-dt-property

Conversation

@jiez

@jiez jiez commented Jun 12, 2026

Copy link
Copy Markdown

Add ngpios to all GPIO port nodes in sc57x, sc58x, sc59x and sc59x-64 DTS files, correctly reflecting the actual hardware pin count for each port. Modify the ADI ADSP GPIO driver accordingly.

PR Type

  • Bug fix (a change that fixes an issue)
  • New feature (a change that adds new functionality)
  • Breaking change (a change that affects other repos or cause CIs to fail)

PR Checklist

  • I have conducted a self-review of my own code changes
  • I have compiled my changes, including the documentation
  • I have tested the changes only on the SC598 SOM EZKIT board
  • I have updated the documentation outside this repo accordingly
  • I have provided links for the relevant upstream lore

gpio->gpio.to_irq = adsp_gpio_to_irq;
gpio->gpio.request = gpiochip_generic_request;
gpio->gpio.free = gpiochip_generic_free;
gpio->gpio.ngpio = ADSP_PORT_NGPIO;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be a different patch

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Split into a separate commit.

@pamolloy pamolloy changed the base branch from adsp-6.12.0-y to adsp-6.18.31-y June 15, 2026 13:40
@pamolloy pamolloy added this to ADSP Jun 16, 2026
@pamolloy pamolloy moved this to In Development in ADSP Jun 16, 2026
@pamolloy pamolloy requested a review from a team June 16, 2026 10:21
@jiez jiez force-pushed the adsp-sc5xx-use-ngpios-dt-property branch from 3321455 to d8427a4 Compare June 18, 2026 17:02
@pamolloy pamolloy added the llm review Request a review from a LLM Reviewer label Jun 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

LLM review

This series fixes incorrect GPIO pin count reporting in the ADI ADSP GPIO driver and DTS files for SC57x, SC58x, SC59x (ARM) and SC59x-64 (ARM64). The driver previously hard-coded ngpios = 16 for every port via ADSP_PORT_NGPIO, regardless of actual hardware. Ports with fewer physical pins (SC57x gpf: 12, SC58x gpg: 6, SC59x/SC59x-64 gpi: 7) were wrongly exposed as 16-line GPIO controllers.

run: 28013140183

d8427a495 - arm/arm64: dts: adi: use ngpios DT property for port pin count

Dead macro: After removing gpio->gpio.ngpio = ADSP_PORT_NGPIO; from drivers/gpio/gpio-adi-adsp-port.c, the macro ADSP_PORT_NGPIO 16 in include/linux/soc/adi/adsp-gpio-port.h:18 is defined but never referenced anywhere. It should be removed.

Backward compatibility: With gc->ngpio no longer set in the driver, booting a new kernel with an old DTB lacking the ngpios property will cause all ADSP GPIO port registrations to fail (tried to insert a GPIO chip with zero lines). This is acceptable since DTS and driver are updated together, but worth noting for out-of-tree users.

Missing binding doc (pre-existing): No Documentation/devicetree/bindings/gpio/adi,adsp-port-gpio.yaml exists; ngpios is now effectively required for operation but undocumented.

CI warnings

checkpatch.pl reports 0 errors, 0 warnings. Both ARM and ARM64 builds clean. All four DTSI files verified: ngpios values are consistent with the gpio-ranges pin count argument in every port node.

Verification data

  • Built gpio-adi-adsp-port.o for ARM (sc573-ezlite_defconfig) and ARM64 (sc598-som-ezkit_defconfig) — clean.
  • Built and decompiled all ADI DTBs to verify ngpios is correctly embedded.
  • Automated Python cross-check confirmed ngpios matches gpio-ranges count in all 25 GPIO port nodes across all four DTSI files.

Suggested patches

Apply the suggested patches with:

cd path/to/repository
export GITHUB_TOKEN=ghp_***
apply-patches --repo=analogdevicesinc/linux 28013140183
Install instructions

The following one-liner installs the script if not present already:

curl -fSsL "https://raw.githubusercontent.com/analogdevicesinc/doctools/refs/heads/main/ci/scripts/apply-patches.sh" \
     -o ~/.local/bin/apply-patches.sh && \
  grep -q "/apply-patches.sh" ~/.bashrc || echo "source ~/.local/bin/apply-patches.sh" >> $_ ; . $_

More information at AI Usage.

jiez added 2 commits June 26, 2026 10:50
Add ngpios to all GPIO port nodes in sc57x, sc58x, sc59x and sc59x-64
DTS files, correctly reflecting the actual hardware pin count for each
port.

Fixes: 586c060 ("gpio: Add GPIO port driver for ADSP-SC5xxx SoCs")
Signed-off-by: Jie Zhang <jie.zhang@analog.com>
Now that ngpios is specified per-port in the DTS, the hardcoded
ADSP_PORT_NGPIO=16 constant and its use in probe are no longer needed.
The gpio chip ngpio count is set by the core from the ngpios DT property.

Fixes: 586c060 ("gpio: Add GPIO port driver for ADSP-SC5xxx SoCs")
Signed-off-by: Jie Zhang <jie.zhang@analog.com>
@jiez jiez force-pushed the adsp-sc5xx-use-ngpios-dt-property branch from d8427a4 to 53a4ea7 Compare June 26, 2026 14:54
@jiez

jiez commented Jun 26, 2026

Copy link
Copy Markdown
Author

LLM review

This series fixes incorrect GPIO pin count reporting in the ADI ADSP GPIO driver and DTS files for SC57x, SC58x, SC59x (ARM) and SC59x-64 (ARM64). The driver previously hard-coded ngpios = 16 for every port via ADSP_PORT_NGPIO, regardless of actual hardware. Ports with fewer physical pins (SC57x gpf: 12, SC58x gpg: 6, SC59x/SC59x-64 gpi: 7) were wrongly exposed as 16-line GPIO controllers.

run: 28013140183

d8427a495 - arm/arm64: dts: adi: use ngpios DT property for port pin count

Dead macro: After removing gpio->gpio.ngpio = ADSP_PORT_NGPIO; from drivers/gpio/gpio-adi-adsp-port.c, the macro ADSP_PORT_NGPIO 16 in include/linux/soc/adi/adsp-gpio-port.h:18 is defined but never referenced anywhere. It should be removed.

Backward compatibility: With gc->ngpio no longer set in the driver, booting a new kernel with an old DTB lacking the ngpios property will cause all ADSP GPIO port registrations to fail (tried to insert a GPIO chip with zero lines). This is acceptable since DTS and driver are updated together, but worth noting for out-of-tree users.

Missing binding doc (pre-existing): No Documentation/devicetree/bindings/gpio/adi,adsp-port-gpio.yaml exists; ngpios is now effectively required for operation but undocumented.

CI warnings

checkpatch.pl reports 0 errors, 0 warnings. Both ARM and ARM64 builds clean. All four DTSI files verified: ngpios values are consistent with the gpio-ranges pin count argument in every port node.

Verification data

* Built `gpio-adi-adsp-port.o` for ARM (`sc573-ezlite_defconfig`) and ARM64 (`sc598-som-ezkit_defconfig`) — clean.

* Built and decompiled all ADI DTBs to verify `ngpios` is correctly embedded.

* Automated Python cross-check confirmed `ngpios` matches `gpio-ranges` count in all 25 GPIO port nodes across all four DTSI files.

Suggested patches

Apply the suggested patches with:

cd path/to/repository
export GITHUB_TOKEN=ghp_***
apply-patches --repo=analogdevicesinc/linux 28013140183

Install instructions

ADSP_PORT_NGPIO definition is removed now.

@sipraga

sipraga commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Will also be obviated by my changes in #3397 - consider dropping.

@jiez

jiez commented Jul 8, 2026

Copy link
Copy Markdown
Author

Will also be obviated by my changes in #3397 - consider dropping.

OK. We can keep this PR open until your changes are merged. I will also need to adjust u-boot for your changes. Hopefully it will not be difficult.

@sipraga

sipraga commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Will also be obviated by my changes in #3397 - consider dropping.

OK. We can keep this PR open until your changes are merged. I will also need to adjust u-boot for your changes. Hopefully it will not be difficult.

Sure thing. Maybe we can have a chat about what needs to change in u-boot? I didn't really consider it while making my changes. I assume the point is to be able to share the device trees between Linux and u-boot?

@jiez

jiez commented Jul 8, 2026

Copy link
Copy Markdown
Author

Will also be obviated by my changes in #3397 - consider dropping.

OK. We can keep this PR open until your changes are merged. I will also need to adjust u-boot for your changes. Hopefully it will not be difficult.

Sure thing. Maybe we can have a chat about what needs to change in u-boot? I didn't really consider it while making my changes. I assume the point is to be able to share the device trees between Linux and u-boot?

Yes. There are one PR analogdevicesinc/u-boot#104 and one commit analogdevicesinc/u-boot@e440a37 (maybe there are several more) to make u-boot align with the current Linux DTS regarding GPIO and pinctrl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

llm review Request a review from a LLM Reviewer

Projects

Status: In Development

Development

Successfully merging this pull request may close these issues.

4 participants