[FOR-UPSTREAM] HID: ayaneo: Add AYANEO 3 detachable controller driver - #101
Open
matmartinez wants to merge 5 commits into
Open
[FOR-UPSTREAM] HID: ayaneo: Add AYANEO 3 detachable controller driver#101matmartinez wants to merge 5 commits into
matmartinez wants to merge 5 commits into
Conversation
Adds platform driver for AYN Loki and Tectoy Zeenix lines of handheld devices. This patch implements a hwmon interface for EC provided manual PWM fan control and user defined fan curves. A global ACPI lock is used when reading or writing from the EC. There are 4 fan modes implemented in this patch. Modes 0-3 act in accordance with the standard hwmon logic where 0 is 100% fan speed, 1 is manual control, and 2 is automatic control. As the EC only provides 3 modes by default, mode 0 is implemented by setting the device to manual and then setting fan speed to 100% directly. In mode 1 the PWM duty cycle is set in sysfs with values [0-255], which are then scaled to the EC max of 128. Mode 4 is an automatic mode where the fan curve is user defined. There are 5 total set points and each set point takes a temperature in Celsius [0-100] and a PWM duty cycle [0-255]. When the CPU temperature reaches a given set point, the corresponding duty cycle is automatically set by the EC. Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Adds temperature sensors to the ayn-ec hwmon interface. These read-only values include Battery, Motherboard, Charger IC, vCore, and CPU Core, as well as labels for each entry. The temperature values provided by the EC are whole numbers in degrees Celsius. As hwmon expects millidegrees, we scale the raw value up. `sensors` output after this patch is applied: aynec-isa-0000 Adapter: ISA adapter fan1: 1876 RPM Battery: +29.0°C Motherboard: +30.0°C Charger IC: +30.0°C vCore: +36.0°C CPU Core: +48.0°C Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Adds an EC controlled LED Multicolor Class Device for controlling the RGB rings around the joysticks. The EC provides a single register for each of the colors red, green, and blue, as well as a mode switching register. The EC accepts values [0-255] for all colors. There are two available effects: breathe, which is the default when the device is started, and monocolor. When resuming from sleep the user selected effect will be overwritten by the EC, so the driver retains the last setting and resets on resume. When setting a color, each color register is set before a final "write" code is sent to the device. The EC may briefly reflect the "write" code when writing, but quickly changes to the "monocolor" value once complete. The driver interprets both of these values as "monocolor" in _show to simplify the sysfs exposed to the user. Two custom attributes are added to the standard LED parent device: effect, a RW file descriptor used to set the effect, and effect_index, which enumerates the available valid options. Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Adds ABI documentation for the ayn-ec platform driver Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
The AYANEO 3 handheld has a detachable controller with swappable
modules ("Magic Modules"). The controller exposes three USB HID
interfaces behind 1c4f:0002 (a generic SigmaMicro VID/PID, hence the
DMI gate): a gamepad, a keyboard for the extra buttons, and a vendor
interface accepting 65-byte commands.
Add a driver for the vendor interface providing module identification
(module_left/module_right sysfs attributes), software eject of the
modules (eject sysfs attribute, blocking until the firmware confirms
the release handshake), and RGB control of the joystick rings as a
multicolor LED class device named ayaneo:rgb:joystick_rings, matching
the name InputPlumber already expects for this device.
This complements the ayaneo-ec platform driver, which exposes module
attach state and controller power. A full physical eject is performed
by writing to eject and then cutting power through ayaneo-ec's
controller_power attribute; that orchestration is deliberately left
to userspace.
The protocol was reverse engineered in the Handheld Daemon project by
Antheas Kapenekakis. Tested on an AYANEO 3 (7.2.0-ogc4.1): module
identification, RGB, and a full eject/reinsert/repower cycle.
Signed-off-by: Matías Martínez <hello@matias.me>
Author
|
Per pastaq's guidance in ShadowBlip/OpenGamepadUI#528, this is now also submitted to the unstable review repo as OpenGamingCollective/linux-unstable#3 (same commit rebased onto its master). Happy to close either one — whichever fits your flow. |
KyleGospo
force-pushed
the
features/ayaneo
branch
from
August 27, 2026 17:18
9ffbc89 to
1fb2b66
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds a HID driver for the AYANEO 3's detachable controller ("Magic Modules"), restoring the module functionality that was lost when Bazzite 44 dropped Handheld Daemon (see ShadowBlip/OpenGamepadUI#528, ublue-os/bazzite context).
What it does
Binds the controller's vendor HID interface (
1c4f:0002, application usage0xff000001; DMI-gated to the AYANEO 3 since the VID/PID is a generic SigmaMicro ID) and provides:module_left/module_rightsysfs attributes (raw firmware module-type IDs; bits 0–5 type, bit 6 rotated)ejectsysfs attribute (left/right/both), blocks until the firmware confirms the release handshakeayaneo:rgb:joystick_rings— the name InputPlumber's50-ayaneo_3.yamlalready expectsreset: quick controller config resetEC power-off is deliberately left to userspace: the full pop-out flow is
eject→ write0to ayaneo-ec'scontroller_power, so orchestration/UX can live in OpenGamepadUI (plugin planned as the next step, per #528).The protocol was reverse engineered in Handheld Daemon by Antheas Kapenekakis; this ports it onto the
ayaneo-ecfoundation (already in this tree since 6.19). Includes aDocumentation/ABI/entry and a MAINTAINERS entry; checkpatch --strict clean except the standard-ENOSYSoutput-report-fallback false positive.Testing
Built and tested on an AYANEO 3 running Bazzite 44 (this tree's 7.2.0-ogc4.1 via kernel-packages):
hid-ayaneo 0003:1C4F:0002.0007: modules: left 0x04 right 0x50eject→ firmware confirm (~4s) → EC power off → module released → reinsert →controller_modulesback toboth→ power on → controller re-enumerates (custom mode persists in controller flash) → driver rebindsA companion PR to kernel-packages adds
CONFIG_HID_AYANEO=m.Marked
[FOR-UPSTREAM]: I intend to submit this to LKML (linux-input) once the sysfs interface has been sanity-checked by the folks working on the AYANEO stack — feedback requested in ShadowBlip/OpenGamepadUI#528. Happy to adjust naming/semantics here first so the OGC tree matches what goes to the list.