]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
UBUNTU: ODM: mfd: Add support for IO functions of AAEON devices
authorKunyang_Fan <kunyang_fan@asus.com>
Wed, 16 Jun 2021 05:56:00 +0000 (07:56 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 18 Jun 2021 09:43:50 +0000 (11:43 +0200)
BugLink: https://bugs.launchpad.net/bugs/1929504
This adds the supports for multiple IO functions of the
AAEON x86 devices and makes use of the WMI interface to
control the these IO devices including:

- GPIO
- LED
- Watchdog
- HWMON

It also adds the mfd child device drivers to support
the above IO functions.

Signed-off-by: Kunyang_Fan <kunyang_fan@asus.com>
Review-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Review-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>
Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
MAINTAINERS
drivers/mfd/Kconfig
drivers/mfd/Makefile
drivers/mfd/mfd-aaeon.c [new file with mode: 0644]

index 64a4ef4ca566f84e013de5638eb2fec0e4a5f924..e9a36fd2616f4c3b4ba32b2576508b977fa021b3 100644 (file)
@@ -257,6 +257,18 @@ W: http://www.adaptec.com/
 F:     Documentation/scsi/aacraid.rst
 F:     drivers/scsi/aacraid/
 
+AAEON DEVICE DRIVER WITH WMI INTERFACE
+M:     Edward Lin<edward1_lin@asus.com>
+M:     Kunyang Fan <kunyang_fan@asus.com>
+M:     Frank Hsieh <frank2_hsieh@asus.com>
+M:     Jacob Wu <jacob_wu@asus.com>
+S:     Supported
+F:     drivers/gpio/gpio-aaeon.c
+F:     drivers/hwmon/hwmon-aaeon.c
+F:     drivers/leds/leds-aaeon.c
+F:     drivers/mfd/mfd-aaeon.c
+F:     drivers/watchdog/wdt_aaeon.c
+
 ABI/API
 L:     linux-api@vger.kernel.org
 F:     include/linux/syscalls.h
index bdfce7b156216b67c14f68af3cfe0419410d8de6..efd6572aed4e7587ac560108af4d1e9a137cd4b0 100644 (file)
@@ -2085,6 +2085,18 @@ config MFD_KHADAS_MCU
          additional drivers must be enabled in order to use the functionality
          of the device.
 
+config MFD_AAEON
+       tristate "AAEON WMI MFD devices"
+       depends on ASUS_WMI
+       depends on UBUNTU_ODM_DRIVERS
+       help
+         Say yes here to support mltiple IO devices on Single Board Computers
+         produced by AAEON.
+
+         This driver leverages the ASUS WMI interface to access device
+         resources.
+
+
 menu "Multimedia Capabilities Port drivers"
        depends on ARCH_SA1100
 
index 14fdb188af022fd9d4781267a49b14878d8a8544..95d27d4490688d6802bc3a0e47c90b7486aa12a9 100644 (file)
@@ -268,3 +268,4 @@ obj-$(CONFIG_MFD_KHADAS_MCU)        += khadas-mcu.o
 obj-$(CONFIG_SGI_MFD_IOC3)     += ioc3.o
 obj-$(CONFIG_MFD_SIMPLE_MFD_I2C)       += simple-mfd-i2c.o
 obj-$(CONFIG_MFD_INTEL_M10_BMC)   += intel-m10-bmc.o
+obj-$(CONFIG_MFD_AAEON)                += mfd-aaeon.o
diff --git a/drivers/mfd/mfd-aaeon.c b/drivers/mfd/mfd-aaeon.c
new file mode 100644 (file)
index 0000000..9d2efde
--- /dev/null
@@ -0,0 +1,77 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * UP Board main platform driver and FPGA configuration support
+ *
+ * Copyright (c) 2021, AAEON Ltd.
+ *
+ * Author: Kunyang_Fan <knuyang_fan@aaeon.com.tw>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/acpi.h>
+#include <linux/gpio.h>
+#include <linux/kernel.h>
+#include <linux/mfd/core.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/leds.h>
+#include <linux/wmi.h>
+
+#define AAEON_WMI_MGMT_GUID      "97845ED0-4E6D-11DE-8A39-0800200C9A66"
+
+struct aaeon_wmi_priv {
+       const struct mfd_cell *cells;
+       size_t ncells;
+};
+
+static const struct mfd_cell aaeon_mfd_cells[] = {
+       { .name = "gpio-aaeon" },
+       { .name = "hwmon-aaeon"},
+       { .name = "leds-aaeon"},
+       { .name = "wdt-aaeon"},
+};
+
+static const struct aaeon_wmi_priv aaeon_wmi_priv_data = {
+       .cells = aaeon_mfd_cells,
+       .ncells = ARRAY_SIZE(aaeon_mfd_cells),
+};
+
+static int aaeon_wmi_probe(struct wmi_device *wdev, const void *context)
+{
+       struct aaeon_wmi_priv *priv;
+
+       if (!wmi_has_guid(AAEON_WMI_MGMT_GUID)) {
+               dev_info(&wdev->dev, "AAEON Management GUID not found\n");
+               return -ENODEV;
+       }
+
+
+       priv = (struct aaeon_wmi_priv *)context;
+       dev_set_drvdata(&wdev->dev, priv);
+
+       return devm_mfd_add_devices(&wdev->dev, 0, priv->cells,
+                                   priv->ncells, NULL, 0, NULL);
+}
+
+static const struct wmi_device_id aaeon_wmi_id_table[] = {
+       { AAEON_WMI_MGMT_GUID, (void *)&aaeon_wmi_priv_data },
+       {}
+};
+
+static struct wmi_driver aaeon_wmi_driver = {
+       .driver = {
+               .name = "mfd-aaeon",
+       },
+       .id_table = aaeon_wmi_id_table,
+       .probe = aaeon_wmi_probe,
+};
+
+module_wmi_driver(aaeon_wmi_driver);
+
+MODULE_DEVICE_TABLE(wmi, aaeon_wmi_id_table);
+MODULE_AUTHOR("Kunyang Fan <kunyang_fan@aaeon.com.tw>");
+MODULE_DESCRIPTION("AAEON Board WMI driver");
+MODULE_LICENSE("GPL v2");