From aa0c8d84e94b7224a39b4a2469fe60696a7abbf9 Mon Sep 17 00:00:00 2001 From: Anze Date: Sun, 28 Jun 2026 16:00:34 +0200 Subject: [PATCH] SM8750: AYN Odin 3 - expose the two back paddles as gpio-keys The Odin 3's two back "macro" paddles (M1, M2) do nothing on stock ROCKNIX because there is no driver for them. They are not on the gamepad MCU UART (rsinput) and not ADC despite AYN's Android "adckey"/keydetect.ko naming - they are plain active-low SoC TLMM GPIOs (M1 = GPIO 3, M2 = GPIO 7), reverse-engineered from AYN's Android keydetect.ko (gpio_request 515/519 = TLMM base 512 + offsets 3/7). Add a gpio-keys node to the Odin 3 dts exposing them as BTN_Z (M1, left) and BTN_C (M2, right) - the spare gamepad codes AYN's own firmware uses and which the existing InputPlumber map (ayn_mcu.yaml) already routes to Left/RightPaddle1, so they become usable paddle buttons in games and Steam. --- ...-ROCKNIX-odin3-back-paddle-gpio-keys.patch | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 projects/ROCKNIX/devices/SM8750/patches/linux/0510-ROCKNIX-odin3-back-paddle-gpio-keys.patch diff --git a/projects/ROCKNIX/devices/SM8750/patches/linux/0510-ROCKNIX-odin3-back-paddle-gpio-keys.patch b/projects/ROCKNIX/devices/SM8750/patches/linux/0510-ROCKNIX-odin3-back-paddle-gpio-keys.patch new file mode 100644 index 00000000000..45bf31ce076 --- /dev/null +++ b/projects/ROCKNIX/devices/SM8750/patches/linux/0510-ROCKNIX-odin3-back-paddle-gpio-keys.patch @@ -0,0 +1,71 @@ +From: Anze +Subject: [PATCH] arm64: dts: qcom: AYN Odin 3 - expose the two back paddles + +The AYN Odin 3 has two extra "macro" paddles (M1, M2) on the back, below the +L1/L2 and R1/R2 shoulder buttons. They are NOT on the gamepad MCU serial +(rsinput) and NOT analog/ADC despite AYN's Android driver naming ("adckey" / +keydetect.ko) - they are two plain active-low SoC TLMM GPIOs that AYN's Android +keydetect driver polls (gpio_request(515)/gpio_request(519) = TLMM base 512 + +offsets 3 and 7; reverse-engineered from /vendor/lib/modules/keydetect.ko). + +Stock ROCKNIX has no driver for them, so the paddles do nothing. Expose them as +a standard gpio-keys device: + + M1 (left paddle) = TLMM GPIO 3 -> BTN_Z + M2 (right paddle) = TLMM GPIO 7 -> BTN_C + +BTN_Z / BTN_C are spare gamepad button codes (unused on a modern Xbox-style +layout) and are exactly what AYN's own Android firmware reports for these +paddles. ROCKNIX's InputPlumber capability map for this controller +(ayn_mcu.yaml) already maps BTN_Z -> LeftPaddle1 and BTN_C -> RightPaddle1, so +once the kernel emits them they are forwarded as real paddle buttons usable in +games and Steam. Pins are configured input with a pull-up (released = high, +pressed = low). + +--- +--- a/arch/arm64/boot/dts/qcom/cq8725s-ayn-odin3.dts ++++ b/arch/arm64/boot/dts/qcom/cq8725s-ayn-odin3.dts +@@ -310,4 +310,42 @@ + bias-pull-down; + drive-strength = <2>; + }; ++ ++ paddle_keys_default: paddle-keys-default-state { ++ pins = "gpio3", "gpio7"; ++ function = "gpio"; ++ bias-pull-up; ++ drive-strength = <2>; ++ }; ++}; ++ ++/* ++ * AYN Odin 3 has two extra back paddles (M1, M2) below the shoulder ++ * triggers. They are plain active-low SoC TLMM GPIOs (M1 = GPIO_3, ++ * M2 = GPIO_7), not on the gamepad MCU UART and not ADC (despite AYN's ++ * Android "adckey"/keydetect.ko naming). Expose them as a gpio-keys ++ * device emitting BTN_Z (M1, left) / BTN_C (M2, right); ROCKNIX's ++ * InputPlumber map (ayn_mcu.yaml) already routes BTN_Z -> LeftPaddle1 and ++ * BTN_C -> RightPaddle1. RE'd from the AYN Android keydetect driver ++ * (gpio_request 515/519 = TLMM base 512 + offsets 3/7). ++ */ ++/ { ++ gpio-keys-paddles { ++ compatible = "gpio-keys"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&paddle_keys_default>; ++ ++ key-paddle-m1 { ++ label = "Back Paddle M1"; ++ linux,code = ; ++ gpios = <&tlmm 3 GPIO_ACTIVE_LOW>; ++ debounce-interval = <15>; ++ }; ++ ++ key-paddle-m2 { ++ label = "Back Paddle M2"; ++ linux,code = ; ++ gpios = <&tlmm 7 GPIO_ACTIVE_LOW>; ++ debounce-interval = <15>; ++ }; ++ }; + };