From 4ed3ca2665cfda54754c4a242f958dc786fc88e8 Mon Sep 17 00:00:00 2001 From: Dj <43033058+DjDeveloperr@users.noreply.github.com> Date: Mon, 26 Oct 2026 02:34:20 -0400 Subject: [PATCH] pinctrl: apple: Describe T6050 host-owned interrupt groups Describe the T6050 pin controller and its host-owned interrupt group range. The driver support is already in 7.3 integration; this PR completes the T6050 binding and carries the existing host-range regression tests. Source snapshot: t6050-gpu ee68abb105200e99636a5edfc647a5cfc1d89954 Integration base: 9cbdd0734d9e186c5f5f5949a21b909d10c2571b Signed-off-by: Dj <43033058+DjDeveloperr@users.noreply.github.com> --- .../bindings/pinctrl/apple,pinctrl.yaml | 6 +- tools/testing/selftests/aurora-apif/gpio.py | 61 +++++++++++++++++++ 2 files changed, 66 insertions(+), 1 deletion(-) create mode 100755 tools/testing/selftests/aurora-apif/gpio.py diff --git a/Documentation/devicetree/bindings/pinctrl/apple,pinctrl.yaml b/Documentation/devicetree/bindings/pinctrl/apple,pinctrl.yaml index edae16e33adbd..3aad356f04cdf 100644 --- a/Documentation/devicetree/bindings/pinctrl/apple,pinctrl.yaml +++ b/Documentation/devicetree/bindings/pinctrl/apple,pinctrl.yaml @@ -26,6 +26,7 @@ properties: - apple,t8122-pinctrl - apple,t8132-pinctrl - apple,t8140-pinctrl + - apple,t6050-pinctrl - const: apple,t8103-pinctrl - items: # Do not add additional SoC to this list. @@ -58,7 +59,10 @@ properties: $ref: /schemas/types.yaml#/definitions/uint32 maximum: 6 default: 0 - description: First hardware interrupt group owned by the host. + description: | + First interrupt group owned by this host. Interrupts lists consecutive + groups starting at this index. The loader must preserve any groups + owned by resident firmware. The range must end before group seven. apple,npins: $ref: /schemas/types.yaml#/definitions/uint32 diff --git a/tools/testing/selftests/aurora-apif/gpio.py b/tools/testing/selftests/aurora-apif/gpio.py new file mode 100755 index 0000000000000..8ecf6aaa9d474 --- /dev/null +++ b/tools/testing/selftests/aurora-apif/gpio.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: GPL-2.0-only +"""Check production host GPIO IRQ-bank and aperture validation.""" +from pathlib import Path +import re +import shutil +import os +import subprocess +import tempfile + +ROOT = Path(__file__).resolve().parents[4] + + +def main(): + print("TAP version 13\n1..1", flush=True) + if not shutil.which("cc"): + print("ok 1 - GPIO IRQ ownership bounds # SKIP cc unavailable") + return 4 + header = (ROOT / "drivers/pinctrl/pinctrl-apple-irq.h").read_text() + header = re.sub(r"^#include .*\n", "", header, flags=re.M) + program = r""" +#include +#include +#include +typedef uint32_t u32; +typedef uint64_t u64; +""" + program += header + program += r""" +int main(void) { + assert(!apple_gpio_irq_layout(128, 4, 3, 0x990)); + assert(apple_gpio_irq_layout(128, 4, 3, 0x98f) == -EINVAL); + assert(!apple_gpio_irq_layout(512, 0, 7, 0x9c0)); + assert(apple_gpio_irq_layout(512, 0, 7, 0x9bf) == -EINVAL); + assert(!apple_gpio_irq_layout(512, 6, 0, 0x800)); + assert(apple_gpio_irq_layout(512, 6, 0, 0x7ff) == -EINVAL); + assert(apple_gpio_irq_layout(0, 0, 1, UINT64_MAX) == -EINVAL); + assert(apple_gpio_irq_layout(513, 0, 1, UINT64_MAX) == -EINVAL); + assert(apple_gpio_irq_layout(32, 7, 0, UINT64_MAX) == -EINVAL); + assert(apple_gpio_irq_layout(32, 6, 2, UINT64_MAX) == -EINVAL); + assert(apple_gpio_irq_layout(32, UINT32_MAX, 1, UINT64_MAX) == -EINVAL); + assert(apple_gpio_irq_layout(32, 0, UINT32_MAX, UINT64_MAX) == -EINVAL); + return 0; +} +""" + with tempfile.TemporaryDirectory() as tmp: + source, binary = Path(tmp) / "gpio.c", Path(tmp) / "gpio" + source.write_text(program) + subprocess.run(["cc", "-std=gnu11", "-Wall", "-Wextra", "-Werror", + "-fsanitize=address,undefined", str(source), "-o", str(binary)], + check=True) + # stdbuf injects LD_PRELOAD into the runner, ahead of the ASan runtime. + # Only this isolated sanitizer child needs a clean loader environment. + env = {**os.environ, "LD_PRELOAD": ""} + subprocess.run([str(binary)], env=env, check=True) + print("ok 1 - GPIO IRQ banks and apertures") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main())