]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
platform/x86: ayaneo-ec: Add Ayaneo Embedded Controller platform driver
authorAntheas Kapenekakis <lkml@antheas.dev>
Wed, 19 Nov 2025 17:45:00 +0000 (18:45 +0100)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Fri, 21 Nov 2025 15:36:12 +0000 (17:36 +0200)
Recent Ayaneo devices feature an ACPI mapped Embedded Controller (EC)
with standard addresses across models that provides access to fan
speed, fan control, battery charge limits, and controller power
controls. Introduce a new driver stub that will handle these driver
features.

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

index b69e3293f7fd067f174eca07a7cbcf5e4d4d821c..a61dda3a6315276e377f41631aee3f4a0d861f27 100644 (file)
@@ -4187,6 +4187,12 @@ W:       https://ez.analog.com/linux-software-drivers
 F:     Documentation/devicetree/bindings/pwm/adi,axi-pwmgen.yaml
 F:     drivers/pwm/pwm-axi-pwmgen.c
 
+AYANEO PLATFORM EC DRIVER
+M:     Antheas Kapenekakis <lkml@antheas.dev>
+L:     platform-driver-x86@vger.kernel.org
+S:     Maintained
+F:     drivers/platform/x86/ayaneo-ec.c
+
 AZ6007 DVB DRIVER
 M:     Mauro Carvalho Chehab <mchehab@kernel.org>
 L:     linux-media@vger.kernel.org
index 245c5f5778f226e05e73cef68790a40226ff45e3..fa3d393c2c1be25ee506fb46ba74c86abbf50727 100644 (file)
@@ -311,6 +311,16 @@ config ASUS_TF103C_DOCK
          If you have an Asus TF103C tablet say Y or M here, for a generic x86
          distro config say M here.
 
+config AYANEO_EC
+       tristate "Ayaneo EC platform control"
+       depends on DMI
+       help
+         Enables support for the platform EC of Ayaneo devices. This
+         includes fan control, fan speed, charge limit, magic
+         module detection, and controller power control.
+
+         If you have an Ayaneo device, say Y or M here.
+
 config MERAKI_MX100
        tristate "Cisco Meraki MX100 Platform Driver"
        depends on GPIOLIB
index ce3423749af5ce40a0e55f61f77713465e9a4192..d25762f7114fe4648e2cd43aedd2dbe1eeeea3ca 100644 (file)
@@ -39,6 +39,9 @@ obj-$(CONFIG_ASUS_TF103C_DOCK)        += asus-tf103c-dock.o
 obj-$(CONFIG_EEEPC_LAPTOP)     += eeepc-laptop.o
 obj-$(CONFIG_EEEPC_WMI)                += eeepc-wmi.o
 
+# Ayaneo
+obj-$(CONFIG_AYANEO_EC)                += ayaneo-ec.o
+
 # Cisco/Meraki
 obj-$(CONFIG_MERAKI_MX100)     += meraki-mx100.o
 
diff --git a/drivers/platform/x86/ayaneo-ec.c b/drivers/platform/x86/ayaneo-ec.c
new file mode 100644 (file)
index 0000000..2fe66c8
--- /dev/null
@@ -0,0 +1,90 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Platform driver for the Embedded Controller (EC) of Ayaneo devices. Handles
+ * hwmon (fan speed, fan control), battery charge limits, and magic module
+ * control (connected modules, controller disconnection).
+ *
+ * Copyright (C) 2025 Antheas Kapenekakis <lkml@antheas.dev>
+ */
+
+#include <linux/dmi.h>
+#include <linux/err.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+
+struct ayaneo_ec_quirk {
+};
+
+struct ayaneo_ec_platform_data {
+       struct platform_device *pdev;
+       struct ayaneo_ec_quirk *quirks;
+};
+
+static const struct ayaneo_ec_quirk quirk_ayaneo3 = {
+};
+
+static const struct dmi_system_id dmi_table[] = {
+       {
+               .matches = {
+                       DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
+                       DMI_EXACT_MATCH(DMI_BOARD_NAME, "AYANEO 3"),
+               },
+               .driver_data = (void *)&quirk_ayaneo3,
+       },
+       {},
+};
+
+static int ayaneo_ec_probe(struct platform_device *pdev)
+{
+       const struct dmi_system_id *dmi_entry;
+       struct ayaneo_ec_platform_data *data;
+
+       dmi_entry = dmi_first_match(dmi_table);
+       if (!dmi_entry)
+               return -ENODEV;
+
+       data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
+       if (!data)
+               return -ENOMEM;
+
+       data->pdev = pdev;
+       data->quirks = dmi_entry->driver_data;
+       platform_set_drvdata(pdev, data);
+
+       return 0;
+}
+
+static struct platform_driver ayaneo_platform_driver = {
+       .driver = {
+               .name = "ayaneo-ec",
+       },
+       .probe = ayaneo_ec_probe,
+};
+
+static struct platform_device *ayaneo_platform_device;
+
+static int __init ayaneo_ec_init(void)
+{
+       ayaneo_platform_device =
+               platform_create_bundle(&ayaneo_platform_driver,
+                                      ayaneo_ec_probe, NULL, 0, NULL, 0);
+
+       return PTR_ERR_OR_ZERO(ayaneo_platform_device);
+}
+
+static void __exit ayaneo_ec_exit(void)
+{
+       platform_device_unregister(ayaneo_platform_device);
+       platform_driver_unregister(&ayaneo_platform_driver);
+}
+
+MODULE_DEVICE_TABLE(dmi, dmi_table);
+
+module_init(ayaneo_ec_init);
+module_exit(ayaneo_ec_exit);
+
+MODULE_AUTHOR("Antheas Kapenekakis <lkml@antheas.dev>");
+MODULE_DESCRIPTION("Ayaneo Embedded Controller (EC) platform features");
+MODULE_LICENSE("GPL");