Skip to content

Commit 70a4a81

Browse files
antheasij-intel
authored andcommitted
platform/x86: ayaneo-ec: Add Ayaneo Embedded Controller platform driver
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>
1 parent a9b0869 commit 70a4a81

4 files changed

Lines changed: 109 additions & 0 deletions

File tree

MAINTAINERS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4187,6 +4187,12 @@ W: https://ez.analog.com/linux-software-drivers
41874187
F: Documentation/devicetree/bindings/pwm/adi,axi-pwmgen.yaml
41884188
F: drivers/pwm/pwm-axi-pwmgen.c
41894189

4190+
AYANEO PLATFORM EC DRIVER
4191+
M: Antheas Kapenekakis <lkml@antheas.dev>
4192+
L: platform-driver-x86@vger.kernel.org
4193+
S: Maintained
4194+
F: drivers/platform/x86/ayaneo-ec.c
4195+
41904196
AZ6007 DVB DRIVER
41914197
M: Mauro Carvalho Chehab <mchehab@kernel.org>
41924198
L: linux-media@vger.kernel.org

drivers/platform/x86/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,16 @@ config ASUS_TF103C_DOCK
311311
If you have an Asus TF103C tablet say Y or M here, for a generic x86
312312
distro config say M here.
313313

314+
config AYANEO_EC
315+
tristate "Ayaneo EC platform control"
316+
depends on DMI
317+
help
318+
Enables support for the platform EC of Ayaneo devices. This
319+
includes fan control, fan speed, charge limit, magic
320+
module detection, and controller power control.
321+
322+
If you have an Ayaneo device, say Y or M here.
323+
314324
config MERAKI_MX100
315325
tristate "Cisco Meraki MX100 Platform Driver"
316326
depends on GPIOLIB

drivers/platform/x86/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ obj-$(CONFIG_ASUS_TF103C_DOCK) += asus-tf103c-dock.o
3939
obj-$(CONFIG_EEEPC_LAPTOP) += eeepc-laptop.o
4040
obj-$(CONFIG_EEEPC_WMI) += eeepc-wmi.o
4141

42+
# Ayaneo
43+
obj-$(CONFIG_AYANEO_EC) += ayaneo-ec.o
44+
4245
# Cisco/Meraki
4346
obj-$(CONFIG_MERAKI_MX100) += meraki-mx100.o
4447

drivers/platform/x86/ayaneo-ec.c

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
// SPDX-License-Identifier: GPL-2.0+
2+
/*
3+
* Platform driver for the Embedded Controller (EC) of Ayaneo devices. Handles
4+
* hwmon (fan speed, fan control), battery charge limits, and magic module
5+
* control (connected modules, controller disconnection).
6+
*
7+
* Copyright (C) 2025 Antheas Kapenekakis <lkml@antheas.dev>
8+
*/
9+
10+
#include <linux/dmi.h>
11+
#include <linux/err.h>
12+
#include <linux/init.h>
13+
#include <linux/kernel.h>
14+
#include <linux/module.h>
15+
#include <linux/platform_device.h>
16+
17+
struct ayaneo_ec_quirk {
18+
};
19+
20+
struct ayaneo_ec_platform_data {
21+
struct platform_device *pdev;
22+
struct ayaneo_ec_quirk *quirks;
23+
};
24+
25+
static const struct ayaneo_ec_quirk quirk_ayaneo3 = {
26+
};
27+
28+
static const struct dmi_system_id dmi_table[] = {
29+
{
30+
.matches = {
31+
DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
32+
DMI_EXACT_MATCH(DMI_BOARD_NAME, "AYANEO 3"),
33+
},
34+
.driver_data = (void *)&quirk_ayaneo3,
35+
},
36+
{},
37+
};
38+
39+
static int ayaneo_ec_probe(struct platform_device *pdev)
40+
{
41+
const struct dmi_system_id *dmi_entry;
42+
struct ayaneo_ec_platform_data *data;
43+
44+
dmi_entry = dmi_first_match(dmi_table);
45+
if (!dmi_entry)
46+
return -ENODEV;
47+
48+
data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
49+
if (!data)
50+
return -ENOMEM;
51+
52+
data->pdev = pdev;
53+
data->quirks = dmi_entry->driver_data;
54+
platform_set_drvdata(pdev, data);
55+
56+
return 0;
57+
}
58+
59+
static struct platform_driver ayaneo_platform_driver = {
60+
.driver = {
61+
.name = "ayaneo-ec",
62+
},
63+
.probe = ayaneo_ec_probe,
64+
};
65+
66+
static struct platform_device *ayaneo_platform_device;
67+
68+
static int __init ayaneo_ec_init(void)
69+
{
70+
ayaneo_platform_device =
71+
platform_create_bundle(&ayaneo_platform_driver,
72+
ayaneo_ec_probe, NULL, 0, NULL, 0);
73+
74+
return PTR_ERR_OR_ZERO(ayaneo_platform_device);
75+
}
76+
77+
static void __exit ayaneo_ec_exit(void)
78+
{
79+
platform_device_unregister(ayaneo_platform_device);
80+
platform_driver_unregister(&ayaneo_platform_driver);
81+
}
82+
83+
MODULE_DEVICE_TABLE(dmi, dmi_table);
84+
85+
module_init(ayaneo_ec_init);
86+
module_exit(ayaneo_ec_exit);
87+
88+
MODULE_AUTHOR("Antheas Kapenekakis <lkml@antheas.dev>");
89+
MODULE_DESCRIPTION("Ayaneo Embedded Controller (EC) platform features");
90+
MODULE_LICENSE("GPL");

0 commit comments

Comments
 (0)