Skip to content

SM8550: AYN Odin 2 - expose the two back buttons as gpio-keys#3050

Open
xiaodoudou wants to merge 1 commit into
ROCKNIX:nextfrom
xiaodoudou:odin2-back-buttons
Open

SM8550: AYN Odin 2 - expose the two back buttons as gpio-keys#3050
xiaodoudou wants to merge 1 commit into
ROCKNIX:nextfrom
xiaodoudou:odin2-back-buttons

Conversation

@xiaodoudou

Copy link
Copy Markdown

Summary

  • Goal: Make the AYN Odin 2's two back buttons (M1, M2) work. On stock ROCKNIX they emit nothing because there is no driver for them. This replicates SM8750: AYN Odin 3 - expose the two back paddles as gpio-keys #2940 (AYN Odin 3) on SM8550: a gpio-keys-paddles node in the Odin 2 dts so they report buttons.
  • 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 57 → BTN_Z, M2 = GPIO 58 → BTN_C (TLMM base 301 + offsets 57/58, RE'd from AYN's keydetect.ko gpio_request(358/359) and confirmed on hardware by watching the TLMM GPIO_IN registers while pressing the buttons).
  • Mirrors the Odin 3 InputPlumber integration on the SM8550 side: source the new device in 02-ayn-controller.yaml, route BTN_Z/BTN_C to Left/RightPaddle2 in ayn_mcu.yaml, and switch the target to ds5-edge so the buttons are emitted as the DualSense Edge's real back-lever buttons (hid-playstation Edge support from patches/mainline/0006 already applies to SM8550 kernels).

Testing

  • Pin discovery and end-to-end flow verified on an AYN Odin 2 base running ROCKNIX next 20260701: an equivalent runtime GPIO driver for pins 57/58 produces clean press/release (evtest) with no chatter, and the events reach the virtual controller through InputPlumber's AYN composite.
  • This dts: compile-tested against linux-7.1.2 + the full SM8550 patch set (qcs8550-ayn-odin2.dtb builds; decompiled blob contains the node). I could not build a full image — happy to flash a CI artifact on my Odin 2 and report back.

Additional Context

  • Same scheme as SM8750: AYN Odin 3 - expose the two back paddles as gpio-keys #2940 — thanks @aanze for the template. Odin 2 differs only in SoC, pins (57/58) and vendor gpiochip base (301).
  • Pins referenced by TLMM offset (<&tlmm 57>, <&tlmm 58>), input + pull-up, 15ms debounce.
  • The ds5-edge target / Paddle2 changes are in the shared SM8550 AYN files also covering Odin 2 Mini / Odin 2 Portal / Retroid Pocket 6 — cosmetic for devices without the buttons (presents as an Edge with unused levers), same situation as SM8750. Happy to split per-device if preferred.
  • Only the base Odin 2 dts gains the node; Mini/Portal very likely share the wiring but I don't own them to test.

AI Usage

Did you use AI tools to help write this code? PARTIALLY — reverse-engineering and patch authoring assisted by AI; hardware findings verified on-device.

Make the AYN Odin 2's M1/M2 back buttons work; on stock ROCKNIX they
emit nothing. Same scheme as the AYN Odin 3 (ROCKNIX#2940):

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 57 -> BTN_Z, M2 = GPIO 58 -> BTN_C (TLMM
base 301 + offsets 57/58, RE'd from AYN's keydetect.ko gpio_request
358/359 and confirmed on hardware by watching the TLMM GPIO_IN
registers while pressing the buttons).

Mirror the Odin 3 integration on SM8550:
- add a gpio-keys-paddles node to the Odin 2 dts
- source it in the AYN composite device config
- route BTN_Z/BTN_C to Left/RightPaddle2 in ayn_mcu.yaml and switch
  the target to ds5-edge so the buttons are emitted as the DualSense
  Edge's real back-lever buttons (hid-playstation Edge support is
  already in the shared patches/mainline/0006)

Only the base Odin 2 wiring was verified on hardware; the Odin 2
Mini/Portal very likely share it but were not available for testing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant