From patchwork Wed Jun 16 05:56:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AceLan Kao X-Patchwork-Id: 1492705 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=H7zKm740; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G4ZG64NNnz9sXL; Wed, 16 Jun 2021 15:57:18 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1ltOY7-0005Jt-5W; Wed, 16 Jun 2021 05:57:15 +0000 Received: from mail-pf1-f169.google.com ([209.85.210.169]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1ltOY4-0005Iy-LB for kernel-team@lists.ubuntu.com; Wed, 16 Jun 2021 05:57:12 +0000 Received: by mail-pf1-f169.google.com with SMTP id c12so1309826pfl.3 for ; Tue, 15 Jun 2021 22:57:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=awWEouzUlclYL1k6Cz5jzqKjg4jkEp/oPceeVYrnJp0=; b=H7zKm740kB1mG1sm6BjTrk/PCoTfbSRQVe340SnOVjmAcXE5JQGh5QTYKr/JvHJyDW dS70YIo85RRdslHSFRVo9AmxZ7OI3kd7lKIsVzMDGkHCcc0ZSKt1/0prkP6lED6aWlz3 H6pegrnGN6fi4Zkz7hgREkZbANq2S1coxWlPyJuSRbS4a3WnwW32zKThd07oCQvhXZ8U g7rTRXVpr+QEXvGu8lCX4Kto5DjjU+3fVtA8rUJOAo8TF9eI9BDMSlsj2P2dz2NIwunK HYdSZPkn2CcBEDKmUQBZU4DCxgY9TMrMO1Egrffh7C711MZZrb3qfi/AygoO7R4nKhhM JAvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=awWEouzUlclYL1k6Cz5jzqKjg4jkEp/oPceeVYrnJp0=; b=YK35dFDrIFU5Kmh0OsmVTtJqO+OToeCrPFwxhnQGkf9T9hjwHestYaf5FIY2GZeqWy IAmLVGd51mZIAMcsQriC7pZSBucR/ue1q/7QwqCOumJ3fL0ZgAmwXNIC0sM36gVZFD6g 68J3vKFChTnE0/iT6/kIkRkzTsWonvdJ74mGFyi7veYNqfEnoqpXChcshezhnZzCk5xC TgM+InStlaAtPi1c/ChtwlknIMmF36MuhBgUeLw/P/SEjfXCJjSn+Pm6nj5fVov8MXOr 8bTguzKhv99Myf6DJIuCLcY5RPtHbPoqJddspwWfyzaJDSONbwWE3DbiOxsi2TEkJRiE Lmdg== X-Gm-Message-State: AOAM5331a0w9xMyv2d8Nq5QtMBVkH3gHlwYKPlSUFzzbMpb8DnznoxWg qHO6Ab4YxXl56j3ST/1hgm35aUYQxrE= X-Google-Smtp-Source: ABdhPJxcyViX85QWNnUrztlVspdMOIW9Q4oOwfBh59nHrXfk05jGYntKEREnNVI8DkGcC9/7ohTawQ== X-Received: by 2002:a62:5c1:0:b029:2a9:7589:dd30 with SMTP id 184-20020a6205c10000b02902a97589dd30mr8024176pff.66.1623823029923; Tue, 15 Jun 2021 22:57:09 -0700 (PDT) Received: from localhost (61-220-137-34.HINET-IP.hinet.net. [61.220.137.34]) by smtp.gmail.com with ESMTPSA id o3sm889871pfd.41.2021.06.15.22.57.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 22:57:09 -0700 (PDT) From: AceLan Kao To: kernel-team@lists.ubuntu.com, Kunyang_Fan Subject: [RESEND][PATCH 1/6][SRU][G] UBUNTU: ODM: mfd: Add support for IO functions of AAEON devices Date: Wed, 16 Jun 2021 13:56:46 +0800 Message-Id: <20210616055703.124039-2-acelan.kao@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210616055703.124039-1-acelan.kao@canonical.com> References: <20210616055703.124039-1-acelan.kao@canonical.com> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.210.169; envelope-from=acelan@gmail.com; helo=mail-pf1-f169.google.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Kunyang_Fan 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 Review-by: Kai-Heng Feng Review-by: Chia-Lin Kao (AceLan) Signed-off-by: Chia-Lin Kao (AceLan) --- MAINTAINERS | 12 +++++++ drivers/mfd/Kconfig | 12 +++++++ drivers/mfd/Makefile | 1 + drivers/mfd/mfd-aaeon.c | 77 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 102 insertions(+) create mode 100644 drivers/mfd/mfd-aaeon.c diff --git a/MAINTAINERS b/MAINTAINERS index 1c19c1e2c970..49783dd44367 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -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 +M: Kunyang Fan +M: Frank Hsieh +M: Jacob Wu +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 diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index a37d7d171382..6716ce5f20bb 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -2053,6 +2053,18 @@ config MFD_WCD934X This driver provides common support WCD934x audio codec and its associated Pin Controller, Soundwire Controller and Audio codec. +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 diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 9367a92f795a..36fff3d0da7e 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -264,3 +264,4 @@ obj-$(CONFIG_MFD_ROHM_BD718XX) += rohm-bd718x7.o obj-$(CONFIG_MFD_STMFX) += stmfx.o obj-$(CONFIG_SGI_MFD_IOC3) += ioc3.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 index 000000000000..9d2efde53cad --- /dev/null +++ b/drivers/mfd/mfd-aaeon.c @@ -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 + * + * 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 +#include +#include +#include +#include +#include +#include +#include + +#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 "); +MODULE_DESCRIPTION("AAEON Board WMI driver"); +MODULE_LICENSE("GPL v2");