]> git.ipfire.org Git - thirdparty/linux.git/commit
platform/x86: ayaneo-ec: Add controller power and modules attributes
authorAntheas Kapenekakis <lkml@antheas.dev>
Wed, 19 Nov 2025 17:45:03 +0000 (18:45 +0100)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Fri, 21 Nov 2025 15:36:19 +0000 (17:36 +0200)
commite921a8b4dea50b9c20f1ee9b2b69cedc00b7570a
tree2ad59fd59d612819a24e85fc27a9126f38963407
parent6d710ec3584227a9c393c478b1cd4a70e74a3c88
platform/x86: ayaneo-ec: Add controller power and modules attributes

The Ayaneo 3 features hot-swappable controller modules. The ejection
and management is done through HID. However, after ejecting the modules,
the controller needs to be power cycled via the EC to re-initialize.

For this, the EC provides a variable that holds whether the left or
right modules are connected, and a power control register to turn
the controller on or off. After ejecting the modules, the controller
should be turned off. Then, after both modules are reinserted,
the controller may be powered on again to re-initialize.

This patch introduces two new sysfs attributes:
 - `controller_modules`: a read-only attribute that indicates whether
   the left and right modules are connected (none, left, right, both).
 - `controller_power`: a read-write attribute that allows the user
   to turn the controller on or off (with '1'/'0').

Therefore, after ejection is complete, userspace can power off the
controller, then wait until both modules have been reinserted
(`controller_modules` will return 'both') to turn on the controller.

Reviewed-by: Armin Wolf <W_Armin@gmx.de>
Signed-off-by: Antheas Kapenekakis <lkml@antheas.dev>
Link: https://patch.msgid.link/20251119174505.597218-5-lkml@antheas.dev
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Documentation/ABI/testing/sysfs-platform-ayaneo-ec [new file with mode: 0644]
MAINTAINERS
drivers/platform/x86/ayaneo-ec.c