mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Armin Wolf <W_Armin@gmx.de>
To: Antheas Kapenekakis <lkml@antheas.dev>
Cc: platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org,
	"Hans de Goede" <hansg@kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Derek John Clark" <derekjohn.clark@gmail.com>,
	"Joaquín Ignacio Aramendía" <samsagax@gmail.com>,
	"Jean Delvare" <jdelvare@suse.com>,
	"Guenter Roeck" <linux@roeck-us.net>
Subject: Re: [PATCH v3 1/6] platform/x86: ayaneo-ec: Add Ayaneo Embedded Controller platform driver
Date: Tue, 4 Nov 2025 20:58:51 +0100	[thread overview]
Message-ID: <6a8fc9ae-5ce6-4583-9b44-b9021f8f8dba@gmx.de> (raw)
In-Reply-To: <CAGwozwGO=sZjGro7NaKH=zC4x_GR8H7kaPSn8NP60H7EZ4s3+g@mail.gmail.com>

Am 02.11.25 um 19:37 schrieb Antheas Kapenekakis:

> On Sun, 2 Nov 2025 at 19:21, Armin Wolf <W_Armin@gmx.de> wrote:
>> Am 31.10.25 um 17:36 schrieb Antheas Kapenekakis:
>>
>>> 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.
>>>
>>> Signed-off-by: Antheas Kapenekakis <lkml@antheas.dev>
>>> ---
>>>    MAINTAINERS                      |  6 +++
>>>    drivers/platform/x86/Kconfig     |  9 ++++
>>>    drivers/platform/x86/Makefile    |  3 ++
>>>    drivers/platform/x86/ayaneo-ec.c | 90 ++++++++++++++++++++++++++++++++
>>>    4 files changed, 108 insertions(+)
>>>    create mode 100644 drivers/platform/x86/ayaneo-ec.c
>>>
>>> diff --git a/MAINTAINERS b/MAINTAINERS
>>> index 545a4776795e..da9498d8cc89 100644
>>> --- a/MAINTAINERS
>>> +++ b/MAINTAINERS
>>> @@ -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
>>> diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
>>> index 46e62feeda3c..ebe7d2ab8758 100644
>>> --- a/drivers/platform/x86/Kconfig
>>> +++ b/drivers/platform/x86/Kconfig
>>> @@ -316,6 +316,15 @@ 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"
>>> +     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
>>> diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
>>> index c7db2a88c11a..274a685eb92d 100644
>>> --- a/drivers/platform/x86/Makefile
>>> +++ b/drivers/platform/x86/Makefile
>>> @@ -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
>>> index 000000000000..2fe66c8a89f4
>>> --- /dev/null
>>> +++ b/drivers/platform/x86/ayaneo-ec.c
>>> @@ -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,
>>> +     },
>>> +     {},
>>> +};
>> MODULE_DEVICE_TABLE() is missing, please add it so that the driver will
>> automatically load on supported devices.
> It is not. See below.

I see, my bad.

>>> +
>>> +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;
>> Please store the quirk inside a global variable and perform the DMI match
>> inside ayaneo_ec_init. This will allow you to mark the DMI table as __initconst.
> This driver was designed to not need a global quirk variable, which
> required a lot of additional work (the drvdata structure) . I am not
> re-adding it as a workaround for __initconst.
>
> Adding init to probe emits a warning because there is a dangling
> reference to it.

Ok.

Thanks,
Armin Wolf

>> Thanks,
>> Armin Wolf
>>
>>> +
>>> +     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);
> Here
>
>>> +
>>> +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");

  reply	other threads:[~2025-11-04 19:59 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-31 16:36 [PATCH v3 0/6] " Antheas Kapenekakis
2025-10-31 16:36 ` [PATCH v3 1/6] " Antheas Kapenekakis
2025-11-02 18:21   ` Armin Wolf
2025-11-02 18:35     ` Armin Wolf
2025-11-02 18:37     ` Antheas Kapenekakis
2025-11-04 19:58       ` Armin Wolf [this message]
2025-10-31 16:36 ` [PATCH v3 2/6] platform/x86: ayaneo-ec: Add hwmon support Antheas Kapenekakis
2025-11-02 18:22   ` Armin Wolf
2025-10-31 16:36 ` [PATCH v3 3/6] platform/x86: ayaneo-ec: Add charge control support Antheas Kapenekakis
2025-11-02 18:26   ` Armin Wolf
     [not found]     ` <CAGwozwHfaeOnMmLbAK03gzG2JCsZ=TDAv3EMyDoBZRtG=ix5ng@mail.gmail.com>
2025-11-04 20:00       ` Armin Wolf
2025-10-31 16:36 ` [PATCH v3 4/6] platform/x86: ayaneo-ec: Add controller power and modules attributes Antheas Kapenekakis
2025-11-02 18:30   ` Armin Wolf
2025-11-02 18:46     ` Antheas Kapenekakis
2025-11-04 20:03       ` Armin Wolf
2025-11-05 12:33         ` Antheas Kapenekakis
2025-11-05 13:24           ` Ilpo Järvinen
2025-11-05 13:38             ` Antheas Kapenekakis
2025-11-05 22:20             ` Armin Wolf
2025-10-31 16:36 ` [PATCH v3 5/6] platform/x86: ayaneo-ec: Move Ayaneo devices from oxpec to ayaneo-ec Antheas Kapenekakis
2025-10-31 16:36 ` [PATCH v3 6/6] platform/x86: ayaneo-ec: Add suspend hook Antheas Kapenekakis
2025-11-02 18:35   ` Armin Wolf
2025-11-02 18:58     ` Antheas Kapenekakis
2025-11-10 12:11       ` Ilpo Järvinen
2025-11-03 16:51   ` Mario Limonciello (AMD) (kernel.org)
2025-11-03 21:20     ` Antheas Kapenekakis
2025-11-03 21:33       ` Mario Limonciello (AMD) (kernel.org)
2025-11-03 22:09         ` Antheas Kapenekakis
2025-10-31 16:38 ` [PATCH v3 0/6] platform/x86: ayaneo-ec: Add Ayaneo Embedded Controller platform driver Antheas Kapenekakis
2025-10-31 16:39   ` Antheas Kapenekakis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6a8fc9ae-5ce6-4583-9b44-b9021f8f8dba@gmx.de \
    --to=w_armin@gmx.de \
    --cc=derekjohn.clark@gmail.com \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=lkml@antheas.dev \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=samsagax@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®