-
Notifications
You must be signed in to change notification settings - Fork 289
SM8750: AYN Odin 3 - expose the two back paddles as gpio-keys #2940
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
aanze
wants to merge
1
commit into
ROCKNIX:next
Choose a base branch
from
aanze:odin3-back-paddles-gpio-keys
base: next
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+71
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
71 changes: 71 additions & 0 deletions
71
projects/ROCKNIX/devices/SM8750/patches/linux/0510-ROCKNIX-odin3-back-paddle-gpio-keys.patch
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| From: Anze <aanzdev@gmail.com> | ||
| 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 = <BTN_Z>; | ||
| + gpios = <&tlmm 3 GPIO_ACTIVE_LOW>; | ||
| + debounce-interval = <15>; | ||
| + }; | ||
| + | ||
| + key-paddle-m2 { | ||
| + label = "Back Paddle M2"; | ||
| + linux,code = <BTN_C>; | ||
| + gpios = <&tlmm 7 GPIO_ACTIVE_LOW>; | ||
| + debounce-interval = <15>; | ||
| + }; | ||
| + }; | ||
| }; |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, could you merge this with
0047-arm64-dts-qcom-Add-AYN-Odin3.patch